mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 16:06:44 +00:00
Handle NiWireframeProperty
This commit is contained in:
parent
ebff64a7a4
commit
2e067e95a9
1 changed files with 31 additions and 6 deletions
|
@ -799,6 +799,7 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
const Nif::NiVertexColorProperty *vertprop,
|
const Nif::NiVertexColorProperty *vertprop,
|
||||||
const Nif::NiZBufferProperty *zprop,
|
const Nif::NiZBufferProperty *zprop,
|
||||||
const Nif::NiSpecularProperty *specprop,
|
const Nif::NiSpecularProperty *specprop,
|
||||||
|
const Nif::NiWireframeProperty *wireprop,
|
||||||
bool &needTangents)
|
bool &needTangents)
|
||||||
{
|
{
|
||||||
Ogre::MaterialManager &matMgr = Ogre::MaterialManager::getSingleton();
|
Ogre::MaterialManager &matMgr = Ogre::MaterialManager::getSingleton();
|
||||||
|
@ -819,6 +820,7 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
int depthFlags = 3;
|
int depthFlags = 3;
|
||||||
// Default should be 1, but Bloodmoon's models are broken
|
// Default should be 1, but Bloodmoon's models are broken
|
||||||
int specFlags = 0;
|
int specFlags = 0;
|
||||||
|
int wireFlags = 0;
|
||||||
Ogre::String texName[7];
|
Ogre::String texName[7];
|
||||||
|
|
||||||
bool vertexColour = (shapedata->colors.size() != 0);
|
bool vertexColour = (shapedata->colors.size() != 0);
|
||||||
|
@ -906,6 +908,18 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(wireprop)
|
||||||
|
{
|
||||||
|
wireFlags = wireprop->flags;
|
||||||
|
|
||||||
|
Nif::ControllerPtr ctrls = wireprop->controller;
|
||||||
|
while(!ctrls.empty())
|
||||||
|
{
|
||||||
|
warn("Unhandled wireframe controller "+ctrls->recName+" in "+name);
|
||||||
|
ctrls = ctrls->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Material
|
// Material
|
||||||
if(matprop)
|
if(matprop)
|
||||||
{
|
{
|
||||||
|
@ -950,6 +964,7 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
boost::hash_combine(h, vertMode);
|
boost::hash_combine(h, vertMode);
|
||||||
boost::hash_combine(h, depthFlags);
|
boost::hash_combine(h, depthFlags);
|
||||||
boost::hash_combine(h, specFlags);
|
boost::hash_combine(h, specFlags);
|
||||||
|
boost::hash_combine(h, wireFlags);
|
||||||
|
|
||||||
std::map<size_t,std::string>::iterator itr = MaterialMap.find(h);
|
std::map<size_t,std::string>::iterator itr = MaterialMap.find(h);
|
||||||
if (itr != MaterialMap.end())
|
if (itr != MaterialMap.end())
|
||||||
|
@ -993,6 +1008,11 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
new sh::Vector4(specular.x, specular.y, specular.z, glossiness)));
|
new sh::Vector4(specular.x, specular.y, specular.z, glossiness)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(wireFlags)
|
||||||
|
{
|
||||||
|
instance->setProperty("polygon_mode", sh::makeProperty(new sh::StringValue("wireframe")));
|
||||||
|
}
|
||||||
|
|
||||||
instance->setProperty("diffuseMap", sh::makeProperty(texName[Nif::NiTexturingProperty::BaseTexture]));
|
instance->setProperty("diffuseMap", sh::makeProperty(texName[Nif::NiTexturingProperty::BaseTexture]));
|
||||||
instance->setProperty("normalMap", sh::makeProperty(texName[Nif::NiTexturingProperty::BumpTexture]));
|
instance->setProperty("normalMap", sh::makeProperty(texName[Nif::NiTexturingProperty::BumpTexture]));
|
||||||
instance->setProperty("emissiveMap", sh::makeProperty(texName[Nif::NiTexturingProperty::GlowTexture]));
|
instance->setProperty("emissiveMap", sh::makeProperty(texName[Nif::NiTexturingProperty::GlowTexture]));
|
||||||
|
@ -1087,10 +1107,11 @@ class NIFObjectLoader : Ogre::ManualResourceLoader
|
||||||
const Nif::NiAlphaProperty *&alphaprop,
|
const Nif::NiAlphaProperty *&alphaprop,
|
||||||
const Nif::NiVertexColorProperty *&vertprop,
|
const Nif::NiVertexColorProperty *&vertprop,
|
||||||
const Nif::NiZBufferProperty *&zprop,
|
const Nif::NiZBufferProperty *&zprop,
|
||||||
const Nif::NiSpecularProperty *&specprop)
|
const Nif::NiSpecularProperty *&specprop,
|
||||||
|
const Nif::NiWireframeProperty *wireprop)
|
||||||
{
|
{
|
||||||
if(node->parent)
|
if(node->parent)
|
||||||
getNodeProperties(node->parent, texprop, matprop, alphaprop, vertprop, zprop, specprop);
|
getNodeProperties(node->parent, texprop, matprop, alphaprop, vertprop, zprop, specprop, wireprop);
|
||||||
|
|
||||||
const Nif::PropertyList &proplist = node->props;
|
const Nif::PropertyList &proplist = node->props;
|
||||||
for(size_t i = 0;i < proplist.length();i++)
|
for(size_t i = 0;i < proplist.length();i++)
|
||||||
|
@ -1112,6 +1133,8 @@ class NIFObjectLoader : Ogre::ManualResourceLoader
|
||||||
zprop = static_cast<const Nif::NiZBufferProperty*>(pr);
|
zprop = static_cast<const Nif::NiZBufferProperty*>(pr);
|
||||||
else if(pr->recType == Nif::RC_NiSpecularProperty)
|
else if(pr->recType == Nif::RC_NiSpecularProperty)
|
||||||
specprop = static_cast<const Nif::NiSpecularProperty*>(pr);
|
specprop = static_cast<const Nif::NiSpecularProperty*>(pr);
|
||||||
|
else if(pr->recType == Nif::RC_NiWireframeProperty)
|
||||||
|
wireprop = static_cast<const Nif::NiWireframeProperty*>(pr);
|
||||||
else
|
else
|
||||||
warn("Unhandled property type: "+pr->recName);
|
warn("Unhandled property type: "+pr->recName);
|
||||||
}
|
}
|
||||||
|
@ -1324,13 +1347,14 @@ class NIFObjectLoader : Ogre::ManualResourceLoader
|
||||||
const Nif::NiVertexColorProperty *vertprop = NULL;
|
const Nif::NiVertexColorProperty *vertprop = NULL;
|
||||||
const Nif::NiZBufferProperty *zprop = NULL;
|
const Nif::NiZBufferProperty *zprop = NULL;
|
||||||
const Nif::NiSpecularProperty *specprop = NULL;
|
const Nif::NiSpecularProperty *specprop = NULL;
|
||||||
|
const Nif::NiWireframeProperty *wireprop = NULL;
|
||||||
bool needTangents = false;
|
bool needTangents = false;
|
||||||
|
|
||||||
getNodeProperties(shape, texprop, matprop, alphaprop, vertprop, zprop, specprop);
|
getNodeProperties(shape, texprop, matprop, alphaprop, vertprop, zprop, specprop, wireprop);
|
||||||
std::string matname = NIFMaterialLoader::getMaterial(data, mesh->getName(), mGroup,
|
std::string matname = NIFMaterialLoader::getMaterial(data, mesh->getName(), mGroup,
|
||||||
texprop, matprop, alphaprop,
|
texprop, matprop, alphaprop,
|
||||||
vertprop, zprop, specprop,
|
vertprop, zprop, specprop,
|
||||||
needTangents);
|
wireprop, needTangents);
|
||||||
if(matname.length() > 0)
|
if(matname.length() > 0)
|
||||||
sub->setMaterialName(matname);
|
sub->setMaterialName(matname);
|
||||||
|
|
||||||
|
@ -1405,13 +1429,14 @@ class NIFObjectLoader : Ogre::ManualResourceLoader
|
||||||
const Nif::NiVertexColorProperty *vertprop = NULL;
|
const Nif::NiVertexColorProperty *vertprop = NULL;
|
||||||
const Nif::NiZBufferProperty *zprop = NULL;
|
const Nif::NiZBufferProperty *zprop = NULL;
|
||||||
const Nif::NiSpecularProperty *specprop = NULL;
|
const Nif::NiSpecularProperty *specprop = NULL;
|
||||||
|
const Nif::NiWireframeProperty *wireprop = NULL;
|
||||||
bool needTangents = false;
|
bool needTangents = false;
|
||||||
|
|
||||||
getNodeProperties(partnode, texprop, matprop, alphaprop, vertprop, zprop, specprop);
|
getNodeProperties(partnode, texprop, matprop, alphaprop, vertprop, zprop, specprop, wireprop);
|
||||||
partsys->setMaterialName(NIFMaterialLoader::getMaterial(particledata, fullname, mGroup,
|
partsys->setMaterialName(NIFMaterialLoader::getMaterial(particledata, fullname, mGroup,
|
||||||
texprop, matprop, alphaprop,
|
texprop, matprop, alphaprop,
|
||||||
vertprop, zprop, specprop,
|
vertprop, zprop, specprop,
|
||||||
needTangents));
|
wireprop, needTangents));
|
||||||
|
|
||||||
partsys->setDefaultDimensions(particledata->particleSize, particledata->particleSize);
|
partsys->setDefaultDimensions(particledata->particleSize, particledata->particleSize);
|
||||||
partsys->setCullIndividually(false);
|
partsys->setCullIndividually(false);
|
||||||
|
|
Loading…
Reference in a new issue