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