Fix UVController and add warn about unhandled material controllers

This commit is contained in:
Chris Robinson 2013-04-07 06:56:12 -07:00
parent be419bc891
commit ebff64a7a4

View file

@ -184,18 +184,23 @@ public:
static float lookupValue(const Nif::FloatKeyList &keys, float time, float def) static float lookupValue(const Nif::FloatKeyList &keys, float time, float def)
{ {
Nif::FloatKeyList::VecType::const_iterator iter(keys.mKeys.begin()); if(keys.mKeys.size() == 0)
return def;
if(time <= keys.mKeys.front().mTime)
return keys.mKeys.front().mValue;
Nif::FloatKeyList::VecType::const_iterator iter(keys.mKeys.begin()+1);
for(;iter != keys.mKeys.end();iter++) for(;iter != keys.mKeys.end();iter++)
{ {
if(iter->mTime > time) if(iter->mTime < time)
continue; continue;
Nif::FloatKeyList::VecType::const_iterator next(iter+1);
if(next == keys.mKeys.end()) Nif::FloatKeyList::VecType::const_iterator last(iter-1);
return iter->mValue; float a = (time-last->mTime) / (iter->mTime-last->mTime);
float a = (time-iter->mTime) / (next->mTime-iter->mTime); return last->mValue + ((iter->mValue - last->mValue)*a);
return iter->mValue + ((next->mValue - iter->mValue)*a);
} }
return def; return keys.mKeys.back().mValue;
} }
public: public:
@ -837,6 +842,13 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
else else
warn("Found internal texture, ignoring."); warn("Found internal texture, ignoring.");
} }
Nif::ControllerPtr ctrls = texprop->controller;
while(!ctrls.empty())
{
warn("Unhandled texture controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
needTangents = !texName[Nif::NiTexturingProperty::BumpTexture].empty(); needTangents = !texName[Nif::NiTexturingProperty::BumpTexture].empty();
@ -845,6 +857,13 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
{ {
alphaFlags = alphaprop->flags; alphaFlags = alphaprop->flags;
alphaTest = alphaprop->data.threshold; alphaTest = alphaprop->data.threshold;
Nif::ControllerPtr ctrls = alphaprop->controller;
while(!ctrls.empty())
{
warn("Unhandled alpha controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
// Vertex color handling // Vertex color handling
@ -853,17 +872,38 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
vertMode = vertprop->data.vertmode; vertMode = vertprop->data.vertmode;
// FIXME: Handle lightmode? // FIXME: Handle lightmode?
//lightMode = vertprop->data.lightmode; //lightMode = vertprop->data.lightmode;
Nif::ControllerPtr ctrls = vertprop->controller;
while(!ctrls.empty())
{
warn("Unhandled vertex color controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
if(zprop) if(zprop)
{ {
depthFlags = zprop->flags; depthFlags = zprop->flags;
// Depth function??? // Depth function???
Nif::ControllerPtr ctrls = zprop->controller;
while(!ctrls.empty())
{
warn("Unhandled depth controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
if(specprop) if(specprop)
{ {
specFlags = specprop->flags; specFlags = specprop->flags;
Nif::ControllerPtr ctrls = specprop->controller;
while(!ctrls.empty())
{
warn("Unhandled specular controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
// Material // Material
@ -875,6 +915,13 @@ static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
emissive = matprop->data.emissive; emissive = matprop->data.emissive;
glossiness = matprop->data.glossiness; glossiness = matprop->data.glossiness;
alpha = matprop->data.alpha; alpha = matprop->data.alpha;
Nif::ControllerPtr ctrls = matprop->controller;
while(!ctrls.empty())
{
warn("Unhandled material controller "+ctrls->recName+" in "+name);
ctrls = ctrls->next;
}
} }
{ {