From d7ab56e31f57cc1c8d2430992bd3f7766a60fef3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 12 Oct 2004 07:54:45 +0000 Subject: [PATCH] From Sondra Iverson, with mods by Robert Osfield. Support for copying texenv from the source StateSet when multi-texturing. --- src/osgPlugins/flt/flt2osg.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 8df34e9f0..5e73fb7f7 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -1710,16 +1710,20 @@ ConvertFromFLT::addMultiTexture( DynGeoSet* dgset, MultiTextureRecord* mtr ) return; } - - texture_stateset->setTextureAttributeAndModes( - i, texture,osg::StateAttribute::ON); - - osg::TexEnv* osgTexEnv = new osg::TexEnv; - - CERR << "osgTexEnv: " << osgTexEnv << "\n"; - - osgTexEnv->setMode(osg::TexEnv::MODULATE); - texture_stateset->setTextureAttribute( i, osgTexEnv ); + texture_stateset->setTextureAttributeAndModes(i, texture,osg::StateAttribute::ON); + + osg::StateAttribute* texenv_0 = textureStateSet->getTextureAttribute( 0, osg::StateAttribute::TEXENV ); + if (texenv_0) + { + texture_stateset->setTextureAttribute( i, texenv_0); + } + else + { + osg::TexEnv* osgTexEnv = new osg::TexEnv; + osgTexEnv->setMode(osg::TexEnv::MODULATE); + texture_stateset->setTextureAttribute( i, osgTexEnv ); + } + CERR << "geom: " << geom << "\n"; CERR << ", referenceCount: "