aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/SAnimatedMesh.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/include/SAnimatedMesh.h')
-rw-r--r--libraries/irrlicht-1.8/include/SAnimatedMesh.h378
1 files changed, 189 insertions, 189 deletions
diff --git a/libraries/irrlicht-1.8/include/SAnimatedMesh.h b/libraries/irrlicht-1.8/include/SAnimatedMesh.h
index ced4060..f962f30 100644
--- a/libraries/irrlicht-1.8/include/SAnimatedMesh.h
+++ b/libraries/irrlicht-1.8/include/SAnimatedMesh.h
@@ -1,189 +1,189 @@
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 __S_ANIMATED_MESH_H_INCLUDED__ 5#ifndef __S_ANIMATED_MESH_H_INCLUDED__
6#define __S_ANIMATED_MESH_H_INCLUDED__ 6#define __S_ANIMATED_MESH_H_INCLUDED__
7 7
8#include "IAnimatedMesh.h" 8#include "IAnimatedMesh.h"
9#include "IMesh.h" 9#include "IMesh.h"
10#include "aabbox3d.h" 10#include "aabbox3d.h"
11#include "irrArray.h" 11#include "irrArray.h"
12 12
13namespace irr 13namespace irr
14{ 14{
15namespace scene 15namespace scene
16{ 16{
17 17
18 //! Simple implementation of the IAnimatedMesh interface. 18 //! Simple implementation of the IAnimatedMesh interface.
19 struct SAnimatedMesh : public IAnimatedMesh 19 struct SAnimatedMesh : public IAnimatedMesh
20 { 20 {
21 //! constructor 21 //! constructor
22 SAnimatedMesh(scene::IMesh* mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN) : IAnimatedMesh(), FramesPerSecond(25.f), Type(type) 22 SAnimatedMesh(scene::IMesh* mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN) : IAnimatedMesh(), FramesPerSecond(25.f), Type(type)
23 { 23 {
24 #ifdef _DEBUG 24 #ifdef _DEBUG
25 setDebugName("SAnimatedMesh"); 25 setDebugName("SAnimatedMesh");
26 #endif 26 #endif
27 addMesh(mesh); 27 addMesh(mesh);
28 recalculateBoundingBox(); 28 recalculateBoundingBox();
29 } 29 }
30 30
31 //! destructor 31 //! destructor
32 virtual ~SAnimatedMesh() 32 virtual ~SAnimatedMesh()
33 { 33 {
34 // drop meshes 34 // drop meshes
35 for (u32 i=0; i<Meshes.size(); ++i) 35 for (u32 i=0; i<Meshes.size(); ++i)
36 Meshes[i]->drop(); 36 Meshes[i]->drop();
37 } 37 }
38 38
39 //! Gets the frame count of the animated mesh. 39 //! Gets the frame count of the animated mesh.
40 /** \return Amount of frames. If the amount is 1, it is a static, non animated mesh. */ 40 /** \return Amount of frames. If the amount is 1, it is a static, non animated mesh. */
41 virtual u32 getFrameCount() const 41 virtual u32 getFrameCount() const
42 { 42 {
43 return Meshes.size(); 43 return Meshes.size();
44 } 44 }
45 45
46 //! Gets the default animation speed of the animated mesh. 46 //! Gets the default animation speed of the animated mesh.
47 /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */ 47 /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */
48 virtual f32 getAnimationSpeed() const 48 virtual f32 getAnimationSpeed() const
49 { 49 {
50 return FramesPerSecond; 50 return FramesPerSecond;
51 } 51 }
52 52
53 //! Gets the frame count of the animated mesh. 53 //! Gets the frame count of the animated mesh.
54 /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated. 54 /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated.
55 The actual speed is set in the scene node the mesh is instantiated in.*/ 55 The actual speed is set in the scene node the mesh is instantiated in.*/
56 virtual void setAnimationSpeed(f32 fps) 56 virtual void setAnimationSpeed(f32 fps)
57 { 57 {
58 FramesPerSecond=fps; 58 FramesPerSecond=fps;
59 } 59 }
60 60
61 //! Returns the IMesh interface for a frame. 61 //! Returns the IMesh interface for a frame.
62 /** \param frame: Frame number as zero based index. The maximum frame number is 62 /** \param frame: Frame number as zero based index. The maximum frame number is
63 getFrameCount() - 1; 63 getFrameCount() - 1;
64 \param detailLevel: Level of detail. 0 is the lowest, 64 \param detailLevel: Level of detail. 0 is the lowest,
65 255 the highest level of detail. Most meshes will ignore the detail level. 65 255 the highest level of detail. Most meshes will ignore the detail level.
66 \param startFrameLoop: start frame 66 \param startFrameLoop: start frame
67 \param endFrameLoop: end frame 67 \param endFrameLoop: end frame
68 \return The animated mesh based on a detail level. */ 68 \return The animated mesh based on a detail level. */
69 virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) 69 virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
70 { 70 {
71 if (Meshes.empty()) 71 if (Meshes.empty())
72 return 0; 72 return 0;
73 73
74 return Meshes[frame]; 74 return Meshes[frame];
75 } 75 }
76 76
77 //! adds a Mesh 77 //! adds a Mesh
78 void addMesh(IMesh* mesh) 78 void addMesh(IMesh* mesh)
79 { 79 {
80 if (mesh) 80 if (mesh)
81 { 81 {
82 mesh->grab(); 82 mesh->grab();
83 Meshes.push_back(mesh); 83 Meshes.push_back(mesh);
84 } 84 }
85 } 85 }
86 86
87 //! Returns an axis aligned bounding box of the mesh. 87 //! Returns an axis aligned bounding box of the mesh.
88 /** \return A bounding box of this mesh is returned. */ 88 /** \return A bounding box of this mesh is returned. */
89 virtual const core::aabbox3d<f32>& getBoundingBox() const 89 virtual const core::aabbox3d<f32>& getBoundingBox() const
90 { 90 {
91 return Box; 91 return Box;
92 } 92 }
93 93
94 //! set user axis aligned bounding box 94 //! set user axis aligned bounding box
95 virtual void setBoundingBox(const core::aabbox3df& box) 95 virtual void setBoundingBox(const core::aabbox3df& box)
96 { 96 {
97 Box = box; 97 Box = box;
98 } 98 }
99 99
100 //! Recalculates the bounding box. 100 //! Recalculates the bounding box.
101 void recalculateBoundingBox() 101 void recalculateBoundingBox()
102 { 102 {
103 Box.reset(0,0,0); 103 Box.reset(0,0,0);
104 104
105 if (Meshes.empty()) 105 if (Meshes.empty())
106 return; 106 return;
107 107
108 Box = Meshes[0]->getBoundingBox(); 108 Box = Meshes[0]->getBoundingBox();
109 109
110 for (u32 i=1; i<Meshes.size(); ++i) 110 for (u32 i=1; i<Meshes.size(); ++i)
111 Box.addInternalBox(Meshes[i]->getBoundingBox()); 111 Box.addInternalBox(Meshes[i]->getBoundingBox());
112 } 112 }
113 113
114 //! Returns the type of the animated mesh. 114 //! Returns the type of the animated mesh.
115 virtual E_ANIMATED_MESH_TYPE getMeshType() const 115 virtual E_ANIMATED_MESH_TYPE getMeshType() const
116 { 116 {
117 return Type; 117 return Type;
118 } 118 }
119 119
120 //! returns amount of mesh buffers. 120 //! returns amount of mesh buffers.
121 virtual u32 getMeshBufferCount() const 121 virtual u32 getMeshBufferCount() const
122 { 122 {
123 if (Meshes.empty()) 123 if (Meshes.empty())
124 return 0; 124 return 0;
125 125
126 return Meshes[0]->getMeshBufferCount(); 126 return Meshes[0]->getMeshBufferCount();
127 } 127 }
128 128
129 //! returns pointer to a mesh buffer 129 //! returns pointer to a mesh buffer
130 virtual IMeshBuffer* getMeshBuffer(u32 nr) const 130 virtual IMeshBuffer* getMeshBuffer(u32 nr) const
131 { 131 {
132 if (Meshes.empty()) 132 if (Meshes.empty())
133 return 0; 133 return 0;
134 134
135 return Meshes[0]->getMeshBuffer(nr); 135 return Meshes[0]->getMeshBuffer(nr);
136 } 136 }
137 137
138 //! Returns pointer to a mesh buffer which fits a material 138 //! Returns pointer to a mesh buffer which fits a material
139 /** \param material: material to search for 139 /** \param material: material to search for
140 \return Returns the pointer to the mesh buffer or 140 \return Returns the pointer to the mesh buffer or
141 NULL if there is no such mesh buffer. */ 141 NULL if there is no such mesh buffer. */
142 virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const 142 virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
143 { 143 {
144 if (Meshes.empty()) 144 if (Meshes.empty())
145 return 0; 145 return 0;
146 146
147 return Meshes[0]->getMeshBuffer(material); 147 return Meshes[0]->getMeshBuffer(material);
148 } 148 }
149 149
150 //! Set a material flag for all meshbuffers of this mesh. 150 //! Set a material flag for all meshbuffers of this mesh.
151 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) 151 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
152 { 152 {
153 for (u32 i=0; i<Meshes.size(); ++i) 153 for (u32 i=0; i<Meshes.size(); ++i)
154 Meshes[i]->setMaterialFlag(flag, newvalue); 154 Meshes[i]->setMaterialFlag(flag, newvalue);
155 } 155 }
156 156
157 //! set the hardware mapping hint, for driver 157 //! set the hardware mapping hint, for driver
158 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) 158 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
159 { 159 {
160 for (u32 i=0; i<Meshes.size(); ++i) 160 for (u32 i=0; i<Meshes.size(); ++i)
161 Meshes[i]->setHardwareMappingHint(newMappingHint, buffer); 161 Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
162 } 162 }
163 163
164 //! flags the meshbuffer as changed, reloads hardware buffers 164 //! flags the meshbuffer as changed, reloads hardware buffers
165 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) 165 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
166 { 166 {
167 for (u32 i=0; i<Meshes.size(); ++i) 167 for (u32 i=0; i<Meshes.size(); ++i)
168 Meshes[i]->setDirty(buffer); 168 Meshes[i]->setDirty(buffer);
169 } 169 }
170 170
171 //! All meshes defining the animated mesh 171 //! All meshes defining the animated mesh
172 core::array<IMesh*> Meshes; 172 core::array<IMesh*> Meshes;
173 173
174 //! The bounding box of this mesh 174 //! The bounding box of this mesh
175 core::aabbox3d<f32> Box; 175 core::aabbox3d<f32> Box;
176 176
177 //! Default animation speed of this mesh. 177 //! Default animation speed of this mesh.
178 f32 FramesPerSecond; 178 f32 FramesPerSecond;
179 179
180 //! The type of the mesh. 180 //! The type of the mesh.
181 E_ANIMATED_MESH_TYPE Type; 181 E_ANIMATED_MESH_TYPE Type;
182 }; 182 };
183 183
184 184
185} // end namespace scene 185} // end namespace scene
186} // end namespace irr 186} // end namespace irr
187 187
188#endif 188#endif
189 189