From 2b1abf1937a8cadfba670035c5ff4e78980e2cb7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 22 Apr 2015 14:25:34 +0000 Subject: [PATCH] From Giampaolo Vigano, "please find attached a further fix for 3ds plugin: now reflection map works also with transparent objects (I also removed a redundant setting of BlendFunc)." git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14855 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgPlugins/3ds/ReaderWriter3DS.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/3ds/ReaderWriter3DS.cpp b/src/osgPlugins/3ds/ReaderWriter3DS.cpp index 5287fedf7..51873bc13 100644 --- a/src/osgPlugins/3ds/ReaderWriter3DS.cpp +++ b/src/osgPlugins/3ds/ReaderWriter3DS.cpp @@ -1365,8 +1365,6 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 stateset->setTextureAttributeAndModes(unit, texenv, osg::StateAttribute::ON); - osg::BlendFunc* blendfunc = new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA,osg::BlendFunc::ONE_MINUS_SRC_ALPHA); - stateset->setAttributeAndModes(blendfunc, osg::StateAttribute::ON); osg::TexEnv* tenv = new osg::TexEnv(); tenv->setMode(osg::TexEnv::MODULATE); stateset->setTextureAttributeAndModes(unit, tenv, osg::StateAttribute::ON); @@ -1392,7 +1390,11 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3 texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE); texenv->setSource1_RGB(osg::TexEnvCombine::PREVIOUS); texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT); - texenv->setConstantColor(osg::Vec4(factor, factor, factor, factor)); + texenv->setCombine_Alpha(osg::TexEnvCombine::REPLACE); + texenv->setSource0_Alpha(osg::TexEnvCombine::CONSTANT); + texenv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA); + texenv->setConstantColor(osg::Vec4(factor, factor, factor, alpha)); + stateset->setTextureAttributeAndModes(unit, texenv.get(), osg::StateAttribute::ON); unit++; }