Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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())) {