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.
This commit is contained in:
frohlich
2007-06-08 06:50:16 +00:00
parent 40b182c550
commit 0281f31df2
4 changed files with 25 additions and 25 deletions
+9 -12
View File
@@ -326,7 +326,7 @@ void SGMaterial::assignTexture( osg::StateSet *state, const std::string &fname,
{ {
osg::Texture2D* texture = SGLoadTexture2D(fname, _wrapu, _wrapv, osg::Texture2D* texture = SGLoadTexture2D(fname, _wrapu, _wrapv,
mipmap ? -1 : 0); mipmap ? -1 : 0);
texture->setMaxAnisotropy( SGTextureFilterListener::getFilter()); texture->setMaxAnisotropy( SGGetTextureFilter());
state->setTextureAttributeAndModes(0, texture); state->setTextureAttributeAndModes(0, texture);
_tex_cache[fname] = texture; _tex_cache[fname] = texture;
} }
@@ -361,15 +361,12 @@ SGMaterialGlyph::SGMaterialGlyph(SGPropertyNode *p) :
{ {
} }
//////////////////////////////////////////////////////////////////////// void
// SGTextureFilterListener SGSetTextureFilter( int max) {
//////////////////////////////////////////////////////////////////////// SGSceneFeatures::instance()->setTextureFilter( max);
}
int
int SGTextureFilterListener::filter = 1; SGGetTextureFilter() {
return SGSceneFeatures::instance()->getTextureFilter();
int SGTextureFilterListener::getFilter() { return filter; }; }
void SGTextureFilterListener::setFilter(int filt) {
filter = filt;
};
// end of mat.cxx
+7 -12
View File
@@ -43,6 +43,7 @@
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/scene/util/SGSceneFeatures.hxx>
#include "matmodel.hxx" #include "matmodel.hxx"
@@ -53,18 +54,6 @@ SG_USING_STD(map);
class SGMaterialGlyph; class SGMaterialGlyph;
class SGTextureFilterListener {
private:
static int filter;
SGTextureFilterListener() {
}
public:
static int getFilter();
static void setFilter(int filt);
};
/** /**
* A material in the scene graph. * A material in the scene graph.
* *
@@ -345,4 +334,10 @@ private:
SGSharedPtr<const SGMaterial> mMaterial; SGSharedPtr<const SGMaterial> mMaterial;
}; };
void
SGSetTextureFilter( int max);
int
SGGetTextureFilter();
#endif // _SG_MAT_HXX #endif // _SG_MAT_HXX
+2 -1
View File
@@ -39,7 +39,8 @@ SGSceneFeatures::SGSceneFeatures() :
_textureCompression(UseARBCompression), _textureCompression(UseARBCompression),
_shaderLights(true), _shaderLights(true),
_pointSpriteLights(true), _pointSpriteLights(true),
_distanceAttenuationLights(true) _distanceAttenuationLights(true),
_textureFilter(1)
{ {
} }
+7
View File
@@ -70,6 +70,12 @@ public:
return false; return false;
return getHaveShaderPrograms(contextId); return getHaveShaderPrograms(contextId);
} }
void setTextureFilter( int max)
{ _textureFilter = max; }
int getTextureFilter() const {
return _textureFilter;
}
protected: protected:
bool getHavePointSprites(unsigned contextId) const; bool getHavePointSprites(unsigned contextId) const;
@@ -87,6 +93,7 @@ private:
bool _shaderLights; bool _shaderLights;
bool _pointSpriteLights; bool _pointSpriteLights;
bool _distanceAttenuationLights; bool _distanceAttenuationLights;
int _textureFilter;
}; };
#endif #endif