arsa  2.7
Public Member Functions | Public Attributes | List of all members
irr::scene::SAnimatedMesh Struct Reference

Simple implementation of the IAnimatedMesh interface. More...

#include <SAnimatedMesh.h>

Inheritance diagram for irr::scene::SAnimatedMesh:
irr::scene::IAnimatedMesh irr::scene::IMesh irr::IReferenceCounted

Public Member Functions

 SAnimatedMesh (scene::IMesh *mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN)
 constructor More...
 
virtual ~SAnimatedMesh ()
 destructor More...
 
virtual u32 getFrameCount () const _IRR_OVERRIDE_
 Gets the frame count of the animated mesh. More...
 
virtual f32 getAnimationSpeed () const _IRR_OVERRIDE_
 Gets the default animation speed of the animated mesh. More...
 
virtual void setAnimationSpeed (f32 fps) _IRR_OVERRIDE_
 Gets the frame count of the animated mesh. More...
 
virtual IMeshgetMesh (s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) _IRR_OVERRIDE_
 Returns the IMesh interface for a frame. More...
 
void addMesh (IMesh *mesh)
 adds a Mesh More...
 
virtual const core::aabbox3d< f32 > & getBoundingBox () const _IRR_OVERRIDE_
 Returns an axis aligned bounding box of the mesh. More...
 
virtual void setBoundingBox (const core::aabbox3df &box) _IRR_OVERRIDE_
 set user axis aligned bounding box More...
 
void recalculateBoundingBox ()
 Recalculates the bounding box. More...
 
virtual E_ANIMATED_MESH_TYPE getMeshType () const _IRR_OVERRIDE_
 Returns the type of the animated mesh. More...
 
virtual u32 getMeshBufferCount () const _IRR_OVERRIDE_
 returns amount of mesh buffers. More...
 
virtual IMeshBuffergetMeshBuffer (u32 nr) const _IRR_OVERRIDE_
 returns pointer to a mesh buffer More...
 
virtual IMeshBuffergetMeshBuffer (const video::SMaterial &material) const _IRR_OVERRIDE_
 Returns pointer to a mesh buffer which fits a material. More...
 
virtual void setMaterialFlag (video::E_MATERIAL_FLAG flag, bool newvalue) _IRR_OVERRIDE_
 Set a material flag for all meshbuffers of this mesh. More...
 
virtual void setHardwareMappingHint (E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
 set the hardware mapping hint, for driver More...
 
virtual void setDirty (E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
 flags the meshbuffer as changed, reloads hardware buffers More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 

Public Attributes

core::array< IMesh * > Meshes
 All meshes defining the animated mesh. More...
 
core::aabbox3d< f32Box
 The bounding box of this mesh. More...
 
f32 FramesPerSecond
 Default animation speed of this mesh. More...
 
E_ANIMATED_MESH_TYPE Type
 The type of the mesh. More...
 

Additional Inherited Members

- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Detailed Description

Simple implementation of the IAnimatedMesh interface.

Definition at line 19 of file SAnimatedMesh.h.

Constructor & Destructor Documentation

◆ SAnimatedMesh()

irr::scene::SAnimatedMesh::SAnimatedMesh ( scene::IMesh mesh = 0,
scene::E_ANIMATED_MESH_TYPE  type = scene::EAMT_UNKNOWN 
)
inline

constructor

Definition at line 22 of file SAnimatedMesh.h.

22  : IAnimatedMesh(), FramesPerSecond(25.f), Type(type)
23  {
24  #ifdef _DEBUG
25  setDebugName("SAnimatedMesh");
26  #endif
27  addMesh(mesh);
29  }
E_ANIMATED_MESH_TYPE Type
The type of the mesh.
void addMesh(IMesh *mesh)
adds a Mesh
Definition: SAnimatedMesh.h:78
f32 FramesPerSecond
Default animation speed of this mesh.
GLfloat f
void recalculateBoundingBox()
Recalculates the bounding box.
void setDebugName(const c8 *newName)
Sets the debug name of the object.
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571

◆ ~SAnimatedMesh()

virtual irr::scene::SAnimatedMesh::~SAnimatedMesh ( )
inlinevirtual

destructor

Definition at line 32 of file SAnimatedMesh.h.

33  {
34  // drop meshes
35  for (u32 i=0; i<Meshes.size(); ++i)
36  Meshes[i]->drop();
37  }
bool drop() const
Drops the object. Decrements the reference counter by one.
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

Member Function Documentation

◆ addMesh()

void irr::scene::SAnimatedMesh::addMesh ( IMesh mesh)
inline

adds a Mesh

Definition at line 78 of file SAnimatedMesh.h.

79  {
80  if (mesh)
81  {
82  mesh->grab();
83  Meshes.push_back(mesh);
84  }
85  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getAnimationSpeed()

virtual f32 irr::scene::SAnimatedMesh::getAnimationSpeed ( ) const
inlinevirtual

Gets the default animation speed of the animated mesh.

Returns
Amount of frames per second. If the amount is 0, it is a static, non animated mesh.

Implements irr::scene::IAnimatedMesh.

Definition at line 48 of file SAnimatedMesh.h.

49  {
50  return FramesPerSecond;
51  }
f32 FramesPerSecond
Default animation speed of this mesh.

◆ getBoundingBox()

virtual const core::aabbox3d<f32>& irr::scene::SAnimatedMesh::getBoundingBox ( ) const
inlinevirtual

Returns an axis aligned bounding box of the mesh.

Returns
A bounding box of this mesh is returned.

Implements irr::scene::IMesh.

Definition at line 89 of file SAnimatedMesh.h.

90  {
91  return Box;
92  }
core::aabbox3d< f32 > Box
The bounding box of this mesh.

◆ getFrameCount()

virtual u32 irr::scene::SAnimatedMesh::getFrameCount ( ) const
inlinevirtual

Gets the frame count of the animated mesh.

Returns
Amount of frames. If the amount is 1, it is a static, non animated mesh.

Implements irr::scene::IAnimatedMesh.

Definition at line 41 of file SAnimatedMesh.h.

42  {
43  return Meshes.size();
44  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getMesh()

virtual IMesh* irr::scene::SAnimatedMesh::getMesh ( s32  frame,
s32  detailLevel = 255,
s32  startFrameLoop = -1,
s32  endFrameLoop = -1 
)
inlinevirtual

Returns the IMesh interface for a frame.

Parameters
frameFrame number as zero based index. The maximum frame number is getFrameCount() - 1;
detailLevelLevel of detail. 0 is the lowest, 255 the highest level of detail. Most meshes will ignore the detail level.
startFrameLoopstart frame
endFrameLoopend frame
Returns
The animated mesh based on a detail level.

Implements irr::scene::IAnimatedMesh.

Definition at line 69 of file SAnimatedMesh.h.

70  {
71  if (Meshes.empty())
72  return 0;
73 
74  return Meshes[frame];
75  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getMeshBuffer() [1/2]

virtual IMeshBuffer* irr::scene::SAnimatedMesh::getMeshBuffer ( u32  nr) const
inlinevirtual

returns pointer to a mesh buffer

Implements irr::scene::IMesh.

Definition at line 130 of file SAnimatedMesh.h.

131  {
132  if (Meshes.empty())
133  return 0;
134 
135  return Meshes[0]->getMeshBuffer(nr);
136  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getMeshBuffer() [2/2]

virtual IMeshBuffer* irr::scene::SAnimatedMesh::getMeshBuffer ( const video::SMaterial material) const
inlinevirtual

Returns pointer to a mesh buffer which fits a material.

Parameters
materialmaterial to search for
Returns
Returns the pointer to the mesh buffer or NULL if there is no such mesh buffer.

Implements irr::scene::IMesh.

Definition at line 142 of file SAnimatedMesh.h.

143  {
144  if (Meshes.empty())
145  return 0;
146 
147  return Meshes[0]->getMeshBuffer(material);
148  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getMeshBufferCount()

virtual u32 irr::scene::SAnimatedMesh::getMeshBufferCount ( ) const
inlinevirtual

returns amount of mesh buffers.

Implements irr::scene::IMesh.

Definition at line 121 of file SAnimatedMesh.h.

122  {
123  if (Meshes.empty())
124  return 0;
125 
126  return Meshes[0]->getMeshBufferCount();
127  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.

◆ getMeshType()

virtual E_ANIMATED_MESH_TYPE irr::scene::SAnimatedMesh::getMeshType ( ) const
inlinevirtual

Returns the type of the animated mesh.

Reimplemented from irr::scene::IAnimatedMesh.

Definition at line 115 of file SAnimatedMesh.h.

116  {
117  return Type;
118  }
E_ANIMATED_MESH_TYPE Type
The type of the mesh.

◆ recalculateBoundingBox()

void irr::scene::SAnimatedMesh::recalculateBoundingBox ( )
inline

Recalculates the bounding box.

Definition at line 101 of file SAnimatedMesh.h.

102  {
103  Box.reset(0,0,0);
104 
105  if (Meshes.empty())
106  return;
107 
108  Box = Meshes[0]->getBoundingBox();
109 
110  for (u32 i=1; i<Meshes.size(); ++i)
111  Box.addInternalBox(Meshes[i]->getBoundingBox());
112  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
void reset(T x, T y, T z)
Resets the bounding box to a one-point box.
Definition: aabbox3d.h:50
void addInternalBox(const aabbox3d< T > &b)
Adds another bounding box.
Definition: aabbox3d.h:82
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
core::aabbox3d< f32 > Box
The bounding box of this mesh.

◆ setAnimationSpeed()

virtual void irr::scene::SAnimatedMesh::setAnimationSpeed ( f32  fps)
inlinevirtual

Gets the frame count of the animated mesh.

Parameters
fpsFrames per second to play the animation with. If the amount is 0, it is not animated. The actual speed is set in the scene node the mesh is instantiated in.

Implements irr::scene::IAnimatedMesh.

Definition at line 56 of file SAnimatedMesh.h.

57  {
58  FramesPerSecond=fps;
59  }
f32 FramesPerSecond
Default animation speed of this mesh.

◆ setBoundingBox()

virtual void irr::scene::SAnimatedMesh::setBoundingBox ( const core::aabbox3df box)
inlinevirtual

set user axis aligned bounding box

Implements irr::scene::IMesh.

Definition at line 95 of file SAnimatedMesh.h.

96  {
97  Box = box;
98  }
core::aabbox3d< f32 > Box
The bounding box of this mesh.

◆ setDirty()

virtual void irr::scene::SAnimatedMesh::setDirty ( E_BUFFER_TYPE  buffer = EBT_VERTEX_AND_INDEX)
inlinevirtual

flags the meshbuffer as changed, reloads hardware buffers

Implements irr::scene::IMesh.

Definition at line 165 of file SAnimatedMesh.h.

166  {
167  for (u32 i=0; i<Meshes.size(); ++i)
168  Meshes[i]->setDirty(buffer);
169  }
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
flags the meshbuffer as changed, reloads hardware buffers
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint buffer

◆ setHardwareMappingHint()

virtual void irr::scene::SAnimatedMesh::setHardwareMappingHint ( E_HARDWARE_MAPPING  newMappingHint,
E_BUFFER_TYPE  buffer = EBT_VERTEX_AND_INDEX 
)
inlinevirtual

set the hardware mapping hint, for driver

Implements irr::scene::IMesh.

Definition at line 158 of file SAnimatedMesh.h.

159  {
160  for (u32 i=0; i<Meshes.size(); ++i)
161  Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
162  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
set the hardware mapping hint, for driver
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint buffer

◆ setMaterialFlag()

virtual void irr::scene::SAnimatedMesh::setMaterialFlag ( video::E_MATERIAL_FLAG  flag,
bool  newvalue 
)
inlinevirtual

Set a material flag for all meshbuffers of this mesh.

Implements irr::scene::IMesh.

Definition at line 151 of file SAnimatedMesh.h.

152  {
153  for (u32 i=0; i<Meshes.size(); ++i)
154  Meshes[i]->setMaterialFlag(flag, newvalue);
155  }
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) _IRR_OVERRIDE_
Set a material flag for all meshbuffers of this mesh.

Member Data Documentation

◆ Box

core::aabbox3d<f32> irr::scene::SAnimatedMesh::Box

The bounding box of this mesh.

Definition at line 175 of file SAnimatedMesh.h.

◆ FramesPerSecond

f32 irr::scene::SAnimatedMesh::FramesPerSecond

Default animation speed of this mesh.

Definition at line 178 of file SAnimatedMesh.h.

◆ Meshes

core::array<IMesh*> irr::scene::SAnimatedMesh::Meshes

All meshes defining the animated mesh.

Definition at line 172 of file SAnimatedMesh.h.

◆ Type

E_ANIMATED_MESH_TYPE irr::scene::SAnimatedMesh::Type

The type of the mesh.

Definition at line 181 of file SAnimatedMesh.h.


The documentation for this struct was generated from the following file: