From b824398c547964c2862c4bf9f76426e1e8a4c1cb Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 27 Apr 2011 11:01:47 +0000 Subject: [PATCH] Remove the LIGHTING enum Add Light::unbind_from function --- source/light.cpp | 6 ++++++ source/light.h | 1 + source/lighting.cpp | 10 ++++------ source/lighting.h | 5 ----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/light.cpp b/source/light.cpp index 26cc8963..215b9d56 100644 --- a/source/light.cpp +++ b/source/light.cpp @@ -118,6 +118,12 @@ void Light::unbind() } } +void Light::unbind_from(unsigned i) +{ + activate(i); + unbind(); +} + unsigned Light::current_unit = 0; vector Light::current_lights(1); diff --git a/source/light.h b/source/light.h index 5871ec72..3be561d7 100644 --- a/source/light.h +++ b/source/light.h @@ -59,6 +59,7 @@ public: static void activate(unsigned); static void unbind(); + static void unbind_from(unsigned); }; } // namespace GL diff --git a/source/lighting.cpp b/source/lighting.cpp index 44a01a5e..4cd4858b 100644 --- a/source/lighting.cpp +++ b/source/lighting.cpp @@ -42,7 +42,7 @@ void Lighting::bind() const if(!set_current(this)) return; - enable(LIGHTING); + enable(GL_LIGHTING); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &ambient.r); for(unsigned i=0; ilights.size(); ++i) if(old->lights[i]) - { - Light::activate(i); - Light::unbind(); - } - disable(LIGHTING); + Light::unbind_from(i); + + disable(GL_LIGHTING); } } // namespace GL diff --git a/source/lighting.h b/source/lighting.h index 31e75a44..76c241e9 100644 --- a/source/lighting.h +++ b/source/lighting.h @@ -18,11 +18,6 @@ namespace GL { class Light; -enum -{ - LIGHTING = GL_LIGHTING -}; - /** Encapsulates global lighting parameters and a number of individual lights. */ -- 2.45.2