diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshHalfLife.h | 630 |
1 files changed, 0 insertions, 630 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshHalfLife.h b/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshHalfLife.h deleted file mode 100644 index 693cd8d..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshHalfLife.h +++ /dev/null | |||
@@ -1,630 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 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 __C_ANIMATED_MESH_HALFLIFE_H_INCLUDED__ | ||
6 | #define __C_ANIMATED_MESH_HALFLIFE_H_INCLUDED__ | ||
7 | |||
8 | #include "IAnimatedMesh.h" | ||
9 | #include "ISceneManager.h" | ||
10 | #include "irrArray.h" | ||
11 | #include "irrString.h" | ||
12 | #include "IMeshLoader.h" | ||
13 | #include "SMesh.h" | ||
14 | #include "IReadFile.h" | ||
15 | |||
16 | namespace irr | ||
17 | { | ||
18 | namespace scene | ||
19 | { | ||
20 | |||
21 | |||
22 | // STUDIO MODELS, Copyright (c) 1998, Valve LLC. All rights reserved. | ||
23 | #define MAXSTUDIOTRIANGLES 20000 // TODO: tune this | ||
24 | #define MAXSTUDIOVERTS 2048 // TODO: tune this | ||
25 | #define MAXSTUDIOSEQUENCES 256 // total animation sequences | ||
26 | #define MAXSTUDIOSKINS 100 // total textures | ||
27 | #define MAXSTUDIOSRCBONES 512 // bones allowed at source movement | ||
28 | #define MAXSTUDIOBONES 128 // total bones actually used | ||
29 | #define MAXSTUDIOMODELS 32 // sub-models per model | ||
30 | #define MAXSTUDIOBODYPARTS 32 | ||
31 | #define MAXSTUDIOGROUPS 4 | ||
32 | #define MAXSTUDIOANIMATIONS 512 // per sequence | ||
33 | #define MAXSTUDIOMESHES 256 | ||
34 | #define MAXSTUDIOEVENTS 1024 | ||
35 | #define MAXSTUDIOPIVOTS 256 | ||
36 | #define MAXSTUDIOCONTROLLERS 8 | ||
37 | |||
38 | typedef f32 vec3_hl[3]; // x,y,z | ||
39 | typedef f32 vec4_hl[4]; // x,y,z,w | ||
40 | |||
41 | // byte-align structures | ||
42 | #include "irrpack.h" | ||
43 | |||
44 | struct SHalflifeHeader | ||
45 | { | ||
46 | c8 id[4]; | ||
47 | s32 version; | ||
48 | |||
49 | c8 name[64]; | ||
50 | s32 length; | ||
51 | |||
52 | vec3_hl eyeposition; // ideal eye position | ||
53 | vec3_hl min; // ideal movement hull size | ||
54 | vec3_hl max; | ||
55 | |||
56 | vec3_hl bbmin; // clipping bounding box | ||
57 | vec3_hl bbmax; | ||
58 | |||
59 | s32 flags; | ||
60 | |||
61 | u32 numbones; // bones | ||
62 | u32 boneindex; | ||
63 | |||
64 | u32 numbonecontrollers; // bone controllers | ||
65 | u32 bonecontrollerindex; | ||
66 | |||
67 | u32 numhitboxes; // complex bounding boxes | ||
68 | u32 hitboxindex; | ||
69 | |||
70 | u32 numseq; // animation sequences | ||
71 | u32 seqindex; | ||
72 | |||
73 | u32 numseqgroups; // demand loaded sequences | ||
74 | u32 seqgroupindex; | ||
75 | |||
76 | u32 numtextures; // raw textures | ||
77 | u32 textureindex; | ||
78 | u32 texturedataindex; | ||
79 | |||
80 | u32 numskinref; // replaceable textures | ||
81 | u32 numskinfamilies; | ||
82 | u32 skinindex; | ||
83 | |||
84 | u32 numbodyparts; | ||
85 | u32 bodypartindex; | ||
86 | |||
87 | u32 numattachments; // queryable attachable points | ||
88 | u32 attachmentindex; | ||
89 | |||
90 | s32 soundtable; | ||
91 | s32 soundindex; | ||
92 | s32 soundgroups; | ||
93 | s32 soundgroupindex; | ||
94 | |||
95 | s32 numtransitions; // animation node to animation node transition graph | ||
96 | s32 transitionindex; | ||
97 | } PACK_STRUCT; | ||
98 | |||
99 | // header for demand loaded sequence group data | ||
100 | struct studioseqhdr_t | ||
101 | { | ||
102 | s32 id; | ||
103 | s32 version; | ||
104 | |||
105 | c8 name[64]; | ||
106 | s32 length; | ||
107 | } PACK_STRUCT; | ||
108 | |||
109 | // bones | ||
110 | struct SHalflifeBone | ||
111 | { | ||
112 | c8 name[32]; // bone name for symbolic links | ||
113 | s32 parent; // parent bone | ||
114 | s32 flags; // ?? | ||
115 | s32 bonecontroller[6]; // bone controller index, -1 == none | ||
116 | f32 value[6]; // default DoF values | ||
117 | f32 scale[6]; // scale for delta DoF values | ||
118 | } PACK_STRUCT; | ||
119 | |||
120 | |||
121 | // bone controllers | ||
122 | struct SHalflifeBoneController | ||
123 | { | ||
124 | s32 bone; // -1 == 0 | ||
125 | s32 type; // X, Y, Z, XR, YR, ZR, M | ||
126 | f32 start; | ||
127 | f32 end; | ||
128 | s32 rest; // byte index value at rest | ||
129 | s32 index; // 0-3 user set controller, 4 mouth | ||
130 | } PACK_STRUCT; | ||
131 | |||
132 | // intersection boxes | ||
133 | struct SHalflifeBBox | ||
134 | { | ||
135 | s32 bone; | ||
136 | s32 group; // intersection group | ||
137 | vec3_hl bbmin; // bounding box | ||
138 | vec3_hl bbmax; | ||
139 | } PACK_STRUCT; | ||
140 | |||
141 | #ifndef ZONE_H | ||
142 | // NOTE: this was a void*, but that crashes on 64bit. | ||
143 | // I have found no mdl format desc, so not sure what it's meant to be, but s32 at least works. | ||
144 | typedef s32 cache_user_t; | ||
145 | #endif | ||
146 | |||
147 | // demand loaded sequence groups | ||
148 | struct SHalflifeSequenceGroup | ||
149 | { | ||
150 | c8 label[32]; // textual name | ||
151 | c8 name[64]; // file name | ||
152 | cache_user_t cache; // cache index pointer | ||
153 | s32 data; // hack for group 0 | ||
154 | } PACK_STRUCT; | ||
155 | |||
156 | // sequence descriptions | ||
157 | struct SHalflifeSequence | ||
158 | { | ||
159 | c8 label[32]; // sequence label | ||
160 | |||
161 | f32 fps; // frames per second | ||
162 | s32 flags; // looping/non-looping flags | ||
163 | |||
164 | s32 activity; | ||
165 | s32 actweight; | ||
166 | |||
167 | s32 numevents; | ||
168 | s32 eventindex; | ||
169 | |||
170 | s32 numframes; // number of frames per sequence | ||
171 | |||
172 | u32 numpivots; // number of foot pivots | ||
173 | u32 pivotindex; | ||
174 | |||
175 | s32 motiontype; | ||
176 | s32 motionbone; | ||
177 | vec3_hl linearmovement; | ||
178 | s32 automoveposindex; | ||
179 | s32 automoveangleindex; | ||
180 | |||
181 | vec3_hl bbmin; // per sequence bounding box | ||
182 | vec3_hl bbmax; | ||
183 | |||
184 | s32 numblends; | ||
185 | s32 animindex; // SHalflifeAnimOffset pointer relative to start of sequence group data | ||
186 | // [blend][bone][X, Y, Z, XR, YR, ZR] | ||
187 | |||
188 | s32 blendtype[2]; // X, Y, Z, XR, YR, ZR | ||
189 | f32 blendstart[2]; // starting value | ||
190 | f32 blendend[2]; // ending value | ||
191 | s32 blendparent; | ||
192 | |||
193 | s32 seqgroup; // sequence group for demand loading | ||
194 | |||
195 | s32 entrynode; // transition node at entry | ||
196 | s32 exitnode; // transition node at exit | ||
197 | s32 nodeflags; // transition rules | ||
198 | |||
199 | s32 nextseq; // auto advancing sequences | ||
200 | } PACK_STRUCT; | ||
201 | |||
202 | // events | ||
203 | struct mstudioevent_t | ||
204 | { | ||
205 | s32 frame; | ||
206 | s32 event; | ||
207 | s32 type; | ||
208 | c8 options[64]; | ||
209 | } PACK_STRUCT; | ||
210 | |||
211 | |||
212 | // pivots | ||
213 | struct mstudiopivot_t | ||
214 | { | ||
215 | vec3_hl org; // pivot point | ||
216 | s32 start; | ||
217 | s32 end; | ||
218 | } PACK_STRUCT; | ||
219 | |||
220 | // attachment | ||
221 | struct SHalflifeAttachment | ||
222 | { | ||
223 | c8 name[32]; | ||
224 | s32 type; | ||
225 | s32 bone; | ||
226 | vec3_hl org; // attachment point | ||
227 | vec3_hl vectors[3]; | ||
228 | } PACK_STRUCT; | ||
229 | |||
230 | struct SHalflifeAnimOffset | ||
231 | { | ||
232 | u16 offset[6]; | ||
233 | } PACK_STRUCT; | ||
234 | |||
235 | // animation frames | ||
236 | union SHalflifeAnimationFrame | ||
237 | { | ||
238 | struct { | ||
239 | u8 valid; | ||
240 | u8 total; | ||
241 | } PACK_STRUCT num; | ||
242 | s16 value; | ||
243 | } PACK_STRUCT; | ||
244 | |||
245 | |||
246 | // body part index | ||
247 | struct SHalflifeBody | ||
248 | { | ||
249 | c8 name[64]; | ||
250 | u32 nummodels; | ||
251 | u32 base; | ||
252 | u32 modelindex; // index into models array | ||
253 | } PACK_STRUCT; | ||
254 | |||
255 | |||
256 | // skin info | ||
257 | struct SHalflifeTexture | ||
258 | { | ||
259 | c8 name[64]; | ||
260 | s32 flags; | ||
261 | s32 width; | ||
262 | s32 height; | ||
263 | s32 index; | ||
264 | } PACK_STRUCT; | ||
265 | |||
266 | |||
267 | // skin families | ||
268 | // short index[skinfamilies][skinref] | ||
269 | |||
270 | // studio models | ||
271 | struct SHalflifeModel | ||
272 | { | ||
273 | c8 name[64]; | ||
274 | s32 type; | ||
275 | |||
276 | f32 boundingradius; | ||
277 | |||
278 | u32 nummesh; | ||
279 | u32 meshindex; | ||
280 | |||
281 | u32 numverts; // number of unique vertices | ||
282 | u32 vertinfoindex; // vertex bone info | ||
283 | u32 vertindex; // vertex vec3_hl | ||
284 | u32 numnorms; // number of unique surface normals | ||
285 | u32 norminfoindex; // normal bone info | ||
286 | u32 normindex; // normal vec3_hl | ||
287 | |||
288 | u32 numgroups; // deformation groups | ||
289 | u32 groupindex; | ||
290 | } PACK_STRUCT; | ||
291 | |||
292 | |||
293 | // meshes | ||
294 | struct SHalflifeMesh | ||
295 | { | ||
296 | u32 numtris; | ||
297 | u32 triindex; | ||
298 | u32 skinref; | ||
299 | u32 numnorms; // per mesh normals | ||
300 | u32 normindex; // normal vec3_hl | ||
301 | } PACK_STRUCT; | ||
302 | |||
303 | // Default alignment | ||
304 | #include "irrunpack.h" | ||
305 | |||
306 | // lighting options | ||
307 | #define STUDIO_NF_FLATSHADE 0x0001 | ||
308 | #define STUDIO_NF_CHROME 0x0002 | ||
309 | #define STUDIO_NF_FULLBRIGHT 0x0004 | ||
310 | |||
311 | // motion flags | ||
312 | #define STUDIO_X 0x0001 | ||
313 | #define STUDIO_Y 0x0002 | ||
314 | #define STUDIO_Z 0x0004 | ||
315 | #define STUDIO_XR 0x0008 | ||
316 | #define STUDIO_YR 0x0010 | ||
317 | #define STUDIO_ZR 0x0020 | ||
318 | #define STUDIO_LX 0x0040 | ||
319 | #define STUDIO_LY 0x0080 | ||
320 | #define STUDIO_LZ 0x0100 | ||
321 | #define STUDIO_AX 0x0200 | ||
322 | #define STUDIO_AY 0x0400 | ||
323 | #define STUDIO_AZ 0x0800 | ||
324 | #define STUDIO_AXR 0x1000 | ||
325 | #define STUDIO_AYR 0x2000 | ||
326 | #define STUDIO_AZR 0x4000 | ||
327 | #define STUDIO_TYPES 0x7FFF | ||
328 | #define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance | ||
329 | |||
330 | // sequence flags | ||
331 | #define STUDIO_LOOPING 0x0001 | ||
332 | |||
333 | // bone flags | ||
334 | #define STUDIO_HAS_NORMALS 0x0001 | ||
335 | #define STUDIO_HAS_VERTICES 0x0002 | ||
336 | #define STUDIO_HAS_BBOX 0x0004 | ||
337 | #define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them | ||
338 | |||
339 | #define RAD_TO_STUDIO (32768.0/M_PI) | ||
340 | #define STUDIO_TO_RAD (M_PI/32768.0) | ||
341 | |||
342 | /*! | ||
343 | Textureatlas | ||
344 | Combine Source Images with arbitrary size and bithdepth to an Image with 2^n size | ||
345 | borders from the source images are copied around for allowing filtering ( bilinear, mipmap ) | ||
346 | */ | ||
347 | struct STextureAtlas | ||
348 | { | ||
349 | STextureAtlas () | ||
350 | { | ||
351 | release(); | ||
352 | } | ||
353 | |||
354 | virtual ~STextureAtlas () | ||
355 | { | ||
356 | release (); | ||
357 | } | ||
358 | |||
359 | void release (); | ||
360 | void addSource ( const c8 * name, video::IImage * image ); | ||
361 | void create ( u32 pixelborder, video::E_TEXTURE_CLAMP texmode ); | ||
362 | void getScale ( core::vector2df &scale ); | ||
363 | void getTranslation ( const c8 * name, core::vector2di &pos ); | ||
364 | |||
365 | struct TextureAtlasEntry | ||
366 | { | ||
367 | io::path name; | ||
368 | u32 width; | ||
369 | u32 height; | ||
370 | |||
371 | core::vector2di pos; | ||
372 | |||
373 | video::IImage * image; | ||
374 | |||
375 | bool operator < ( const TextureAtlasEntry & other ) | ||
376 | { | ||
377 | return height > other.height; | ||
378 | } | ||
379 | }; | ||
380 | |||
381 | |||
382 | core::array < TextureAtlasEntry > atlas; | ||
383 | video::IImage * Master; | ||
384 | }; | ||
385 | |||
386 | |||
387 | //! Possible types of Animation Type | ||
388 | enum E_ANIMATION_TYPE | ||
389 | { | ||
390 | //! No Animation | ||
391 | EAMT_STILL, | ||
392 | //! From Start to End, then Stop ( Limited Line ) | ||
393 | EAMT_WAYPOINT, | ||
394 | //! Linear Cycling Animation ( Sawtooth ) | ||
395 | EAMT_LOOPING, | ||
396 | //! Linear bobbing ( Triangle ) | ||
397 | EAMT_PINGPONG | ||
398 | }; | ||
399 | |||
400 | //! Names for Animation Type | ||
401 | const c8* const MeshAnimationTypeNames[] = | ||
402 | { | ||
403 | "still", | ||
404 | "waypoint", | ||
405 | "looping", | ||
406 | "pingpong", | ||
407 | 0 | ||
408 | }; | ||
409 | |||
410 | |||
411 | //! Data for holding named Animation Info | ||
412 | struct KeyFrameInterpolation | ||
413 | { | ||
414 | core::stringc Name; // Name of the current Animation/Bone | ||
415 | E_ANIMATION_TYPE AnimationType; // Type of Animation ( looping, usw..) | ||
416 | |||
417 | f32 CurrentFrame; // Current Frame | ||
418 | s32 NextFrame; // Frame which will be used next. For blending | ||
419 | |||
420 | s32 StartFrame; // Absolute Frame where the current animation start | ||
421 | s32 Frames; // Relative Frames how much Frames this animation have | ||
422 | s32 LoopingFrames; // How much of Frames sould be looped | ||
423 | s32 EndFrame; // Absolute Frame where the current animation ends End = start + frames - 1 | ||
424 | |||
425 | f32 FramesPerSecond; // Speed in Frames/Seconds the animation is played | ||
426 | f32 RelativeSpeed; // Factor Original fps is modified | ||
427 | |||
428 | u32 BeginTime; // Animation started at this thime | ||
429 | u32 EndTime; // Animation end at this time | ||
430 | u32 LastTime; // Last Keyframe was done at this time | ||
431 | |||
432 | KeyFrameInterpolation ( const c8 * name = "", s32 start = 0, s32 frames = 0, s32 loopingframes = 0, | ||
433 | f32 fps = 0.f, f32 relativefps = 1.f ) | ||
434 | : Name ( name ), AnimationType ( loopingframes ? EAMT_LOOPING : EAMT_WAYPOINT), | ||
435 | CurrentFrame ( (f32) start ), NextFrame ( start ), StartFrame ( start ), | ||
436 | Frames ( frames ), LoopingFrames ( loopingframes ), EndFrame ( start + frames - 1 ), | ||
437 | FramesPerSecond ( fps ), RelativeSpeed ( relativefps ), | ||
438 | BeginTime ( 0 ), EndTime ( 0 ), LastTime ( 0 ) | ||
439 | { | ||
440 | } | ||
441 | |||
442 | // linear search | ||
443 | bool operator == ( const KeyFrameInterpolation & other ) const | ||
444 | { | ||
445 | return Name.equals_ignore_case ( other.Name ); | ||
446 | } | ||
447 | |||
448 | }; | ||
449 | |||
450 | |||
451 | //! a List holding named Animations | ||
452 | typedef core::array < KeyFrameInterpolation > IAnimationList; | ||
453 | |||
454 | //! a List holding named Skins | ||
455 | typedef core::array < core::stringc > ISkinList; | ||
456 | |||
457 | |||
458 | // Current Model per Body | ||
459 | struct SubModel | ||
460 | { | ||
461 | core::stringc name; | ||
462 | u32 startBuffer; | ||
463 | u32 endBuffer; | ||
464 | u32 state; | ||
465 | }; | ||
466 | |||
467 | struct BodyPart | ||
468 | { | ||
469 | core::stringc name; | ||
470 | u32 defaultModel; | ||
471 | core::array < SubModel > model; | ||
472 | }; | ||
473 | //! a List holding named Models and SubModels | ||
474 | typedef core::array < BodyPart > IBodyList; | ||
475 | |||
476 | |||
477 | class CAnimatedMeshHalfLife : public IAnimatedMesh | ||
478 | { | ||
479 | public: | ||
480 | |||
481 | //! constructor | ||
482 | CAnimatedMeshHalfLife(); | ||
483 | |||
484 | //! destructor | ||
485 | virtual ~CAnimatedMeshHalfLife(); | ||
486 | |||
487 | //! loads a Halflife mdl file | ||
488 | virtual bool loadModelFile( io::IReadFile* file, ISceneManager * smgr ); | ||
489 | |||
490 | //IAnimatedMesh | ||
491 | virtual u32 getFrameCount() const; | ||
492 | virtual IMesh* getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop); | ||
493 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | ||
494 | virtual E_ANIMATED_MESH_TYPE getMeshType() const; | ||
495 | virtual void renderModel ( u32 param, video::IVideoDriver * driver, const core::matrix4 &absoluteTransformation); | ||
496 | |||
497 | //! returns amount of mesh buffers. | ||
498 | virtual u32 getMeshBufferCount() const; | ||
499 | //! returns pointer to a mesh buffer | ||
500 | virtual IMeshBuffer* getMeshBuffer(u32 nr) const; | ||
501 | //! Returns pointer to a mesh buffer which fits a material | ||
502 | virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const; | ||
503 | |||
504 | virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); | ||
505 | |||
506 | //! set the hardware mapping hint, for driver | ||
507 | virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); | ||
508 | |||
509 | //! flags the meshbuffer as changed, reloads hardware buffers | ||
510 | virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); | ||
511 | |||
512 | //! set user axis aligned bounding box | ||
513 | virtual void setBoundingBox(const core::aabbox3df& box); | ||
514 | |||
515 | //! Gets the default animation speed of the animated mesh. | ||
516 | /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ | ||
517 | virtual f32 getAnimationSpeed() const | ||
518 | { | ||
519 | return FramesPerSecond; | ||
520 | } | ||
521 | |||
522 | //! Gets the frame count of the animated mesh. | ||
523 | /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. | ||
524 | The actual speed is set in the scene node the mesh is instantiated in.*/ | ||
525 | virtual void setAnimationSpeed(f32 fps) | ||
526 | { | ||
527 | FramesPerSecond=fps; | ||
528 | } | ||
529 | |||
530 | //! Get the Animation List | ||
531 | virtual IAnimationList* getAnimList () { return &AnimList; } | ||
532 | |||
533 | //! Return the named Body List of this Animated Mesh | ||
534 | virtual IBodyList *getBodyList() { return &BodyList; } | ||
535 | |||
536 | private: | ||
537 | |||
538 | // KeyFrame Animation List | ||
539 | IAnimationList AnimList; | ||
540 | // Sum of all sequences | ||
541 | u32 FrameCount; | ||
542 | |||
543 | // Named meshes of the Body | ||
544 | IBodyList BodyList; | ||
545 | |||
546 | //! return a Mesh per frame | ||
547 | SMesh* MeshIPol; | ||
548 | |||
549 | ISceneManager *SceneManager; | ||
550 | |||
551 | SHalflifeHeader *Header; | ||
552 | SHalflifeHeader *TextureHeader; | ||
553 | bool OwnTexModel; // do we have a modelT.mdl ? | ||
554 | SHalflifeHeader *AnimationHeader[32]; // sequences named model01.mdl, model02.mdl | ||
555 | |||
556 | void initData (); | ||
557 | SHalflifeHeader * loadModel( io::IReadFile* file, const io::path &filename ); | ||
558 | bool postLoadModel( const io::path &filename ); | ||
559 | |||
560 | u32 SequenceIndex; // sequence index | ||
561 | f32 CurrentFrame; // Current Frame | ||
562 | f32 FramesPerSecond; | ||
563 | |||
564 | #define MOUTH_CONTROLLER 4 | ||
565 | u8 BoneController[4 + 1 ]; // bone controllers + mouth position | ||
566 | u8 Blending[2]; // animation blending | ||
567 | |||
568 | vec4_hl BoneAdj; | ||
569 | f32 SetController( s32 controllerIndex, f32 value ); | ||
570 | |||
571 | u32 SkinGroupSelection; // skin group selection | ||
572 | u32 SetSkin( u32 value ); | ||
573 | |||
574 | void initModel(); | ||
575 | void dumpModelInfo(u32 level) const; | ||
576 | |||
577 | void ExtractBbox(s32 sequence, core::aabbox3df &box) const; | ||
578 | |||
579 | void setUpBones (); | ||
580 | SHalflifeAnimOffset * getAnim( SHalflifeSequence *seq ); | ||
581 | void slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s ); | ||
582 | void calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeSequence *seq, SHalflifeAnimOffset *anim, f32 f ); | ||
583 | |||
584 | void calcBoneAdj(); | ||
585 | void calcBoneQuaternion(const s32 frame, const SHalflifeBone *bone, SHalflifeAnimOffset *anim, const u32 j, f32& angle1, f32& angle2) const; | ||
586 | void calcBonePosition(const s32 frame, f32 s, const SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const; | ||
587 | |||
588 | void buildVertices (); | ||
589 | |||
590 | io::path TextureBaseName; | ||
591 | |||
592 | #define HL_TEXTURE_ATLAS | ||
593 | |||
594 | #ifdef HL_TEXTURE_ATLAS | ||
595 | STextureAtlas TextureAtlas; | ||
596 | video::ITexture *TextureMaster; | ||
597 | #endif | ||
598 | |||
599 | }; | ||
600 | |||
601 | |||
602 | //! Meshloader capable of loading HalfLife Model files | ||
603 | class CHalflifeMDLMeshFileLoader : public IMeshLoader | ||
604 | { | ||
605 | public: | ||
606 | |||
607 | //! Constructor | ||
608 | CHalflifeMDLMeshFileLoader( scene::ISceneManager* smgr ); | ||
609 | |||
610 | //! returns true if the file maybe is able to be loaded by this class | ||
611 | /** based on the file extension (e.g. ".bsp") */ | ||
612 | virtual bool isALoadableFileExtension(const io::path& filename) const; | ||
613 | |||
614 | //! creates/loads an animated mesh from the file. | ||
615 | /** \return Pointer to the created mesh. Returns 0 if loading failed. | ||
616 | If you no longer need the mesh, you should call IAnimatedMesh::drop(). | ||
617 | See IReferenceCounted::drop() for more information. | ||
618 | */ | ||
619 | virtual IAnimatedMesh* createMesh(io::IReadFile* file); | ||
620 | |||
621 | private: | ||
622 | scene::ISceneManager* SceneManager; | ||
623 | }; | ||
624 | |||
625 | |||
626 | } // end namespace scene | ||
627 | } // end namespace irr | ||
628 | |||
629 | #endif | ||
630 | |||