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.cc51
1 files changed, 19 insertions, 32 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 3806672..61030b4 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -109,7 +109,7 @@ void pass_prepare(float seconds)
has_zone_light = true;
}
- }
+ }
}
}
@@ -189,7 +189,7 @@ void draw_globe(core::EntityGlobe *globe)
{
/*
Globes have to be rendered distance sorted, closest last.
- Globes behind farplane should be rendered with z-buffer writes disabled.
+ Globes behind farplane are rescaled and repositioned.
*/
math::Vector3f location(globe->location());
float radius = globe->radius();
@@ -744,16 +744,6 @@ void draw_pass_model_fx(float elapsed)
math::Axis flare_axis;
- // disable culling by default
- gl::disable(GL_CULL_FACE);
- model::Cull current_cull = model::CullNone;
-
- // default light texture
- size_t current_texture = Textures::bind("textures/fx/flare00");
- gl::enable(GL_TEXTURE_2D);
-
- gl::begin(gl::Quads);
-
for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
core::Entity *entity = (*it);
@@ -768,6 +758,17 @@ void draw_pass_model_fx(float elapsed)
}
if (entity->model() && ext_render(entity)->detailvisible() && power) {
+
+ // disable culling by default
+ gl::disable(GL_CULL_FACE);
+ model::Cull current_cull = model::CullNone;
+
+ // default light texture
+ size_t current_texture = Textures::bind("textures/fx/flare00");
+ gl::enable(GL_TEXTURE_2D);
+
+ gl::begin(gl::Quads);
+
// draw model lights
for (model::Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) {
light = (*lit);
@@ -860,16 +861,10 @@ void draw_pass_model_fx(float elapsed)
gl::begin(gl::Quads);
}
-
- if (flare->entity()) {
- color.assign(entity->color());
- } else {
- color.assign(flare->color());
- }
- a = dotproduct(flare_axis.forward(), Camera::axis().forward());
- if (a < -0.1f) {
- a = -a - 0.1f;
+ a = math::absf( dotproduct(flare_axis.forward(), Camera::axis().forward()));
+ if (a > 0.1f) {
+ a = a - 0.1f;
if (flare->entity()) {
color.assign(entity->color());
} else if (flare->engine()) {
@@ -896,10 +891,10 @@ void draw_pass_model_fx(float elapsed)
}
}
+ gl::end();
+
// draw particle systems
if (r_particles->value() && ext_render(entity)->particles().size()) {
- gl::end();
-
for (RenderExt::ParticleSystems::iterator it = ext_render(entity)->particles().begin(); it != ext_render(entity)->particles().end(); it++) {
ParticleSystem *particlesystem = (*it);
@@ -924,20 +919,12 @@ void draw_pass_model_fx(float elapsed)
particlesystem->draw(elapsed);
}
-
- current_texture = Textures::bind("textures/fx/flare00");
- gl::begin(gl::Quads);
- }
- if (current_cull != model::CullNone) {
- gl::disable(GL_CULL_FACE);
- current_cull = model::CullNone;
}
+
}
}
- gl::end();
-
gl::disable(GL_TEXTURE_2D);
gl::cullface(GL_BACK);
gl::enable(GL_CULL_FACE);