Handle NiCamera nodes

actorid
Chris Robinson 12 years ago
parent 878b4c15c5
commit be419bc891

@ -46,6 +46,7 @@ Animation::~Animation()
sceneMgr->destroyEntity(mObjectList.mEntities[i]);
}
mObjectList.mControllers.clear();
mObjectList.mCameras.clear();
mObjectList.mParticles.clear();
mObjectList.mEntities.clear();
mObjectList.mSkelBase = NULL;

@ -384,6 +384,7 @@ void NpcAnimation::removeObjects(NifOgre::ObjectList &objects)
for(size_t i = 0;i < objects.mEntities.size();i++)
sceneMgr->destroyEntity(objects.mEntities[i]);
objects.mControllers.clear();
objects.mCameras.clear();
objects.mParticles.clear();
objects.mEntities.clear();
objects.mSkelBase = NULL;

@ -498,6 +498,7 @@ void buildBones(Ogre::Skeleton *skel, const Nif::Node *node, Ogre::Bone *&animro
if(!(node->recType == Nif::RC_NiNode || /* Nothing special; children traversed below */
node->recType == Nif::RC_RootCollisionNode || /* handled in nifbullet (hopefully) */
node->recType == Nif::RC_NiTriShape || /* Handled in the mesh loader */
node->recType == Nif::RC_NiCamera ||
node->recType == Nif::RC_NiAutoNormalParticles ||
node->recType == Nif::RC_NiRotatingParticles
))
@ -1452,6 +1453,13 @@ class NIFObjectLoader : Ogre::ManualResourceLoader
e = e->extra;
}
if(node->recType == Nif::RC_NiCamera)
{
int trgtid = NIFSkeletonLoader::lookupOgreBoneHandle(mName, node->recIndex);
Ogre::Bone *trgtbone = objectlist.mSkelBase->getSkeleton()->getBone(trgtid);
objectlist.mCameras.push_back(trgtbone);
}
Nif::ControllerPtr ctrl = node->controller;
while(!ctrl.empty())
{

@ -42,9 +42,14 @@ static const char sTextKeyExtraDataID[] = "TextKeyExtraData";
struct ObjectList {
Ogre::Entity *mSkelBase;
std::vector<Ogre::Entity*> mEntities;
std::vector<Ogre::ParticleSystem*> mParticles;
// We could actually have Ogre::Camera objects, but that means more
// maintenance when switching cameras. The information in the NiCamera node
// is pretty much useless too anyway. So instead, this is just a list of
// bones in the mSkelBase which are NiCamera nodes.
std::vector<Ogre::Bone*> mCameras;
std::vector<Ogre::Controller<Ogre::Real> > mControllers;
ObjectList() : mSkelBase(0)

Loading…
Cancel
Save