Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc69
1 files changed, 38 insertions, 31 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 96bc632..2975ecb 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -303,40 +303,47 @@ void draw_globe(core::EntityGlobe *globe)
gl::translate(location);
if(flag_is_set(globe->flags(), core::Entity::Bright)) {
+
+ math::Vector3f v = globe->location() - Camera::eye();
+ v.normalize();
+ float a = dotproduct(v, Camera::axis().forward());
+ if (a > 0.1f) {
+ // FIXME a corona is actually just a giant flare
+ if (!globe->render_texture) {
+ gl::enable(GL_TEXTURE_2D);
+ }
+ Textures::bind("bitmaps/fx/corona");
- if (!globe->render_texture) {
- gl::enable(GL_TEXTURE_2D);
- }
- Textures::bind("bitmaps/fx/corona");
+ if (globe->state()->distance() <= farplane) {
+ gl::depthmask(GL_FALSE);
+ }
+ math::Color color(globe->color());
+ color.a = a - 0.1f;
- 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);
+ gl::color(color);
+ 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;
}