Irrlicht 3D Engine
 
Loading...
Searching...
No Matches
IAnimatedMeshMD3.h
Go to the documentation of this file.
1// Copyright (C) 2007-2012 Nikolaus Gebhardt / Thomas Alten
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_MD3_H_INCLUDED__
6#define __I_ANIMATED_MESH_MD3_H_INCLUDED__
7
8#include "IAnimatedMesh.h"
9#include "IQ3Shader.h"
10#include "quaternion.h"
11
12namespace irr
13{
14namespace scene
15{
16
25
63
75
76
77// byte-align structures
78#include "irrpack.h"
79
82 {
83 c8 headerID[4]; //id of file, always "IDP3"
84 s32 Version; //this is a version number, always 15
85 s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
86 s32 numFrames; //number of KeyFrames
87 s32 numTags; //number of 'tags' per frame
88 s32 numMeshes; //number of meshes/skins
89 s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2
90 s32 frameStart; //starting position of frame-structur
91 s32 tagStart; //starting position of tag-structures
92 s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
95
98 {
99 c8 meshID[4]; //id, must be IDP3
100 c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
101
102 s32 numFrames; //number of meshframes in mesh
103 s32 numShader; //number of skins in mesh
104 s32 numVertices; //number of vertices
105 s32 numTriangles; //number of Triangles
106
107 s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
108 s32 offset_shaders; //size of 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
112 } PACK_STRUCT;
113
114
117 {
120 } PACK_STRUCT;
121
124 {
127 } PACK_STRUCT;
128
130 struct SMD3Face
131 {
133 } PACK_STRUCT;
134
135
136// Default alignment
137#include "irrunpack.h"
138
149
151
153 {
155 {
156 position.X = 0.f;
157 }
158
159 // construct copy constructor
161 {
162 *this = copyMe;
163 }
164
165 // construct for searching
167 : Name ( name ) {}
168
169 // construct from a position and euler angles in degrees
171 : position(pos), rotation(angle * core::DEGTORAD) {}
172
173 // set to matrix
175 {
177 }
178
179 bool operator == ( const SMD3QuaternionTag &other ) const
180 {
181 return Name == other.Name;
182 }
183
185 {
186 Name = copyMe.Name;
187 position = copyMe.position;
188 rotation = copyMe.rotation;
189 return *this;
190 }
191
195 };
196
199 {
201 {
202 Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
203 }
204
205 // construct copy constructor
207 {
208 *this = copyMe;
209 }
210
212
214 {
215 SMD3QuaternionTag search ( name );
216 s32 index = Container.linear_search ( search );
217 if ( index >= 0 )
218 return &Container[index];
219 return 0;
220 }
221
222 u32 size () const
223 {
224 return Container.size();
225 }
226
227 void set_used(u32 new_size)
228 {
229 s32 diff = (s32) new_size - (s32) Container.allocated_size();
230 if ( diff > 0 )
231 {
232 SMD3QuaternionTag e("");
233 for ( s32 i = 0; i < diff; ++i )
234 Container.push_back(e);
235 }
236 }
237
238 const SMD3QuaternionTag& operator[](u32 index) const
239 {
240 return Container[index];
241 }
242
244 {
245 return Container[index];
246 }
247
248 void push_back(const SMD3QuaternionTag& other)
249 {
250 Container.push_back(other);
251 }
252
254 {
255 Container = copyMe.Container;
256 return *this;
257 }
258
259 private:
261 };
262
263
266 {
268 {
270 }
271
272 virtual ~SMD3Mesh()
273 {
274 for (u32 i=0; i<Buffer.size(); ++i)
275 Buffer[i]->drop();
276 }
277
282 };
283
284
287 {
288 public:
289
291 virtual void setInterpolationShift(u32 shift, u32 loopMode) =0;
292
294 virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) =0;
295
298 };
299
300} // end namespace scene
301} // end namespace irr
302
303#endif
304
Base class of most objects of the Irrlicht Engine.
bool drop() const
Drops the object. Decrements the reference counter by one.
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.h:46
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
Quaternion class for representing rotations.
Definition quaternion.h:27
matrix4 getMatrix() const
Creates a matrix from this quaternion.
Definition quaternion.h:338
T X
X coordinate of the vector.
Definition vector3d.h:408
Interface for an animated mesh.
Interface for using some special functions of MD3 meshes.
virtual SMD3Mesh * getOriginalMesh()=0
get the original md3 mesh.
virtual void setInterpolationShift(u32 shift, u32 loopMode)=0
tune how many frames you want to render inbetween.
virtual SMD3QuaternionTagList * getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)=0
get the tag list of the mesh.
@ ALLOC_STRATEGY_SAFE
struct irr::scene::SMD3Header PACK_STRUCT
EMD3_ANIMATION_TYPE
Animation list.
@ EMD3_ANIMATION_COUNT
Not an animation, but amount of animation types.
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
float f32
32 bit floating point variable.
Definition irrTypes.h:104
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
signed short s16
16 bit signed variable.
Definition irrTypes.h:48
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.h:18
char c8
8 bit character variable.
Definition irrTypes.h:31
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
signed char s8
8 bit signed variable.
Definition irrTypes.h:26
this holds the header info of the MD3 file
Holding Frame Data for a Mesh.
core::array< SMD3Vertex > Vertices
core::array< SMD3TexCoord > Tex
this holds the header info of an MD3 mesh section
Holding Frames Buffers and Tag Infos.
core::array< SMD3MeshBuffer * > Buffer
SMD3QuaternionTagList TagList
hold a tag info for connecting meshes
SMD3QuaternionTag(const core::stringc &name)
void setto(core::matrix4 &m)
SMD3QuaternionTag & operator=(const SMD3QuaternionTag &copyMe)
bool operator==(const SMD3QuaternionTag &other) const
SMD3QuaternionTag(const core::vector3df &pos, const core::vector3df &angle)
SMD3QuaternionTag(const SMD3QuaternionTag &copyMe)
holds a associative list of named quaternions
SMD3QuaternionTag * get(const core::stringc &name)
const SMD3QuaternionTag & operator[](u32 index) const
SMD3QuaternionTag & operator[](u32 index)
SMD3QuaternionTagList & operator=(const SMD3QuaternionTagList &copyMe)
SMD3QuaternionTagList(const SMD3QuaternionTagList &copyMe)
void push_back(const SMD3QuaternionTag &other)
Compressed Vertex Data.