diff options
Diffstat (limited to 'libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h')
-rw-r--r-- | libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h | 456 |
1 files changed, 228 insertions, 228 deletions
diff --git a/libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h b/libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h index 84d25a2..f34161e 100644 --- a/libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h +++ b/libraries/irrlicht-1.8/include/IAnimatedMeshSceneNode.h | |||
@@ -1,228 +1,228 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ | 5 | #ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ |
6 | #define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ | 6 | #define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "ISceneNode.h" | 8 | #include "ISceneNode.h" |
9 | #include "IBoneSceneNode.h" | 9 | #include "IBoneSceneNode.h" |
10 | #include "IAnimatedMeshMD2.h" | 10 | #include "IAnimatedMeshMD2.h" |
11 | #include "IAnimatedMeshMD3.h" | 11 | #include "IAnimatedMeshMD3.h" |
12 | 12 | ||
13 | namespace irr | 13 | namespace irr |
14 | { | 14 | { |
15 | namespace scene | 15 | namespace scene |
16 | { | 16 | { |
17 | class IShadowVolumeSceneNode; | 17 | class IShadowVolumeSceneNode; |
18 | 18 | ||
19 | enum E_JOINT_UPDATE_ON_RENDER | 19 | enum E_JOINT_UPDATE_ON_RENDER |
20 | { | 20 | { |
21 | //! do nothing | 21 | //! do nothing |
22 | EJUOR_NONE = 0, | 22 | EJUOR_NONE = 0, |
23 | 23 | ||
24 | //! get joints positions from the mesh (for attached nodes, etc) | 24 | //! get joints positions from the mesh (for attached nodes, etc) |
25 | EJUOR_READ, | 25 | EJUOR_READ, |
26 | 26 | ||
27 | //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() ) | 27 | //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() ) |
28 | EJUOR_CONTROL | 28 | EJUOR_CONTROL |
29 | }; | 29 | }; |
30 | 30 | ||
31 | 31 | ||
32 | class IAnimatedMeshSceneNode; | 32 | class IAnimatedMeshSceneNode; |
33 | 33 | ||
34 | //! Callback interface for catching events of ended animations. | 34 | //! Callback interface for catching events of ended animations. |
35 | /** Implement this interface and use | 35 | /** Implement this interface and use |
36 | IAnimatedMeshSceneNode::setAnimationEndCallback to be able to | 36 | IAnimatedMeshSceneNode::setAnimationEndCallback to be able to |
37 | be notified if an animation playback has ended. | 37 | be notified if an animation playback has ended. |
38 | **/ | 38 | **/ |
39 | class IAnimationEndCallBack : public virtual IReferenceCounted | 39 | class IAnimationEndCallBack : public virtual IReferenceCounted |
40 | { | 40 | { |
41 | public: | 41 | public: |
42 | 42 | ||
43 | //! Will be called when the animation playback has ended. | 43 | //! Will be called when the animation playback has ended. |
44 | /** See IAnimatedMeshSceneNode::setAnimationEndCallback for | 44 | /** See IAnimatedMeshSceneNode::setAnimationEndCallback for |
45 | more informations. | 45 | more informations. |
46 | \param node: Node of which the animation has ended. */ | 46 | \param node: Node of which the animation has ended. */ |
47 | virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0; | 47 | virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | //! Scene node capable of displaying an animated mesh and its shadow. | 50 | //! Scene node capable of displaying an animated mesh and its shadow. |
51 | /** The shadow is optional: If a shadow should be displayed too, just | 51 | /** The shadow is optional: If a shadow should be displayed too, just |
52 | invoke the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/ | 52 | invoke the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/ |
53 | class IAnimatedMeshSceneNode : public ISceneNode | 53 | class IAnimatedMeshSceneNode : public ISceneNode |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | 56 | ||
57 | //! Constructor | 57 | //! Constructor |
58 | IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, | 58 | IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, |
59 | const core::vector3df& position = core::vector3df(0,0,0), | 59 | const core::vector3df& position = core::vector3df(0,0,0), |
60 | const core::vector3df& rotation = core::vector3df(0,0,0), | 60 | const core::vector3df& rotation = core::vector3df(0,0,0), |
61 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) | 61 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) |
62 | : ISceneNode(parent, mgr, id, position, rotation, scale) {} | 62 | : ISceneNode(parent, mgr, id, position, rotation, scale) {} |
63 | 63 | ||
64 | //! Destructor | 64 | //! Destructor |
65 | virtual ~IAnimatedMeshSceneNode() {} | 65 | virtual ~IAnimatedMeshSceneNode() {} |
66 | 66 | ||
67 | //! Sets the current frame number. | 67 | //! Sets the current frame number. |
68 | /** From now on the animation is played from this frame. | 68 | /** From now on the animation is played from this frame. |
69 | \param frame: Number of the frame to let the animation be started from. | 69 | \param frame: Number of the frame to let the animation be started from. |
70 | The frame number must be a valid frame number of the IMesh used by this | 70 | The frame number must be a valid frame number of the IMesh used by this |
71 | scene node. Set IAnimatedMesh::getMesh() for details. */ | 71 | scene node. Set IAnimatedMesh::getMesh() for details. */ |
72 | virtual void setCurrentFrame(f32 frame) = 0; | 72 | virtual void setCurrentFrame(f32 frame) = 0; |
73 | 73 | ||
74 | //! Sets the frame numbers between the animation is looped. | 74 | //! Sets the frame numbers between the animation is looped. |
75 | /** The default is 0 - MaximalFrameCount of the mesh. | 75 | /** The default is 0 - MaximalFrameCount of the mesh. |
76 | \param begin: Start frame number of the loop. | 76 | \param begin: Start frame number of the loop. |
77 | \param end: End frame number of the loop. | 77 | \param end: End frame number of the loop. |
78 | \return True if successful, false if not. */ | 78 | \return True if successful, false if not. */ |
79 | virtual bool setFrameLoop(s32 begin, s32 end) = 0; | 79 | virtual bool setFrameLoop(s32 begin, s32 end) = 0; |
80 | 80 | ||
81 | //! Sets the speed with which the animation is played. | 81 | //! Sets the speed with which the animation is played. |
82 | /** \param framesPerSecond: Frames per second played. */ | 82 | /** \param framesPerSecond: Frames per second played. */ |
83 | virtual void setAnimationSpeed(f32 framesPerSecond) = 0; | 83 | virtual void setAnimationSpeed(f32 framesPerSecond) = 0; |
84 | 84 | ||
85 | //! Gets the speed with which the animation is played. | 85 | //! Gets the speed with which the animation is played. |
86 | /** \return Frames per second played. */ | 86 | /** \return Frames per second played. */ |
87 | virtual f32 getAnimationSpeed() const =0; | 87 | virtual f32 getAnimationSpeed() const =0; |
88 | 88 | ||
89 | //! Creates shadow volume scene node as child of this node. | 89 | //! Creates shadow volume scene node as child of this node. |
90 | /** The shadow can be rendered using the ZPass or the zfail | 90 | /** The shadow can be rendered using the ZPass or the zfail |
91 | method. ZPass is a little bit faster because the shadow volume | 91 | method. ZPass is a little bit faster because the shadow volume |
92 | creation is easier, but with this method there occur ugly | 92 | creation is easier, but with this method there occur ugly |
93 | looking artifacs when the camera is inside the shadow volume. | 93 | looking artifacs when the camera is inside the shadow volume. |
94 | These error do not occur with the ZFail method. | 94 | These error do not occur with the ZFail method. |
95 | \param shadowMesh: Optional custom mesh for shadow volume. | 95 | \param shadowMesh: Optional custom mesh for shadow volume. |
96 | \param id: Id of the shadow scene node. This id can be used to | 96 | \param id: Id of the shadow scene node. This id can be used to |
97 | identify the node later. | 97 | identify the node later. |
98 | \param zfailmethod: If set to true, the shadow will use the | 98 | \param zfailmethod: If set to true, the shadow will use the |
99 | zfail method, if not, zpass is used. | 99 | zfail method, if not, zpass is used. |
100 | \param infinity: Value used by the shadow volume algorithm to | 100 | \param infinity: Value used by the shadow volume algorithm to |
101 | scale the shadow volume (for zfail shadow volume we support only | 101 | scale the shadow volume (for zfail shadow volume we support only |
102 | finite shadows, so camera zfar must be larger than shadow back cap, | 102 | finite shadows, so camera zfar must be larger than shadow back cap, |
103 | which is depend on infinity parameter). | 103 | which is depend on infinity parameter). |
104 | \return Pointer to the created shadow scene node. This pointer | 104 | \return Pointer to the created shadow scene node. This pointer |
105 | should not be dropped. See IReferenceCounted::drop() for more | 105 | should not be dropped. See IReferenceCounted::drop() for more |
106 | information. */ | 106 | information. */ |
107 | virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0, | 107 | virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0, |
108 | s32 id=-1, bool zfailmethod=true, f32 infinity=1000.0f) = 0; | 108 | s32 id=-1, bool zfailmethod=true, f32 infinity=1000.0f) = 0; |
109 | 109 | ||
110 | 110 | ||
111 | //! Get a pointer to a joint in the mesh (if the mesh is a bone based mesh). | 111 | //! Get a pointer to a joint in the mesh (if the mesh is a bone based mesh). |
112 | /** With this method it is possible to attach scene nodes to | 112 | /** With this method it is possible to attach scene nodes to |
113 | joints for example possible to attach a weapon to the left hand | 113 | joints for example possible to attach a weapon to the left hand |
114 | of an animated model. This example shows how: | 114 | of an animated model. This example shows how: |
115 | \code | 115 | \code |
116 | ISceneNode* hand = | 116 | ISceneNode* hand = |
117 | yourAnimatedMeshSceneNode->getJointNode("LeftHand"); | 117 | yourAnimatedMeshSceneNode->getJointNode("LeftHand"); |
118 | hand->addChild(weaponSceneNode); | 118 | hand->addChild(weaponSceneNode); |
119 | \endcode | 119 | \endcode |
120 | Please note that the joint returned by this method may not exist | 120 | Please note that the joint returned by this method may not exist |
121 | before this call and the joints in the node were created by it. | 121 | before this call and the joints in the node were created by it. |
122 | \param jointName: Name of the joint. | 122 | \param jointName: Name of the joint. |
123 | \return Pointer to the scene node which represents the joint | 123 | \return Pointer to the scene node which represents the joint |
124 | with the specified name. Returns 0 if the contained mesh is not | 124 | with the specified name. Returns 0 if the contained mesh is not |
125 | an skinned mesh or the name of the joint could not be found. */ | 125 | an skinned mesh or the name of the joint could not be found. */ |
126 | virtual IBoneSceneNode* getJointNode(const c8* jointName)=0; | 126 | virtual IBoneSceneNode* getJointNode(const c8* jointName)=0; |
127 | 127 | ||
128 | //! same as getJointNode(const c8* jointName), but based on id | 128 | //! same as getJointNode(const c8* jointName), but based on id |
129 | virtual IBoneSceneNode* getJointNode(u32 jointID) = 0; | 129 | virtual IBoneSceneNode* getJointNode(u32 jointID) = 0; |
130 | 130 | ||
131 | //! Gets joint count. | 131 | //! Gets joint count. |
132 | /** \return Amount of joints in the mesh. */ | 132 | /** \return Amount of joints in the mesh. */ |
133 | virtual u32 getJointCount() const = 0; | 133 | virtual u32 getJointCount() const = 0; |
134 | 134 | ||
135 | //! Starts a default MD2 animation. | 135 | //! Starts a default MD2 animation. |
136 | /** With this method it is easily possible to start a Run, | 136 | /** With this method it is easily possible to start a Run, |
137 | Attack, Die or whatever animation, if the mesh contained in | 137 | Attack, Die or whatever animation, if the mesh contained in |
138 | this scene node is an md2 mesh. Otherwise, nothing happens. | 138 | this scene node is an md2 mesh. Otherwise, nothing happens. |
139 | \param anim: An MD2 animation type, which should be played, for | 139 | \param anim: An MD2 animation type, which should be played, for |
140 | example EMAT_STAND for the standing animation. | 140 | example EMAT_STAND for the standing animation. |
141 | \return True if successful, and false if not, for example if | 141 | \return True if successful, and false if not, for example if |
142 | the mesh in the scene node is not a md2 mesh. */ | 142 | the mesh in the scene node is not a md2 mesh. */ |
143 | virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0; | 143 | virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0; |
144 | 144 | ||
145 | //! Starts a special MD2 animation. | 145 | //! Starts a special MD2 animation. |
146 | /** With this method it is easily possible to start a Run, | 146 | /** With this method it is easily possible to start a Run, |
147 | Attack, Die or whatever animation, if the mesh contained in | 147 | Attack, Die or whatever animation, if the mesh contained in |
148 | this scene node is an md2 mesh. Otherwise, nothing happens. | 148 | this scene node is an md2 mesh. Otherwise, nothing happens. |
149 | This method uses a character string to identify the animation. | 149 | This method uses a character string to identify the animation. |
150 | If the animation is a standard md2 animation, you might want to | 150 | If the animation is a standard md2 animation, you might want to |
151 | start this animation with the EMD2_ANIMATION_TYPE enumeration | 151 | start this animation with the EMD2_ANIMATION_TYPE enumeration |
152 | instead. | 152 | instead. |
153 | \param animationName: Name of the animation which should be | 153 | \param animationName: Name of the animation which should be |
154 | played. | 154 | played. |
155 | \return Returns true if successful, and false if not, for | 155 | \return Returns true if successful, and false if not, for |
156 | example if the mesh in the scene node is not an md2 mesh, or no | 156 | example if the mesh in the scene node is not an md2 mesh, or no |
157 | animation with this name could be found. */ | 157 | animation with this name could be found. */ |
158 | virtual bool setMD2Animation(const c8* animationName) = 0; | 158 | virtual bool setMD2Animation(const c8* animationName) = 0; |
159 | 159 | ||
160 | //! Returns the currently displayed frame number. | 160 | //! Returns the currently displayed frame number. |
161 | virtual f32 getFrameNr() const = 0; | 161 | virtual f32 getFrameNr() const = 0; |
162 | //! Returns the current start frame number. | 162 | //! Returns the current start frame number. |
163 | virtual s32 getStartFrame() const = 0; | 163 | virtual s32 getStartFrame() const = 0; |
164 | //! Returns the current end frame number. | 164 | //! Returns the current end frame number. |
165 | virtual s32 getEndFrame() const = 0; | 165 | virtual s32 getEndFrame() const = 0; |
166 | 166 | ||
167 | //! Sets looping mode which is on by default. | 167 | //! Sets looping mode which is on by default. |
168 | /** If set to false, animations will not be played looped. */ | 168 | /** If set to false, animations will not be played looped. */ |
169 | virtual void setLoopMode(bool playAnimationLooped) = 0; | 169 | virtual void setLoopMode(bool playAnimationLooped) = 0; |
170 | 170 | ||
171 | //! returns the current loop mode | 171 | //! returns the current loop mode |
172 | /** When true the animations are played looped */ | 172 | /** When true the animations are played looped */ |
173 | virtual bool getLoopMode() const = 0; | 173 | virtual bool getLoopMode() const = 0; |
174 | 174 | ||
175 | //! Sets a callback interface which will be called if an animation playback has ended. | 175 | //! Sets a callback interface which will be called if an animation playback has ended. |
176 | /** Set this to 0 to disable the callback again. | 176 | /** Set this to 0 to disable the callback again. |
177 | Please note that this will only be called when in non looped | 177 | Please note that this will only be called when in non looped |
178 | mode, see IAnimatedMeshSceneNode::setLoopMode(). */ | 178 | mode, see IAnimatedMeshSceneNode::setLoopMode(). */ |
179 | virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0; | 179 | virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0; |
180 | 180 | ||
181 | //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. | 181 | //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. |
182 | /** In this way it is possible to change the materials a mesh | 182 | /** In this way it is possible to change the materials a mesh |
183 | causing all mesh scene nodes referencing this mesh to change | 183 | causing all mesh scene nodes referencing this mesh to change |
184 | too. */ | 184 | too. */ |
185 | virtual void setReadOnlyMaterials(bool readonly) = 0; | 185 | virtual void setReadOnlyMaterials(bool readonly) = 0; |
186 | 186 | ||
187 | //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style | 187 | //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style |
188 | virtual bool isReadOnlyMaterials() const = 0; | 188 | virtual bool isReadOnlyMaterials() const = 0; |
189 | 189 | ||
190 | //! Sets a new mesh | 190 | //! Sets a new mesh |
191 | virtual void setMesh(IAnimatedMesh* mesh) = 0; | 191 | virtual void setMesh(IAnimatedMesh* mesh) = 0; |
192 | 192 | ||
193 | //! Returns the current mesh | 193 | //! Returns the current mesh |
194 | virtual IAnimatedMesh* getMesh(void) = 0; | 194 | virtual IAnimatedMesh* getMesh(void) = 0; |
195 | 195 | ||
196 | //! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode | 196 | //! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode |
197 | virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0; | 197 | virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0; |
198 | 198 | ||
199 | //! Set how the joints should be updated on render | 199 | //! Set how the joints should be updated on render |
200 | virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0; | 200 | virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0; |
201 | 201 | ||
202 | //! Sets the transition time in seconds | 202 | //! Sets the transition time in seconds |
203 | /** Note: This needs to enable joints, and setJointmode set to | 203 | /** Note: This needs to enable joints, and setJointmode set to |
204 | EJUOR_CONTROL. You must call animateJoints(), or the mesh will | 204 | EJUOR_CONTROL. You must call animateJoints(), or the mesh will |
205 | not animate. */ | 205 | not animate. */ |
206 | virtual void setTransitionTime(f32 Time) =0; | 206 | virtual void setTransitionTime(f32 Time) =0; |
207 | 207 | ||
208 | //! animates the joints in the mesh based on the current frame. | 208 | //! animates the joints in the mesh based on the current frame. |
209 | /** Also takes in to account transitions. */ | 209 | /** Also takes in to account transitions. */ |
210 | virtual void animateJoints(bool CalculateAbsolutePositions=true) = 0; | 210 | virtual void animateJoints(bool CalculateAbsolutePositions=true) = 0; |
211 | 211 | ||
212 | //! render mesh ignoring its transformation. | 212 | //! render mesh ignoring its transformation. |
213 | /** Culling is unaffected. */ | 213 | /** Culling is unaffected. */ |
214 | virtual void setRenderFromIdentity( bool On )=0; | 214 | virtual void setRenderFromIdentity( bool On )=0; |
215 | 215 | ||
216 | //! Creates a clone of this scene node and its children. | 216 | //! Creates a clone of this scene node and its children. |
217 | /** \param newParent An optional new parent. | 217 | /** \param newParent An optional new parent. |
218 | \param newManager An optional new scene manager. | 218 | \param newManager An optional new scene manager. |
219 | \return The newly created clone of this node. */ | 219 | \return The newly created clone of this node. */ |
220 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) = 0; | 220 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) = 0; |
221 | 221 | ||
222 | }; | 222 | }; |
223 | 223 | ||
224 | } // end namespace scene | 224 | } // end namespace scene |
225 | } // end namespace irr | 225 | } // end namespace irr |
226 | 226 | ||
227 | #endif | 227 | #endif |
228 | 228 | ||