From 0281f31df22ca4dc6e4f6c77c7a19966232fb86a Mon Sep 17 00:00:00 2001
From: frohlich <frohlich>
Date: Fri, 8 Jun 2007 06:50:16 +0000
Subject: [PATCH] Modified Files: 	simgear/scene/material/mat.cxx
 simgear/scene/material/mat.hxx 	simgear/scene/util/SGSceneFeatures.cxx
 	simgear/scene/util/SGSceneFeatures.hxx: 	Olaf Flebbe: Make use
 of SGSceneFeatues for anisotropic filtering, 	clean up.

---
 simgear/scene/material/mat.cxx         | 21 +++++++++------------
 simgear/scene/material/mat.hxx         | 19 +++++++------------
 simgear/scene/util/SGSceneFeatures.cxx |  3 ++-
 simgear/scene/util/SGSceneFeatures.hxx |  7 +++++++
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx
index 646a0e53..fdccd511 100644
--- a/simgear/scene/material/mat.cxx
+++ b/simgear/scene/material/mat.cxx
@@ -326,7 +326,7 @@ void SGMaterial::assignTexture( osg::StateSet *state, const std::string &fname,
    {
       osg::Texture2D* texture = SGLoadTexture2D(fname, _wrapu, _wrapv,
                                                 mipmap ? -1 : 0);
-      texture->setMaxAnisotropy( SGTextureFilterListener::getFilter());
+	  texture->setMaxAnisotropy( SGGetTextureFilter());
       state->setTextureAttributeAndModes(0, texture);
       _tex_cache[fname] = texture;
    }
@@ -361,15 +361,12 @@ SGMaterialGlyph::SGMaterialGlyph(SGPropertyNode *p) :
 {
 }
 
-////////////////////////////////////////////////////////////////////////
-// SGTextureFilterListener
-////////////////////////////////////////////////////////////////////////
-
-
-int SGTextureFilterListener::filter = 1;
+void
+SGSetTextureFilter( int max) {
+	SGSceneFeatures::instance()->setTextureFilter( max);
+}
 
-int SGTextureFilterListener::getFilter() { return filter; };
-void SGTextureFilterListener::setFilter(int filt) { 
-    filter = filt;
-};
-// end of mat.cxx
+int
+SGGetTextureFilter() {
+	return SGSceneFeatures::instance()->getTextureFilter();
+}
diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx
index 648abcab..a5d328b0 100644
--- a/simgear/scene/material/mat.hxx
+++ b/simgear/scene/material/mat.hxx
@@ -43,6 +43,7 @@
 
 #include <simgear/props/props.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
+#include <simgear/scene/util/SGSceneFeatures.hxx>
 
 #include "matmodel.hxx"
 
@@ -53,18 +54,6 @@ SG_USING_STD(map);
 
 class SGMaterialGlyph;
 
-class SGTextureFilterListener  {
-private:
-  static int filter;
-
-  SGTextureFilterListener() {
-  }
-  
-public:
-  static int getFilter();
-  static void setFilter(int filt);
- };
-
 /**
  * A material in the scene graph.
  *
@@ -345,4 +334,10 @@ private:
   SGSharedPtr<const SGMaterial> mMaterial;
 };
 
+void
+SGSetTextureFilter( int max);
+
+int
+SGGetTextureFilter();
+
 #endif // _SG_MAT_HXX 
diff --git a/simgear/scene/util/SGSceneFeatures.cxx b/simgear/scene/util/SGSceneFeatures.cxx
index 7cc71262..ccefab95 100644
--- a/simgear/scene/util/SGSceneFeatures.cxx
+++ b/simgear/scene/util/SGSceneFeatures.cxx
@@ -39,7 +39,8 @@ SGSceneFeatures::SGSceneFeatures() :
   _textureCompression(UseARBCompression),
   _shaderLights(true),
   _pointSpriteLights(true),
-  _distanceAttenuationLights(true)
+  _distanceAttenuationLights(true),
+  _textureFilter(1)
 {
 }
 
diff --git a/simgear/scene/util/SGSceneFeatures.hxx b/simgear/scene/util/SGSceneFeatures.hxx
index c38921e8..458633ff 100644
--- a/simgear/scene/util/SGSceneFeatures.hxx
+++ b/simgear/scene/util/SGSceneFeatures.hxx
@@ -70,6 +70,12 @@ public:
       return false;
     return getHaveShaderPrograms(contextId);
   }
+  
+  void setTextureFilter( int max) 
+  { _textureFilter = max; }
+  int getTextureFilter() const {
+	  return _textureFilter;
+  }
 
 protected:  
   bool getHavePointSprites(unsigned contextId) const;
@@ -87,6 +93,7 @@ private:
   bool _shaderLights;
   bool _pointSpriteLights;
   bool _distanceAttenuationLights;
+  int  _textureFilter;
 };
 
 #endif
-- 
2.39.5