From 75fd54748dd65b25f25f84a0bbdc25d6b7d4eb67 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 22 Mar 2012 19:56:35 +0000 Subject: Cleaned up lighting related variable names. --- src/ui/modelview.cc | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index 303f8e2..813fddb 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -19,9 +19,8 @@ namespace ui { -GLenum modelview_gllight = GL_LIGHT0; -float modelview_light_distance = -10.0f; -float modelview_light_attenuation = 0.05f; +const float LIGHT_DISTANCE = -10.0f; +const float LIGHT_ATTENUATION = 0.05f; ModelView::ModelView(Widget *parent) : Widget(parent) { @@ -206,12 +205,11 @@ void ModelView::draw_globe() glEnableClientState(GL_NORMAL_ARRAY); // we set up the light in camera space - float modelview_light_location[] = {modelview_light_distance * reference_radius, 0, 0}; - math::Color modelview_light_color; - modelview_light_color.assign(1.0); - modelview_gllight = render::add_light(modelview_light_location, modelview_light_attenuation, modelview_light_color); + const math::Vector3f light_location(LIGHT_DISTANCE * reference_radius, 0, 0); + const math::Color light_color(1.0f, 1.0f, 1.0f); + GLenum gllight = render::add_light(light_location, LIGHT_ATTENUATION, light_color); - gl::enable(modelview_gllight); + gl::enable(gllight); render::State::set_normalize(true); @@ -240,7 +238,7 @@ void ModelView::draw_globe() gl::pop(); render::State::set_normalize(false); - gl::disable(modelview_gllight); + gl::disable(gllight); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); @@ -306,12 +304,11 @@ void ModelView::draw_model() glEnableClientState(GL_NORMAL_ARRAY); // we set up the light in camera space - float modelview_light_location[] = {modelview_light_distance * reference_radius, 0, 0}; - math::Color modelview_light_color; - modelview_light_color.assign(1.0); - modelview_gllight = render::add_light(modelview_light_location, modelview_light_attenuation, modelview_light_color); + const math::Vector3f light_location(LIGHT_DISTANCE * reference_radius, 0, 0); + const math::Color light_color(1.0f, 1.0f, 1.0f); + GLenum gllight = render::add_light(light_location, LIGHT_ATTENUATION, light_color); - gl::enable(modelview_gllight); + gl::enable(gllight); // push transformation matrix to stack gl::push(); @@ -335,7 +332,7 @@ void ModelView::draw_model() gl::pop(); - gl::disable(modelview_gllight); + gl::disable(gllight); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); -- cgit v1.2.3