Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-08-07 23:27:42 +0000
committerStijn Buys <ingar@osirion.org>2008-08-07 23:27:42 +0000
commita743791e624590e0b41229f28f940db5272b60ba (patch)
tree6a6ec736e4ed34d5254a292889e6e33300919a63 /src/render
parent1f36b993d603c56251aa15eb6edc6b92ecf599ae (diff)
rotating planets, navpoints, network protocol updates, entity event state
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc78
1 files changed, 53 insertions, 25 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 3e3a13e..26b1109 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -8,6 +8,7 @@
#include <iomanip>
#include "core/core.h"
+#include "core/range.h"
#include "model/fragment.h"
#include "model/material.h"
#include "model/model.h"
@@ -39,7 +40,7 @@ math::Vector3f v5(1, 1, -1);
math::Vector3f v6(-1, 1, -1);
math::Vector3f v7(-1, -1, -1);
-const float drawdistance = 128.0f;
+const float drawdistance = 256.0f;
const float drawfxdistance = 64.0f;
const float farplane = 1016.0f;
@@ -133,7 +134,7 @@ void pass_prepare(float seconds)
// entites within detail range
entity->state()->state_visible = true;
entity->state()->state_detailvisible = true;
- } else if (entity->state()->distance() < drawdistance * r) {
+ } else if (entity->state()->distance() < drawdistance * r && entity->state()->distance() < core::range::max) {
// entities within drawing distance, outside detail range
entity->state()->state_visible = true;
entity->state()->state_detailvisible = false;
@@ -297,7 +298,13 @@ void draw_globe(core::EntityGlobe *globe)
gl::translate(location);
gl::multmatrix(globe->state()->axis());
+ if (globe->rotationspeed()) {
+ float angle = core::application()->time() * globe->rotationspeed();
+ angle = angle - 360.0f * floorf(angle / 360.0f);
+ gl::rotate(angle, math::Vector3f::Zaxis());
+ }
draw_sphere(globe->color(), radius);
+
gl::pop();
if (globe->state()->distance() > farplane) {
@@ -391,6 +398,38 @@ void draw_entity_diamond(core::Entity *entity)
{
float radius = entity->radius()/2;
+ /* ---- draw axis lines ---- */
+ gl::color(entity->color_second());
+ gl::begin(gl::Lines);
+
+ gl::vertex(1.25f * radius, 0, 0);
+ gl::vertex(2* radius, 0, 0);
+
+ gl::vertex(0, 1.25f * radius, 0);
+ gl::vertex(0, 2* radius, 0);
+
+ gl::vertex(0, 0, 1.25f * radius);
+ gl::vertex(0, 0, 2 * radius);
+
+ gl::vertex(-1.25f * radius, 0, 0);
+ gl::vertex(-2 * radius, 0, 0);
+
+ gl::vertex(0, -1.25f * radius, 0);
+ gl::vertex(0, -2 * radius, 0);
+
+ gl::vertex(0, 0, -1.25f * radius);
+ gl::vertex(0, 0, -2 * radius);
+
+ gl::end();
+
+ /* ---- draw rotating body lines ---- */
+ float angle = (core::application()->time() + entity->state()->fuzz() ) * 45.0f;
+ angle = angle - 360.0f * floorf(angle / 360.0f);
+ gl::rotate(angle, math::Vector3f::Zaxis());
+
+ if (r_wireframe->value() == 0.0f) {
+ glPolygonMode(GL_FRONT, GL_LINE);
+ }
gl::color(entity->color());
gl::begin(gl::TriangleFan );
@@ -430,28 +469,9 @@ void draw_entity_diamond(core::Entity *entity)
gl::vertex(radius, 0.0f, 0.0f);
gl::end();
-
- gl::begin(gl::Lines);
-
- gl::vertex(radius, 0, 0);
- gl::vertex(2* radius, 0, 0);
-
- gl::vertex(0, radius, 0);
- gl::vertex(0, 2* radius, 0);
-
- gl::vertex(0, 0, radius);
- gl::vertex(0, 0, 2 * radius);
-
- gl::vertex(-radius, 0, 0);
- gl::vertex(-2 * radius, 0, 0);
-
- gl::vertex(0, -radius, 0);
- gl::vertex(0, -2 * radius, 0);
-
- gl::vertex(0, 0, -radius);
- gl::vertex(0, 0, -2 * radius);
-
- gl::end();
+ if (r_wireframe->value() == 0.0f) {
+ glPolygonMode(GL_FRONT, GL_FILL);
+ }
}
void draw_entity_axis(core::Entity *entity)
@@ -459,7 +479,7 @@ void draw_entity_axis(core::Entity *entity)
float r = entity->radius();
gl::begin(gl::Lines);
- gl::color(1.0f, 0.0f, 0.0f);
+ gl::color(entity->color_second());
gl::vertex(r,0.0f,0.0f);
gl::color(entity->color());
gl::vertex(-r,0.0f,0.0f);
@@ -483,6 +503,10 @@ void draw_pass_default()
gl::translate(entity->state()->location());
gl::multmatrix(entity->state()->axis());
+ if (flag_is_set(entity->flags(), core::Entity::Bright)) {
+ gl::disable(GL_LIGHTING);
+ }
+
switch(entity->shape()) {
case core::Entity::Sphere:
draw_entity_sphere(entity);
@@ -503,6 +527,10 @@ void draw_pass_default()
break;
}
+ if (flag_is_set(entity->flags(), core::Entity::Bright)) {
+ gl::enable(GL_LIGHTING);
+ }
+
gl::pop();
}
}