diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h | 454 |
1 files changed, 227 insertions, 227 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h b/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h index 522393d..b207c4a 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshSceneNode.h | |||
@@ -1,227 +1,227 @@ | |||
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 __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ | 5 | #ifndef __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ |
6 | #define __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ | 6 | #define __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IAnimatedMeshSceneNode.h" | 8 | #include "IAnimatedMeshSceneNode.h" |
9 | #include "IAnimatedMesh.h" | 9 | #include "IAnimatedMesh.h" |
10 | 10 | ||
11 | #include "matrix4.h" | 11 | #include "matrix4.h" |
12 | 12 | ||
13 | 13 | ||
14 | namespace irr | 14 | namespace irr |
15 | { | 15 | { |
16 | namespace scene | 16 | namespace scene |
17 | { | 17 | { |
18 | class IDummyTransformationSceneNode; | 18 | class IDummyTransformationSceneNode; |
19 | 19 | ||
20 | class CAnimatedMeshSceneNode : public IAnimatedMeshSceneNode | 20 | class CAnimatedMeshSceneNode : public IAnimatedMeshSceneNode |
21 | { | 21 | { |
22 | public: | 22 | public: |
23 | 23 | ||
24 | //! constructor | 24 | //! constructor |
25 | CAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id, | 25 | CAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id, |
26 | const core::vector3df& position = core::vector3df(0,0,0), | 26 | const core::vector3df& position = core::vector3df(0,0,0), |
27 | const core::vector3df& rotation = core::vector3df(0,0,0), | 27 | const core::vector3df& rotation = core::vector3df(0,0,0), |
28 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 28 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
29 | 29 | ||
30 | //! destructor | 30 | //! destructor |
31 | virtual ~CAnimatedMeshSceneNode(); | 31 | virtual ~CAnimatedMeshSceneNode(); |
32 | 32 | ||
33 | //! sets the current frame. from now on the animation is played from this frame. | 33 | //! sets the current frame. from now on the animation is played from this frame. |
34 | virtual void setCurrentFrame(f32 frame); | 34 | virtual void setCurrentFrame(f32 frame); |
35 | 35 | ||
36 | //! frame | 36 | //! frame |
37 | virtual void OnRegisterSceneNode(); | 37 | virtual void OnRegisterSceneNode(); |
38 | 38 | ||
39 | //! OnAnimate() is called just before rendering the whole scene. | 39 | //! OnAnimate() is called just before rendering the whole scene. |
40 | virtual void OnAnimate(u32 timeMs); | 40 | virtual void OnAnimate(u32 timeMs); |
41 | 41 | ||
42 | //! renders the node. | 42 | //! renders the node. |
43 | virtual void render(); | 43 | virtual void render(); |
44 | 44 | ||
45 | //! returns the axis aligned bounding box of this node | 45 | //! returns the axis aligned bounding box of this node |
46 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | 46 | virtual const core::aabbox3d<f32>& getBoundingBox() const; |
47 | 47 | ||
48 | //! sets the frames between the animation is looped. | 48 | //! sets the frames between the animation is looped. |
49 | //! the default is 0 - MaximalFrameCount of the mesh. | 49 | //! the default is 0 - MaximalFrameCount of the mesh. |
50 | virtual bool setFrameLoop(s32 begin, s32 end); | 50 | virtual bool setFrameLoop(s32 begin, s32 end); |
51 | 51 | ||
52 | //! Sets looping mode which is on by default. If set to false, | 52 | //! Sets looping mode which is on by default. If set to false, |
53 | //! animations will not be looped. | 53 | //! animations will not be looped. |
54 | virtual void setLoopMode(bool playAnimationLooped); | 54 | virtual void setLoopMode(bool playAnimationLooped); |
55 | 55 | ||
56 | //! returns the current loop mode | 56 | //! returns the current loop mode |
57 | virtual bool getLoopMode() const; | 57 | virtual bool getLoopMode() const; |
58 | 58 | ||
59 | //! Sets a callback interface which will be called if an animation | 59 | //! Sets a callback interface which will be called if an animation |
60 | //! playback has ended. Set this to 0 to disable the callback again. | 60 | //! playback has ended. Set this to 0 to disable the callback again. |
61 | virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0); | 61 | virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0); |
62 | 62 | ||
63 | //! sets the speed with which the animation is played | 63 | //! sets the speed with which the animation is played |
64 | virtual void setAnimationSpeed(f32 framesPerSecond); | 64 | virtual void setAnimationSpeed(f32 framesPerSecond); |
65 | 65 | ||
66 | //! gets the speed with which the animation is played | 66 | //! gets the speed with which the animation is played |
67 | virtual f32 getAnimationSpeed() const; | 67 | virtual f32 getAnimationSpeed() const; |
68 | 68 | ||
69 | //! returns the material based on the zero based index i. To get the amount | 69 | //! returns the material based on the zero based index i. To get the amount |
70 | //! of materials used by this scene node, use getMaterialCount(). | 70 | //! of materials used by this scene node, use getMaterialCount(). |
71 | //! This function is needed for inserting the node into the scene hirachy on a | 71 | //! This function is needed for inserting the node into the scene hirachy on a |
72 | //! optimal position for minimizing renderstate changes, but can also be used | 72 | //! optimal position for minimizing renderstate changes, but can also be used |
73 | //! to directly modify the material of a scene node. | 73 | //! to directly modify the material of a scene node. |
74 | virtual video::SMaterial& getMaterial(u32 i); | 74 | virtual video::SMaterial& getMaterial(u32 i); |
75 | 75 | ||
76 | //! returns amount of materials used by this scene node. | 76 | //! returns amount of materials used by this scene node. |
77 | virtual u32 getMaterialCount() const; | 77 | virtual u32 getMaterialCount() const; |
78 | 78 | ||
79 | //! Creates shadow volume scene node as child of this node | 79 | //! Creates shadow volume scene node as child of this node |
80 | //! and returns a pointer to it. | 80 | //! and returns a pointer to it. |
81 | virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh, | 81 | virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh, |
82 | s32 id, bool zfailmethod=true, f32 infinity=1000.0f); | 82 | s32 id, bool zfailmethod=true, f32 infinity=1000.0f); |
83 | 83 | ||
84 | //! Returns a pointer to a child node, which has the same transformation as | 84 | //! Returns a pointer to a child node, which has the same transformation as |
85 | //! the corrsesponding joint, if the mesh in this scene node is a skinned mesh. | 85 | //! the corrsesponding joint, if the mesh in this scene node is a skinned mesh. |
86 | virtual IBoneSceneNode* getJointNode(const c8* jointName); | 86 | virtual IBoneSceneNode* getJointNode(const c8* jointName); |
87 | 87 | ||
88 | //! same as getJointNode(const c8* jointName), but based on id | 88 | //! same as getJointNode(const c8* jointName), but based on id |
89 | virtual IBoneSceneNode* getJointNode(u32 jointID); | 89 | virtual IBoneSceneNode* getJointNode(u32 jointID); |
90 | 90 | ||
91 | //! Gets joint count. | 91 | //! Gets joint count. |
92 | virtual u32 getJointCount() const; | 92 | virtual u32 getJointCount() const; |
93 | 93 | ||
94 | //! Deprecated command, please use getJointNode. | 94 | //! Deprecated command, please use getJointNode. |
95 | virtual ISceneNode* getMS3DJointNode(const c8* jointName); | 95 | virtual ISceneNode* getMS3DJointNode(const c8* jointName); |
96 | 96 | ||
97 | //! Deprecated command, please use getJointNode. | 97 | //! Deprecated command, please use getJointNode. |
98 | virtual ISceneNode* getXJointNode(const c8* jointName); | 98 | virtual ISceneNode* getXJointNode(const c8* jointName); |
99 | 99 | ||
100 | //! Removes a child from this scene node. | 100 | //! Removes a child from this scene node. |
101 | //! Implemented here, to be able to remove the shadow properly, if there is one, | 101 | //! Implemented here, to be able to remove the shadow properly, if there is one, |
102 | //! or to remove attached childs. | 102 | //! or to remove attached childs. |
103 | virtual bool removeChild(ISceneNode* child); | 103 | virtual bool removeChild(ISceneNode* child); |
104 | 104 | ||
105 | //! Starts a MD2 animation. | 105 | //! Starts a MD2 animation. |
106 | virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim); | 106 | virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim); |
107 | 107 | ||
108 | //! Starts a special MD2 animation. | 108 | //! Starts a special MD2 animation. |
109 | virtual bool setMD2Animation(const c8* animationName); | 109 | virtual bool setMD2Animation(const c8* animationName); |
110 | 110 | ||
111 | //! Returns the current displayed frame number. | 111 | //! Returns the current displayed frame number. |
112 | virtual f32 getFrameNr() const; | 112 | virtual f32 getFrameNr() const; |
113 | //! Returns the current start frame number. | 113 | //! Returns the current start frame number. |
114 | virtual s32 getStartFrame() const; | 114 | virtual s32 getStartFrame() const; |
115 | //! Returns the current end frame number. | 115 | //! Returns the current end frame number. |
116 | virtual s32 getEndFrame() const; | 116 | virtual s32 getEndFrame() const; |
117 | 117 | ||
118 | //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. | 118 | //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. |
119 | /* In this way it is possible to change the materials a mesh causing all mesh scene nodes | 119 | /* In this way it is possible to change the materials a mesh causing all mesh scene nodes |
120 | referencing this mesh to change too. */ | 120 | referencing this mesh to change too. */ |
121 | virtual void setReadOnlyMaterials(bool readonly); | 121 | virtual void setReadOnlyMaterials(bool readonly); |
122 | 122 | ||
123 | //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style | 123 | //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style |
124 | virtual bool isReadOnlyMaterials() const; | 124 | virtual bool isReadOnlyMaterials() const; |
125 | 125 | ||
126 | //! Sets a new mesh | 126 | //! Sets a new mesh |
127 | virtual void setMesh(IAnimatedMesh* mesh); | 127 | virtual void setMesh(IAnimatedMesh* mesh); |
128 | 128 | ||
129 | //! Returns the current mesh | 129 | //! Returns the current mesh |
130 | virtual IAnimatedMesh* getMesh(void) { return Mesh; } | 130 | virtual IAnimatedMesh* getMesh(void) { return Mesh; } |
131 | 131 | ||
132 | //! Writes attributes of the scene node. | 132 | //! Writes attributes of the scene node. |
133 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; | 133 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; |
134 | 134 | ||
135 | //! Reads attributes of the scene node. | 135 | //! Reads attributes of the scene node. |
136 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); | 136 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); |
137 | 137 | ||
138 | //! Returns type of the scene node | 138 | //! Returns type of the scene node |
139 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_ANIMATED_MESH; } | 139 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_ANIMATED_MESH; } |
140 | 140 | ||
141 | // returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, | 141 | // returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, |
142 | // or the absolutetransformation if it's a normal scenenode | 142 | // or the absolutetransformation if it's a normal scenenode |
143 | const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname); | 143 | const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname); |
144 | 144 | ||
145 | //! updates the absolute position based on the relative and the parents position | 145 | //! updates the absolute position based on the relative and the parents position |
146 | virtual void updateAbsolutePosition(); | 146 | virtual void updateAbsolutePosition(); |
147 | 147 | ||
148 | 148 | ||
149 | //! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set) | 149 | //! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set) |
150 | virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode); | 150 | virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode); |
151 | 151 | ||
152 | //! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2) | 152 | //! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2) |
153 | //! you must call animateJoints(), or the mesh will not animate | 153 | //! you must call animateJoints(), or the mesh will not animate |
154 | virtual void setTransitionTime(f32 Time); | 154 | virtual void setTransitionTime(f32 Time); |
155 | 155 | ||
156 | //! updates the joint positions of this mesh | 156 | //! updates the joint positions of this mesh |
157 | virtual void animateJoints(bool CalculateAbsolutePositions=true); | 157 | virtual void animateJoints(bool CalculateAbsolutePositions=true); |
158 | 158 | ||
159 | //! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected) | 159 | //! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected) |
160 | virtual void setRenderFromIdentity( bool On ); | 160 | virtual void setRenderFromIdentity( bool On ); |
161 | 161 | ||
162 | //! Creates a clone of this scene node and its children. | 162 | //! Creates a clone of this scene node and its children. |
163 | /** \param newParent An optional new parent. | 163 | /** \param newParent An optional new parent. |
164 | \param newManager An optional new scene manager. | 164 | \param newManager An optional new scene manager. |
165 | \return The newly created clone of this node. */ | 165 | \return The newly created clone of this node. */ |
166 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0); | 166 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0); |
167 | 167 | ||
168 | private: | 168 | private: |
169 | 169 | ||
170 | //! Get a static mesh for the current frame of this animated mesh | 170 | //! Get a static mesh for the current frame of this animated mesh |
171 | IMesh* getMeshForCurrentFrame(); | 171 | IMesh* getMeshForCurrentFrame(); |
172 | 172 | ||
173 | void buildFrameNr(u32 timeMs); | 173 | void buildFrameNr(u32 timeMs); |
174 | void checkJoints(); | 174 | void checkJoints(); |
175 | void beginTransition(); | 175 | void beginTransition(); |
176 | 176 | ||
177 | core::array<video::SMaterial> Materials; | 177 | core::array<video::SMaterial> Materials; |
178 | core::aabbox3d<f32> Box; | 178 | core::aabbox3d<f32> Box; |
179 | IAnimatedMesh* Mesh; | 179 | IAnimatedMesh* Mesh; |
180 | 180 | ||
181 | s32 StartFrame; | 181 | s32 StartFrame; |
182 | s32 EndFrame; | 182 | s32 EndFrame; |
183 | f32 FramesPerSecond; | 183 | f32 FramesPerSecond; |
184 | f32 CurrentFrameNr; | 184 | f32 CurrentFrameNr; |
185 | 185 | ||
186 | u32 LastTimeMs; | 186 | u32 LastTimeMs; |
187 | u32 TransitionTime; //Transition time in millisecs | 187 | u32 TransitionTime; //Transition time in millisecs |
188 | f32 Transiting; //is mesh transiting (plus cache of TransitionTime) | 188 | f32 Transiting; //is mesh transiting (plus cache of TransitionTime) |
189 | f32 TransitingBlend; //0-1, calculated on buildFrameNr | 189 | f32 TransitingBlend; //0-1, calculated on buildFrameNr |
190 | 190 | ||
191 | //0-unused, 1-get joints only, 2-set joints only, 3-move and set | 191 | //0-unused, 1-get joints only, 2-set joints only, 3-move and set |
192 | E_JOINT_UPDATE_ON_RENDER JointMode; | 192 | E_JOINT_UPDATE_ON_RENDER JointMode; |
193 | bool JointsUsed; | 193 | bool JointsUsed; |
194 | 194 | ||
195 | bool Looping; | 195 | bool Looping; |
196 | bool ReadOnlyMaterials; | 196 | bool ReadOnlyMaterials; |
197 | bool RenderFromIdentity; | 197 | bool RenderFromIdentity; |
198 | 198 | ||
199 | IAnimationEndCallBack* LoopCallBack; | 199 | IAnimationEndCallBack* LoopCallBack; |
200 | s32 PassCount; | 200 | s32 PassCount; |
201 | 201 | ||
202 | IShadowVolumeSceneNode* Shadow; | 202 | IShadowVolumeSceneNode* Shadow; |
203 | 203 | ||
204 | core::array<IBoneSceneNode* > JointChildSceneNodes; | 204 | core::array<IBoneSceneNode* > JointChildSceneNodes; |
205 | core::array<core::matrix4> PretransitingSave; | 205 | core::array<core::matrix4> PretransitingSave; |
206 | 206 | ||
207 | // Quake3 Model | 207 | // Quake3 Model |
208 | struct SMD3Special : public virtual IReferenceCounted | 208 | struct SMD3Special : public virtual IReferenceCounted |
209 | { | 209 | { |
210 | core::stringc Tagname; | 210 | core::stringc Tagname; |
211 | SMD3QuaternionTagList AbsoluteTagList; | 211 | SMD3QuaternionTagList AbsoluteTagList; |
212 | 212 | ||
213 | SMD3Special & operator = (const SMD3Special & copyMe) | 213 | SMD3Special & operator = (const SMD3Special & copyMe) |
214 | { | 214 | { |
215 | Tagname = copyMe.Tagname; | 215 | Tagname = copyMe.Tagname; |
216 | AbsoluteTagList = copyMe.AbsoluteTagList; | 216 | AbsoluteTagList = copyMe.AbsoluteTagList; |
217 | return *this; | 217 | return *this; |
218 | } | 218 | } |
219 | }; | 219 | }; |
220 | SMD3Special *MD3Special; | 220 | SMD3Special *MD3Special; |
221 | }; | 221 | }; |
222 | 222 | ||
223 | } // end namespace scene | 223 | } // end namespace scene |
224 | } // end namespace irr | 224 | } // end namespace irr |
225 | 225 | ||
226 | #endif | 226 | #endif |
227 | 227 | ||