source: OGRE/trunk/ogrenew/Tools/XMLConverter/include/OgreXMLSkeletonSerializer.h @ 657

Revision 657, 3.7 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25
26#ifndef __XMLSkeletonSerializer_H__
27#define __XMLSkeletonSerializer_H__
28
29#include "OgreXMLPrerequisites.h"
30#include "OgreMaterial.h"
31#include "OgreSkeleton.h"
32
33
34namespace Ogre {
35
36    /** Class for serializing a Skeleton to/from XML.
37    @remarks
38        This class behaves the same way as SkeletonSerializer in the main project,
39        but is here to allow conversions to / from XML. This class is
40        deliberately not included in the main project because <UL>
41        <LI>Dependence on Xerces would unnecessarily bloat the main library</LI>
42        <LI>Runtime use of XML is discouraged because of the parsing overhead</LI></UL>
43        This class gives people the option of saving out a Skeleton as XML for examination
44        and possible editing. It can then be converted back to the native format
45        for maximum runtime efficiency.
46    */
47    class XMLSkeletonSerializer
48    {
49    public:
50
51        XMLSkeletonSerializer();
52        virtual ~XMLSkeletonSerializer();
53        /** Imports a Skeleton from the given XML file.
54        @param filename The name of the file to import, expected to be in XML format.
55        @param pSkeleton The pre-created Skeleton object to be populated.
56        */
57        void importSkeleton(const String& filename, Skeleton* pSkeleton);
58
59        /** Exports a skeleton to the named XML file. */
60        void exportSkeleton(const Skeleton* pSkeleton, const String& filename);
61
62    private:
63        // State for export
64        TiXmlDocument* mXMLDoc;
65        // State for import
66        Skeleton* mpSkel;
67
68        void writeSkeleton(const Skeleton* pSkel);
69        void writeBone(TiXmlElement* bonesElement, const Bone* pBone);
70        void writeBoneParent(TiXmlElement* boneHierarchyNode, String boneName , String parentName);
71        void writeAnimation(TiXmlElement* animsNode, const Animation* anim);
72        void writeAnimationTrack(TiXmlElement* tracksNode, const AnimationTrack* track);
73        void writeKeyFrame(TiXmlElement* keysNode, const KeyFrame* key);
74                void writeSkeletonAnimationLink(TiXmlElement* linksNode,
75                        const LinkedSkeletonAnimationSource& link);
76               
77                void readBones(Skeleton* skel, TiXmlElement* mBonesNode);
78                void readBones2(Skeleton* skel, TiXmlElement* mBonesNode);
79                void createHierarchy(Skeleton* skel, TiXmlElement* mHierNode);
80                void readKeyFrames(AnimationTrack* track, TiXmlElement* mKeyfNode);
81                void readAnimations(Skeleton* skel, TiXmlElement* mAnimNode) ;
82                void readSkeletonAnimationLinks(Skeleton* skel, TiXmlElement* linksNode);
83
84    };
85
86
87}
88
89#endif
90
Note: See TracBrowser for help on using the repository browser.