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:
@@ -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
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
SGSetTextureFilter( int max) {
|
||||
SGSceneFeatures::instance()->setTextureFilter( max);
|
||||
}
|
||||
|
||||
|
||||
int SGTextureFilterListener::filter = 1;
|
||||
|
||||
int SGTextureFilterListener::getFilter() { return filter; };
|
||||
void SGTextureFilterListener::setFilter(int filt) {
|
||||
filter = filt;
|
||||
};
|
||||
// end of mat.cxx
|
||||
int
|
||||
SGGetTextureFilter() {
|
||||
return SGSceneFeatures::instance()->getTextureFilter();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,7 +39,8 @@ SGSceneFeatures::SGSceneFeatures() :
|
||||
_textureCompression(UseARBCompression),
|
||||
_shaderLights(true),
|
||||
_pointSpriteLights(true),
|
||||
_distanceAttenuationLights(true)
|
||||
_distanceAttenuationLights(true),
|
||||
_textureFilter(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user