Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgrePose.h @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 4.1 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-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
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 __OGRE_POSE_H
30#define __OGRE_POSE_H
31
32#include "OgrePrerequisites.h"
33#include "OgreString.h"
34#include "OgreHardwareVertexBuffer.h"
35#include "OgreVector3.h"
36#include "OgreIteratorWrappers.h"
37
38namespace Ogre {
39
40        /** A pose is a linked set of vertex offsets applying to one set of vertex
41                data.
42        @remarks
43                The target index referred to by the pose has a meaning set by the user
44                of this class; but for example when used by Mesh it refers to either the
45                Mesh shared geometry (0) or a SubMesh dedicated geometry (1+).
46                Pose instances can be referred to by keyframes in VertexAnimationTrack in
47                order to animate based on blending poses together.
48        */
49        class _OgreExport Pose
50        {
51        public:
52                /** Constructor
53                        @param target The target vertexdata index (0 for shared, 1+ for
54                                dedicated at the submesh index + 1)
55                        @param name Optional name
56                */
57                Pose(ushort target, const String& name = StringUtil::BLANK);
58                virtual ~Pose();
59                /// Return the name of the pose (may be blank)
60                const String& getName(void) const { return mName; }
61                /// Return the target geometry index of the pose
62                ushort getTarget(void) const { return mTarget; }
63                /// A collection of vertex offsets based on the vertex index
64                typedef std::map<size_t, Vector3> VertexOffsetMap;
65                /// An iterator over the vertex offsets
66                typedef MapIterator<VertexOffsetMap> VertexOffsetIterator;
67                /// An iterator over the vertex offsets
68                typedef ConstMapIterator<VertexOffsetMap> ConstVertexOffsetIterator;
69
70                /** Adds an offset to a vertex for this pose.
71                @param index The vertex index
72                @param offset The position offset for this pose
73                */
74                void addVertex(size_t index, const Vector3& offset);
75
76                /** Remove a vertex offset. */
77                void removeVertex(size_t index);
78
79                /** Clear all vertex offsets. */
80                void clearVertexOffsets(void);
81
82                /** Gets an iterator over all the vertex offsets. */
83                ConstVertexOffsetIterator getVertexOffsetIterator(void) const;
84                /** Gets an iterator over all the vertex offsets. */
85                VertexOffsetIterator getVertexOffsetIterator(void);
86                /** Gets a const reference to the vertex offsets. */
87                const VertexOffsetMap& getVertexOffsets(void) const { return mVertexOffsetMap; }
88
89                /** Get a hardware vertex buffer version of the vertex offsets. */
90                const HardwareVertexBufferSharedPtr& _getHardwareVertexBuffer(size_t numVertices) const;
91
92                /** Clone this pose and create another one configured exactly the same
93                        way (only really useful for cloning holders of this class).
94                */
95                Pose* clone(void) const;
96        protected:
97                /// Target geometry index
98                ushort mTarget;
99                /// Optional name
100                String mName;
101                /// Primary storage, sparse vertex use
102                VertexOffsetMap mVertexOffsetMap;
103                /// Derived hardware buffer, covers all vertices
104                mutable HardwareVertexBufferSharedPtr mBuffer;
105        };
106        typedef std::vector<Pose*> PoseList;
107
108
109}
110
111#endif
Note: See TracBrowser for help on using the repository browser.