From Luc Frauciel, "When dae plugin is used with daeUseSequencedTextureUnitsoption, the transparency processing is done with the wrong texture unit

I've remplaced the unused parameter diffuseColorName by the diffuseTextureUnit effectively used."
This commit is contained in:
Robert Osfield
2012-02-20 16:00:46 +00:00
parent b213f6030e
commit ec89769e6b
2 changed files with 7 additions and 7 deletions

View File

@@ -384,7 +384,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc )
ss->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
}
processTransparencySettings(b->getTransparent(), b->getTransparency(), ss, mat.get(), DiffuseTextureName );
processTransparencySettings(b->getTransparent(), b->getTransparency(), ss, mat.get(), _pluginOptions.usePredefinedTextureUnits ? MAIN_TEXTURE_UNIT : 0 );
}
// <phong>
// elements:
@@ -461,7 +461,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc )
ss->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
}
processTransparencySettings(p->getTransparent(), p->getTransparency(), ss, mat.get(), DiffuseTextureName );
processTransparencySettings(p->getTransparent(), p->getTransparency(), ss, mat.get(), _pluginOptions.usePredefinedTextureUnits ? MAIN_TEXTURE_UNIT : 0 );
}
// <lambert>
// elements:
@@ -526,7 +526,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc )
OSG_WARN << "Ambient occlusion map only supported when diffuse texture also specified" << std::endl;
}
processTransparencySettings(l->getTransparent(), l->getTransparency(), ss, mat.get(), DiffuseTextureName );
processTransparencySettings(l->getTransparent(), l->getTransparency(), ss, mat.get(), _pluginOptions.usePredefinedTextureUnits ? MAIN_TEXTURE_UNIT : 0 );
}
// <constant>
// elements:
@@ -551,7 +551,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc )
// Use the emission colour as the main colour in transparency calculations
mat->setDiffuse(osg::Material::FRONT_AND_BACK, mat->getEmission(osg::Material::FRONT_AND_BACK));
processTransparencySettings(c->getTransparent(), c->getTransparency(), ss, mat.get(), NULL );
processTransparencySettings(c->getTransparent(), c->getTransparency(), ss, mat.get(), _pluginOptions.usePredefinedTextureUnits ? MAIN_TEXTURE_UNIT : 0 );
// Kill the lighting
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0, 0.0, 0.0, 1.0));
@@ -1181,7 +1181,7 @@ void daeReader::processTransparencySettings( domCommon_transparent_type *ctt,
domCommon_float_or_param_type *pTransparency,
osg::StateSet *ss,
osg::Material *material,
xsNCName diffuseTextureName )
unsigned int diffuseTextureUnit )
{
if (ss == NULL)
return;
@@ -1259,7 +1259,7 @@ void daeReader::processTransparencySettings( domCommon_transparent_type *ctt,
if (!strictTransparency)
{
const osg::Texture* pMainTexture = dynamic_cast<osg::Texture*>(
ss->getTextureAttribute(MAIN_TEXTURE_UNIT, osg::StateAttribute::TEXTURE));
ss->getTextureAttribute(diffuseTextureUnit, osg::StateAttribute::TEXTURE));
bool haveTranslucentTexture = pMainTexture &&
pMainTexture->getImage(0) && pMainTexture->getImage(0)->isImageTranslucent();
strictTransparency = !haveTranslucentTexture;

View File

@@ -347,7 +347,7 @@ private:
domCommon_float_or_param_type *pTransparency,
osg::StateSet*,
osg::Material *material,
xsNCName diffuseTextureName );
unsigned int diffuseTextureUnit );
bool GetFloat4Param(xsNCName Reference, domFloat4 &f4) const;
bool GetFloatParam(xsNCName Reference, domFloat &f) const;