Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/XSIExport/include/OgreXSISkeletonExporter.h @ 20

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

=…

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