aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-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/include/IAnimatedMeshMD3.h608
1 files changed, 304 insertions, 304 deletions
diff --git a/libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h b/libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h
index 35c1c97..93b24c1 100644
--- a/libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h
+++ b/libraries/irrlicht-1.8/include/IAnimatedMeshMD3.h
@@ -1,304 +1,304 @@
1// Copyright (C) 2007-2012 Nikolaus Gebhardt / Thomas Alten 1// Copyright (C) 2007-2012 Nikolaus Gebhardt / Thomas Alten
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_MD3_H_INCLUDED__ 5#ifndef __I_ANIMATED_MESH_MD3_H_INCLUDED__
6#define __I_ANIMATED_MESH_MD3_H_INCLUDED__ 6#define __I_ANIMATED_MESH_MD3_H_INCLUDED__
7 7
8#include "IAnimatedMesh.h" 8#include "IAnimatedMesh.h"
9#include "IQ3Shader.h" 9#include "IQ3Shader.h"
10#include "quaternion.h" 10#include "quaternion.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14namespace scene 14namespace scene
15{ 15{
16 16
17 enum eMD3Models 17 enum eMD3Models
18 { 18 {
19 EMD3_HEAD = 0, 19 EMD3_HEAD = 0,
20 EMD3_UPPER, 20 EMD3_UPPER,
21 EMD3_LOWER, 21 EMD3_LOWER,
22 EMD3_WEAPON, 22 EMD3_WEAPON,
23 EMD3_NUMMODELS 23 EMD3_NUMMODELS
24 }; 24 };
25 25
26 //! Animation list 26 //! Animation list
27 enum EMD3_ANIMATION_TYPE 27 enum EMD3_ANIMATION_TYPE
28 { 28 {
29 // Animations for both lower and upper parts of the player 29 // Animations for both lower and upper parts of the player
30 EMD3_BOTH_DEATH_1 = 0, 30 EMD3_BOTH_DEATH_1 = 0,
31 EMD3_BOTH_DEAD_1, 31 EMD3_BOTH_DEAD_1,
32 EMD3_BOTH_DEATH_2, 32 EMD3_BOTH_DEATH_2,
33 EMD3_BOTH_DEAD_2, 33 EMD3_BOTH_DEAD_2,
34 EMD3_BOTH_DEATH_3, 34 EMD3_BOTH_DEATH_3,
35 EMD3_BOTH_DEAD_3, 35 EMD3_BOTH_DEAD_3,
36 36
37 // Animations for the upper part 37 // Animations for the upper part
38 EMD3_TORSO_GESTURE, 38 EMD3_TORSO_GESTURE,
39 EMD3_TORSO_ATTACK_1, 39 EMD3_TORSO_ATTACK_1,
40 EMD3_TORSO_ATTACK_2, 40 EMD3_TORSO_ATTACK_2,
41 EMD3_TORSO_DROP, 41 EMD3_TORSO_DROP,
42 EMD3_TORSO_RAISE, 42 EMD3_TORSO_RAISE,
43 EMD3_TORSO_STAND_1, 43 EMD3_TORSO_STAND_1,
44 EMD3_TORSO_STAND_2, 44 EMD3_TORSO_STAND_2,
45 45
46 // Animations for the lower part 46 // Animations for the lower part
47 EMD3_LEGS_WALK_CROUCH, 47 EMD3_LEGS_WALK_CROUCH,
48 EMD3_LEGS_WALK, 48 EMD3_LEGS_WALK,
49 EMD3_LEGS_RUN, 49 EMD3_LEGS_RUN,
50 EMD3_LEGS_BACK, 50 EMD3_LEGS_BACK,
51 EMD3_LEGS_SWIM, 51 EMD3_LEGS_SWIM,
52 EMD3_LEGS_JUMP_1, 52 EMD3_LEGS_JUMP_1,
53 EMD3_LEGS_LAND_1, 53 EMD3_LEGS_LAND_1,
54 EMD3_LEGS_JUMP_2, 54 EMD3_LEGS_JUMP_2,
55 EMD3_LEGS_LAND_2, 55 EMD3_LEGS_LAND_2,
56 EMD3_LEGS_IDLE, 56 EMD3_LEGS_IDLE,
57 EMD3_LEGS_IDLE_CROUCH, 57 EMD3_LEGS_IDLE_CROUCH,
58 EMD3_LEGS_TURN, 58 EMD3_LEGS_TURN,
59 59
60 //! Not an animation, but amount of animation types. 60 //! Not an animation, but amount of animation types.
61 EMD3_ANIMATION_COUNT 61 EMD3_ANIMATION_COUNT
62 }; 62 };
63 63
64 struct SMD3AnimationInfo 64 struct SMD3AnimationInfo
65 { 65 {
66 //! First frame 66 //! First frame
67 s32 first; 67 s32 first;
68 //! Last frame 68 //! Last frame
69 s32 num; 69 s32 num;
70 //! Looping frames 70 //! Looping frames
71 s32 looping; 71 s32 looping;
72 //! Frames per second 72 //! Frames per second
73 s32 fps; 73 s32 fps;
74 }; 74 };
75 75
76 76
77// byte-align structures 77// byte-align structures
78#include "irrpack.h" 78#include "irrpack.h"
79 79
80 //! this holds the header info of the MD3 file 80 //! this holds the header info of the MD3 file
81 struct SMD3Header 81 struct SMD3Header
82 { 82 {
83 c8 headerID[4]; //id of file, always "IDP3" 83 c8 headerID[4]; //id of file, always "IDP3"
84 s32 Version; //this is a version number, always 15 84 s32 Version; //this is a version number, always 15
85 s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars 85 s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
86 s32 numFrames; //number of KeyFrames 86 s32 numFrames; //number of KeyFrames
87 s32 numTags; //number of 'tags' per frame 87 s32 numTags; //number of 'tags' per frame
88 s32 numMeshes; //number of meshes/skins 88 s32 numMeshes; //number of meshes/skins
89 s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2 89 s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2
90 s32 frameStart; //starting position of frame-structur 90 s32 frameStart; //starting position of frame-structur
91 s32 tagStart; //starting position of tag-structures 91 s32 tagStart; //starting position of tag-structures
92 s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures 92 s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
93 s32 fileSize; 93 s32 fileSize;
94 } PACK_STRUCT; 94 } PACK_STRUCT;
95 95
96 //! this holds the header info of an MD3 mesh section 96 //! this holds the header info of an MD3 mesh section
97 struct SMD3MeshHeader 97 struct SMD3MeshHeader
98 { 98 {
99 c8 meshID[4]; //id, must be IDP3 99 c8 meshID[4]; //id, must be IDP3
100 c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars 100 c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
101 101
102 s32 numFrames; //number of meshframes in mesh 102 s32 numFrames; //number of meshframes in mesh
103 s32 numShader; //number of skins in mesh 103 s32 numShader; //number of skins in mesh
104 s32 numVertices; //number of vertices 104 s32 numVertices; //number of vertices
105 s32 numTriangles; //number of Triangles 105 s32 numTriangles; //number of Triangles
106 106
107 s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header 107 s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
108 s32 offset_shaders; //size of header 108 s32 offset_shaders; //size of header
109 s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header 109 s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header
110 s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header 110 s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header
111 s32 offset_end; 111 s32 offset_end;
112 } PACK_STRUCT; 112 } PACK_STRUCT;
113 113
114 114
115 //! Compressed Vertex Data 115 //! Compressed Vertex Data
116 struct SMD3Vertex 116 struct SMD3Vertex
117 { 117 {
118 s16 position[3]; 118 s16 position[3];
119 u8 normal[2]; 119 u8 normal[2];
120 } PACK_STRUCT; 120 } PACK_STRUCT;
121 121
122 //! Texture Coordinate 122 //! Texture Coordinate
123 struct SMD3TexCoord 123 struct SMD3TexCoord
124 { 124 {
125 f32 u; 125 f32 u;
126 f32 v; 126 f32 v;
127 } PACK_STRUCT; 127 } PACK_STRUCT;
128 128
129 //! Triangle Index 129 //! Triangle Index
130 struct SMD3Face 130 struct SMD3Face
131 { 131 {
132 s32 Index[3]; 132 s32 Index[3];
133 } PACK_STRUCT; 133 } PACK_STRUCT;
134 134
135 135
136// Default alignment 136// Default alignment
137#include "irrunpack.h" 137#include "irrunpack.h"
138 138
139 //! Holding Frame Data for a Mesh 139 //! Holding Frame Data for a Mesh
140 struct SMD3MeshBuffer : public IReferenceCounted 140 struct SMD3MeshBuffer : public IReferenceCounted
141 { 141 {
142 SMD3MeshHeader MeshHeader; 142 SMD3MeshHeader MeshHeader;
143 143
144 core::stringc Shader; 144 core::stringc Shader;
145 core::array < s32 > Indices; 145 core::array < s32 > Indices;
146 core::array < SMD3Vertex > Vertices; 146 core::array < SMD3Vertex > Vertices;
147 core::array < SMD3TexCoord > Tex; 147 core::array < SMD3TexCoord > Tex;
148 }; 148 };
149 149
150 //! hold a tag info for connecting meshes 150 //! hold a tag info for connecting meshes
151 /** Basically its an alternate way to describe a transformation. */ 151 /** Basically its an alternate way to describe a transformation. */
152 struct SMD3QuaternionTag 152 struct SMD3QuaternionTag
153 { 153 {
154 virtual ~SMD3QuaternionTag() 154 virtual ~SMD3QuaternionTag()
155 { 155 {
156 position.X = 0.f; 156 position.X = 0.f;
157 } 157 }
158 158
159 // construct copy constructor 159 // construct copy constructor
160 SMD3QuaternionTag( const SMD3QuaternionTag & copyMe ) 160 SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
161 { 161 {
162 *this = copyMe; 162 *this = copyMe;
163 } 163 }
164 164
165 // construct for searching 165 // construct for searching
166 SMD3QuaternionTag( const core::stringc& name ) 166 SMD3QuaternionTag( const core::stringc& name )
167 : Name ( name ) {} 167 : Name ( name ) {}
168 168
169 // construct from a position and euler angles in degrees 169 // construct from a position and euler angles in degrees
170 SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle ) 170 SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle )
171 : position(pos), rotation(angle * core::DEGTORAD) {} 171 : position(pos), rotation(angle * core::DEGTORAD) {}
172 172
173 // set to matrix 173 // set to matrix
174 void setto ( core::matrix4 &m ) 174 void setto ( core::matrix4 &m )
175 { 175 {
176 rotation.getMatrix ( m, position ); 176 rotation.getMatrix ( m, position );
177 } 177 }
178 178
179 bool operator == ( const SMD3QuaternionTag &other ) const 179 bool operator == ( const SMD3QuaternionTag &other ) const
180 { 180 {
181 return Name == other.Name; 181 return Name == other.Name;
182 } 182 }
183 183
184 SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe ) 184 SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
185 { 185 {
186 Name = copyMe.Name; 186 Name = copyMe.Name;
187 position = copyMe.position; 187 position = copyMe.position;
188 rotation = copyMe.rotation; 188 rotation = copyMe.rotation;
189 return *this; 189 return *this;
190 } 190 }
191 191
192 core::stringc Name; 192 core::stringc Name;
193 core::vector3df position; 193 core::vector3df position;
194 core::quaternion rotation; 194 core::quaternion rotation;
195 }; 195 };
196 196
197 //! holds a associative list of named quaternions 197 //! holds a associative list of named quaternions
198 struct SMD3QuaternionTagList 198 struct SMD3QuaternionTagList
199 { 199 {
200 SMD3QuaternionTagList() 200 SMD3QuaternionTagList()
201 { 201 {
202 Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); 202 Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
203 } 203 }
204 204
205 // construct copy constructor 205 // construct copy constructor
206 SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe) 206 SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
207 { 207 {
208 *this = copyMe; 208 *this = copyMe;
209 } 209 }
210 210
211 virtual ~SMD3QuaternionTagList() {} 211 virtual ~SMD3QuaternionTagList() {}
212 212
213 SMD3QuaternionTag* get(const core::stringc& name) 213 SMD3QuaternionTag* get(const core::stringc& name)
214 { 214 {
215 SMD3QuaternionTag search ( name ); 215 SMD3QuaternionTag search ( name );
216 s32 index = Container.linear_search ( search ); 216 s32 index = Container.linear_search ( search );
217 if ( index >= 0 ) 217 if ( index >= 0 )
218 return &Container[index]; 218 return &Container[index];
219 return 0; 219 return 0;
220 } 220 }
221 221
222 u32 size () const 222 u32 size () const
223 { 223 {
224 return Container.size(); 224 return Container.size();
225 } 225 }
226 226
227 void set_used(u32 new_size) 227 void set_used(u32 new_size)
228 { 228 {
229 s32 diff = (s32) new_size - (s32) Container.allocated_size(); 229 s32 diff = (s32) new_size - (s32) Container.allocated_size();
230 if ( diff > 0 ) 230 if ( diff > 0 )
231 { 231 {
232 SMD3QuaternionTag e(""); 232 SMD3QuaternionTag e("");
233 for ( s32 i = 0; i < diff; ++i ) 233 for ( s32 i = 0; i < diff; ++i )
234 Container.push_back(e); 234 Container.push_back(e);
235 } 235 }
236 } 236 }
237 237
238 const SMD3QuaternionTag& operator[](u32 index) const 238 const SMD3QuaternionTag& operator[](u32 index) const
239 { 239 {
240 return Container[index]; 240 return Container[index];
241 } 241 }
242 242
243 SMD3QuaternionTag& operator[](u32 index) 243 SMD3QuaternionTag& operator[](u32 index)
244 { 244 {
245 return Container[index]; 245 return Container[index];
246 } 246 }
247 247
248 void push_back(const SMD3QuaternionTag& other) 248 void push_back(const SMD3QuaternionTag& other)
249 { 249 {
250 Container.push_back(other); 250 Container.push_back(other);
251 } 251 }
252 252
253 SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe) 253 SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
254 { 254 {
255 Container = copyMe.Container; 255 Container = copyMe.Container;
256 return *this; 256 return *this;
257 } 257 }
258 258
259 private: 259 private:
260 core::array < SMD3QuaternionTag > Container; 260 core::array < SMD3QuaternionTag > Container;
261 }; 261 };
262 262
263 263
264 //! Holding Frames Buffers and Tag Infos 264 //! Holding Frames Buffers and Tag Infos
265 struct SMD3Mesh: public IReferenceCounted 265 struct SMD3Mesh: public IReferenceCounted
266 { 266 {
267 SMD3Mesh () 267 SMD3Mesh ()
268 { 268 {
269 MD3Header.numFrames = 0; 269 MD3Header.numFrames = 0;
270 } 270 }
271 271
272 virtual ~SMD3Mesh() 272 virtual ~SMD3Mesh()
273 { 273 {
274 for (u32 i=0; i<Buffer.size(); ++i) 274 for (u32 i=0; i<Buffer.size(); ++i)
275 Buffer[i]->drop(); 275 Buffer[i]->drop();
276 } 276 }
277 277
278 core::stringc Name; 278 core::stringc Name;
279 core::array<SMD3MeshBuffer*> Buffer; 279 core::array<SMD3MeshBuffer*> Buffer;
280 SMD3QuaternionTagList TagList; 280 SMD3QuaternionTagList TagList;
281 SMD3Header MD3Header; 281 SMD3Header MD3Header;
282 }; 282 };
283 283
284 284
285 //! Interface for using some special functions of MD3 meshes 285 //! Interface for using some special functions of MD3 meshes
286 class IAnimatedMeshMD3 : public IAnimatedMesh 286 class IAnimatedMeshMD3 : public IAnimatedMesh
287 { 287 {
288 public: 288 public:
289 289
290 //! tune how many frames you want to render inbetween. 290 //! tune how many frames you want to render inbetween.
291 virtual void setInterpolationShift(u32 shift, u32 loopMode) =0; 291 virtual void setInterpolationShift(u32 shift, u32 loopMode) =0;
292 292
293 //! get the tag list of the mesh. 293 //! get the tag list of the mesh.
294 virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) =0; 294 virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) =0;
295 295
296 //! get the original md3 mesh. 296 //! get the original md3 mesh.
297 virtual SMD3Mesh* getOriginalMesh() =0; 297 virtual SMD3Mesh* getOriginalMesh() =0;
298 }; 298 };
299 299
300} // end namespace scene 300} // end namespace scene
301} // end namespace irr 301} // end namespace irr
302 302
303#endif 303#endif
304 304