From Tom Jolly, added support for TexEnv to pfb plugin.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <osg/Image>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/TexGen>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/TexMat>
|
||||
#include <osg/Material>
|
||||
#include <osg/Notify>
|
||||
@@ -1121,6 +1122,45 @@ osg::StateSet* ConvertFromPerformer::visitGeoState(osg::Drawable* osgDrawable,pf
|
||||
pfTexture* tex = (pfTexture*)geostate->getAttr(PFSTATE_TEXTURE);
|
||||
visitTexture(osgStateSet,tex);
|
||||
|
||||
pfTexEnv* texenv = (pfTexEnv*)geostate->getAttr(PFSTATE_TEXENV);
|
||||
|
||||
if(texenv)
|
||||
{
|
||||
osg::TexEnv* osgTexEnv = new osg::TexEnv();
|
||||
int mode = texenv->getMode();
|
||||
|
||||
float r,g,b,a;
|
||||
texenv->getBlendColor(&r, &g, &b, &a);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case(PFTE_MODULATE) :
|
||||
osgTexEnv->setMode(osg::TexEnv::MODULATE);
|
||||
osgTexEnv->setColor(osg::Vec4(r,g,b,a));
|
||||
break;
|
||||
case(PFTE_DECAL) :
|
||||
osgTexEnv->setMode(osg::TexEnv::DECAL);
|
||||
osgTexEnv->setColor(osg::Vec4(r,g,b,a));
|
||||
break;
|
||||
case(PFTE_BLEND) :
|
||||
osgTexEnv->setMode(osg::TexEnv::BLEND);
|
||||
osgTexEnv->setColor(osg::Vec4(r,g,b,a));
|
||||
break;
|
||||
case(PFTE_REPLACE) :
|
||||
osgTexEnv->setMode(osg::TexEnv::REPLACE);
|
||||
osgTexEnv->setColor(osg::Vec4(r,g,b,a));
|
||||
break;
|
||||
case(PFTE_ADD) :
|
||||
osgTexEnv->setMode(osg::TexEnv::ADD);
|
||||
osgTexEnv->setColor(osg::Vec4(r,g,b,a));
|
||||
break;
|
||||
default:
|
||||
std::cerr << "TexEnv Mode "<<mode<<" not currently supported by the OSG."<<std::endl;
|
||||
break;
|
||||
}
|
||||
osgStateSet->setTextureAttribute(0,osgTexEnv);
|
||||
}
|
||||
|
||||
pfTexGen* texgen = (pfTexGen*)geostate->getAttr(PFSTATE_TEXGEN);
|
||||
|
||||
if (texgen)
|
||||
|
||||
Reference in New Issue
Block a user