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-2013 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 
40  {
45 
48  };
49 
69  {
70 
71  public:
74 
75 
84  void exportSkeleton(const Skeleton* pSkeleton, const String& filename,
85  SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
86 
95  void exportSkeleton(const Skeleton* pSkeleton, DataStreamPtr stream,
96  SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
104  void importSkeleton(DataStreamPtr& stream, Skeleton* pDest);
105 
106  // TODO: provide Cal3D importer?
107 
108  protected:
109 
111 
112  // Internal export methods
113  void writeSkeleton(const Skeleton* pSkel, SkeletonVersion ver);
114  void writeBone(const Skeleton* pSkel, const Bone* pBone);
115  void writeBoneParent(const Skeleton* pSkel, unsigned short boneId, unsigned short parentId);
116  void writeAnimation(const Skeleton* pSkel, const Animation* anim, SkeletonVersion ver);
117  void writeAnimationTrack(const Skeleton* pSkel, const NodeAnimationTrack* track);
118  void writeKeyFrame(const Skeleton* pSkel, const TransformKeyFrame* key);
120  const LinkedSkeletonAnimationSource& link);
121 
122  // Internal import methods
124  void readBone(DataStreamPtr& stream, Skeleton* pSkel);
125  void readBoneParent(DataStreamPtr& stream, Skeleton* pSkel);
126  void readAnimation(DataStreamPtr& stream, Skeleton* pSkel);
127  void readAnimationTrack(DataStreamPtr& stream, Animation* anim, Skeleton* pSkel);
128  void readKeyFrame(DataStreamPtr& stream, NodeAnimationTrack* track, Skeleton* pSkel);
130 
131  size_t calcBoneSize(const Skeleton* pSkel, const Bone* pBone);
132  size_t calcBoneSizeWithoutScale(const Skeleton* pSkel, const Bone* pBone);
133  size_t calcBoneParentSize(const Skeleton* pSkel);
134  size_t calcAnimationSize(const Skeleton* pSkel, const Animation* pAnim);
135  size_t calcAnimationTrackSize(const Skeleton* pSkel, const NodeAnimationTrack* pTrack);
136  size_t calcKeyFrameSize(const Skeleton* pSkel, const TransformKeyFrame* pKey);
137  size_t calcKeyFrameSizeWithoutScale(const Skeleton* pSkel, const TransformKeyFrame* pKey);
139  const LinkedSkeletonAnimationSource& link);
140 
141 
142 
143 
144  };
148 }
149 
150 
151 #endif
Ogre::SkeletonSerializer::writeAnimation
void writeAnimation(const Skeleton *pSkel, const Animation *anim, SkeletonVersion ver)
Ogre::SkeletonSerializer::readKeyFrame
void readKeyFrame(DataStreamPtr &stream, NodeAnimationTrack *track, Skeleton *pSkel)
Ogre::SkeletonSerializer::setWorkingVersion
void setWorkingVersion(SkeletonVersion ver)
Ogre::SkeletonSerializer::calcAnimationSize
size_t calcAnimationSize(const Skeleton *pSkel, const Animation *pAnim)
Ogre::SkeletonSerializer::SkeletonSerializer
SkeletonSerializer()
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::SkeletonSerializer::readSkeletonAnimationLink
void readSkeletonAnimationLink(DataStreamPtr &stream, Skeleton *pSkel)
Ogre::SkeletonSerializer::exportSkeleton
void exportSkeleton(const Skeleton *pSkeleton, const String &filename, SkeletonVersion ver=SKELETON_VERSION_LATEST, Endian endianMode=ENDIAN_NATIVE)
Exports a skeleton to the file specified.
Ogre::SkeletonSerializer::importSkeleton
void importSkeleton(DataStreamPtr &stream, Skeleton *pDest)
Imports Skeleton and animation data from a .skeleton file DataStream.
Ogre::SkeletonSerializer::writeKeyFrame
void writeKeyFrame(const Skeleton *pSkel, const TransformKeyFrame *key)
Ogre::SkeletonSerializer::calcKeyFrameSize
size_t calcKeyFrameSize(const Skeleton *pSkel, const TransformKeyFrame *pKey)
Ogre::SkeletonSerializer::readAnimationTrack
void readAnimationTrack(DataStreamPtr &stream, Animation *anim, Skeleton *pSkel)
Ogre::SKELETON_VERSION_LATEST
@ SKELETON_VERSION_LATEST
Latest version available.
Definition: OgreSkeletonSerializer.h:47
Ogre::SkeletonSerializer
Class for serialising skeleton data to/from an OGRE .skeleton file.
Definition: OgreSkeletonSerializer.h:69
Ogre::SkeletonVersion
SkeletonVersion
Skeleton compatibility versions.
Definition: OgreSkeletonSerializer.h:40
Ogre::SkeletonSerializer::calcSkeletonAnimationLinkSize
size_t calcSkeletonAnimationLinkSize(const Skeleton *pSkel, const LinkedSkeletonAnimationSource &link)
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::SkeletonSerializer::calcKeyFrameSizeWithoutScale
size_t calcKeyFrameSizeWithoutScale(const Skeleton *pSkel, const TransformKeyFrame *pKey)
Ogre::SkeletonSerializer::readBone
void readBone(DataStreamPtr &stream, Skeleton *pSkel)
Ogre::SkeletonSerializer::~SkeletonSerializer
virtual ~SkeletonSerializer()
Ogre::SkeletonSerializer::calcBoneSize
size_t calcBoneSize(const Skeleton *pSkel, const Bone *pBone)
OgreSerializer.h
OgrePrerequisites.h
Ogre::NodeAnimationTrack
Specialised AnimationTrack for dealing with node transforms.
Definition: OgreAnimationTrack.h:327
Ogre::SKELETON_VERSION_1_0
@ SKELETON_VERSION_1_0
OGRE version v1.0+.
Definition: OgreSkeletonSerializer.h:42
Ogre::SkeletonSerializer::readAnimation
void readAnimation(DataStreamPtr &stream, Skeleton *pSkel)
Ogre::SkeletonSerializer::readBoneParent
void readBoneParent(DataStreamPtr &stream, Skeleton *pSkel)
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Animation
An animation sequence.
Definition: OgreAnimation.h:93
Ogre::SkeletonSerializer::writeSkeletonAnimationLink
void writeSkeletonAnimationLink(const Skeleton *pSkel, const LinkedSkeletonAnimationSource &link)
Ogre::SharedPtr< DataStream >
Ogre::LinkedSkeletonAnimationSource
Link to another skeleton to share animations.
Definition: OgreSkeleton.h:468
Ogre::SKELETON_VERSION_1_8
@ SKELETON_VERSION_1_8
OGRE version v1.8+.
Definition: OgreSkeletonSerializer.h:44
Ogre::Skeleton
A collection of Bone objects used to animate a skinned mesh.
Definition: OgreSkeleton.h:88
Ogre::SkeletonSerializer::calcBoneSizeWithoutScale
size_t calcBoneSizeWithoutScale(const Skeleton *pSkel, const Bone *pBone)
Ogre::SkeletonSerializer::writeBone
void writeBone(const Skeleton *pSkel, const Bone *pBone)
Ogre::TransformKeyFrame
Specialised KeyFrame which stores a full transform.
Definition: OgreKeyFrame.h:104
Ogre::SkeletonSerializer::writeAnimationTrack
void writeAnimationTrack(const Skeleton *pSkel, const NodeAnimationTrack *track)
Ogre::SkeletonSerializer::exportSkeleton
void exportSkeleton(const Skeleton *pSkeleton, DataStreamPtr stream, SkeletonVersion ver=SKELETON_VERSION_LATEST, Endian endianMode=ENDIAN_NATIVE)
Exports a skeleton to the stream specified.
Ogre::SkeletonSerializer::calcAnimationTrackSize
size_t calcAnimationTrackSize(const Skeleton *pSkel, const NodeAnimationTrack *pTrack)
Ogre::Serializer
Generic class for serialising data to / from binary stream-based files.
Definition: OgreSerializer.h:51
Ogre::SkeletonSerializer::writeBoneParent
void writeBoneParent(const Skeleton *pSkel, unsigned short boneId, unsigned short parentId)
Ogre::Bone
A bone in a skeleton.
Definition: OgreBone.h:52
Ogre::SkeletonSerializer::writeSkeleton
void writeSkeleton(const Skeleton *pSkel, SkeletonVersion ver)
Ogre::Serializer::Endian
Endian
The endianness of written files.
Definition: OgreSerializer.h:58
OgreSkeleton.h
Ogre::SkeletonSerializer::readFileHeader
void readFileHeader(DataStreamPtr &stream)
Ogre::SkeletonSerializer::calcBoneParentSize
size_t calcBoneParentSize(const Skeleton *pSkel)

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.