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/CSkinnedMesh.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 'libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h | 430 |
1 files changed, 215 insertions, 215 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h b/libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h index cb3665c..adf7725 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CSkinnedMesh.h | |||
@@ -1,215 +1,215 @@ | |||
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 | //New skinned mesh | 5 | //New skinned mesh |
6 | 6 | ||
7 | #ifndef __C_SKINNED_MESH_H_INCLUDED__ | 7 | #ifndef __C_SKINNED_MESH_H_INCLUDED__ |
8 | #define __C_SKINNED_MESH_H_INCLUDED__ | 8 | #define __C_SKINNED_MESH_H_INCLUDED__ |
9 | 9 | ||
10 | #include "ISkinnedMesh.h" | 10 | #include "ISkinnedMesh.h" |
11 | #include "SMeshBuffer.h" | 11 | #include "SMeshBuffer.h" |
12 | #include "S3DVertex.h" | 12 | #include "S3DVertex.h" |
13 | #include "irrString.h" | 13 | #include "irrString.h" |
14 | #include "matrix4.h" | 14 | #include "matrix4.h" |
15 | #include "quaternion.h" | 15 | #include "quaternion.h" |
16 | 16 | ||
17 | namespace irr | 17 | namespace irr |
18 | { | 18 | { |
19 | namespace scene | 19 | namespace scene |
20 | { | 20 | { |
21 | 21 | ||
22 | class IAnimatedMeshSceneNode; | 22 | class IAnimatedMeshSceneNode; |
23 | class IBoneSceneNode; | 23 | class IBoneSceneNode; |
24 | 24 | ||
25 | class CSkinnedMesh: public ISkinnedMesh | 25 | class CSkinnedMesh: public ISkinnedMesh |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | 28 | ||
29 | //! constructor | 29 | //! constructor |
30 | CSkinnedMesh(); | 30 | CSkinnedMesh(); |
31 | 31 | ||
32 | //! destructor | 32 | //! destructor |
33 | virtual ~CSkinnedMesh(); | 33 | virtual ~CSkinnedMesh(); |
34 | 34 | ||
35 | //! returns the amount of frames. If the amount is 1, it is a static (=non animated) mesh. | 35 | //! returns the amount of frames. If the amount is 1, it is a static (=non animated) mesh. |
36 | virtual u32 getFrameCount() const; | 36 | virtual u32 getFrameCount() const; |
37 | 37 | ||
38 | //! Gets the default animation speed of the animated mesh. | 38 | //! Gets the default animation speed of the animated mesh. |
39 | /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ | 39 | /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ |
40 | virtual f32 getAnimationSpeed() const; | 40 | virtual f32 getAnimationSpeed() const; |
41 | 41 | ||
42 | //! Gets the frame count of the animated mesh. | 42 | //! Gets the frame count of the animated mesh. |
43 | /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. | 43 | /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. |
44 | The actual speed is set in the scene node the mesh is instantiated in.*/ | 44 | The actual speed is set in the scene node the mesh is instantiated in.*/ |
45 | virtual void setAnimationSpeed(f32 fps); | 45 | virtual void setAnimationSpeed(f32 fps); |
46 | 46 | ||
47 | //! returns the animated mesh based on a detail level (which is ignored) | 47 | //! returns the animated mesh based on a detail level (which is ignored) |
48 | virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1); | 48 | virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1); |
49 | 49 | ||
50 | //! Animates this mesh's joints based on frame input | 50 | //! Animates this mesh's joints based on frame input |
51 | //! blend: {0-old position, 1-New position} | 51 | //! blend: {0-old position, 1-New position} |
52 | virtual void animateMesh(f32 frame, f32 blend); | 52 | virtual void animateMesh(f32 frame, f32 blend); |
53 | 53 | ||
54 | //! Preforms a software skin on this mesh based of joint positions | 54 | //! Preforms a software skin on this mesh based of joint positions |
55 | virtual void skinMesh(); | 55 | virtual void skinMesh(); |
56 | 56 | ||
57 | //! returns amount of mesh buffers. | 57 | //! returns amount of mesh buffers. |
58 | virtual u32 getMeshBufferCount() const; | 58 | virtual u32 getMeshBufferCount() const; |
59 | 59 | ||
60 | //! returns pointer to a mesh buffer | 60 | //! returns pointer to a mesh buffer |
61 | virtual IMeshBuffer* getMeshBuffer(u32 nr) const; | 61 | virtual IMeshBuffer* getMeshBuffer(u32 nr) const; |
62 | 62 | ||
63 | //! Returns pointer to a mesh buffer which fits a material | 63 | //! Returns pointer to a mesh buffer which fits a material |
64 | /** \param material: material to search for | 64 | /** \param material: material to search for |
65 | \return Returns the pointer to the mesh buffer or | 65 | \return Returns the pointer to the mesh buffer or |
66 | NULL if there is no such mesh buffer. */ | 66 | NULL if there is no such mesh buffer. */ |
67 | virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const; | 67 | virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const; |
68 | 68 | ||
69 | //! returns an axis aligned bounding box | 69 | //! returns an axis aligned bounding box |
70 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | 70 | virtual const core::aabbox3d<f32>& getBoundingBox() const; |
71 | 71 | ||
72 | //! set user axis aligned bounding box | 72 | //! set user axis aligned bounding box |
73 | virtual void setBoundingBox( const core::aabbox3df& box); | 73 | virtual void setBoundingBox( const core::aabbox3df& box); |
74 | 74 | ||
75 | //! sets a flag of all contained materials to a new value | 75 | //! sets a flag of all contained materials to a new value |
76 | virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); | 76 | virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); |
77 | 77 | ||
78 | //! set the hardware mapping hint, for driver | 78 | //! set the hardware mapping hint, for driver |
79 | virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); | 79 | virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); |
80 | 80 | ||
81 | //! flags the meshbuffer as changed, reloads hardware buffers | 81 | //! flags the meshbuffer as changed, reloads hardware buffers |
82 | virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); | 82 | virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); |
83 | 83 | ||
84 | //! Returns the type of the animated mesh. | 84 | //! Returns the type of the animated mesh. |
85 | virtual E_ANIMATED_MESH_TYPE getMeshType() const; | 85 | virtual E_ANIMATED_MESH_TYPE getMeshType() const; |
86 | 86 | ||
87 | //! Gets joint count. | 87 | //! Gets joint count. |
88 | virtual u32 getJointCount() const; | 88 | virtual u32 getJointCount() const; |
89 | 89 | ||
90 | //! Gets the name of a joint. | 90 | //! Gets the name of a joint. |
91 | virtual const c8* getJointName(u32 number) const; | 91 | virtual const c8* getJointName(u32 number) const; |
92 | 92 | ||
93 | //! Gets a joint number from its name | 93 | //! Gets a joint number from its name |
94 | virtual s32 getJointNumber(const c8* name) const; | 94 | virtual s32 getJointNumber(const c8* name) const; |
95 | 95 | ||
96 | //! uses animation from another mesh | 96 | //! uses animation from another mesh |
97 | virtual bool useAnimationFrom(const ISkinnedMesh *mesh); | 97 | virtual bool useAnimationFrom(const ISkinnedMesh *mesh); |
98 | 98 | ||
99 | //! Update Normals when Animating | 99 | //! Update Normals when Animating |
100 | //! False= Don't (default) | 100 | //! False= Don't (default) |
101 | //! True = Update normals, slower | 101 | //! True = Update normals, slower |
102 | virtual void updateNormalsWhenAnimating(bool on); | 102 | virtual void updateNormalsWhenAnimating(bool on); |
103 | 103 | ||
104 | //! Sets Interpolation Mode | 104 | //! Sets Interpolation Mode |
105 | virtual void setInterpolationMode(E_INTERPOLATION_MODE mode); | 105 | virtual void setInterpolationMode(E_INTERPOLATION_MODE mode); |
106 | 106 | ||
107 | //! Convertes the mesh to contain tangent information | 107 | //! Convertes the mesh to contain tangent information |
108 | virtual void convertMeshToTangents(); | 108 | virtual void convertMeshToTangents(); |
109 | 109 | ||
110 | //! Does the mesh have no animation | 110 | //! Does the mesh have no animation |
111 | virtual bool isStatic(); | 111 | virtual bool isStatic(); |
112 | 112 | ||
113 | //! (This feature is not implemented in irrlicht yet) | 113 | //! (This feature is not implemented in irrlicht yet) |
114 | virtual bool setHardwareSkinning(bool on); | 114 | virtual bool setHardwareSkinning(bool on); |
115 | 115 | ||
116 | //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_ | 116 | //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_ |
117 | //these functions will use the needed arrays, set values, etc to help the loaders | 117 | //these functions will use the needed arrays, set values, etc to help the loaders |
118 | 118 | ||
119 | //! exposed for loaders to add mesh buffers | 119 | //! exposed for loaders to add mesh buffers |
120 | virtual core::array<SSkinMeshBuffer*> &getMeshBuffers(); | 120 | virtual core::array<SSkinMeshBuffer*> &getMeshBuffers(); |
121 | 121 | ||
122 | //! alternative method for adding joints | 122 | //! alternative method for adding joints |
123 | virtual core::array<SJoint*> &getAllJoints(); | 123 | virtual core::array<SJoint*> &getAllJoints(); |
124 | 124 | ||
125 | //! alternative method for adding joints | 125 | //! alternative method for adding joints |
126 | virtual const core::array<SJoint*> &getAllJoints() const; | 126 | virtual const core::array<SJoint*> &getAllJoints() const; |
127 | 127 | ||
128 | //! loaders should call this after populating the mesh | 128 | //! loaders should call this after populating the mesh |
129 | virtual void finalize(); | 129 | virtual void finalize(); |
130 | 130 | ||
131 | //! Adds a new meshbuffer to the mesh, access it as last one | 131 | //! Adds a new meshbuffer to the mesh, access it as last one |
132 | virtual SSkinMeshBuffer *addMeshBuffer(); | 132 | virtual SSkinMeshBuffer *addMeshBuffer(); |
133 | 133 | ||
134 | //! Adds a new joint to the mesh, access it as last one | 134 | //! Adds a new joint to the mesh, access it as last one |
135 | virtual SJoint *addJoint(SJoint *parent=0); | 135 | virtual SJoint *addJoint(SJoint *parent=0); |
136 | 136 | ||
137 | //! Adds a new position key to the mesh, access it as last one | 137 | //! Adds a new position key to the mesh, access it as last one |
138 | virtual SPositionKey *addPositionKey(SJoint *joint); | 138 | virtual SPositionKey *addPositionKey(SJoint *joint); |
139 | //! Adds a new rotation key to the mesh, access it as last one | 139 | //! Adds a new rotation key to the mesh, access it as last one |
140 | virtual SRotationKey *addRotationKey(SJoint *joint); | 140 | virtual SRotationKey *addRotationKey(SJoint *joint); |
141 | //! Adds a new scale key to the mesh, access it as last one | 141 | //! Adds a new scale key to the mesh, access it as last one |
142 | virtual SScaleKey *addScaleKey(SJoint *joint); | 142 | virtual SScaleKey *addScaleKey(SJoint *joint); |
143 | 143 | ||
144 | //! Adds a new weight to the mesh, access it as last one | 144 | //! Adds a new weight to the mesh, access it as last one |
145 | virtual SWeight *addWeight(SJoint *joint); | 145 | virtual SWeight *addWeight(SJoint *joint); |
146 | 146 | ||
147 | virtual void updateBoundingBox(void); | 147 | virtual void updateBoundingBox(void); |
148 | 148 | ||
149 | //! Recovers the joints from the mesh | 149 | //! Recovers the joints from the mesh |
150 | void recoverJointsFromMesh(core::array<IBoneSceneNode*> &jointChildSceneNodes); | 150 | void recoverJointsFromMesh(core::array<IBoneSceneNode*> &jointChildSceneNodes); |
151 | 151 | ||
152 | //! Tranfers the joint data to the mesh | 152 | //! Tranfers the joint data to the mesh |
153 | void transferJointsToMesh(const core::array<IBoneSceneNode*> &jointChildSceneNodes); | 153 | void transferJointsToMesh(const core::array<IBoneSceneNode*> &jointChildSceneNodes); |
154 | 154 | ||
155 | //! Tranfers the joint hints to the mesh | 155 | //! Tranfers the joint hints to the mesh |
156 | void transferOnlyJointsHintsToMesh(const core::array<IBoneSceneNode*> &jointChildSceneNodes); | 156 | void transferOnlyJointsHintsToMesh(const core::array<IBoneSceneNode*> &jointChildSceneNodes); |
157 | 157 | ||
158 | //! Creates an array of joints from this mesh as children of node | 158 | //! Creates an array of joints from this mesh as children of node |
159 | void addJoints(core::array<IBoneSceneNode*> &jointChildSceneNodes, | 159 | void addJoints(core::array<IBoneSceneNode*> &jointChildSceneNodes, |
160 | IAnimatedMeshSceneNode* node, | 160 | IAnimatedMeshSceneNode* node, |
161 | ISceneManager* smgr); | 161 | ISceneManager* smgr); |
162 | 162 | ||
163 | private: | 163 | private: |
164 | void checkForAnimation(); | 164 | void checkForAnimation(); |
165 | 165 | ||
166 | void normalizeWeights(); | 166 | void normalizeWeights(); |
167 | 167 | ||
168 | void buildAllLocalAnimatedMatrices(); | 168 | void buildAllLocalAnimatedMatrices(); |
169 | 169 | ||
170 | void buildAllGlobalAnimatedMatrices(SJoint *Joint=0, SJoint *ParentJoint=0); | 170 | void buildAllGlobalAnimatedMatrices(SJoint *Joint=0, SJoint *ParentJoint=0); |
171 | 171 | ||
172 | void getFrameData(f32 frame, SJoint *Node, | 172 | void getFrameData(f32 frame, SJoint *Node, |
173 | core::vector3df &position, s32 &positionHint, | 173 | core::vector3df &position, s32 &positionHint, |
174 | core::vector3df &scale, s32 &scaleHint, | 174 | core::vector3df &scale, s32 &scaleHint, |
175 | core::quaternion &rotation, s32 &rotationHint); | 175 | core::quaternion &rotation, s32 &rotationHint); |
176 | 176 | ||
177 | void calculateGlobalMatrices(SJoint *Joint,SJoint *ParentJoint); | 177 | void calculateGlobalMatrices(SJoint *Joint,SJoint *ParentJoint); |
178 | 178 | ||
179 | void skinJoint(SJoint *Joint, SJoint *ParentJoint); | 179 | void skinJoint(SJoint *Joint, SJoint *ParentJoint); |
180 | 180 | ||
181 | void calculateTangents(core::vector3df& normal, | 181 | void calculateTangents(core::vector3df& normal, |
182 | core::vector3df& tangent, core::vector3df& binormal, | 182 | core::vector3df& tangent, core::vector3df& binormal, |
183 | core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3, | 183 | core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3, |
184 | core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3); | 184 | core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3); |
185 | 185 | ||
186 | core::array<SSkinMeshBuffer*> *SkinningBuffers; //Meshbuffer to skin, default is to skin localBuffers | 186 | core::array<SSkinMeshBuffer*> *SkinningBuffers; //Meshbuffer to skin, default is to skin localBuffers |
187 | 187 | ||
188 | core::array<SSkinMeshBuffer*> LocalBuffers; | 188 | core::array<SSkinMeshBuffer*> LocalBuffers; |
189 | 189 | ||
190 | core::array<SJoint*> AllJoints; | 190 | core::array<SJoint*> AllJoints; |
191 | core::array<SJoint*> RootJoints; | 191 | core::array<SJoint*> RootJoints; |
192 | 192 | ||
193 | core::array< core::array<bool> > Vertices_Moved; | 193 | core::array< core::array<bool> > Vertices_Moved; |
194 | 194 | ||
195 | core::aabbox3d<f32> BoundingBox; | 195 | core::aabbox3d<f32> BoundingBox; |
196 | 196 | ||
197 | f32 AnimationFrames; | 197 | f32 AnimationFrames; |
198 | f32 FramesPerSecond; | 198 | f32 FramesPerSecond; |
199 | 199 | ||
200 | f32 LastAnimatedFrame; | 200 | f32 LastAnimatedFrame; |
201 | bool SkinnedLastFrame; | 201 | bool SkinnedLastFrame; |
202 | 202 | ||
203 | E_INTERPOLATION_MODE InterpolationMode:8; | 203 | E_INTERPOLATION_MODE InterpolationMode:8; |
204 | 204 | ||
205 | bool HasAnimation; | 205 | bool HasAnimation; |
206 | bool PreparedForSkinning; | 206 | bool PreparedForSkinning; |
207 | bool AnimateNormals; | 207 | bool AnimateNormals; |
208 | bool HardwareSkinning; | 208 | bool HardwareSkinning; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | } // end namespace scene | 211 | } // end namespace scene |
212 | } // end namespace irr | 212 | } // end namespace irr |
213 | 213 | ||
214 | #endif | 214 | #endif |
215 | 215 | ||