Disabled the RGB components of the opacity texture
This commit is contained in:
@@ -143,6 +143,9 @@ FbxMaterialToOsgStateSet::convert(const KFbxSurfaceMaterial* pFbxMat)
|
||||
static_cast<float>(color[2] * factor),
|
||||
1.0f));
|
||||
|
||||
// get maps factors...
|
||||
result.diffuseFactor = pFbxLambert->GetDiffuseFactor().Get();
|
||||
|
||||
if (const KFbxSurfacePhong* pFbxPhong = dynamic_cast<const KFbxSurfacePhong*>(pFbxLambert))
|
||||
{
|
||||
color = pFbxPhong->GetSpecularColor().Get();
|
||||
@@ -157,9 +160,7 @@ FbxMaterialToOsgStateSet::convert(const KFbxSurfaceMaterial* pFbxMat)
|
||||
static_cast<float>(pFbxPhong->GetShininess().Get()));
|
||||
|
||||
// get maps factors...
|
||||
result.diffuseFactor = pFbxPhong->GetDiffuseFactor().Get();
|
||||
result.reflectionFactor = pFbxPhong->GetReflectionFactor().Get();
|
||||
result.opacityFactor = pFbxPhong->GetTransparencyFactor().Get();
|
||||
// get more factors here...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ struct StateSetContent
|
||||
{
|
||||
StateSetContent()
|
||||
: diffuseFactor(1.0),
|
||||
opacityFactor(1.0),
|
||||
reflectionFactor(1.0),
|
||||
emissiveFactor(1.0)
|
||||
{
|
||||
@@ -44,7 +43,6 @@ struct StateSetContent
|
||||
|
||||
// combining factors...
|
||||
double diffuseFactor;
|
||||
double opacityFactor;
|
||||
double reflectionFactor;
|
||||
double emissiveFactor;
|
||||
// more combining factors here...
|
||||
|
||||
@@ -246,16 +246,10 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
|
||||
stateSet->setTextureAttributeAndModes(StateSetContent::OPACITY_TEXTURE_UNIT, texmat.get(), osg::StateAttribute::ON);
|
||||
}
|
||||
|
||||
// setup combiner for factor...
|
||||
//In practice factor will always be zero, hence the RGB of the
|
||||
//opacity map will be ignored. The alpha will modulate the previous alpha.
|
||||
double factor = ssc.opacityFactor;
|
||||
// setup combiner to ignore RGB...
|
||||
osg::ref_ptr<osg::TexEnvCombine> texenv = new osg::TexEnvCombine();
|
||||
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
|
||||
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_RGB(osg::TexEnvCombine::REPLACE);
|
||||
texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
|
||||
stateSet->setTextureAttributeAndModes(StateSetContent::OPACITY_TEXTURE_UNIT, texenv.get(), osg::StateAttribute::ON);
|
||||
|
||||
// setup transparency...
|
||||
|
||||
Reference in New Issue
Block a user