mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-15 15:30:56 -04:00
Use white color if told to use nonexisting vertexcolors (Fixes #3833)
This commit is contained in:
parent
5d2fe5e887
commit
bc82c6a35d
@ -1710,8 +1710,6 @@ namespace NifOsg
|
|||||||
const Nif::NiVertexColorProperty* vertprop = static_cast<const Nif::NiVertexColorProperty*>(property);
|
const Nif::NiVertexColorProperty* vertprop = static_cast<const Nif::NiVertexColorProperty*>(property);
|
||||||
lightmode = vertprop->data.lightmode;
|
lightmode = vertprop->data.lightmode;
|
||||||
|
|
||||||
if (hasVertexColors)
|
|
||||||
{
|
|
||||||
switch (vertprop->data.vertmode)
|
switch (vertprop->data.vertmode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -1727,7 +1725,6 @@ namespace NifOsg
|
|||||||
mat->setColorMode(osg::Material::OFF);
|
mat->setColorMode(osg::Material::OFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Nif::RC_NiAlphaProperty:
|
case Nif::RC_NiAlphaProperty:
|
||||||
@ -1788,6 +1785,27 @@ namespace NifOsg
|
|||||||
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f());
|
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're told to use vertex colors but there are none to use, use a default color instead.
|
||||||
|
if (!hasVertexColors)
|
||||||
|
{
|
||||||
|
switch (mat->getColorMode())
|
||||||
|
{
|
||||||
|
case osg::Material::AMBIENT:
|
||||||
|
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||||
|
break;
|
||||||
|
case osg::Material::AMBIENT_AND_DIFFUSE:
|
||||||
|
mat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||||
|
mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||||
|
break;
|
||||||
|
case osg::Material::EMISSION:
|
||||||
|
mat->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mat->setColorMode(osg::Material::OFF);
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasMatCtrl && mat->getColorMode() == osg::Material::OFF
|
if (!hasMatCtrl && mat->getColorMode() == osg::Material::OFF
|
||||||
&& mat->getEmission(osg::Material::FRONT_AND_BACK) == osg::Vec4f(0,0,0,1)
|
&& mat->getEmission(osg::Material::FRONT_AND_BACK) == osg::Vec4f(0,0,0,1)
|
||||||
&& mat->getDiffuse(osg::Material::FRONT_AND_BACK) == osg::Vec4f(1,1,1,1)
|
&& mat->getDiffuse(osg::Material::FRONT_AND_BACK) == osg::Vec4f(1,1,1,1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user