Added check for validity of OpenFlight shininess value.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14998 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-07-21 14:21:49 +00:00
parent 36352031ef
commit 7c4b5febcb

View File

@ -220,7 +220,15 @@ protected:
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha)); material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha));
material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha));
if (shininess>=0.0f)
{
material->setShininess(osg::Material::FRONT_AND_BACK,shininess); material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
}
else
{
OSG_INFO<<"Warning: OpenFlight shininess value out of range: "<<shininess<<std::endl;
}
MaterialPool* mp = document.getOrCreateMaterialPool(); MaterialPool* mp = document.getOrCreateMaterialPool();
(*mp)[index] = material; (*mp)[index] = material;
@ -266,7 +274,15 @@ protected:
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha)); material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha));
material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha));
if (shininess>=0.0f)
{
material->setShininess(osg::Material::FRONT_AND_BACK,shininess); material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
}
else
{
OSG_INFO<<"Warning: OpenFlight shininess value out of range: "<<shininess<<std::endl;
}
MaterialPool* mp = document.getOrCreateMaterialPool(); MaterialPool* mp = document.getOrCreateMaterialPool();
(*mp)[i] = material; (*mp)[i] = material;