diff options
Diffstat (limited to 'libraries/irrlicht-1.8/include/ISkinnedMesh.h')
-rw-r--r-- | libraries/irrlicht-1.8/include/ISkinnedMesh.h | 438 |
1 files changed, 219 insertions, 219 deletions
diff --git a/libraries/irrlicht-1.8/include/ISkinnedMesh.h b/libraries/irrlicht-1.8/include/ISkinnedMesh.h index 03f5016..5f0f9cb 100644 --- a/libraries/irrlicht-1.8/include/ISkinnedMesh.h +++ b/libraries/irrlicht-1.8/include/ISkinnedMesh.h | |||
@@ -1,219 +1,219 @@ | |||
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_SKINNED_MESH_H_INCLUDED__ | 5 | #ifndef __I_SKINNED_MESH_H_INCLUDED__ |
6 | #define __I_SKINNED_MESH_H_INCLUDED__ | 6 | #define __I_SKINNED_MESH_H_INCLUDED__ |
7 | 7 | ||
8 | #include "irrArray.h" | 8 | #include "irrArray.h" |
9 | #include "IBoneSceneNode.h" | 9 | #include "IBoneSceneNode.h" |
10 | #include "IAnimatedMesh.h" | 10 | #include "IAnimatedMesh.h" |
11 | #include "SSkinMeshBuffer.h" | 11 | #include "SSkinMeshBuffer.h" |
12 | 12 | ||
13 | namespace irr | 13 | namespace irr |
14 | { | 14 | { |
15 | namespace scene | 15 | namespace scene |
16 | { | 16 | { |
17 | 17 | ||
18 | enum E_INTERPOLATION_MODE | 18 | enum E_INTERPOLATION_MODE |
19 | { | 19 | { |
20 | // constant does use the current key-values without interpolation | 20 | // constant does use the current key-values without interpolation |
21 | EIM_CONSTANT = 0, | 21 | EIM_CONSTANT = 0, |
22 | 22 | ||
23 | // linear interpolation | 23 | // linear interpolation |
24 | EIM_LINEAR, | 24 | EIM_LINEAR, |
25 | 25 | ||
26 | //! count of all available interpolation modes | 26 | //! count of all available interpolation modes |
27 | EIM_COUNT | 27 | EIM_COUNT |
28 | }; | 28 | }; |
29 | 29 | ||
30 | 30 | ||
31 | //! Interface for using some special functions of Skinned meshes | 31 | //! Interface for using some special functions of Skinned meshes |
32 | class ISkinnedMesh : public IAnimatedMesh | 32 | class ISkinnedMesh : public IAnimatedMesh |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | 35 | ||
36 | //! Gets joint count. | 36 | //! Gets joint count. |
37 | /** \return Amount of joints in the skeletal animated mesh. */ | 37 | /** \return Amount of joints in the skeletal animated mesh. */ |
38 | virtual u32 getJointCount() const = 0; | 38 | virtual u32 getJointCount() const = 0; |
39 | 39 | ||
40 | //! Gets the name of a joint. | 40 | //! Gets the name of a joint. |
41 | /** \param number: Zero based index of joint. The last joint | 41 | /** \param number: Zero based index of joint. The last joint |
42 | has the number getJointCount()-1; | 42 | has the number getJointCount()-1; |
43 | \return Name of joint and null if an error happened. */ | 43 | \return Name of joint and null if an error happened. */ |
44 | virtual const c8* getJointName(u32 number) const = 0; | 44 | virtual const c8* getJointName(u32 number) const = 0; |
45 | 45 | ||
46 | //! Gets a joint number from its name | 46 | //! Gets a joint number from its name |
47 | /** \param name: Name of the joint. | 47 | /** \param name: Name of the joint. |
48 | \return Number of the joint or -1 if not found. */ | 48 | \return Number of the joint or -1 if not found. */ |
49 | virtual s32 getJointNumber(const c8* name) const = 0; | 49 | virtual s32 getJointNumber(const c8* name) const = 0; |
50 | 50 | ||
51 | //! Use animation from another mesh | 51 | //! Use animation from another mesh |
52 | /** The animation is linked (not copied) based on joint names | 52 | /** The animation is linked (not copied) based on joint names |
53 | so make sure they are unique. | 53 | so make sure they are unique. |
54 | \return True if all joints in this mesh were | 54 | \return True if all joints in this mesh were |
55 | matched up (empty names will not be matched, and it's case | 55 | matched up (empty names will not be matched, and it's case |
56 | sensitive). Unmatched joints will not be animated. */ | 56 | sensitive). Unmatched joints will not be animated. */ |
57 | virtual bool useAnimationFrom(const ISkinnedMesh *mesh) = 0; | 57 | virtual bool useAnimationFrom(const ISkinnedMesh *mesh) = 0; |
58 | 58 | ||
59 | //! Update Normals when Animating | 59 | //! Update Normals when Animating |
60 | /** \param on If false don't animate, which is faster. | 60 | /** \param on If false don't animate, which is faster. |
61 | Else update normals, which allows for proper lighting of | 61 | Else update normals, which allows for proper lighting of |
62 | animated meshes. */ | 62 | animated meshes. */ |
63 | virtual void updateNormalsWhenAnimating(bool on) = 0; | 63 | virtual void updateNormalsWhenAnimating(bool on) = 0; |
64 | 64 | ||
65 | //! Sets Interpolation Mode | 65 | //! Sets Interpolation Mode |
66 | virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0; | 66 | virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0; |
67 | 67 | ||
68 | //! Animates this mesh's joints based on frame input | 68 | //! Animates this mesh's joints based on frame input |
69 | virtual void animateMesh(f32 frame, f32 blend)=0; | 69 | virtual void animateMesh(f32 frame, f32 blend)=0; |
70 | 70 | ||
71 | //! Preforms a software skin on this mesh based of joint positions | 71 | //! Preforms a software skin on this mesh based of joint positions |
72 | virtual void skinMesh() = 0; | 72 | virtual void skinMesh() = 0; |
73 | 73 | ||
74 | //! converts the vertex type of all meshbuffers to tangents. | 74 | //! converts the vertex type of all meshbuffers to tangents. |
75 | /** E.g. used for bump mapping. */ | 75 | /** E.g. used for bump mapping. */ |
76 | virtual void convertMeshToTangents() = 0; | 76 | virtual void convertMeshToTangents() = 0; |
77 | 77 | ||
78 | //! Allows to enable hardware skinning. | 78 | //! Allows to enable hardware skinning. |
79 | /* This feature is not implementated in Irrlicht yet */ | 79 | /* This feature is not implementated in Irrlicht yet */ |
80 | virtual bool setHardwareSkinning(bool on) = 0; | 80 | virtual bool setHardwareSkinning(bool on) = 0; |
81 | 81 | ||
82 | //! A vertex weight | 82 | //! A vertex weight |
83 | struct SWeight | 83 | struct SWeight |
84 | { | 84 | { |
85 | //! Index of the mesh buffer | 85 | //! Index of the mesh buffer |
86 | u16 buffer_id; //I doubt 32bits is needed | 86 | u16 buffer_id; //I doubt 32bits is needed |
87 | 87 | ||
88 | //! Index of the vertex | 88 | //! Index of the vertex |
89 | u32 vertex_id; //Store global ID here | 89 | u32 vertex_id; //Store global ID here |
90 | 90 | ||
91 | //! Weight Strength/Percentage (0-1) | 91 | //! Weight Strength/Percentage (0-1) |
92 | f32 strength; | 92 | f32 strength; |
93 | 93 | ||
94 | private: | 94 | private: |
95 | //! Internal members used by CSkinnedMesh | 95 | //! Internal members used by CSkinnedMesh |
96 | friend class CSkinnedMesh; | 96 | friend class CSkinnedMesh; |
97 | bool *Moved; | 97 | bool *Moved; |
98 | core::vector3df StaticPos; | 98 | core::vector3df StaticPos; |
99 | core::vector3df StaticNormal; | 99 | core::vector3df StaticNormal; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | 102 | ||
103 | //! Animation keyframe which describes a new position | 103 | //! Animation keyframe which describes a new position |
104 | struct SPositionKey | 104 | struct SPositionKey |
105 | { | 105 | { |
106 | f32 frame; | 106 | f32 frame; |
107 | core::vector3df position; | 107 | core::vector3df position; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | //! Animation keyframe which describes a new scale | 110 | //! Animation keyframe which describes a new scale |
111 | struct SScaleKey | 111 | struct SScaleKey |
112 | { | 112 | { |
113 | f32 frame; | 113 | f32 frame; |
114 | core::vector3df scale; | 114 | core::vector3df scale; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | //! Animation keyframe which describes a new rotation | 117 | //! Animation keyframe which describes a new rotation |
118 | struct SRotationKey | 118 | struct SRotationKey |
119 | { | 119 | { |
120 | f32 frame; | 120 | f32 frame; |
121 | core::quaternion rotation; | 121 | core::quaternion rotation; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | //! Joints | 124 | //! Joints |
125 | struct SJoint | 125 | struct SJoint |
126 | { | 126 | { |
127 | SJoint() : UseAnimationFrom(0), GlobalSkinningSpace(false), | 127 | SJoint() : UseAnimationFrom(0), GlobalSkinningSpace(false), |
128 | positionHint(-1),scaleHint(-1),rotationHint(-1) | 128 | positionHint(-1),scaleHint(-1),rotationHint(-1) |
129 | { | 129 | { |
130 | } | 130 | } |
131 | 131 | ||
132 | //! The name of this joint | 132 | //! The name of this joint |
133 | core::stringc Name; | 133 | core::stringc Name; |
134 | 134 | ||
135 | //! Local matrix of this joint | 135 | //! Local matrix of this joint |
136 | core::matrix4 LocalMatrix; | 136 | core::matrix4 LocalMatrix; |
137 | 137 | ||
138 | //! List of child joints | 138 | //! List of child joints |
139 | core::array<SJoint*> Children; | 139 | core::array<SJoint*> Children; |
140 | 140 | ||
141 | //! List of attached meshes | 141 | //! List of attached meshes |
142 | core::array<u32> AttachedMeshes; | 142 | core::array<u32> AttachedMeshes; |
143 | 143 | ||
144 | //! Animation keys causing translation change | 144 | //! Animation keys causing translation change |
145 | core::array<SPositionKey> PositionKeys; | 145 | core::array<SPositionKey> PositionKeys; |
146 | 146 | ||
147 | //! Animation keys causing scale change | 147 | //! Animation keys causing scale change |
148 | core::array<SScaleKey> ScaleKeys; | 148 | core::array<SScaleKey> ScaleKeys; |
149 | 149 | ||
150 | //! Animation keys causing rotation change | 150 | //! Animation keys causing rotation change |
151 | core::array<SRotationKey> RotationKeys; | 151 | core::array<SRotationKey> RotationKeys; |
152 | 152 | ||
153 | //! Skin weights | 153 | //! Skin weights |
154 | core::array<SWeight> Weights; | 154 | core::array<SWeight> Weights; |
155 | 155 | ||
156 | //! Unnecessary for loaders, will be overwritten on finalize | 156 | //! Unnecessary for loaders, will be overwritten on finalize |
157 | core::matrix4 GlobalMatrix; | 157 | core::matrix4 GlobalMatrix; |
158 | core::matrix4 GlobalAnimatedMatrix; | 158 | core::matrix4 GlobalAnimatedMatrix; |
159 | core::matrix4 LocalAnimatedMatrix; | 159 | core::matrix4 LocalAnimatedMatrix; |
160 | core::vector3df Animatedposition; | 160 | core::vector3df Animatedposition; |
161 | core::vector3df Animatedscale; | 161 | core::vector3df Animatedscale; |
162 | core::quaternion Animatedrotation; | 162 | core::quaternion Animatedrotation; |
163 | 163 | ||
164 | core::matrix4 GlobalInversedMatrix; //the x format pre-calculates this | 164 | core::matrix4 GlobalInversedMatrix; //the x format pre-calculates this |
165 | 165 | ||
166 | private: | 166 | private: |
167 | //! Internal members used by CSkinnedMesh | 167 | //! Internal members used by CSkinnedMesh |
168 | friend class CSkinnedMesh; | 168 | friend class CSkinnedMesh; |
169 | 169 | ||
170 | SJoint *UseAnimationFrom; | 170 | SJoint *UseAnimationFrom; |
171 | bool GlobalSkinningSpace; | 171 | bool GlobalSkinningSpace; |
172 | 172 | ||
173 | s32 positionHint; | 173 | s32 positionHint; |
174 | s32 scaleHint; | 174 | s32 scaleHint; |
175 | s32 rotationHint; | 175 | s32 rotationHint; |
176 | }; | 176 | }; |
177 | 177 | ||
178 | 178 | ||
179 | //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_ | 179 | //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_ |
180 | 180 | ||
181 | //these functions will use the needed arrays, set values, etc to help the loaders | 181 | //these functions will use the needed arrays, set values, etc to help the loaders |
182 | 182 | ||
183 | //! exposed for loaders: to add mesh buffers | 183 | //! exposed for loaders: to add mesh buffers |
184 | virtual core::array<SSkinMeshBuffer*>& getMeshBuffers() = 0; | 184 | virtual core::array<SSkinMeshBuffer*>& getMeshBuffers() = 0; |
185 | 185 | ||
186 | //! exposed for loaders: joints list | 186 | //! exposed for loaders: joints list |
187 | virtual core::array<SJoint*>& getAllJoints() = 0; | 187 | virtual core::array<SJoint*>& getAllJoints() = 0; |
188 | 188 | ||
189 | //! exposed for loaders: joints list | 189 | //! exposed for loaders: joints list |
190 | virtual const core::array<SJoint*>& getAllJoints() const = 0; | 190 | virtual const core::array<SJoint*>& getAllJoints() const = 0; |
191 | 191 | ||
192 | //! loaders should call this after populating the mesh | 192 | //! loaders should call this after populating the mesh |
193 | virtual void finalize() = 0; | 193 | virtual void finalize() = 0; |
194 | 194 | ||
195 | //! Adds a new meshbuffer to the mesh, access it as last one | 195 | //! Adds a new meshbuffer to the mesh, access it as last one |
196 | virtual SSkinMeshBuffer* addMeshBuffer() = 0; | 196 | virtual SSkinMeshBuffer* addMeshBuffer() = 0; |
197 | 197 | ||
198 | //! Adds a new joint to the mesh, access it as last one | 198 | //! Adds a new joint to the mesh, access it as last one |
199 | virtual SJoint* addJoint(SJoint *parent=0) = 0; | 199 | virtual SJoint* addJoint(SJoint *parent=0) = 0; |
200 | 200 | ||
201 | //! Adds a new weight to the mesh, access it as last one | 201 | //! Adds a new weight to the mesh, access it as last one |
202 | virtual SWeight* addWeight(SJoint *joint) = 0; | 202 | virtual SWeight* addWeight(SJoint *joint) = 0; |
203 | 203 | ||
204 | //! Adds a new position key to the mesh, access it as last one | 204 | //! Adds a new position key to the mesh, access it as last one |
205 | virtual SPositionKey* addPositionKey(SJoint *joint) = 0; | 205 | virtual SPositionKey* addPositionKey(SJoint *joint) = 0; |
206 | //! Adds a new scale key to the mesh, access it as last one | 206 | //! Adds a new scale key to the mesh, access it as last one |
207 | virtual SScaleKey* addScaleKey(SJoint *joint) = 0; | 207 | virtual SScaleKey* addScaleKey(SJoint *joint) = 0; |
208 | //! Adds a new rotation key to the mesh, access it as last one | 208 | //! Adds a new rotation key to the mesh, access it as last one |
209 | virtual SRotationKey* addRotationKey(SJoint *joint) = 0; | 209 | virtual SRotationKey* addRotationKey(SJoint *joint) = 0; |
210 | 210 | ||
211 | //! Check if the mesh is non-animated | 211 | //! Check if the mesh is non-animated |
212 | virtual bool isStatic()=0; | 212 | virtual bool isStatic()=0; |
213 | }; | 213 | }; |
214 | 214 | ||
215 | } // end namespace scene | 215 | } // end namespace scene |
216 | } // end namespace irr | 216 | } // end namespace irr |
217 | 217 | ||
218 | #endif | 218 | #endif |
219 | 219 | ||