Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/XMLConverter/include/OgreXMLSkeletonSerializer.h @ 20

Last change on this file since 20 was 6, checked in by anonymous, 17 years ago

=…

File size: 3.8 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29
30#ifndef __XMLSkeletonSerializer_H__
31#define __XMLSkeletonSerializer_H__
32
33#include "OgreXMLPrerequisites.h"
34#include "OgreMaterial.h"
35#include "OgreSkeleton.h"
36
37
38namespace Ogre {
39
40    /** Class for serializing a Skeleton to/from XML.
41    @remarks
42        This class behaves the same way as SkeletonSerializer in the main project,
43        but is here to allow conversions to / from XML. This class is
44        deliberately not included in the main project because <UL>
45        <LI>Dependence on Xerces would unnecessarily bloat the main library</LI>
46        <LI>Runtime use of XML is discouraged because of the parsing overhead</LI></UL>
47        This class gives people the option of saving out a Skeleton as XML for examination
48        and possible editing. It can then be converted back to the native format
49        for maximum runtime efficiency.
50    */
51    class XMLSkeletonSerializer
52    {
53    public:
54
55        XMLSkeletonSerializer();
56        virtual ~XMLSkeletonSerializer();
57        /** Imports a Skeleton from the given XML file.
58        @param filename The name of the file to import, expected to be in XML format.
59        @param pSkeleton The pre-created Skeleton object to be populated.
60        */
61        void importSkeleton(const String& filename, Skeleton* pSkeleton);
62
63        /** Exports a skeleton to the named XML file. */
64        void exportSkeleton(const Skeleton* pSkeleton, const String& filename);
65
66    private:
67        // State for export
68        TiXmlDocument* mXMLDoc;
69        // State for import
70        Skeleton* mpSkel;
71
72        void writeSkeleton(const Skeleton* pSkel);
73        void writeBone(TiXmlElement* bonesElement, const Bone* pBone);
74        void writeBoneParent(TiXmlElement* boneHierarchyNode, String boneName , String parentName);
75        void writeAnimation(TiXmlElement* animsNode, const Animation* anim);
76        void writeAnimationTrack(TiXmlElement* tracksNode, 
77                        const NodeAnimationTrack* track);
78        void writeKeyFrame(TiXmlElement* keysNode, const TransformKeyFrame* key);
79                void writeSkeletonAnimationLink(TiXmlElement* linksNode, 
80                        const LinkedSkeletonAnimationSource& link);
81               
82                void readBones(Skeleton* skel, TiXmlElement* mBonesNode);
83                void readBones2(Skeleton* skel, TiXmlElement* mBonesNode);
84                void createHierarchy(Skeleton* skel, TiXmlElement* mHierNode);
85                void readKeyFrames(NodeAnimationTrack* track, TiXmlElement* mKeyfNode);
86                void readAnimations(Skeleton* skel, TiXmlElement* mAnimNode) ;
87                void readSkeletonAnimationLinks(Skeleton* skel, TiXmlElement* linksNode);
88
89    };
90
91
92}
93
94#endif
95
Note: See TracBrowser for help on using the repository browser.