source: OGRE/trunk/ogrenew/Tools/XSIExport/include/OgreXSISkeletonExporter.h @ 692

Revision 692, 3.9 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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#ifndef __XSISKELETONEXPORTER_H__
26#define __XSISKELETONEXPORTER_H__
27
28#include "OgrePrerequisites.h"
29#include "OgreVector2.h"
30#include "OgreVector3.h"
31#include "OgreXSIHelper.h"
32#include <xsi_x3dobject.h>
33#include <xsi_string.h>
34#include <xsi_application.h>
35#include <xsi_actionsource.h>
36#include <xsi_mixer.h>
37
38
39namespace Ogre {
40
41        /** Class for performing a skeleton export from XSI.
42        */
43        class XsiSkeletonExporter
44        {
45        public:
46                XsiSkeletonExporter();
47                virtual ~XsiSkeletonExporter();
48
49
50                /** Export a skeleton to the provided filename.
51                @param skeletonFileName The file name to export to
52                @param deformers The list of deformers (bones) found during mesh traversal
53                @param framesPerSecond The number of frames per second
54                @param animList List of animation splits
55                */
56                void exportSkeleton(const String& skeletonFileName,
57                        DeformerMap& deformers, float framesPerSecond,
58                        AnimationList& animList);
59        protected:
60                // XSI Objects
61                XSI::Application mXsiApp;
62                XSI::X3DObject mXsiSceneRoot;
63                std::map<String, int> mXSITrackTypeNames;
64                // Lower-case version of deformer map (XSI seems to be case insensitive and
65                // some animations rely on that!)
66                DeformerMap mLowerCaseDeformerMap;
67                // Actions created as part of IK sampling, will be deleted afterward
68                XSI::CStringArray mIKSampledAnimations;
69
70                /// Build the bone hierarchy from a simple list of bones
71                void buildBoneHierarchy(Skeleton* pSkeleton, DeformerMap& deformers,
72                        AnimationList& animList);
73                /** Link the current bone with it's parent
74                */
75                void linkBoneWithParent(DeformerEntry* deformer,
76                        DeformerMap& deformers, std::list<DeformerEntry*>& deformerList);
77                /** Validate and create a bone, or eliminate the current bone if it
78                        has no animated parameters
79                */
80                void validateAsBone(Skeleton* pSkeleton, DeformerEntry* deformer,
81                        DeformerMap& deformers, std::list<DeformerEntry*>& deformerList,
82                        AnimationList& animList);
83                /// Process an action source
84                void processActionSource(const XSI::ActionSource& source, DeformerMap& deformers);
85                /// Bake animations
86                void createAnimations(Skeleton* pSkel, DeformerMap& deformers,
87                        float framesPerSecond, AnimationList& animList);
88                /// Bake animation tracks by sampling
89                void createAnimationTracksSampled(Animation* pAnim, AnimationEntry& animEntry,
90                        DeformerMap& deformers, float fps);
91
92                void cleanup(void);
93                void copyDeformerMap(DeformerMap& deformers);
94                /// Get deformer from passed in map or lower case version
95                DeformerEntry* getDeformer(const String& name, DeformerMap& deformers);
96                void sampleAllBones(DeformerMap& deformers,
97                        std::vector<NodeAnimationTrack*> deformerTracks, double frame, Real time, float fps);
98                void establishInitialTransforms(DeformerMap& deformers);
99
100        };
101
102
103
104}
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.