00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #include "SO3NodeAnimation.h"
00035 #include "SO3NodeAnimationTrack.h"
00036 #include "../SO3SceneGraph/SO3NodeScol.h"
00037 #include "../SO3SceneGraph/SO3Scene.h"
00038
00039 namespace SO3
00040 {
00041
00042
00043 SNodeAnimation::SNodeAnimation(SScene* scene, std::string animationName, SNode* node, unsigned short id, float animationLength) : SAnim(scene, animationName, node, id, SAnim::SO3_SCENENODE_ANIM)
00044 {
00045 ogreAnimation = mScene->GetOgreScenePointer()->createAnimation(name, animationLength);
00046 ogreAnimationState = mScene->GetOgreScenePointer()->createAnimationState(name);
00047 }
00048
00049 SNodeAnimation::SNodeAnimation() : SAnim(0, "", 0, 0, SO3_UNKNOWN_ANIM)
00050 {
00051
00052 }
00053
00054 SNodeAnimation::~SNodeAnimation()
00055 {
00056 if (mScene->GetOgreScenePointer()->hasAnimationState(name))
00057 mScene->GetOgreScenePointer()->destroyAnimationState(name);
00058 ogreAnimationState = 0;
00059 if (mScene->GetOgreScenePointer()->hasAnimation(name))
00060 mScene->GetOgreScenePointer()->destroyAnimation(name);
00061 }
00062
00063 SAnimTrack* SNodeAnimation::CreateAnimationTrackImpl(std::string newAnimationTrackName)
00064 {
00065 return new SNodeAnimationTrack(newAnimationTrackName, this, ogreAnimation->getNumNodeTracks());
00066 }
00067
00068 Ogre::AnimationState* SNodeAnimation::_GetOgreAnimationState()
00069 {
00070 return ogreAnimationState;
00071 }
00072
00073 }