OgreSkeletonSerializer.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __SkeletonSerializer_H__
#define __SkeletonSerializer_H__
#include "OgrePrerequisites.h"
#include "OgreSkeleton.h"
#include "OgreSerializer.h"
namespace Ogre {
enum SkeletonVersion
{
SKELETON_VERSION_1_0,
SKELETON_VERSION_1_8,
SKELETON_VERSION_LATEST = 100
};
class _OgreExport SkeletonSerializer : public Serializer
{
public:
SkeletonSerializer();
virtual ~SkeletonSerializer();
void exportSkeleton(const Skeleton* pSkeleton, const String& filename,
SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
void exportSkeleton(const Skeleton* pSkeleton, DataStreamPtr stream,
SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
void importSkeleton(DataStreamPtr& stream, Skeleton* pDest);
// TODO: provide Cal3D importer?
protected:
void setWorkingVersion(SkeletonVersion ver);
// Internal export methods
void writeSkeleton(const Skeleton* pSkel, SkeletonVersion ver);
void writeBone(const Skeleton* pSkel, const Bone* pBone);
void writeBoneParent(const Skeleton* pSkel, unsigned short boneId, unsigned short parentId);
void writeAnimation(const Skeleton* pSkel, const Animation* anim, SkeletonVersion ver);
void writeAnimationTrack(const Skeleton* pSkel, const NodeAnimationTrack* track);
void writeKeyFrame(const Skeleton* pSkel, const TransformKeyFrame* key);
void writeSkeletonAnimationLink(const Skeleton* pSkel,
const LinkedSkeletonAnimationSource& link);
// Internal import methods
void readFileHeader(DataStreamPtr& stream);
void readBone(DataStreamPtr& stream, Skeleton* pSkel);
void readBoneParent(DataStreamPtr& stream, Skeleton* pSkel);
void readAnimation(DataStreamPtr& stream, Skeleton* pSkel);
void readAnimationTrack(DataStreamPtr& stream, Animation* anim, Skeleton* pSkel);
void readKeyFrame(DataStreamPtr& stream, NodeAnimationTrack* track, Skeleton* pSkel);
void readSkeletonAnimationLink(DataStreamPtr& stream, Skeleton* pSkel);
size_t calcBoneSize(const Skeleton* pSkel, const Bone* pBone);
size_t calcBoneSizeWithoutScale(const Skeleton* pSkel, const Bone* pBone);
size_t calcBoneParentSize(const Skeleton* pSkel);
size_t calcAnimationSize(const Skeleton* pSkel, const Animation* pAnim);
size_t calcAnimationTrackSize(const Skeleton* pSkel, const NodeAnimationTrack* pTrack);
size_t calcKeyFrameSize(const Skeleton* pSkel, const TransformKeyFrame* pKey);
size_t calcKeyFrameSizeWithoutScale(const Skeleton* pSkel, const TransformKeyFrame* pKey);
size_t calcSkeletonAnimationLinkSize(const Skeleton* pSkel,
const LinkedSkeletonAnimationSource& link);
};
}
#endif
OgreSkeleton.h
Ogre::LinkedSkeletonAnimationSource
Link to another skeleton to share animations.
Definition: OgreSkeleton.h:467
Ogre::SKELETON_VERSION_LATEST
Latest version available.
Definition: OgreSkeletonSerializer.h:47
Ogre::Serializer
Generic class for serialising data to / from binary stream-based files.
Definition: OgreSerializer.h:50
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Serializer::Endian
Endian
The endianness of written files.
Definition: OgreSerializer.h:57
Ogre::TransformKeyFrame
Specialised KeyFrame which stores a full transform.
Definition: OgreKeyFrame.h:103
Ogre::Skeleton
A collection of Bone objects used to animate a skinned mesh.
Definition: OgreSkeleton.h:87
Ogre::SKELETON_VERSION_1_0
OGRE version v1.0+.
Definition: OgreSkeletonSerializer.h:42
Ogre::SkeletonVersion
SkeletonVersion
Skeleton compatibility versions.
Definition: OgreSkeletonSerializer.h:39
OgrePrerequisites.h
Ogre::Bone
A bone in a skeleton.
Definition: OgreBone.h:51
Ogre::Animation
An animation sequence.
Definition: OgreAnimation.h:92
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre
Definition: OgreAndroidLogListener.h:34
OgreSerializer.h
Ogre::SharedPtr< DataStream >
Ogre::SkeletonSerializer
Class for serialising skeleton data to/from an OGRE .skeleton file.
Definition: OgreSkeletonSerializer.h:68
Ogre::SKELETON_VERSION_1_8
OGRE version v1.8+.
Definition: OgreSkeletonSerializer.h:44
Ogre::NodeAnimationTrack
Specialised AnimationTrack for dealing with node transforms.
Definition: OgreAnimationTrack.h:326

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