Added useage of TexEnvCombine

This commit is contained in:
Robert Osfield 2004-10-29 18:24:26 +00:00
parent 8dc722e2a7
commit 4065c551ef

View File

@ -558,7 +558,26 @@ osg::Geode* SolarSystem::createPlanet( double radius, const std::string& name, c
if ( image ) if ( image )
{ {
osg::StateSet* stateset = geodePlanet->getOrCreateStateSet(); osg::StateSet* stateset = geodePlanet->getOrCreateStateSet();
stateset->setTextureAttribute( 1, new osg::TexEnv(osg::TexEnv::ADD));
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource2_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
/*
texenv->setCombine_Alpha(osg::TexEnvCombine::INTERPOLATE);
texenv->setSource0_Alpha(osg::TexEnvCombine::PREVIOUS);
texenv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA);
texenv->setSource1_Alpha(osg::TexEnvCombine::TEXTURE);
texenv->setOperand1_Alpha(osg::TexEnvCombine::ONE_MINUS_SRC_ALPHA);
texenv->setSource2_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_ALPHA);
*/
stateset->setTextureAttribute( 1, texenv );
stateset->setTextureAttributeAndModes( 1, new osg::Texture2D( image ), osg::StateAttribute::ON ); stateset->setTextureAttributeAndModes( 1, new osg::Texture2D( image ), osg::StateAttribute::ON );
} }
} }