diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshMD3.h | 270 |
1 files changed, 135 insertions, 135 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshMD3.h b/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshMD3.h index 1b01eee..a741f02 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshMD3.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CAnimatedMeshMD3.h | |||
@@ -1,135 +1,135 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten | 1 | // Copyright (C) 2002-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 __C_ANIMATED_MESH_MD3_H_INCLUDED__ | 5 | #ifndef __C_ANIMATED_MESH_MD3_H_INCLUDED__ |
6 | #define __C_ANIMATED_MESH_MD3_H_INCLUDED__ | 6 | #define __C_ANIMATED_MESH_MD3_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IAnimatedMeshMD3.h" | 8 | #include "IAnimatedMeshMD3.h" |
9 | #include "IReadFile.h" | 9 | #include "IReadFile.h" |
10 | #include "IFileSystem.h" | 10 | #include "IFileSystem.h" |
11 | #include "irrArray.h" | 11 | #include "irrArray.h" |
12 | #include "irrString.h" | 12 | #include "irrString.h" |
13 | #include "SMesh.h" | 13 | #include "SMesh.h" |
14 | #include "SMeshBuffer.h" | 14 | #include "SMeshBuffer.h" |
15 | #include "IQ3Shader.h" | 15 | #include "IQ3Shader.h" |
16 | 16 | ||
17 | namespace irr | 17 | namespace irr |
18 | { | 18 | { |
19 | namespace scene | 19 | namespace scene |
20 | { | 20 | { |
21 | 21 | ||
22 | class CAnimatedMeshMD3 : public IAnimatedMeshMD3 | 22 | class CAnimatedMeshMD3 : public IAnimatedMeshMD3 |
23 | { | 23 | { |
24 | public: | 24 | public: |
25 | 25 | ||
26 | //! constructor | 26 | //! constructor |
27 | CAnimatedMeshMD3(); | 27 | CAnimatedMeshMD3(); |
28 | 28 | ||
29 | //! destructor | 29 | //! destructor |
30 | virtual ~CAnimatedMeshMD3(); | 30 | virtual ~CAnimatedMeshMD3(); |
31 | 31 | ||
32 | //! loads a quake3 md3 file | 32 | //! loads a quake3 md3 file |
33 | virtual bool loadModelFile(u32 modelIndex, io::IReadFile* file, | 33 | virtual bool loadModelFile(u32 modelIndex, io::IReadFile* file, |
34 | io::IFileSystem* fs, video::IVideoDriver* driver); | 34 | io::IFileSystem* fs, video::IVideoDriver* driver); |
35 | 35 | ||
36 | // IAnimatedMeshMD3 | 36 | // IAnimatedMeshMD3 |
37 | virtual void setInterpolationShift(u32 shift, u32 loopMode); | 37 | virtual void setInterpolationShift(u32 shift, u32 loopMode); |
38 | virtual SMD3Mesh* getOriginalMesh(); | 38 | virtual SMD3Mesh* getOriginalMesh(); |
39 | virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop); | 39 | virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop); |
40 | 40 | ||
41 | //IAnimatedMesh | 41 | //IAnimatedMesh |
42 | virtual u32 getFrameCount() const; | 42 | virtual u32 getFrameCount() const; |
43 | 43 | ||
44 | //! Gets the default animation speed of the animated mesh. | 44 | //! Gets the default animation speed of the animated mesh. |
45 | /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ | 45 | /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ |
46 | virtual f32 getAnimationSpeed() const | 46 | virtual f32 getAnimationSpeed() const |
47 | { | 47 | { |
48 | return FramesPerSecond; | 48 | return FramesPerSecond; |
49 | } | 49 | } |
50 | 50 | ||
51 | //! Gets the frame count of the animated mesh. | 51 | //! Gets the frame count of the animated mesh. |
52 | /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. | 52 | /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. |
53 | The actual speed is set in the scene node the mesh is instantiated in.*/ | 53 | The actual speed is set in the scene node the mesh is instantiated in.*/ |
54 | virtual void setAnimationSpeed(f32 fps) | 54 | virtual void setAnimationSpeed(f32 fps) |
55 | { | 55 | { |
56 | FramesPerSecond=fps; | 56 | FramesPerSecond=fps; |
57 | } | 57 | } |
58 | 58 | ||
59 | virtual IMesh* getMesh(s32 frame, s32 detailLevel, | 59 | virtual IMesh* getMesh(s32 frame, s32 detailLevel, |
60 | s32 startFrameLoop, s32 endFrameLoop); | 60 | s32 startFrameLoop, s32 endFrameLoop); |
61 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | 61 | virtual const core::aabbox3d<f32>& getBoundingBox() const; |
62 | virtual E_ANIMATED_MESH_TYPE getMeshType() const; | 62 | virtual E_ANIMATED_MESH_TYPE getMeshType() const; |
63 | 63 | ||
64 | //! returns amount of mesh buffers. | 64 | //! returns amount of mesh buffers. |
65 | virtual u32 getMeshBufferCount() const; | 65 | virtual u32 getMeshBufferCount() const; |
66 | 66 | ||
67 | //! returns pointer to a mesh buffer | 67 | //! returns pointer to a mesh buffer |
68 | virtual IMeshBuffer* getMeshBuffer(u32 nr) const; | 68 | virtual IMeshBuffer* getMeshBuffer(u32 nr) const; |
69 | 69 | ||
70 | //! Returns pointer to a mesh buffer which fits a material | 70 | //! Returns pointer to a mesh buffer which fits a material |
71 | virtual IMeshBuffer* getMeshBuffer(const video::SMaterial &material) const; | 71 | virtual IMeshBuffer* getMeshBuffer(const video::SMaterial &material) const; |
72 | 72 | ||
73 | virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); | 73 | virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); |
74 | 74 | ||
75 | //! set user axis aligned bounding box | 75 | //! set user axis aligned bounding box |
76 | virtual void setBoundingBox(const core::aabbox3df& box); | 76 | virtual void setBoundingBox(const core::aabbox3df& box); |
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 | private: | 84 | private: |
85 | //! animates one frame | 85 | //! animates one frame |
86 | inline void Animate(u32 frame); | 86 | inline void Animate(u32 frame); |
87 | 87 | ||
88 | video::SMaterial Material; | 88 | video::SMaterial Material; |
89 | 89 | ||
90 | //! hold original compressed MD3 Info | 90 | //! hold original compressed MD3 Info |
91 | SMD3Mesh *Mesh; | 91 | SMD3Mesh *Mesh; |
92 | 92 | ||
93 | u32 IPolShift; | 93 | u32 IPolShift; |
94 | u32 LoopMode; | 94 | u32 LoopMode; |
95 | f32 Scaling; | 95 | f32 Scaling; |
96 | 96 | ||
97 | //! Cache Info | 97 | //! Cache Info |
98 | struct SCacheInfo | 98 | struct SCacheInfo |
99 | { | 99 | { |
100 | SCacheInfo(s32 frame=-1, s32 start=-1, s32 end=-1 ) : | 100 | SCacheInfo(s32 frame=-1, s32 start=-1, s32 end=-1 ) : |
101 | Frame(frame), startFrameLoop(start), | 101 | Frame(frame), startFrameLoop(start), |
102 | endFrameLoop(end) | 102 | endFrameLoop(end) |
103 | {} | 103 | {} |
104 | 104 | ||
105 | bool operator == ( const SCacheInfo &other ) const | 105 | bool operator == ( const SCacheInfo &other ) const |
106 | { | 106 | { |
107 | return 0 == memcmp ( this, &other, sizeof ( SCacheInfo ) ); | 107 | return 0 == memcmp ( this, &other, sizeof ( SCacheInfo ) ); |
108 | } | 108 | } |
109 | s32 Frame; | 109 | s32 Frame; |
110 | s32 startFrameLoop; | 110 | s32 startFrameLoop; |
111 | s32 endFrameLoop; | 111 | s32 endFrameLoop; |
112 | }; | 112 | }; |
113 | SCacheInfo Current; | 113 | SCacheInfo Current; |
114 | 114 | ||
115 | //! return a Mesh per frame | 115 | //! return a Mesh per frame |
116 | SMesh* MeshIPol; | 116 | SMesh* MeshIPol; |
117 | SMD3QuaternionTagList TagListIPol; | 117 | SMD3QuaternionTagList TagListIPol; |
118 | 118 | ||
119 | IMeshBuffer* createMeshBuffer(const SMD3MeshBuffer* source, | 119 | IMeshBuffer* createMeshBuffer(const SMD3MeshBuffer* source, |
120 | io::IFileSystem* fs, video::IVideoDriver* driver); | 120 | io::IFileSystem* fs, video::IVideoDriver* driver); |
121 | 121 | ||
122 | void buildVertexArray(u32 frameA, u32 frameB, f32 interpolate, | 122 | void buildVertexArray(u32 frameA, u32 frameB, f32 interpolate, |
123 | const SMD3MeshBuffer* source, | 123 | const SMD3MeshBuffer* source, |
124 | SMeshBufferLightMap* dest); | 124 | SMeshBufferLightMap* dest); |
125 | 125 | ||
126 | void buildTagArray(u32 frameA, u32 frameB, f32 interpolate); | 126 | void buildTagArray(u32 frameA, u32 frameB, f32 interpolate); |
127 | f32 FramesPerSecond; | 127 | f32 FramesPerSecond; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | 130 | ||
131 | } // end namespace scene | 131 | } // end namespace scene |
132 | } // end namespace irr | 132 | } // end namespace irr |
133 | 133 | ||
134 | #endif | 134 | #endif |
135 | 135 | ||