From Brede Johansen, "Here's a patch discussed in the thread "OpenFlight Loader Discarding

Material" on the osg-user mailing list."
This commit is contained in:
Robert Osfield
2006-10-06 13:04:48 +00:00
parent fe575de98f
commit d445995432

View File

@@ -303,8 +303,10 @@ protected:
stateset->setMode(GL_LIGHTING, isLit() ? osg::StateAttribute::ON : osg::StateAttribute::OFF);
// Material
if (isLit())
if (isLit() || materialIndex>=0)
{
// MaterialPool will return a "default" material if no material is defined for materialIndex.
// http://www.multigen-paradigm.com/ubb/Forum1/HTML/000228.html
osg::Vec4 col = _primaryColor;
col.a() = 1.0f - getTransparency();
osg::Material* material = document.getOrCreateMaterialPool()->getOrCreateMaterial(materialIndex,col);
@@ -858,8 +860,10 @@ protected:
stateset->setMode(GL_LIGHTING, isLit() ? osg::StateAttribute::ON : osg::StateAttribute::OFF);
// Material
if (isLit())
if (isLit() || materialIndex>=0)
{
// MaterialPool will return a "default" material if no material is defined for materialIndex.
// http://www.multigen-paradigm.com/ubb/Forum1/HTML/000228.html
osg::Vec4 col = _primaryColor;
col.a() = 1.0f - getTransparency();
osg::Material* material = document.getOrCreateMaterialPool()->getOrCreateMaterial(materialIndex,col);