From dd16796ac3ef352a5ff404373b568dd00ef74936 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 12 Nov 2008 18:24:36 +0000 Subject: add star corona --- src/render/draw.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'src/render/draw.cc') 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(); -- cgit v1.2.3