Loading...
Searching...
No Matches
SMesh.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_MESH_H_INCLUDED__
#define __S_MESH_H_INCLUDED__
#include "IMesh.h"
#include "IMeshBuffer.h"
#include "aabbox3d.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
struct SMesh : public IMesh
{
SMesh()
{
#ifdef _DEBUG
setDebugName("SMesh");
#endif
}
virtual ~SMesh()
{
// drop buffers
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->drop();
}
virtual void clear()
{
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->drop();
MeshBuffers.clear();
BoundingBox.reset ( 0.f, 0.f, 0.f );
}
virtual u32 getMeshBufferCount() const
{
return MeshBuffers.size();
}
virtual IMeshBuffer* getMeshBuffer(u32 nr) const
{
return MeshBuffers[nr];
}
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const
{
for (s32 i = (s32)MeshBuffers.size()-1; i >= 0; --i)
{
if ( material == MeshBuffers[i]->getMaterial())
return MeshBuffers[i];
}
return 0;
}
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return BoundingBox;
}
virtual void setBoundingBox( const core::aabbox3df& box)
{
BoundingBox = box;
}
void recalculateBoundingBox()
{
if (MeshBuffers.size())
{
BoundingBox = MeshBuffers[0]->getBoundingBox();
for (u32 i=1; i<MeshBuffers.size(); ++i)
BoundingBox.addInternalBox(MeshBuffers[i]->getBoundingBox());
}
else
BoundingBox.reset(0.0f, 0.0f, 0.0f);
}
void addMeshBuffer(IMeshBuffer* buf)
{
if (buf)
{
buf->grab();
MeshBuffers.push_back(buf);
}
}
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->getMaterial().setFlag(flag, newvalue);
}
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
{
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->setHardwareMappingHint(newMappingHint, buffer);
}
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
{
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->setDirty(buffer);
}
core::array<IMeshBuffer*> MeshBuffers;
core::aabbox3d<f32> BoundingBox;
};
} // end namespace scene
} // end namespace irr
#endif
IMesh.h
IMeshBuffer.h
aabbox3d.h
irr::IReferenceCounted::drop
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.h:116
irr::IReferenceCounted::grab
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:86
irr::IReferenceCounted::setDebugName
void setDebugName(const c8 *newName)
Sets the debug name of the object.
Definition IReferenceCounted.h:153
irr::core::aabbox3d
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
irr::core::array
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
irr::scene::IMeshBuffer
Struct for holding a mesh with a single material.
Definition IMeshBuffer.h:40
irr::scene::IMesh
Class which holds the geometry of an object.
Definition IMesh.h:24
irr::video::SMaterial
Struct for holding parameters for a material renderer.
Definition SMaterial.h:227
irrArray.h
irr::core::aabbox3df
aabbox3d< f32 > aabbox3df
Typedef for a f32 3d bounding box.
Definition aabbox3d.h:324
irr::scene
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CDynamicMeshBuffer.h:16
irr::scene::E_BUFFER_TYPE
E_BUFFER_TYPE
Definition EHardwareBufferFlags.h:29
irr::scene::EBT_VERTEX_AND_INDEX
@ EBT_VERTEX_AND_INDEX
Change both vertex and index mapping to the same value.
Definition EHardwareBufferFlags.h:37
irr::scene::E_HARDWARE_MAPPING
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.h:14
irr::video::E_MATERIAL_FLAG
E_MATERIAL_FLAG
Material flags.
Definition EMaterialFlags.h:15
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
irr::scene::SMesh::getMeshBufferCount
virtual u32 getMeshBufferCount() const
returns amount of mesh buffers.
Definition SMesh.h:47
irr::scene::SMesh::setMaterialFlag
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
sets a flag of all contained materials to a new value
Definition SMesh.h:108
irr::scene::SMesh::getBoundingBox
virtual const core::aabbox3d< f32 > & getBoundingBox() const
returns an axis aligned bounding box
Definition SMesh.h:72
irr::scene::SMesh::setDirty
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
flags the meshbuffer as changed, reloads hardware buffers
Definition SMesh.h:122
irr::scene::SMesh::setBoundingBox
virtual void setBoundingBox(const core::aabbox3df &box)
set user axis aligned bounding box
Definition SMesh.h:78
irr::scene::SMesh::setHardwareMappingHint
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
set the hardware mapping hint, for driver
Definition SMesh.h:115
irr::scene::SMesh::recalculateBoundingBox
void recalculateBoundingBox()
recalculates the bounding box
Definition SMesh.h:84
irr::scene::SMesh::addMeshBuffer
void addMeshBuffer(IMeshBuffer *buf)
adds a MeshBuffer
Definition SMesh.h:98
irr::scene::SMesh::clear
virtual void clear()
clean mesh
Definition SMesh.h:37
irr::scene::SMesh::getMeshBuffer
virtual IMeshBuffer * getMeshBuffer(const video::SMaterial &material) const
returns a meshbuffer which fits a material
Definition SMesh.h:60
irr::scene::SMesh::SMesh
SMesh()
constructor
Definition SMesh.h:21
irr::scene::SMesh::~SMesh
virtual ~SMesh()
destructor
Definition SMesh.h:29
irr::scene::SMesh::BoundingBox
core::aabbox3d< f32 > BoundingBox
The bounding box of this mesh.
Definition SMesh.h:132
irr::scene::SMesh::getMeshBuffer
virtual IMeshBuffer * getMeshBuffer(u32 nr) const
returns pointer to a mesh buffer
Definition SMesh.h:53
irr::scene::SMesh::MeshBuffers
core::array< IMeshBuffer * > MeshBuffers
The meshbuffers of this mesh.
Definition SMesh.h:129
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0