Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rwxr-xr-xsrc/ui/modelview.cc27
1 files changed, 12 insertions, 15 deletions
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);