Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-16 17:33:21 +0000
committerStijn Buys <ingar@osirion.org>2011-07-16 17:33:21 +0000
commit459e3886be7a93c4000bd2c4edafea2c6fdddfb5 (patch)
treec81ad7f6a75ff31a6d9f079a1092e038b1a0ebae /src
parentbb3a44030e4dda94a516102eaf9dd45e536fc94b (diff)
Draw a star after drawing the corona to prevent the corona from washing out the star texture.
Diffstat (limited to 'src')
-rw-r--r--src/render/draw.cc39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 792969f..b4fe5bd 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -268,12 +268,6 @@ void draw_globe(const core::EntityGlobe* globe)
gl::disable(GL_LIGHT0);
}
- if (globe->texture_id()) {
- // textured globe
- Textures::bind(globe->texture_id());
- gl::enable(GL_TEXTURE_2D);
- }
-
if (ext_render(globe)->distance() > (FARPLANE - globe->radius())) {
// globe is behind the far plane, make a fake size calculation
location = Camera::eye() + (location - Camera::eye()) * ((FARPLANE - globe->radius()) / ext_render(globe)->distance());
@@ -292,18 +286,7 @@ void draw_globe(const core::EntityGlobe* globe)
}
}
- gl::push();
- gl::translate(location);
- gl::multmatrix(globe->axis());
-
- if (globe->rotationspeed()) {
- float angle = math::degrees360f(core::application()->time() * globe->rotationspeed());
- gl::rotate(angle, math::Vector3f::Zaxis());
- }
-
- draw_sphere(globe->color(), radius);
- gl::pop();
-
+ // draw the globe's corona
if (globe->flag_is_set(core::Entity::Bright) && globe->corona_id()) {
math::Vector3f v = globe->location() - Camera::eye();
@@ -321,7 +304,6 @@ void draw_globe(const core::EntityGlobe* globe)
gl::color(color);
-
gl::begin(gl::Quads);
glTexCoord2f(0, 1);
gl::vertex(location + (Camera::axis().up() - Camera::axis().left()) * radius * 4.0f);
@@ -334,14 +316,31 @@ void draw_globe(const core::EntityGlobe* globe)
gl::end();
Stats::quads++;
-
gl::disable(GL_TEXTURE_2D);
gl::enable(GL_DEPTH_TEST);
gl::disable(GL_BLEND);
}
}
+
+ if (globe->texture_id()) {
+ // textured globe
+ Textures::bind(globe->texture_id());
+ gl::enable(GL_TEXTURE_2D);
+ }
+
+ // draw the globe an apply rotation if required
+ gl::push();
+ gl::translate(location);
+ gl::multmatrix(globe->axis());
+
+ if (globe->rotationspeed()) {
+ float angle = math::degrees360f(core::application()->time() * globe->rotationspeed());
+ gl::rotate(angle, math::Vector3f::Zaxis());
+ }
+ draw_sphere(globe->color(), radius);
+ gl::pop();
if (ext_render(globe)->distance() > (FARPLANE - globe->radius())) {