diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/base/star.cc | 3 | ||||
-rw-r--r-- | src/render/draw.cc | 48 | ||||
-rw-r--r-- | src/render/render.cc | 4 | ||||
-rw-r--r-- | src/render/screenshot.cc | 3 | ||||
-rw-r--r-- | src/render/screenshot.h | 5 |
5 files changed, 54 insertions, 9 deletions
diff --git a/src/game/base/star.cc b/src/game/base/star.cc index ecf403e..b68b202 100644 --- a/src/game/base/star.cc +++ b/src/game/base/star.cc @@ -12,7 +12,8 @@ namespace game { Star::Star() : core::EntityGlobe(core::Entity::Static | core::Entity::Solid | core::Entity::Bright) { - entity_color = math::Color(1,1,1,1); // white + entity_color.assign(1,1,1,1); + entity_color_second.assign(1,1,1,1); entity_radius = 96; // 96 game units entity_moduletypeid = star_enttype; diff --git a/src/render/draw.cc b/src/render/draw.cc index 1b1262f..96bc632 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -17,6 +17,7 @@ #include "render/draw.h" #include "render/dust.h" #include "render/gl.h" +#include "math/functions.h" namespace render { @@ -272,7 +273,7 @@ void draw_globe(core::EntityGlobe *globe) gl::disable(GL_LIGHTING); } else { // disable camera light, level light only - gl::disable(GL_LIGHT0); + gl::disable(GL_LIGHT0); } if (globe->render_texture) { @@ -298,16 +299,55 @@ void draw_globe(core::EntityGlobe *globe) glLightfv(GL_LIGHT1, GL_POSITION, fake_light); } } - gl::push(); gl::translate(location); + + if(flag_is_set(globe->flags(), core::Entity::Bright)) { + + if (!globe->render_texture) { + gl::enable(GL_TEXTURE_2D); + } + Textures::bind("bitmaps/fx/corona"); + + if (globe->state()->distance() <= farplane) { + gl::depthmask(GL_FALSE); + } + gl::color(globe->color()); + globe->color().a = 1.0f; + gl::enable(GL_BLEND); + + gl::begin(gl::Quads); + glTexCoord2f(0,1); + gl::vertex((Camera::axis().up() - Camera::axis().left()) * radius * 2.0f); + glTexCoord2f(0,0); + gl::vertex((Camera::axis().up() + Camera::axis().left()) * radius * 2.0f); + glTexCoord2f(1,0); + gl::vertex((Camera::axis().up() * -1 + Camera::axis().left()) * radius * 2.0f); + glTexCoord2f(1,1); + gl::vertex((Camera::axis().up() * -1 - Camera::axis().left()) * radius * 2.0f); + gl::end(); + + Stats::quads++; + + gl::disable(GL_BLEND); + if (globe->state()->distance() <= farplane) { + gl::depthmask(GL_TRUE); + } + if (!globe->render_texture) { + gl::disable(GL_TEXTURE_2D); + } + + radius *= 0.5f; + } + + gl::multmatrix(globe->state()->axis()); if (globe->rotationspeed()) { - float angle = core::application()->time() * globe->rotationspeed(); - angle = angle - 360.0f * floorf(angle / 360.0f); + float angle = math::degrees360f(core::application()->time() * globe->rotationspeed()); gl::rotate(angle, math::Vector3f::Zaxis()); } + draw_sphere(globe->color(), radius); gl::pop(); diff --git a/src/render/render.cc b/src/render/render.cc index 9afa179..81237dc 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -96,6 +96,7 @@ void init(int width, int height) } // unload game assets (zone change) +/* TODO RenderExt class containing render state */ void unload() { // clear zone sky textures @@ -123,7 +124,7 @@ void unload() // clear all assets void clear() { - //con_debug << " vclearing render data...\n"; + //con_debug << " clearing render data...\n"; // clear zone sky textures for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) { @@ -199,3 +200,4 @@ void shutdown() } } // namespace render + diff --git a/src/render/screenshot.cc b/src/render/screenshot.cc index c2ee88a..e006344 100644 --- a/src/render/screenshot.cc +++ b/src/render/screenshot.cc @@ -106,4 +106,5 @@ void Screenshot::save() } } -} // namsepace render
\ No newline at end of file +} // namsepace render + diff --git a/src/render/screenshot.h b/src/render/screenshot.h index bf61ef6..8b9269a 100644 --- a/src/render/screenshot.h +++ b/src/render/screenshot.h @@ -22,6 +22,7 @@ private: static int number; }; -} +} // namespace render + +#endif // __INCLUDED_RENDER_SCREENSHOT_H__ -#endif // __INCLUDED_RENDER_SCREENSHOT_H__
\ No newline at end of file |