Project

General

Profile

SO3Engine
SO3VertexAnimation.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
36#include <boost/lexical_cast.hpp>
37
38namespace SO3
39{
40
41SVertexAnimation::SVertexAnimation(SScene* scene, const std::string& animationName, SEntity* entity, const unsigned short& id) : SAnim(scene, animationName, entity, id, SAnim::SO3_VERTEX_ANIM)
42{
43 mOgreEntity = entity->getOgreEntityPointer();
44 ogreAnimation = mOgreEntity->getMesh()->getAnimation(id);
45
46 Ogre::Animation::VertexTrackList ogreVertexTracks = ogreAnimation->_getVertexTrackList();
47 for (Ogre::Animation::VertexTrackList::iterator it = ogreVertexTracks.begin(); it != ogreVertexTracks.end(); it++)
48 {
49 Ogre::VertexAnimationTrack* ogreVertexTrack = it->second;
50 std::string animationTrackName = animationName+".vertexTrack_"+boost::lexical_cast<std::string>(ogreVertexTrack->getHandle());
51 SAnimTrack* animationTrack = new SVertexAnimationTrack(animationTrackName, this, ogreVertexTrack->getHandle());
52 AddAnimationTrack(animationTrack);
53 }
54}
55
56SVertexAnimation::SVertexAnimation() : SAnim(0, "", 0, 0, SO3_UNKNOWN_ANIM)
57{
58 // Forbiden (private)
59}
60
64
66{
67 return mOgreEntity->getAnimationState(name);
68}
69
70}
void AddAnimationTrack(SAnimTrack *existingAnimationTrack)
Definition SO3Anim.cpp:187
Ogre::Animation * ogreAnimation
Definition SO3Anim.h:65
std::string name
Definition SO3DataScol.h:44
Ogre::Entity * getOgreEntityPointer()
virtual Ogre::AnimationState * _GetOgreAnimationState()