5#ifndef DCPP_P_DYNAMIC_MESHBUFFER_HPP_INCLUDED
6#define DCPP_P_DYNAMIC_MESHBUFFER_HPP_INCLUDED
8#include <duckcpp/core/engine/IDynamicMeshBuffer.hpp>
10#include <duckcpp/core/engine/PVertexBuffer.hpp>
11#include <duckcpp/core/engine/PIndexBuffer.hpp>
43 virtual IIndexBuffer& getIndexBuffer()
const override
48 virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
override
51 newVertexBuffer->
grab();
55 VertexBuffer=newVertexBuffer;
58 virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
override
61 newIndexBuffer->
grab();
65 IndexBuffer=newIndexBuffer;
95 if (!getVertexBuffer().size())
96 BoundingBox.
reset(0,0,0);
99 BoundingBox.
reset(getVertexBuffer()[0].Pos);
148 if (cloneFlags & ECF_VERTICES)
151 clone->VertexBuffer->reallocate(numVertices);
154 clone->VertexBuffer->
push_back((*VertexBuffer)[i]);
156 clone->BoundingBox = BoundingBox;
162 clone->IndexBuffer->reallocate(numIndices);
165 clone->IndexBuffer->
push_back((*IndexBuffer)[i]);
171 clone->Material = Material;
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.hpp:126
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.hpp:96
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
void reset(T x, T y, T z)
Resets the bounding box to a one-point box.
Definition aabbox3d.hpp:50
void addInternalPoint(const vector3d< T > &p)
Adds a point to the bounding box.
Definition aabbox3d.hpp:74
Definition IDynamicMeshBuffer.hpp:19
Definition IIndexBuffer.hpp:20
virtual dcpp::uint32_kt size() const =0
Number of elements.
virtual void push_back(dcpp::uint32_kt value)=0
Add value to end. Note that for 16 bit index types values shouldn't be larger than dcpp::uint16_kt.
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
Class for holding a mesh with a single material.
Definition IMeshBuffer.hpp:41
@ ECF_INDICES
clone the vertices (or copy pointer for SSharedMeshBuffer)
Definition IMeshBuffer.hpp:205
Definition IVertexBuffer.hpp:19
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
virtual void push_back(const dcpp::video::S3DVertex &element)=0
Add vertex to end.
virtual dcpp::uint32_kt size() const =0
Number of elements.
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
Implementation of the IMeshBuffer interface for which can work with 16 and 32 bit indices as well as ...
Definition PDynamicMeshBuffer.hpp:19
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) override
Describe what kind of primitive geometry is used by the meshbuffer.
Definition PDynamicMeshBuffer.hpp:126
virtual const dcpp::video::SMaterial & getMaterial() const override
Get Material of this buffer.
Definition PDynamicMeshBuffer.hpp:69
virtual const dcpp::nub::aabbox3df & getBoundingBox() const override
Get bounding box.
Definition PDynamicMeshBuffer.hpp:81
E_PRIMITIVE_TYPE PrimitiveType
Primitive type used for rendering (triangles, lines, ...)
Definition PDynamicMeshBuffer.hpp:180
virtual dcpp::video::SMaterial & getMaterial() override
Get Material of this buffer.
Definition PDynamicMeshBuffer.hpp:75
virtual void recalculateBoundingBox() override
Recalculate bounding box.
Definition PDynamicMeshBuffer.hpp:93
virtual void setBoundingBox(const dcpp::nub::aabbox3df &box) override
Set bounding box.
Definition PDynamicMeshBuffer.hpp:87
virtual IMeshBuffer * createClone(int cloneFlags) const override
Create copy of the meshbuffer.
Definition PDynamicMeshBuffer.hpp:144
virtual E_PRIMITIVE_TYPE getPrimitiveType() const override
Get the kind of primitive geometry which is used by the meshbuffer.
Definition PDynamicMeshBuffer.hpp:132
PDynamicMeshBuffer(dcpp::video::E_VERTEX_TYPE vertexType, dcpp::video::E_INDEX_TYPE indexType)
constructor
Definition PDynamicMeshBuffer.hpp:22
virtual ~PDynamicMeshBuffer()
destructor
Definition PDynamicMeshBuffer.hpp:30
virtual void append(const IMeshBuffer *const other) override
Append the meshbuffer to the current buffer.
Definition PDynamicMeshBuffer.hpp:119
virtual void append(const void *const vertices, dcpp::uint32_kt numVertices, const dcpp::uint16_kt *const indices, dcpp::uint32_kt numIndices) override
Append the vertices and indices to the current buffer.
Definition PDynamicMeshBuffer.hpp:111
virtual EMESH_BUFFER_TYPE getType() const override
Returns type of the class implementing the IMeshBuffer.
Definition PDynamicMeshBuffer.hpp:138
Definition PIndexBuffer.hpp:16
Definition PVertexBuffer.hpp:17
Class for holding parameters for a material renderer.
Definition SMaterial.hpp:304
E_PRIMITIVE_TYPE
Enumeration for all primitive types there are.
Definition EPrimitiveTypes.hpp:15
@ EPT_TRIANGLES
Explicitly set all vertices for each triangle.
Definition EPrimitiveTypes.hpp:37
EMESH_BUFFER_TYPE
An enumeration for all types of built-in mesh buffers.
Definition EMeshBufferTypes.hpp:18
@ EMBT_DYNAMIC
PDynamicMeshBuffer (16 or 32 bit buffers)
Definition EMeshBufferTypes.hpp:29
E_VERTEX_TYPE
Enumeration for all vertex types there are.
Definition S3DVertex.hpp:19
As of Duckcpp 1.6, position2d is a synonym for vector2d.
Definition shared_device.hpp:34
unsigned int uint32_kt
32 bit unsigned variable.
Definition irrTypes.hpp:64
unsigned short uint16_kt
16 bit unsigned variable.
Definition irrTypes.hpp:46