From 784cca22336da412c62f03cdbfe0344a507c8fce Mon Sep 17 00:00:00 2001 From: frohlich Date: Sat, 21 Apr 2007 12:13:16 +0000 Subject: [PATCH] =?utf8?q?Modified=20Files:=20=20=09simgear/scene/material?= =?utf8?q?/mat.cxx=20simgear/scene/material/mat.hxx:=20=09Olaf=20Flebbe:?= =?utf8?q?=20make=20anisotro=C3=BCpic=20filtering=20configurable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- simgear/scene/material/mat.cxx | 9 ++++++--- simgear/scene/material/mat.hxx | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index cf5266d8..8c93886a 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -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 >::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; } diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index a55ddd73..3ede53fd 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -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 ); }; -- 2.39.2