source: GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBone.h @ 1092

Revision 1092, 4.8 KB checked in by gumbau, 18 years ago (diff)

LodStrips? and LODTrees demos

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 __Bone_H__
27#define __Bone_H__
28
29#include "OgrePrerequisites.h"
30#include "OgreNode.h"
31
32
33namespace Ogre
34{
35    /** A bone in a skeleton.
36    @remarks
37        See Skeleton for more information about the principles behind skeletal animation.
38        This class is a node in the joint hierarchy. Mesh vertices also have assignments
39        to bones to define how they move in relation to the skeleton.
40    */
41    class _OgreExport Bone : public Node
42    {
43    public:
44        /** Constructor, not to be used directly (use Bone::createChild or Skeleton::createBone) */
45        Bone(unsigned short handle, Skeleton* creator);
46        /** Constructor, not to be used directly (use Bone::createChild or Skeleton::createBone) */
47        Bone(const String& name, unsigned short handle, Skeleton* creator);
48        ~Bone();
49
50        /** Creates a new Bone as a child of this bone.
51        @remarks
52            This method creates a new bone which will inherit the transforms of this
53            bone, with the handle specified.
54            @param
55                handle The numeric handle to give the new bone; must be unique within the Skeleton.
56            @param
57                translate Initial translation offset of child relative to parent
58            @param
59                rotate Initial rotation relative to parent
60        */
61        Bone* createChild(unsigned short handle,
62            const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
63
64
65        /** Gets the numeric handle for this bone (unique within the skeleton). */
66        unsigned short getHandle(void) const;
67
68        /** Sets the current position / orientation to be the 'binding pose' ie the layout in which
69            bones were originally bound to a mesh.
70        */
71        void setBindingPose(void);
72
73        /** Resets the position and orientation of this Bone to the original binding position.
74        @remarks
75            Bones are bound to the mesh in a binding pose. They are then modified from this
76            position during animation. This method returns the bone to it's original position and
77            orientation.
78        */
79        void reset(void);
80
81        /** Sets whether or not this bone is manually controlled.
82        @remarks
83            Manually controlled bones can be altered by the application at runtime,
84            and their positions will not be reset by the animation routines. Note
85            that you should also make sure that there are no AnimationTrack objects
86            referencing this bone, or if there are, you should disable them using
87            pAnimation->destroyTrack(pBone->getHandle());
88        */
89        void setManuallyControlled(bool manuallyControlled);
90
91        /** Getter for mManuallyControlled Flag */
92        bool isManuallyControlled() const;
93
94       
95        /** Gets the inverse transform which takes bone space to origin from the binding pose.
96        @remarks
97            Internal use only.
98        */
99        const Matrix4& _getBindingPoseInverseTransform(void) const;
100
101
102    protected:
103        /// The numeric handle of this bone
104        unsigned short mHandle;
105
106        /** Bones set as manuallyControlled are not reseted in Skeleton::reset() */
107        bool mManuallyControlled;
108
109        /** See Node. */
110        Node* createChildImpl(void);
111        /** See Node. */
112        Node* createChildImpl(const String& name);
113
114        /// Pointer back to creator, for child creation (not smart ptr so child does not preserve parent)
115        Skeleton* mCreator;
116
117        /// The inversed derived transform of the bone in the binding pose
118        Matrix4 mBindDerivedInverseTransform;
119
120
121
122    };
123
124
125}
126
127#endif
Note: See TracBrowser for help on using the repository browser.