OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreSkeletonSerializer.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __SkeletonSerializer_H__
30 #define __SkeletonSerializer_H__
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreSkeleton.h"
34 #include "OgreSerializer.h"
35 
36 namespace Ogre {
37 
57  {
58  public:
60  virtual ~SkeletonSerializer();
61 
62 
71  void exportSkeleton(const Skeleton* pSkeleton, const String& filename,
72  Endian endianMode = ENDIAN_NATIVE);
73 
81  void importSkeleton(DataStreamPtr& stream, Skeleton* pDest);
82 
83  // TODO: provide Cal3D importer?
84 
85  protected:
86  // Internal export methods
87  void writeSkeleton(const Skeleton* pSkel);
88  void writeBone(const Skeleton* pSkel, const Bone* pBone);
89  void writeBoneParent(const Skeleton* pSkel, unsigned short boneId, unsigned short parentId);
90  void writeAnimation(const Skeleton* pSkel, const Animation* anim);
91  void writeAnimationTrack(const Skeleton* pSkel, const NodeAnimationTrack* track);
92  void writeKeyFrame(const Skeleton* pSkel, const TransformKeyFrame* key);
93  void writeSkeletonAnimationLink(const Skeleton* pSkel,
94  const LinkedSkeletonAnimationSource& link);
95 
96  // Internal import methods
97  void readBone(DataStreamPtr& stream, Skeleton* pSkel);
98  void readBoneParent(DataStreamPtr& stream, Skeleton* pSkel);
99  void readAnimation(DataStreamPtr& stream, Skeleton* pSkel);
100  void readAnimationTrack(DataStreamPtr& stream, Animation* anim, Skeleton* pSkel);
101  void readKeyFrame(DataStreamPtr& stream, NodeAnimationTrack* track, Skeleton* pSkel);
102  void readSkeletonAnimationLink(DataStreamPtr& stream, Skeleton* pSkel);
103 
104  size_t calcBoneSize(const Skeleton* pSkel, const Bone* pBone);
105  size_t calcBoneSizeWithoutScale(const Skeleton* pSkel, const Bone* pBone);
106  size_t calcBoneParentSize(const Skeleton* pSkel);
107  size_t calcAnimationSize(const Skeleton* pSkel, const Animation* pAnim);
108  size_t calcAnimationTrackSize(const Skeleton* pSkel, const NodeAnimationTrack* pTrack);
109  size_t calcKeyFrameSize(const Skeleton* pSkel, const TransformKeyFrame* pKey);
110  size_t calcKeyFrameSizeWithoutScale(const Skeleton* pSkel, const TransformKeyFrame* pKey);
111  size_t calcSkeletonAnimationLinkSize(const Skeleton* pSkel,
112  const LinkedSkeletonAnimationSource& link);
113 
114 
115 
116 
117  };
121 }
122 
123 
124 #endif
Specialised KeyFrame which stores a full transform.
Definition: OgreKeyFrame.h:102
#define _OgreExport
Definition: OgrePlatform.h:203
Generic class for serialising data to / from binary stream-based files.
Specialised AnimationTrack for dealing with node transforms.
Class for serialising skeleton data to/from an OGRE .skeleton file.
Endian
The endianness of written files.
Link to another skeleton to share animations.
Definition: OgreSkeleton.h:512
_StringBase String
An animation sequence.
Definition: OgreAnimation.h:58
A bone in a skeleton.
Definition: OgreBone.h:51
A collection of Bone objects used to animate a skinned mesh.
Definition: OgreSkeleton.h:85