From 459e3886be7a93c4000bd2c4edafea2c6fdddfb5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 16 Jul 2011 17:33:21 +0000 Subject: Draw a star after drawing the corona to prevent the corona from washing out the star texture. --- src/render/draw.cc | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src') 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())) { -- cgit v1.2.3