#ifndef __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
#define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
#include "IMeshBuffer.h"
#include "IVertexBuffer.h"
#include "IIndexBuffer.h"
namespace irr
{
namespace scene
{
class IDynamicMeshBuffer : public IMeshBuffer
{
public:
virtual IVertexBuffer &getVertexBuffer() const =0;
virtual IIndexBuffer &getIndexBuffer() const =0;
virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0;
virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0;
virtual video::SMaterial& getMaterial() =0;
virtual const video::SMaterial& getMaterial() const =0;
virtual const core::aabbox3df& getBoundingBox() const =0;
virtual void setBoundingBox(const core::aabbox3df& box) =0;
virtual void recalculateBoundingBox() =0;
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
{
}
virtual void append(const IMeshBuffer* const other)
{
}
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
{
return getVertexBuffer().getHardwareMappingHint();
}
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
{
return getIndexBuffer().getHardwareMappingHint();
}
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX )
{
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
getVertexBuffer().setHardwareMappingHint(NewMappingHint);
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
getIndexBuffer().setHardwareMappingHint(NewMappingHint);
}
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
{
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
getVertexBuffer().setDirty();
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
getIndexBuffer().setDirty();
}
virtual u32 getChangedID_Vertex() const
{
return getVertexBuffer().getChangedID();
}
virtual u32 getChangedID_Index() const
{
return getIndexBuffer().getChangedID();
}
virtual video::E_VERTEX_TYPE getVertexType() const
{
return getVertexBuffer().getType();
}
virtual const void* getVertices() const
{
return getVertexBuffer().getData();
}
virtual void* getVertices()
{
return getVertexBuffer().getData();
}
virtual u32 getVertexCount() const
{
return getVertexBuffer().size();
}
virtual video::E_INDEX_TYPE getIndexType() const
{
return getIndexBuffer().getType();
}
virtual const u16* getIndices() const
{
return (u16*)getIndexBuffer().getData();
}
virtual u16* getIndices()
{
return (u16*)getIndexBuffer().getData();
}
virtual u32 getIndexCount() const
{
return getIndexBuffer().size();
}
virtual const core::vector3df& getPosition(u32 i) const
{
return getVertexBuffer()[i].Pos;
}
virtual core::vector3df& getPosition(u32 i)
{
return getVertexBuffer()[i].Pos;
}
virtual const core::vector2df& getTCoords(u32 i) const
{
return getVertexBuffer()[i].TCoords;
}
virtual core::vector2df& getTCoords(u32 i)
{
return getVertexBuffer()[i].TCoords;
}
virtual const core::vector3df& getNormal(u32 i) const
{
return getVertexBuffer()[i].Normal;
}
virtual core::vector3df& getNormal(u32 i)
{
return getVertexBuffer()[i].Normal;
}
};
}
}
#endif