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-2013 Torus Knot Software Ltd |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
10 | of this software and associated documentation files (the "Software"), to deal |
---|
11 | in the Software without restriction, including without limitation the rights |
---|
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
13 | copies of the Software, and to permit persons to whom the Software is |
---|
14 | furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included in |
---|
17 | all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
25 | THE SOFTWARE. |
---|
26 | ----------------------------------------------------------------------------- |
---|
27 | */ |
---|
28 | #ifndef __TagPoint_H_ |
---|
29 | #define __TagPoint_H_ |
---|
30 | |
---|
31 | #include "OgrePrerequisites.h" |
---|
32 | |
---|
33 | #include "OgreBone.h" |
---|
34 | #include "OgreMatrix4.h" |
---|
35 | |
---|
36 | namespace Ogre { |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | /** \addtogroup Core |
---|
41 | * @{ |
---|
42 | */ |
---|
43 | /** \addtogroup Animation |
---|
44 | * @{ |
---|
45 | */ |
---|
46 | /** A tagged point on a skeleton, which can be used to attach entities to on specific |
---|
47 | other entities. |
---|
48 | @remarks |
---|
49 | A Skeleton, like a Mesh, is shared between Entity objects and simply updated as required |
---|
50 | when it comes to rendering. However there are times when you want to attach another object |
---|
51 | to an animated entity, and make sure that attachment follows the parent entity's animation |
---|
52 | (for example, a character holding a gun in his / her hand). This class simply identifies |
---|
53 | attachment points on a skeleton which can be used to attach child objects. |
---|
54 | @par |
---|
55 | The child objects themselves are not physically attached to this class; as it's name suggests |
---|
56 | this class just 'tags' the area. The actual child objects are attached to the Entity using the |
---|
57 | skeleton which has this tag point. Use the Entity::attachMovableObjectToBone method to attach |
---|
58 | the objects, which creates a new TagPoint on demand. |
---|
59 | */ |
---|
60 | class _OgreExport TagPoint : public Bone |
---|
61 | { |
---|
62 | |
---|
63 | public: |
---|
64 | TagPoint(unsigned short handle, Skeleton* creator); |
---|
65 | virtual ~TagPoint(); |
---|
66 | |
---|
67 | Entity *getParentEntity(void) const; |
---|
68 | MovableObject* getChildObject(void) const; |
---|
69 | |
---|
70 | void setParentEntity(Entity *pEntity); |
---|
71 | void setChildObject(MovableObject *pObject); |
---|
72 | |
---|
73 | /** Tells the TagPoint whether it should inherit orientation from it's parent entity. |
---|
74 | @param inherit If true, this TagPoint's orientation will be affected by |
---|
75 | its parent entity's orientation. If false, it will not be affected. |
---|
76 | */ |
---|
77 | void setInheritParentEntityOrientation(bool inherit); |
---|
78 | |
---|
79 | /** Returns true if this TagPoint is affected by orientation applied to the parent entity. |
---|
80 | */ |
---|
81 | bool getInheritParentEntityOrientation(void) const; |
---|
82 | |
---|
83 | /** Tells the TagPoint whether it should inherit scaling factors from it's parent entity. |
---|
84 | @param inherit If true, this TagPoint's scaling factors will be affected by |
---|
85 | its parent entity's scaling factors. If false, it will not be affected. |
---|
86 | */ |
---|
87 | void setInheritParentEntityScale(bool inherit); |
---|
88 | |
---|
89 | /** Returns true if this TagPoint is affected by scaling factors applied to the parent entity. |
---|
90 | */ |
---|
91 | bool getInheritParentEntityScale(void) const; |
---|
92 | |
---|
93 | /** Gets the transform of parent entity. */ |
---|
94 | const Matrix4& getParentEntityTransform(void) const; |
---|
95 | |
---|
96 | /** Gets the transform of this node just for the skeleton (not entity) */ |
---|
97 | const Matrix4& _getFullLocalTransform(void) const; |
---|
98 | |
---|
99 | /** @copydoc Node::needUpdate */ |
---|
100 | void needUpdate(bool forceParentUpdate = false); |
---|
101 | |
---|
102 | /** Overridden from Node in order to include parent Entity transform. */ |
---|
103 | void updateFromParentImpl(void) const; |
---|
104 | /** @copydoc Renderable::getLights */ |
---|
105 | const LightList& getLights(void) const; |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | private: |
---|
110 | Entity *mParentEntity; |
---|
111 | MovableObject *mChildObject; |
---|
112 | mutable Matrix4 mFullLocalTransform; |
---|
113 | bool mInheritParentEntityOrientation; |
---|
114 | bool mInheritParentEntityScale; |
---|
115 | }; |
---|
116 | |
---|
117 | /** @} */ |
---|
118 | /** @} */ |
---|
119 | |
---|
120 | } //namespace |
---|
121 | |
---|
122 | |
---|
123 | #endif//__TagPoint_H_ |
---|