a few changes

This commit is contained in:
Jason Hooks 2012-02-26 21:27:54 -05:00
parent 08f3ecf935
commit 8d7a5f469b
4 changed files with 22 additions and 14 deletions

View file

@ -276,6 +276,7 @@ namespace MWRender{
rotmult = bonePtr->getOrientation(); rotmult = bonePtr->getOrientation();
scale = bonePtr->getScale().x; scale = bonePtr->getScale().x;
boneSequenceIter++; boneSequenceIter++;
std::cout << "Entering\n";
for(; boneSequenceIter != boneSequence.end(); boneSequenceIter++) for(; boneSequenceIter != boneSequence.end(); boneSequenceIter++)
{ {
if(creaturemodel->getSkeleton()->hasBone(*boneSequenceIter)){ if(creaturemodel->getSkeleton()->hasBone(*boneSequenceIter)){
@ -330,7 +331,7 @@ namespace MWRender{
} }
} }
bool Animation::timeIndex( float time, std::vector<float> times, int & i, int & j, float & x ){ bool Animation::timeIndex( float time, std::vector<float>& times, int & i, int & j, float & x ){
int count; int count;
if ( (count = times.size()) > 0 ) if ( (count = times.size()) > 0 )
{ {
@ -388,6 +389,8 @@ namespace MWRender{
} }
void Animation::handleAnimationTransforms(){ void Animation::handleAnimationTransforms(){
Ogre::SkeletonInstance* skel = base->getSkeleton(); Ogre::SkeletonInstance* skel = base->getSkeleton();
@ -404,10 +407,10 @@ namespace MWRender{
for(unsigned int i = 0; i < entityparts.size(); i++){ for(unsigned int i = 0; i < entityparts.size(); i++){
//Ogre::SkeletonInstance* skel = entityparts[i]->getSkeleton(); //Ogre::SkeletonInstance* skel = entityparts[i]->getSkeleton();
Ogre::Bone* b = skel->getRootBone(); //Ogre::Bone* b = skel->getRootBone();
b->setOrientation(Ogre::Real(.3),Ogre::Real(.3),Ogre::Real(.3), Ogre::Real(.3));//This is a trick //b->setOrientation(Ogre::Real(.3),Ogre::Real(.3),Ogre::Real(.3), Ogre::Real(.3));//This is a trick
entityparts[i]->getAllAnimationStates()->_notifyDirty(); //entityparts[i]->getAllAnimationStates()->_notifyDirty();
} }
@ -424,18 +427,19 @@ namespace MWRender{
float x; float x;
float x2; float x2;
std::vector<Ogre::Quaternion> quats = iter->getQuat(); std::vector<Ogre::Quaternion>& quats = iter->getQuat();
std::vector<float> ttime = iter->gettTime(); std::vector<float>& ttime = iter->gettTime();
std::vector<float>::iterator ttimeiter = ttime.begin();
std::vector<float>& rtime = iter->getrTime();
int rindexJ = rindexI[slot];
std::vector<float> rtime = iter->getrTime();
int rindexJ = 0;
timeIndex(time, rtime, rindexI[slot], rindexJ, x2); timeIndex(time, rtime, rindexI[slot], rindexJ, x2);
int tindexJ = 0; int tindexJ = tindexI[slot];
std::vector<Ogre::Vector3> translist1 = iter->getTranslist1(); std::vector<Ogre::Vector3>& translist1 = iter->getTranslist1();
timeIndex(time, ttime, tindexI[slot], tindexJ, x); timeIndex(time, ttime, tindexI[slot], tindexJ, x);

View file

@ -28,6 +28,8 @@ class Animation{
MWWorld::Environment& mEnvironment; MWWorld::Environment& mEnvironment;
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos; std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
static std::map<std::string, int> mUniqueIDs; static std::map<std::string, int> mUniqueIDs;
float oldHund;
bool samePlace;
std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc
@ -55,11 +57,11 @@ class Animation{
Ogre::Entity* base; Ogre::Entity* base;
void handleShapes(std::vector<Nif::NiTriShapeCopy>* allshapes, Ogre::Entity* creaturemodel, Ogre::SkeletonInstance *skel); void handleShapes(std::vector<Nif::NiTriShapeCopy>* allshapes, Ogre::Entity* creaturemodel, Ogre::SkeletonInstance *skel);
void handleAnimationTransforms(); void handleAnimationTransforms();
bool timeIndex( float time, std::vector<float> times, int & i, int & j, float & x ); bool timeIndex( float time, std::vector<float>& times, int & i, int & j, float & x );
std::string getUniqueID(std::string mesh); std::string getUniqueID(std::string mesh);
public: public:
Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend): mRend(_rend), mEnvironment(_env), animate(0){}; Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend): mRend(_rend), mEnvironment(_env), animate(0), oldHund(0){};
virtual void runAnimation(float timepassed) = 0; virtual void runAnimation(float timepassed) = 0;
void startScript(std::string groupname, int mode, int loops); void startScript(std::string groupname, int mode, int loops);
void stopScript(); void stopScript();

View file

@ -276,6 +276,7 @@ void NpcAnimation::runAnimation(float timepassed){
shapepartsiter++; shapepartsiter++;
entitypartsiter++; entitypartsiter++;
} }
} }
} }

View file

@ -1328,7 +1328,8 @@ void NIFLoader::loadResource(Resource *resource)
(*iter)->addBoneAssignment(vba); (*iter)->addBoneAssignment(vba);
} }
mesh->_notifySkeleton(mSkel); if(triname == "")
mesh->_notifySkeleton(mSkel);
} }
} }