#include <simgear/misc/sgstream.hxx>
#include <simgear/scene/model/model.hxx>
+
#include "mat.hxx"
static map<string, osg::ref_ptr<osg::Texture2D> > _tex_cache;
wrapu = props->getBoolValue("wrapu", true);
wrapv = props->getBoolValue("wrapv", true);
mipmap = props->getBoolValue("mipmap", true);
- filtering = props->getDoubleValue("filtering", 1.0);
light_coverage = props->getDoubleValue("light-coverage", 0.0);
// surface values for use with ground reactions
wrapv = true;
mipmap = true;
- filtering = 1.0f;
light_coverage = 0.0;
solid = true;
SG_LOG( SG_GENERAL, SG_INFO, "Loading deferred texture "
<< _status[i].texture_path );
assignTexture(_status[i].state.get(), _status[i].texture_path,
- wrapu, wrapv, mipmap, filtering );
+ wrapu, wrapv, mipmap);
_status[i].texture_loaded = true;
}
}
if ( !defer_tex_load ) {
SG_LOG(SG_INPUT, SG_INFO, " " << _status[i].texture_path );
- assignTexture( stateSet, _status[i].texture_path, wrapu, wrapv, 1, filtering );
+ assignTexture( stateSet, _status[i].texture_path, wrapu, wrapv);
_status[i].texture_loaded = true;
} else {
_status[i].texture_loaded = false;
}
void SGMaterial::assignTexture( osg::StateSet *state, const std::string &fname,
- int _wrapu, int _wrapv, int _mipmap, float filtering )
+ int _wrapu, int _wrapv, int _mipmap )
{
map<string, osg::ref_ptr<osg::Texture2D> >::iterator _tex_cache_iter;
_tex_cache_iter = _tex_cache.find(fname);
{
osg::Texture2D* texture = SGLoadTexture2D(fname, _wrapu, _wrapv,
mipmap ? -1 : 0);
- texture->setMaxAnisotropy( filtering);
+ texture->setMaxAnisotropy( SGTextureFilterListener::getFilter());
state->setTextureAttributeAndModes(0, texture);
_tex_cache[fname] = texture;
}
{
}
+////////////////////////////////////////////////////////////////////////
+// SGTextureFilterListener
+////////////////////////////////////////////////////////////////////////
+
+
+int SGTextureFilterListener::filter = 1;
+int SGTextureFilterListener::getFilter() { return filter; };
+void SGTextureFilterListener::setFilter(int filt) {
+ filter = filt;
+};
// end of mat.cxx
class SGMaterialGlyph;
+class SGTextureFilterListener {
+private:
+ static int filter;
+
+ SGTextureFilterListener() {
+ }
+
+public:
+ static int getFilter();
+ static void setFilter(int filt);
+ };
/**
* A material in the scene graph.
*/
bool load_texture (int n = -1);
-
/**
* Get the textured state.
*/
// use mipmapping?
int mipmap;
- // use anisotropic filtering
- float filtering;
-
// coverage of night lighting.
double light_coverage;
void build_state( bool defer_tex_load );
void set_state( osg::StateSet *s );
- void assignTexture( osg::StateSet *state, const std::string &fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE, float filtering = 1.0f );
+ void assignTexture( osg::StateSet *state, const std::string &fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE );
};