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

Simple implementation of the IMesh interface. More...

#include <SMesh.h>

Inheritance diagram for irr::scene::SMesh:
irr::scene::IMesh irr::IReferenceCounted

Public Member Functions

 SMesh ()
 constructor More...
 
virtual ~SMesh ()
 destructor More...
 
virtual void clear ()
 clean 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 a meshbuffer which fits a material More...
 
virtual const core::aabbox3d< f32 > & getBoundingBox () const _IRR_OVERRIDE_
 returns an axis aligned bounding box More...
 
virtual void setBoundingBox (const core::aabbox3df &box) _IRR_OVERRIDE_
 set user axis aligned bounding box More...
 
void recalculateBoundingBox ()
 recalculates the bounding box More...
 
void addMeshBuffer (IMeshBuffer *buf)
 adds a MeshBuffer More...
 
virtual void setMaterialFlag (video::E_MATERIAL_FLAG flag, bool newvalue) _IRR_OVERRIDE_
 sets a flag of all contained materials to a new value 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::scene::IMesh
virtual E_ANIMATED_MESH_TYPE getMeshType () const
 Returns the type of the meshes. 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< IMeshBuffer * > MeshBuffers
 The meshbuffers of this mesh. More...
 
core::aabbox3d< f32BoundingBox
 The bounding box of this 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 IMesh interface.

Definition at line 18 of file SMesh.h.

Constructor & Destructor Documentation

◆ SMesh()

irr::scene::SMesh::SMesh ( )
inline

constructor

Definition at line 21 of file SMesh.h.

22  {
23  #ifdef _DEBUG
24  setDebugName("SMesh");
25  #endif
26  }
void setDebugName(const c8 *newName)
Sets the debug name of the object.

◆ ~SMesh()

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

destructor

Definition at line 29 of file SMesh.h.

30  {
31  // drop buffers
32  for (u32 i=0; i<MeshBuffers.size(); ++i)
33  MeshBuffers[i]->drop();
34  }
bool drop() const
Drops the object. Decrements the reference counter by one.
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

Member Function Documentation

◆ addMeshBuffer()

void irr::scene::SMesh::addMeshBuffer ( IMeshBuffer buf)
inline

adds a MeshBuffer

The bounding box is not updated automatically.

Definition at line 111 of file SMesh.h.

112  {
113  if (buf)
114  {
115  buf->grab();
116  MeshBuffers.push_back(buf);
117  }
118  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
GLenum GLuint GLenum GLsizei const GLchar * buf

◆ clear()

virtual void irr::scene::SMesh::clear ( void  )
inlinevirtual

clean mesh

Definition at line 37 of file SMesh.h.

38  {
39  for (u32 i=0; i<MeshBuffers.size(); ++i)
40  MeshBuffers[i]->drop();
41  MeshBuffers.clear();
42  BoundingBox.reset ( 0.f, 0.f, 0.f );
43  }
bool drop() const
Drops the object. Decrements the reference counter by one.
core::aabbox3d< f32 > BoundingBox
The bounding box of this mesh.
Definition: SMesh.h:145
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
void reset(T x, T y, T z)
Resets the bounding box to a one-point box.
Definition: aabbox3d.h:50
GLfloat f
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ getBoundingBox()

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

returns an axis aligned bounding box

Implements irr::scene::IMesh.

Definition at line 72 of file SMesh.h.

73  {
74  return BoundingBox;
75  }
core::aabbox3d< f32 > BoundingBox
The bounding box of this mesh.
Definition: SMesh.h:145

◆ getMeshBuffer() [1/2]

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

returns pointer to a mesh buffer

Implements irr::scene::IMesh.

Definition at line 53 of file SMesh.h.

54  {
55  return MeshBuffers[nr];
56  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142

◆ getMeshBuffer() [2/2]

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

returns a meshbuffer which fits a material

reverse search

Implements irr::scene::IMesh.

Definition at line 60 of file SMesh.h.

61  {
62  for (s32 i = (s32)MeshBuffers.size()-1; i >= 0; --i)
63  {
64  if ( material == MeshBuffers[i]->getMaterial())
65  return MeshBuffers[i];
66  }
67 
68  return 0;
69  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70

◆ getMeshBufferCount()

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

returns amount of mesh buffers.

Implements irr::scene::IMesh.

Definition at line 47 of file SMesh.h.

48  {
49  return MeshBuffers.size();
50  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142

◆ recalculateBoundingBox()

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

recalculates the bounding box

Definition at line 84 of file SMesh.h.

85  {
86  bool hasMeshBufferBBox = false;
87  for (u32 i=0; i<MeshBuffers.size(); ++i)
88  {
89  const core::aabbox3df& bb = MeshBuffers[i]->getBoundingBox();
90  if ( !bb.isEmpty() )
91  {
92  if ( !hasMeshBufferBBox )
93  {
94  hasMeshBufferBBox = true;
95  BoundingBox = bb;
96  }
97  else
98  {
100  }
101 
102  }
103  }
104 
105  if ( !hasMeshBufferBBox )
106  BoundingBox.reset(0.0f, 0.0f, 0.0f);
107  }
core::aabbox3d< f32 > BoundingBox
The bounding box of this mesh.
Definition: SMesh.h:145
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
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
aabbox3d< f32 > aabbox3df
Typedef for a f32 3d bounding box.
Definition: aabbox3d.h:361
GLfloat f
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ setBoundingBox()

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

set user axis aligned bounding box

Implements irr::scene::IMesh.

Definition at line 78 of file SMesh.h.

79  {
80  BoundingBox = box;
81  }
core::aabbox3d< f32 > BoundingBox
The bounding box of this mesh.
Definition: SMesh.h:145

◆ setDirty()

virtual void irr::scene::SMesh::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 135 of file SMesh.h.

136  {
137  for (u32 i=0; i<MeshBuffers.size(); ++i)
139  }
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
flags the meshbuffer as changed, reloads hardware buffers
Definition: SMesh.h:135
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint buffer

◆ setHardwareMappingHint()

virtual void irr::scene::SMesh::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 128 of file SMesh.h.

129  {
130  for (u32 i=0; i<MeshBuffers.size(); ++i)
131  MeshBuffers[i]->setHardwareMappingHint(newMappingHint, buffer);
132  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint buffer
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
set the hardware mapping hint, for driver
Definition: SMesh.h:128

◆ setMaterialFlag()

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

sets a flag of all contained materials to a new value

Implements irr::scene::IMesh.

Definition at line 121 of file SMesh.h.

122  {
123  for (u32 i=0; i<MeshBuffers.size(); ++i)
124  MeshBuffers[i]->getMaterial().setFlag(flag, newvalue);
125  }
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition: SMesh.h:142
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

Member Data Documentation

◆ BoundingBox

core::aabbox3d<f32> irr::scene::SMesh::BoundingBox

The bounding box of this mesh.

Definition at line 145 of file SMesh.h.

◆ MeshBuffers

core::array<IMeshBuffer*> irr::scene::SMesh::MeshBuffers

The meshbuffers of this mesh.

Definition at line 142 of file SMesh.h.


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