|
|
|
@ -187,7 +187,7 @@ static TextKeyMap extractTextKeys(const Nif::NiTextKeyExtraData *tk)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void buildBones(Ogre::Skeleton *skel, const Nif::Node *node, std::vector<Nif::NiKeyframeController*> &ctrls, Ogre::Bone *parent=NULL)
|
|
|
|
|
void buildBones(Ogre::Skeleton *skel, const Nif::Node *node, std::vector<Nif::NiKeyframeController const*> &ctrls, Ogre::Bone *parent=NULL)
|
|
|
|
|
{
|
|
|
|
|
Ogre::Bone *bone;
|
|
|
|
|
if(!skel->hasBone(node->name))
|
|
|
|
@ -255,7 +255,7 @@ void loadResource(Ogre::Resource *resource)
|
|
|
|
|
Nif::NIFFile nif(skel->getName());
|
|
|
|
|
const Nif::Node *node = dynamic_cast<const Nif::Node*>(nif.getRecord(0));
|
|
|
|
|
|
|
|
|
|
std::vector<Nif::NiKeyframeController*> ctrls;
|
|
|
|
|
std::vector<Nif::NiKeyframeController const*> ctrls;
|
|
|
|
|
buildBones(skel, node, ctrls);
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> targets;
|
|
|
|
@ -266,7 +266,7 @@ void loadResource(Ogre::Resource *resource)
|
|
|
|
|
float maxtime = 0.0f;
|
|
|
|
|
for(size_t i = 0;i < ctrls.size();i++)
|
|
|
|
|
{
|
|
|
|
|
Nif::NiKeyframeController *ctrl = ctrls[i];
|
|
|
|
|
Nif::NiKeyframeController const *ctrl = ctrls[i];
|
|
|
|
|
maxtime = std::max(maxtime, ctrl->timeStop);
|
|
|
|
|
Nif::Named *target = dynamic_cast<Nif::Named*>(ctrl->target.getPtr());
|
|
|
|
|
if(target != NULL)
|
|
|
|
@ -289,8 +289,8 @@ void loadResource(Ogre::Resource *resource)
|
|
|
|
|
|
|
|
|
|
for(size_t i = 0;i < ctrls.size();i++)
|
|
|
|
|
{
|
|
|
|
|
Nif::NiKeyframeController *kfc = ctrls[i];
|
|
|
|
|
Nif::NiKeyframeData *kf = kfc->data.getPtr();
|
|
|
|
|
Nif::NiKeyframeController const *kfc = ctrls[i];
|
|
|
|
|
Nif::NiKeyframeData const *kf = kfc->data.getPtr();
|
|
|
|
|
|
|
|
|
|
/* Get the keyframes and make sure they're sorted first to last */
|
|
|
|
|
Nif::QuaternionKeyList quatkeys = kf->mRotations;
|
|
|
|
@ -711,7 +711,7 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Convert NiTriShape to Ogre::SubMesh
|
|
|
|
|
void handleNiTriShape(Ogre::Mesh *mesh, Nif::NiTriShape *shape)
|
|
|
|
|
void handleNiTriShape(Ogre::Mesh *mesh, Nif::NiTriShape const *shape)
|
|
|
|
|
{
|
|
|
|
|
Ogre::SkeletonPtr skel;
|
|
|
|
|
const Nif::NiTriShapeData *data = shape->data.getPtr();
|
|
|
|
@ -909,18 +909,18 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
|
|
|
|
|
sub->setMaterialName(mMaterialName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool findTriShape(Ogre::Mesh *mesh, Nif::Node *node)
|
|
|
|
|
bool findTriShape(Ogre::Mesh *mesh, Nif::Node const *node)
|
|
|
|
|
{
|
|
|
|
|
if(node->recType == Nif::RC_NiTriShape && mShapeName == node->name)
|
|
|
|
|
{
|
|
|
|
|
handleNiTriShape(mesh, dynamic_cast<Nif::NiTriShape*>(node));
|
|
|
|
|
handleNiTriShape(mesh, dynamic_cast<Nif::NiTriShape const *>(node));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Nif::NiNode *ninode = dynamic_cast<Nif::NiNode*>(node);
|
|
|
|
|
Nif::NiNode const *ninode = dynamic_cast<Nif::NiNode const *>(node);
|
|
|
|
|
if(ninode)
|
|
|
|
|
{
|
|
|
|
|
Nif::NodeList &children = ninode->children;
|
|
|
|
|
Nif::NodeList const &children = ninode->children;
|
|
|
|
|
for(size_t i = 0;i < children.length();i++)
|
|
|
|
|
{
|
|
|
|
|
if(!children[i].empty())
|
|
|
|
@ -957,7 +957,7 @@ public:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Nif::NIFFile nif(mName);
|
|
|
|
|
Nif::Node *node = dynamic_cast<Nif::Node*>(nif.getRecord(0));
|
|
|
|
|
Nif::Node const *node = dynamic_cast<Nif::Node const *>(nif.getRecord(0));
|
|
|
|
|
findTriShape(mesh, node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1062,10 +1062,10 @@ MeshPairList NIFLoader::load(std::string name, std::string skelName, const std::
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The first record is assumed to be the root node
|
|
|
|
|
Nif::Record *r = nif.getRecord(0);
|
|
|
|
|
Nif::Record const *r = nif.getRecord(0);
|
|
|
|
|
assert(r != NULL);
|
|
|
|
|
|
|
|
|
|
Nif::Node *node = dynamic_cast<Nif::Node*>(r);
|
|
|
|
|
Nif::Node const *node = dynamic_cast<Nif::Node const *>(r);
|
|
|
|
|
if(node == NULL)
|
|
|
|
|
{
|
|
|
|
|
nif.warn("First record in file was not a node, but a "+
|
|
|
|
|