Loading...
Searching...
No Matches
CDynamicMeshBuffer.h
Go to the documentation of this file.
// Copyright (C) 2008-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#include "IDynamicMeshBuffer.h"
#include "CVertexBuffer.h"
#include "CIndexBuffer.h"
namespace irr
{
namespace scene
{
class CDynamicMeshBuffer: public IDynamicMeshBuffer
{
public:
CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
{
VertexBuffer=new CVertexBuffer(vertexType);
IndexBuffer=new CIndexBuffer(indexType);
}
virtual ~CDynamicMeshBuffer()
{
if (VertexBuffer)
VertexBuffer->drop();
if (IndexBuffer)
IndexBuffer->drop();
}
virtual IVertexBuffer& getVertexBuffer() const
{
return *VertexBuffer;
}
virtual IIndexBuffer& getIndexBuffer() const
{
return *IndexBuffer;
}
virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
{
if (newVertexBuffer)
newVertexBuffer->grab();
if (VertexBuffer)
VertexBuffer->drop();
VertexBuffer=newVertexBuffer;
}
virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
{
if (newIndexBuffer)
newIndexBuffer->grab();
if (IndexBuffer)
IndexBuffer->drop();
IndexBuffer=newIndexBuffer;
}
virtual const video::SMaterial& getMaterial() const
{
return Material;
}
virtual video::SMaterial& getMaterial()
{
return Material;
}
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return BoundingBox;
}
virtual void setBoundingBox( const core::aabbox3df& box)
{
BoundingBox = box;
}
virtual void recalculateBoundingBox()
{
if (!getVertexBuffer().size())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(getVertexBuffer()[0].Pos);
for (u32 i=1; i<getVertexBuffer().size(); ++i)
BoundingBox.addInternalPoint(getVertexBuffer()[i].Pos);
}
}
video::SMaterial Material;
core::aabbox3d<f32> BoundingBox;
private:
IVertexBuffer *VertexBuffer;
IIndexBuffer *IndexBuffer;
};
} // end namespace scene
} // end namespace irr
#endif
CIndexBuffer.h
CVertexBuffer.h
IDynamicMeshBuffer.h
irr::IReferenceCounted::grab
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:86
irr::core::aabbox3d
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
irr::scene::CDynamicMeshBuffer::getVertexBuffer
virtual IVertexBuffer & getVertexBuffer() const
Definition CDynamicMeshBuffer.h:37
irr::scene::CDynamicMeshBuffer::getMaterial
virtual const video::SMaterial & getMaterial() const
Get Material of this buffer.
Definition CDynamicMeshBuffer.h:68
irr::scene::CDynamicMeshBuffer::~CDynamicMeshBuffer
virtual ~CDynamicMeshBuffer()
destructor
Definition CDynamicMeshBuffer.h:29
irr::scene::CDynamicMeshBuffer::recalculateBoundingBox
virtual void recalculateBoundingBox()
Recalculate bounding box.
Definition CDynamicMeshBuffer.h:92
irr::scene::CDynamicMeshBuffer::setVertexBuffer
virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
Definition CDynamicMeshBuffer.h:47
irr::scene::CDynamicMeshBuffer::getIndexBuffer
virtual IIndexBuffer & getIndexBuffer() const
Definition CDynamicMeshBuffer.h:42
irr::scene::CDynamicMeshBuffer::getMaterial
virtual video::SMaterial & getMaterial()
Get Material of this buffer.
Definition CDynamicMeshBuffer.h:74
irr::scene::CDynamicMeshBuffer::BoundingBox
core::aabbox3d< f32 > BoundingBox
Definition CDynamicMeshBuffer.h:105
irr::scene::CDynamicMeshBuffer::setBoundingBox
virtual void setBoundingBox(const core::aabbox3df &box)
Set bounding box.
Definition CDynamicMeshBuffer.h:86
irr::scene::CDynamicMeshBuffer::setIndexBuffer
virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
Definition CDynamicMeshBuffer.h:57
irr::scene::CDynamicMeshBuffer::Material
video::SMaterial Material
Definition CDynamicMeshBuffer.h:104
irr::scene::CDynamicMeshBuffer::getBoundingBox
virtual const core::aabbox3d< f32 > & getBoundingBox() const
Get bounding box.
Definition CDynamicMeshBuffer.h:80
irr::scene::CDynamicMeshBuffer::CDynamicMeshBuffer
CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
constructor
Definition CDynamicMeshBuffer.h:22
irr::scene::CIndexBuffer
Definition CIndexBuffer.h:16
irr::scene::CVertexBuffer
Definition CVertexBuffer.h:17
irr::scene::IDynamicMeshBuffer
Definition IDynamicMeshBuffer.h:19
irr::scene::IIndexBuffer
Definition IIndexBuffer.h:25
irr::scene::IVertexBuffer
Definition IVertexBuffer.h:18
irr::scene::IVertexBuffer::size
virtual u32 size() const =0
irr::video::SMaterial
Struct for holding parameters for a material renderer.
Definition SMaterial.h:227
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::video::E_VERTEX_TYPE
E_VERTEX_TYPE
Enumeration for all vertex types there are.
Definition S3DVertex.h:19
irr::video::E_INDEX_TYPE
E_INDEX_TYPE
Definition SVertexIndex.h:16
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
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0