Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials
SAnimatedMesh.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2010 Nikolaus Gebhardt
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 __S_ANIMATED_MESH_H_INCLUDED__
6 #define __S_ANIMATED_MESH_H_INCLUDED__
7 
8 #include "IAnimatedMesh.h"
9 #include "IMesh.h"
10 #include "aabbox3d.h"
11 #include "irrArray.h"
12 
13 namespace irr
14 {
15 namespace scene
16 {
17 
19  struct SAnimatedMesh : public IAnimatedMesh
20  {
23  {
24  #ifdef _DEBUG
25  setDebugName("SAnimatedMesh");
26  #endif
27  addMesh(mesh);
29  }
30 
31 
33  virtual ~SAnimatedMesh()
34  {
35  // drop meshes
36  for (u32 i=0; i<Meshes.size(); ++i)
37  Meshes[i]->drop();
38  }
39 
40 
42 
43  virtual u32 getFrameCount() const
44  {
45  return Meshes.size();
46  }
47 
48 
50 
57  virtual IMesh* getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
58  {
59  if (Meshes.empty())
60  return 0;
61 
62  return Meshes[frame];
63  }
64 
65 
67  void addMesh(IMesh* mesh)
68  {
69  if (mesh)
70  {
71  mesh->grab();
72  Meshes.push_back(mesh);
73  }
74  }
75 
76 
78 
79  virtual const core::aabbox3d<f32>& getBoundingBox() const
80  {
81  return Box;
82  }
83 
84 
86  virtual void setBoundingBox(const core::aabbox3df& box)
87  {
88  Box = box;
89  }
90 
93  {
94  Box.reset(0,0,0);
95 
96  if (Meshes.empty())
97  return;
98 
99  Box = Meshes[0]->getBoundingBox();
100 
101  for (u32 i=1; i<Meshes.size(); ++i)
102  Box.addInternalBox(Meshes[i]->getBoundingBox());
103  }
104 
105 
108  {
109  return Type;
110  }
111 
112 
114  virtual u32 getMeshBufferCount() const
115  {
116  if (Meshes.empty())
117  return 0;
118 
119  return Meshes[0]->getMeshBufferCount();
120  }
121 
122 
124  virtual IMeshBuffer* getMeshBuffer(u32 nr) const
125  {
126  if (Meshes.empty())
127  return 0;
128 
129  return Meshes[0]->getMeshBuffer(nr);
130  }
131 
132 
134 
137  virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
138  {
139  if (Meshes.empty())
140  return 0;
141 
142  return Meshes[0]->getMeshBuffer(material);
143  }
144 
145 
147  virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
148  {
149  for (u32 i=0; i<Meshes.size(); ++i)
150  Meshes[i]->setMaterialFlag(flag, newvalue);
151  }
152 
155  {
156  for (u32 i=0; i<Meshes.size(); ++i)
157  Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
158  }
159 
162  {
163  for (u32 i=0; i<Meshes.size(); ++i)
164  Meshes[i]->setDirty(buffer);
165  }
166 
169 
172 
175  };
176 
177 
178 } // end namespace scene
179 } // end namespace irr
180 
181 #endif
182 

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Fri Mar 21 2014 04:40:17 by Doxygen (1.8.1.2)