Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-10-30 12:38:41 +0000
committerStijn Buys <ingar@osirion.org>2010-10-30 12:38:41 +0000
commit37a8c7aa64bdded36f452e6f95c829165d44e792 (patch)
tree61b428a69222b1942db6b996ef07903bf3a7ecbb /src/render/draw.cc
parentdda07be1e679458aad9a82a7a2af5af13e733b32 (diff)
moved clientside thrust and power state into render::RenderExt, added engine spawnflag to func_rotate
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc75
1 files changed, 12 insertions, 63 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index ed2c8f7..945e04b 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -565,7 +565,7 @@ void draw_fragment(const model::Fragment *fragment, bool draw_details)
void draw_model_fragments(model::Model *model,
const math::Color & color_primary, const math::Color & color_secondary,
- const bool detail, const bool power, const float thrust)
+ const float time, const bool detail, const bool power, const float thrust)
{
// default material, lighted and geometry color
const model::Material *material = 0;
@@ -588,7 +588,7 @@ void draw_model_fragments(model::Model *model,
gl::translate(group->location());
if (group->type() == model::FragmentGroup::Rotate) {
- float rotation_angle = math::degrees360f(core::application()->time() * group->speed());
+ float rotation_angle = math::degrees360f(time * group->speed());
gl::rotate(-rotation_angle, group->axis().forward());
} else {
gl::multmatrix(group->axis());
@@ -609,21 +609,9 @@ void draw_model_fragments(model::Model *model,
if (material) {
if (material->flags() & model::Material::Engine) {
- /*
- if (use_color_array) {
- glDisableClientState(GL_COLOR_ARRAY);
- use_color_array = false;
- }
- */
color.assign(model->enginecolor() * thrust);
} else if (material->flags() & model::Material::Tertiary) {
- /*
- if (use_color_array) {
- use_color_array = false;
- glDisableClientState(GL_COLOR_ARRAY);
- }
- */
if ((material->flags() & model::Material::Tertiary) == model::Material::Tertiary) {
for (size_t i = 0; i < 3; i++)
@@ -641,12 +629,7 @@ void draw_model_fragments(model::Model *model,
color.g *= material->color().g;
color.b *= material->color().b;
} else {
- /*
- if (!use_color_array) {
- glEnableClientState(GL_COLOR_ARRAY);
- use_color_array = true;
- }
- */
+
color.assign(material->color());
}
@@ -740,12 +723,6 @@ void draw_model_fragments(model::Model *model,
use_texture = false;
}
- /*
- if (!use_color_array) {
- glEnableClientState(GL_COLOR_ARRAY);
- use_color_array = true;
- }
- */
color.assign(1.0f, 0.0f, 1.0f);
}
}
@@ -775,42 +752,6 @@ void draw_model_fragments(model::Model *model,
use_texture = false;
}
- /*
- if (!use_color_array) {
- glEnableClientState(GL_COLOR_ARRAY);
- }
- */
-}
-
-void draw_model_fragments(core::Entity *entity)
-{
- model::Model *model = entity->model();
- if (!model)
- return;
-
- bool power = true;
- float thrust = 0.0f;
-
- if ((entity->type() == core::Entity::Dynamic) || (entity->type() == core::Entity::Controlable)) {
-
- int state = static_cast<core::EntityDynamic *>(entity)->state();
-
- if ((state == core::Entity::NoPower) || (state == core::Entity::Destroyed)) {
- power = false;
-
- } else if (entity->type() == core::Entity::Controlable) {
-
- core::EntityControlable *ec = static_cast<core::EntityControlable *>(entity);
-
- if ((ec->state() == core::Entity::Impulse) || (ec->state() == core::Entity::ImpulseInitiate)) {
- thrust = 1.0f;
- } else {
- thrust = ec->thrust();
- }
- }
- }
-
- draw_model_fragments(model, entity->color(), entity->color_second(), ext_render(entity)->detailvisible(), power, thrust);
}
// draw bounding box
@@ -892,7 +833,15 @@ void draw_pass_model_fragments()
gl::translate(entity->location());
gl::multmatrix(entity->axis());
- draw_model_fragments(entity);
+ draw_model_fragments(
+ entity->model(),
+ entity->color(),
+ entity->color_second(),
+ ext_render(entity)->enginetime(),
+ ext_render(entity)->detailvisible(),
+ ext_render(entity)->power(),
+ ext_render(entity)->thrust()
+ );
if (r_bbox->value()) {
gl::color(entity->color());