]> git.mxchange.org Git - simgear.git/commitdiff
#232: resurrect the "point sprites for runway lights" switch
authorThorstenB <brehmt@gmail.com>
Sun, 31 Jul 2011 12:00:48 +0000 (14:00 +0200)
committerThorstenB <brehmt@gmail.com>
Sun, 31 Jul 2011 12:00:48 +0000 (14:00 +0200)
Automatic GL/OSG feature detection still not working, since we don't have
a "context" - but at least the manual switch works (on start-up only).

simgear/scene/tgdb/pt_lights.cxx
simgear/scene/util/SGSceneFeatures.hxx

index 5b7cf375e1546e0fc5a863b1d418b1118660ff22..74c696eda2d4768221b8472b27f44faefecefb93 100644 (file)
@@ -204,21 +204,26 @@ Effect* getLightEffect(float size, const Vec3& attenuation,
     Pass *combinedPass = clone(spritePass, CopyOp::SHALLOW_COPY);
     combinedPass->setAttributeAndModes(point);
     Effect* effect = new Effect;
-    std::vector<std::string> combinedExtensions;
-    combinedExtensions.push_back("GL_ARB_point_sprite");
-    combinedExtensions.push_back("GL_ARB_point_parameters");
-    Technique* combinedTniq = new Technique;
-    combinedTniq->passes.push_back(combinedPass);
-    combinedTniq->setGLExtensionsPred(2.0, combinedExtensions);
-    effect->techniques.push_back(combinedTniq);
-    std::vector<std::string> spriteExtensions;
-    spriteExtensions.push_back(combinedExtensions.front());
-    Technique* spriteTniq = new Technique;
-    spriteTniq->passes.push_back(spritePass);
-    spriteTniq->setGLExtensionsPred(2.0, spriteExtensions);
-    effect->techniques.push_back(spriteTniq);
     std::vector<std::string> parameterExtensions;
-    parameterExtensions.push_back(combinedExtensions.back());
+
+    if (SGSceneFeatures::instance()->getEnablePointSpriteLights())
+    {
+        std::vector<std::string> combinedExtensions;
+        combinedExtensions.push_back("GL_ARB_point_sprite");
+        combinedExtensions.push_back("GL_ARB_point_parameters");
+        Technique* combinedTniq = new Technique;
+        combinedTniq->passes.push_back(combinedPass);
+        combinedTniq->setGLExtensionsPred(2.0, combinedExtensions);
+        effect->techniques.push_back(combinedTniq);
+        std::vector<std::string> spriteExtensions;
+        spriteExtensions.push_back(combinedExtensions.front());
+        Technique* spriteTniq = new Technique;
+        spriteTniq->passes.push_back(spritePass);
+        spriteTniq->setGLExtensionsPred(2.0, spriteExtensions);
+        effect->techniques.push_back(spriteTniq);
+        parameterExtensions.push_back(combinedExtensions.back());
+    }
+
     Technique* parameterTniq = new Technique;
     parameterTniq->passes.push_back(attenuationPass);
     parameterTniq->setGLExtensionsPred(1.4, parameterExtensions);
index 9c954015f205085369c428c392854f3f7925e6a0..51261286c5ab0667cb727ed03fe658ac8bfc5e9f 100644 (file)
@@ -46,6 +46,10 @@ public:
 
   void setEnablePointSpriteLights(bool enable)
   { _pointSpriteLights = enable; }
+  bool getEnablePointSpriteLights() const
+  {
+      return _pointSpriteLights;
+  }
   bool getEnablePointSpriteLights(unsigned contextId) const
   {
     if (!_pointSpriteLights)