SO3Engine
SO3NodeAnimation.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
35
36namespace SO3
37{
38
39// No handles on Ogre::NodeAnimation!
40SNodeAnimation::SNodeAnimation(SScene* scene, const std::string& animationName, SNode* node, const unsigned short& id, const float& animationLength) : SAnim(scene, animationName, node, id, SAnim::SO3_SCENENODE_ANIM)
41{
42 ogreAnimation = mScene->GetOgreScenePointer()->createAnimation(name, animationLength);
43 ogreAnimationState = mScene->GetOgreScenePointer()->createAnimationState(name);
44}
45
46SNodeAnimation::SNodeAnimation() : SAnim(0, "", 0, 0, SO3_UNKNOWN_ANIM)
47{
48 // Forbiden (private)
49}
50
52{
53 if (mScene->GetOgreScenePointer()->hasAnimationState(name))
54 mScene->GetOgreScenePointer()->destroyAnimationState(name);
55 ogreAnimationState = 0;
56 if (mScene->GetOgreScenePointer()->hasAnimation(name))
57 mScene->GetOgreScenePointer()->destroyAnimation(name);
58}
59
60SAnimTrack* SNodeAnimation::CreateAnimationTrackImpl(const std::string& newAnimationTrackName)
61{
62 return new SNodeAnimationTrack(newAnimationTrackName, this, ogreAnimation->getNumNodeTracks());
63}
64
66{
67 return ogreAnimationState;
68}
69
70}
Ogre::Animation * ogreAnimation
Definition SO3Anim.h:65
SScene * mScene
Definition SO3Anim.h:67
std::string name
Definition SO3DataScol.h:44
virtual SAnimTrack * CreateAnimationTrackImpl(const std::string &newAnimationTrackName)
virtual Ogre::AnimationState * _GetOgreAnimationState()
Ogre::SceneManager * GetOgreScenePointer()
Definition SO3Scene.cpp:449