diff options
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 6e60f86..22ff90f 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -59,21 +59,8 @@ Globes globes_list; /* ---- Prepare the renderer state --------------------------------- */ -void pass_prepare(float seconds) +void pass_reset_lights() { - using namespace model; - - // render settings for this pass_prepare - draw_lights = true; - if (r_lights && (r_lights->value() <= 0.0f)) { - draw_lights = false; - } - - draw_particles = true; - if (r_particles && (r_particles->value() <= 0.0f)) { - draw_particles = false; - } - // lighting settings for the default light GL_LIGHT0 GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat ambient_light[] = { r_ambient->value(), r_ambient->value(), r_ambient->value(), 1.0f }; @@ -94,6 +81,25 @@ void pass_prepare(float seconds) // reset light state gl::disable(GL_LIGHT1); +} + +void pass_prepare(float seconds) +{ + using namespace model; + + // render settings for this pass_prepare + draw_lights = true; + if (r_lights && (r_lights->value() <= 0.0f)) { + draw_lights = false; + } + + draw_particles = true; + if (r_particles && (r_particles->value() <= 0.0f)) { + draw_particles = false; + } + + // initialize lights + pass_reset_lights(); has_zone_light = false; zone_color.assign(1.0); @@ -1232,13 +1238,7 @@ void draw(float seconds) glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); - if (r_normalize && r_normalize->value()) { - // enable full normalization - gl::enable(GL_NORMALIZE); - } else { - // enable rescaling of normals - gl::enable(GL_RESCALE_NORMAL); - } + State::set_normalize(true); gl::enable(GL_LIGHTING); // enable lighting @@ -1250,13 +1250,7 @@ void draw(float seconds) gl::disable(GL_LIGHTING); // disable lighting - if (r_normalize && r_normalize->value()) { - // disable full normalization - gl::disable(GL_NORMALIZE); - } else { - // disable rescaling of normals - gl::disable(GL_RESCALE_NORMAL); - } + State::set_normalize(false); gl::enable(GL_BLEND); gl::depthmask(GL_FALSE); // disable depth buffer writing |