Hi all,

I seem to be having some issues with models that have color layers when i do 
the IVE generation from 3ds.

I have a MaterialVisitor class that essentialy does this to make sure we use 
the material colors. And also i need this to make sure the lighting settings 
are passed to the models correctly. If i dont have this the texture models are 
really really dark ( close to black)

void Material_Visitor::SetUseMaterialColors(osg::StateSet *stateset)
{
        if(stateset)
        {       
                                osg::Material *mat;
                unsigned int i=0;

                while((mat = (osg::Material 
*)stateset->getAttribute(osg::StateAttribute::MATERIAL, i)))
                {
                        if(mat->getColorMode() == osg::Material::OFF)
                                
mat->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);

                        i++;
                }
        }
}

I read the 3ds model and i apply the visitor:

Material_Visitor mv;
theNode->accept(mv);

If the 3ds model has image textures associated with it then it is all good.

However if i have a 3ds model that has color layers associated with it and not 
image textures then after the model is saved into an IVE all the colors are 
gone and the model is all white.

Any advice on what i am doing wrong?


Thank you!

Cheers,
Dan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38814#38814





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to