From 5feb96ea3e0616d108a68c14a9a77d0217a686cd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 31 Jul 2011 19:01:43 +0000 Subject: Added power state to the material context. --- src/render/draw.cc | 1 + src/render/state.cc | 14 ++++++++++---- src/render/state.h | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index 64ac4c1..2236d8c 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -647,6 +647,7 @@ void draw_model_fragments(model::Model *model, State::set_color(color_primary); State::set_color_second(color_secondary); State::set_color_engine(model->enginecolor() * thrust); + State::set_power(power); for (model::Model::Groups::const_iterator git = model->groups().begin(); git != model->groups().end(); git++) { diff --git a/src/render/state.cc b/src/render/state.cc index 21a142f..dbcb276 100644 --- a/src/render/state.cc +++ b/src/render/state.cc @@ -28,6 +28,8 @@ math::Color State::state_color_primary; math::Color State::state_color_secondary; math::Color State::state_color_engine; +bool State::state_power = true; + void State::init(int width, int height) { resize(width, height); @@ -197,7 +199,12 @@ void State::set_color(const core::Entity *entity) state_color_primary.assign(entity->color()); state_color_secondary.assign(entity->color_second()); } - + +void State::set_power(const bool power) +{ + state_power = power; +} + void State::use_material(const model::Material * material) { math::Color color; @@ -240,11 +247,10 @@ void State::use_material(const model::Material * material) { } // lighted or fullbright - // FIXME entity power - if (material->flags() & model::Material::Bright) { + if (state_power && (material->flags() & model::Material::Bright)) { gl::disable(GL_LIGHTING); - } else if (material->flags() & model::Material::Engine) { + } else if (state_power && (material->flags() & model::Material::Engine)) { gl::disable(GL_LIGHTING); } else { diff --git a/src/render/state.h b/src/render/state.h index b614c1b..2ba7c32 100644 --- a/src/render/state.h +++ b/src/render/state.h @@ -68,6 +68,11 @@ public: * set_color() should be used before calling set_material(). **/ static void set_color(const core::Entity *entity); + + /** + * @brief set the power state for materials with Bright and Engine flags + */ + static void set_power(const bool power); /** * @brief Set the material context @@ -112,6 +117,8 @@ private: static math::Color state_color_secondary; // current secondary color static math::Color state_color_engine; // current secondary color + static bool state_power; // power state indicator + }; } // namespace render -- cgit v1.2.3