diff --git a/src/osgPlugins/ac3d/ac3d.cpp b/src/osgPlugins/ac3d/ac3d.cpp index 02f703a72..faf171be6 100644 --- a/src/osgPlugins/ac3d/ac3d.cpp +++ b/src/osgPlugins/ac3d/ac3d.cpp @@ -158,9 +158,10 @@ static std::vector palette; // change to dynamic array static int startmatindex = 0; -osg::Material*ac_palette_get_material(int id) +osg::Material*ac_palette_get_material(const unsigned int id) { - return(palette[id]); + if (idsetTexCoordArray(0,tgeom); // share same set of TexCoords } - osg::Material*mat=ac_palette_get_material(asurf.mat); osg::StateSet *dstate = new osg::StateSet; + osg::Material*mat=ac_palette_get_material(asurf.mat); + if (mat) { dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON ); dstate->setAttribute(mat); const osg::Vec4 cdiff =mat->getDiffuse(osg::Material::FRONT_AND_BACK); @@ -665,6 +667,7 @@ osg::Group *ac_load_object(FILE *f,const ACObject *parent) { dstate->setMode(GL_BLEND,osg::StateAttribute::OFF); } + } if (ob.texture.valid()) dstate->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OFF); if (ob.texture.valid()) { diff --git a/src/osgPlugins/ac3d/osgac3d.h b/src/osgPlugins/ac3d/osgac3d.h index e4404e01c..35c5fbf8c 100644 --- a/src/osgPlugins/ac3d/osgac3d.h +++ b/src/osgPlugins/ac3d/osgac3d.h @@ -65,7 +65,7 @@ typedef struct ACObject_t Prototype osg::Group *ac_load_ac3d(const char *filename); -Prototype osg::Material *ac_palette_get_material(int index); +Prototype osg::Material *ac_palette_get_material(const unsigned int index);