1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __TagPoint_H_ |
---|
30 | #define __TagPoint_H_ |
---|
31 | |
---|
32 | #include "OgrePrerequisites.h" |
---|
33 | |
---|
34 | #include "OgreBone.h" |
---|
35 | #include "OgreMatrix4.h" |
---|
36 | |
---|
37 | namespace Ogre { |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | /** A tagged point on a skeleton, which can be used to attach entities to on specific |
---|
42 | other entities. |
---|
43 | @remarks |
---|
44 | A Skeleton, like a Mesh, is shared between Entity objects and simply updated as required |
---|
45 | when it comes to rendering. However there are times when you want to attach another object |
---|
46 | to an animated entity, and make sure that attachment follows the parent entity's animation |
---|
47 | (for example, a character holding a gun in his / her hand). This class simply identifies |
---|
48 | attachment points on a skeleton which can be used to attach child objects. |
---|
49 | @par |
---|
50 | The child objects themselves are not physically attached to this class; as it's name suggests |
---|
51 | this class just 'tags' the area. The actual child objects are attached to the Entity using the |
---|
52 | skeleton which has this tag point. Use the Entity::attachMovableObjectToBone method to attach |
---|
53 | the objects, which creates a new TagPoint on demand. |
---|
54 | */ |
---|
55 | class _OgreExport TagPoint : public Bone |
---|
56 | { |
---|
57 | |
---|
58 | public: |
---|
59 | TagPoint(unsigned short handle, Skeleton* creator); |
---|
60 | virtual ~TagPoint(); |
---|
61 | |
---|
62 | Entity *getParentEntity(void) const; |
---|
63 | MovableObject* getChildObject(void) const; |
---|
64 | |
---|
65 | void setParentEntity(Entity *pEntity); |
---|
66 | void setChildObject(MovableObject *pObject); |
---|
67 | |
---|
68 | /** Tells the TagPoint whether it should inherit orientation from it's parent entity. |
---|
69 | @param inherit If true, this TagPoint's orientation will be affected by |
---|
70 | its parent entity's orientation. If false, it will not be affected. |
---|
71 | */ |
---|
72 | void setInheritParentEntityOrientation(bool inherit); |
---|
73 | |
---|
74 | /** Returns true if this TagPoint is affected by orientation applied to the parent entity. |
---|
75 | */ |
---|
76 | bool getInheritParentEntityOrientation(void) const; |
---|
77 | |
---|
78 | /** Tells the TagPoint whether it should inherit scaling factors from it's parent entity. |
---|
79 | @param inherit If true, this TagPoint's scaling factors will be affected by |
---|
80 | its parent entity's scaling factors. If false, it will not be affected. |
---|
81 | */ |
---|
82 | void setInheritParentEntityScale(bool inherit); |
---|
83 | |
---|
84 | /** Returns true if this TagPoint is affected by scaling factors applied to the parent entity. |
---|
85 | */ |
---|
86 | bool getInheritParentEntityScale(void) const; |
---|
87 | |
---|
88 | /** Gets the transform of parent entity. */ |
---|
89 | const Matrix4& getParentEntityTransform(void) const; |
---|
90 | |
---|
91 | /** Gets the transform of this node just for the skeleton (not entity) */ |
---|
92 | const Matrix4& _getFullLocalTransform(void) const; |
---|
93 | |
---|
94 | /** @copydoc Node::needUpdate */ |
---|
95 | void needUpdate(bool forceParentUpdate = false); |
---|
96 | |
---|
97 | /** Overridden from Node in order to include parent Entity transform. */ |
---|
98 | void updateFromParentImpl(void) const; |
---|
99 | /** @copydoc Renderable::getLights */ |
---|
100 | const LightList& getLights(void) const; |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | private: |
---|
105 | Entity *mParentEntity; |
---|
106 | MovableObject *mChildObject; |
---|
107 | mutable Matrix4 mFullLocalTransform; |
---|
108 | bool mInheritParentEntityOrientation; |
---|
109 | bool mInheritParentEntityScale; |
---|
110 | }; |
---|
111 | |
---|
112 | |
---|
113 | } //namespace |
---|
114 | |
---|
115 | |
---|
116 | #endif//__TagPoint_H_ |
---|