]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove the LIGHTING enum
authorMikko Rasa <tdb@tdb.fi>
Wed, 27 Apr 2011 11:01:47 +0000 (11:01 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 27 Apr 2011 11:01:47 +0000 (11:01 +0000)
Add Light::unbind_from function

source/light.cpp
source/light.h
source/lighting.cpp
source/lighting.h

index 26cc896358d46f4a7de30cd0bd40e4d811f27ad8..215b9d567eb6e357781015cd4f5f5e58844f3baf 100644 (file)
@@ -118,6 +118,12 @@ void Light::unbind()
        }
 }
 
+void Light::unbind_from(unsigned i)
+{
+       activate(i);
+       unbind();
+}
+
 unsigned Light::current_unit = 0;
 vector<const Light *> Light::current_lights(1);
 
index 5871ec72d2ea65c3ef3d43721387d47bf86d1a64..3be561d71c7dc1b5ba08a3ef0d882786dc39ea3f 100644 (file)
@@ -59,6 +59,7 @@ public:
 
        static void activate(unsigned);
        static void unbind();
+       static void unbind_from(unsigned);
 };
 
 } // namespace GL
index 44a01a5e6ab6ade990bd324d0ea7a0f97a5c8e85..4cd4858b438fc99ef51a8ffb4702da674b3efd3d 100644 (file)
@@ -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; i<lights.size(); ++i)
                if(lights[i])
@@ -57,11 +57,9 @@ void Lighting::unbind()
 
        for(unsigned i=0; i<old->lights.size(); ++i)
                if(old->lights[i])
-               {
-                       Light::activate(i);
-                       Light::unbind();
-               }
-       disable(LIGHTING);
+                       Light::unbind_from(i);
+
+       disable(GL_LIGHTING);
 }
 
 } // namespace GL
index 31e75a44c66b36442778b7ac2d07e0add0a6f342..76c241e9fa5c46e0ff6aefbcd17ef4dadfc81bdc 100644 (file)
@@ -18,11 +18,6 @@ namespace GL {
 
 class Light;
 
-enum
-{
-       LIGHTING = GL_LIGHTING
-};
-
 /**
 Encapsulates global lighting parameters and a number of individual lights.
 */