Modified Files:
simgear/scene/material/mat.cxx simgear/scene/material/mat.hxx: Olaf Flebbe: make anisotroüpic filtering configurable.
This commit is contained in:
@@ -141,6 +141,7 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props
|
||||
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
|
||||
@@ -204,6 +205,7 @@ SGMaterial::init ()
|
||||
wrapv = true;
|
||||
|
||||
mipmap = true;
|
||||
filtering = 1.0f;
|
||||
light_coverage = 0.0;
|
||||
|
||||
solid = true;
|
||||
@@ -233,7 +235,7 @@ SGMaterial::load_texture ( int n )
|
||||
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 );
|
||||
wrapu, wrapv, mipmap, filtering );
|
||||
_status[i].texture_loaded = true;
|
||||
}
|
||||
}
|
||||
@@ -279,7 +281,7 @@ SGMaterial::build_state( bool defer_tex_load )
|
||||
|
||||
if ( !defer_tex_load ) {
|
||||
SG_LOG(SG_INPUT, SG_INFO, " " << _status[i].texture_path );
|
||||
assignTexture( stateSet, _status[i].texture_path, wrapu, wrapv );
|
||||
assignTexture( stateSet, _status[i].texture_path, wrapu, wrapv, 1, filtering );
|
||||
_status[i].texture_loaded = true;
|
||||
} else {
|
||||
_status[i].texture_loaded = false;
|
||||
@@ -316,7 +318,7 @@ void SGMaterial::set_state( osg::StateSet *s )
|
||||
}
|
||||
|
||||
void SGMaterial::assignTexture( osg::StateSet *state, const std::string &fname,
|
||||
int _wrapu, int _wrapv, int _mipmap )
|
||||
int _wrapu, int _wrapv, int _mipmap, float filtering )
|
||||
{
|
||||
map<string, osg::ref_ptr<osg::Texture2D> >::iterator _tex_cache_iter;
|
||||
_tex_cache_iter = _tex_cache.find(fname);
|
||||
@@ -324,6 +326,7 @@ void SGMaterial::assignTexture( osg::StateSet *state, const std::string &fname,
|
||||
{
|
||||
osg::Texture2D* texture = SGLoadTexture2D(fname, _wrapu, _wrapv,
|
||||
mipmap ? -1 : 0);
|
||||
texture->setMaxAnisotropy( filtering);
|
||||
state->setTextureAttributeAndModes(0, texture);
|
||||
_tex_cache[fname] = texture;
|
||||
}
|
||||
|
||||
@@ -252,6 +252,9 @@ private:
|
||||
// use mipmapping?
|
||||
int mipmap;
|
||||
|
||||
// use anisotropic filtering
|
||||
float filtering;
|
||||
|
||||
// coverage of night lighting.
|
||||
double light_coverage;
|
||||
|
||||
@@ -293,7 +296,7 @@ private:
|
||||
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 );
|
||||
void assignTexture( osg::StateSet *state, const std::string &fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE, float filtering = 1.0f );
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user