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/draw.cc')
-rw-r--r--src/render/draw.cc106
1 files changed, 55 insertions, 51 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 8d8ea1f..2752030 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -302,7 +302,7 @@ void draw_model_fragments(core::Entity *entity)
use_color_array = false;
}
- gl::color(thrust, 0.0f, 0.0f);
+ gl::color(model->enginecolor() * thrust);
} else if (material & Material::Tertiary) {
if (use_color_array) {
@@ -643,7 +643,7 @@ void draw_pass_model_fx(float elapsed)
// strobe frequency
t = 1.0f;
if (light->strobe())
- t = (core::application()->time() - light->offset() - entity->state()->fuzz()) * light->frequency();
+ t = (core::application()->time() + entity->state()->fuzz() - light->offset()) * light->frequency();
if ((!light->strobe()) || (( t - floorf(t)) <= light->time())) {
location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * light->location()));
light_size = 0.0625 * light->radius();
@@ -703,7 +703,6 @@ void draw_pass_model_fx(float elapsed)
color.assign(flare->color());
}
- // FIXME Camera::axis().forward() should be the vector flare_location - camera_eye
a = dotproduct(flare_axis.forward(), Camera::axis().forward());
if (a < -0.1f) {
color.a = -a - 0.1f;
@@ -737,15 +736,12 @@ void draw_pass_model_fx(float elapsed)
t -= 1.0f;
math::clamp(t, 0.0f, 1.0f);
entity->state()->state_engine_trail_offset = t;
-
+
for(model::Model::Engines::iterator eit = entity->model()->engines().begin(); eit != entity->model()->engines().end(); eit++) {
engine = (*eit);
-
location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * engine->location()));
- engine_size = 0.0625 * engine->radius();
- color.assign(engine->color());
- color.a = 0.9f * u;
+ engine_size = 0.0625 * engine->radius();
if (current_texture != engine->texture() ) {
gl::end();
@@ -757,57 +753,65 @@ void draw_pass_model_fx(float elapsed)
quad[1].assign(entity->state()->axis().up() + entity->state()->axis().left());
quad[2].assign(entity->state()->axis().up() * -1 + entity->state()->axis().left());
quad[3].assign(entity->state()->axis().up() * -1 - entity->state()->axis().left());
-
- gl::color(color);
- glTexCoord2f(0,1);
- gl::vertex(location + quad[0] * engine_size);
- glTexCoord2f(0,0);
- gl::vertex(location + quad[1] * engine_size);
- glTexCoord2f(1,0);
- gl::vertex(location + quad[2] * engine_size);
- glTexCoord2f(1,1);
- gl::vertex(location + quad[3] * engine_size);
- Stats::quads++;
-
- // draw the engine trail
- if (current_texture != circle_texture) {
- gl::end();
- current_texture = Textures::bind(circle_texture);
- gl::begin(gl::Quads);
- }
- color.assign(1.0f, 1.0f);
- offset.assign(entity->state()->axis().forward() * engine_size);
- if (t > 0)
- location -= offset * t;
-
- for (size_t i = count; i > 0; i--) {
- trail_size = engine_size * 0.8f * (0.4f + ((-t + (float) i) / (float) count) * 0.6f);
- color.a = (0.1f + ((-t + (float) i) / (float) count) * 0.7f) * u;
- gl::color(color);
+ // assign engine color to the flare
+ if (!engine->noflare()){
+ color.assign(entity->model()->enginecolor());
+ color.a = 0.9f * u;
+
+ gl::color(color);
glTexCoord2f(0,1);
- gl::vertex(location + quad[0] * trail_size);
+ gl::vertex(location + quad[0] * engine_size);
glTexCoord2f(0,0);
- gl::vertex(location + quad[1] * trail_size);
+ gl::vertex(location + quad[1] * engine_size);
glTexCoord2f(1,0);
- gl::vertex(location + quad[2] * trail_size);
+ gl::vertex(location + quad[2] * engine_size);
glTexCoord2f(1,1);
- gl::vertex(location + quad[3] * trail_size);
+ gl::vertex(location + quad[3] * engine_size);
Stats::quads++;
+ }
+
+ if (!engine->notrail()) {
+ // draw the engine trail
+ if (current_texture != circle_texture) {
+ gl::end();
+ current_texture = Textures::bind(circle_texture);
+ gl::begin(gl::Quads);
+ }
+ color.assign(1.0f, 1.0f);
+ offset.assign(entity->state()->axis().forward() * engine_size);
+ if (t > 0)
+ location -= offset * t;
- gl::color(color);
- glTexCoord2f(1,1);
- gl::vertex(location + quad[3] * trail_size);
- glTexCoord2f(1,0);
- gl::vertex(location + quad[2] * trail_size);
- glTexCoord2f(0,0);
- gl::vertex(location + quad[1] * trail_size);
- glTexCoord2f(0,1);
- gl::vertex(location + quad[0] * trail_size);
- Stats::quads++;
-
- location -= offset;
+ for (size_t i = count; i > 0; i--) {
+ trail_size = engine_size * 0.8f * (0.4f + ((-t + (float) i) / (float) count) * 0.6f);
+ color.a = (0.1f + ((-t + (float) i) / (float) count) * 0.7f) * u;
+ gl::color(color);
+ glTexCoord2f(0,1);
+ gl::vertex(location + quad[0] * trail_size);
+ glTexCoord2f(0,0);
+ gl::vertex(location + quad[1] * trail_size);
+ glTexCoord2f(1,0);
+ gl::vertex(location + quad[2] * trail_size);
+ glTexCoord2f(1,1);
+ gl::vertex(location + quad[3] * trail_size);
+ Stats::quads++;
+
+
+ gl::color(color);
+ glTexCoord2f(1,1);
+ gl::vertex(location + quad[3] * trail_size);
+ glTexCoord2f(1,0);
+ gl::vertex(location + quad[2] * trail_size);
+ glTexCoord2f(0,0);
+ gl::vertex(location + quad[1] * trail_size);
+ glTexCoord2f(0,1);
+ gl::vertex(location + quad[0] * trail_size);
+ Stats::quads++;
+
+ location -= offset;
+ }
}
}
}