5#ifndef DCPP_T_MESH_BUFFER_HPP_INCLUDED
6#define DCPP_T_MESH_BUFFER_HPP_INCLUDED
8#include <duckcpp/core/engine/irrArray.hpp>
9#include <duckcpp/core/engine/IMeshBuffer.hpp>
22 : ChangedID_Vertex(1), ChangedID_Index(1)
75 return dcpp::video::EIT_16BIT;
204 Vertices.reallocate(vertexCount+numVertices);
205 for (i=0; i<numVertices; ++i)
207 Vertices.push_back(
static_cast<const T*
>(vertices)[i]);
212 for (i=0; i<numIndices; ++i)
259 return MappingHint_Index;
268 MappingHint_Index=NewMappingHint;
311 if (cloneFlags & ECF_VERTICES)
325 clone->MappingHint_Index = MappingHint_Index;
void setDebugName(const dcpp::char_kt *newName)
Sets the debug name of the object.
Definition IReferenceCounted.hpp:163
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
void reallocate(dcpp::uint32_kt new_size, bool canShrink=true)
Reallocates the array, make it bigger or smaller.
Definition irrArray.hpp:66
T * pointer()
Gets a pointer to the array.
Definition irrArray.hpp:381
dcpp::uint32_kt size() const
Get number of occupied elements of the array.
Definition irrArray.hpp:397
const T * const_pointer() const
Gets a const pointer to the array.
Definition irrArray.hpp:389
void push_back(const T &element)
Adds an element at back of array.
Definition irrArray.hpp:111
2d vector template class with lots of operators and methods.
Definition vector2d.hpp:22
3d vector template class with lots of operators and methods.
Definition vector3d.hpp:32
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
Template implementation of the IMeshBuffer interface for 16-bit buffers.
Definition PMeshBuffer.hpp:18
virtual dcpp::video::E_INDEX_TYPE getIndexType() const override
Get type of index data which is stored in this meshbuffer.
Definition PMeshBuffer.hpp:73
virtual const dcpp::video::SColor & getColor(dcpp::uint32_kt i) const override
returns color of vertex i
Definition PMeshBuffer.hpp:186
virtual dcpp::uint32_kt getIndexCount() const override
Get number of indices.
Definition PMeshBuffer.hpp:96
EMESH_BUFFER_TYPE getTypeT() const
Returns type of the class implementing the IMeshBuffer for template specialization.
PMeshBuffer()
Default constructor for empty meshbuffer.
Definition PMeshBuffer.hpp:21
virtual dcpp::uint32_kt getVertexCount() const override
Get number of vertices.
Definition PMeshBuffer.hpp:66
dcpp::video::SMaterial Material
Material for this meshbuffer.
Definition PMeshBuffer.hpp:343
virtual dcpp::video::SColor & getColor(dcpp::uint32_kt i) override
returns color of vertex i
Definition PMeshBuffer.hpp:180
virtual dcpp::uint32_kt getChangedID_Index() const override
Get the currently used ID for identification of changes.
Definition PMeshBuffer.hpp:298
virtual IMeshBuffer * createClone(int cloneFlags) const override
Create copy of the meshbuffer.
Definition PMeshBuffer.hpp:307
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
get the current hardware mapping hint
Definition PMeshBuffer.hpp:251
virtual EMESH_BUFFER_TYPE getType() const override
Returns type of the class implementing the IMeshBuffer.
Definition PMeshBuffer.hpp:301
virtual dcpp::nub::vector3df & getNormal(dcpp::uint32_kt i) override
returns normal of vertex i
Definition PMeshBuffer.hpp:162
dcpp::nub::array< dcpp::uint16_kt > Indices
Indices into the vertices of this buffer.
Definition PMeshBuffer.hpp:347
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 PMeshBuffer.hpp:196
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const override
get the current hardware mapping hint
Definition PMeshBuffer.hpp:257
virtual const dcpp::video::SMaterial & getMaterial() const override
Get material of this meshbuffer.
Definition PMeshBuffer.hpp:34
virtual const void * getVertices() const override
Get pointer to vertices.
Definition PMeshBuffer.hpp:50
virtual dcpp::video::SMaterial & getMaterial() override
Get material of this meshbuffer.
Definition PMeshBuffer.hpp:42
virtual void append(const IMeshBuffer *const other) override
Append the meshbuffer to the current buffer.
Definition PMeshBuffer.hpp:225
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) override
Describe what kind of primitive geometry is used by the meshbuffer.
Definition PMeshBuffer.hpp:272
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override
set the hardware mapping hint, for driver
Definition PMeshBuffer.hpp:263
virtual E_PRIMITIVE_TYPE getPrimitiveType() const override
Get the kind of primitive geometry which is used by the meshbuffer.
Definition PMeshBuffer.hpp:278
virtual dcpp::uint32_kt getChangedID_Vertex() const override
Get the currently used ID for identification of changes.
Definition PMeshBuffer.hpp:294
dcpp::nub::array< T > Vertices
Vertices of this buffer.
Definition PMeshBuffer.hpp:345
E_HARDWARE_MAPPING MappingHint_Vertex
hardware mapping hint
Definition PMeshBuffer.hpp:339
virtual void recalculateBoundingBox() override
Recalculate the bounding box.
Definition PMeshBuffer.hpp:121
virtual const dcpp::nub::vector3df & getPosition(dcpp::uint32_kt i) const override
returns position of vertex i
Definition PMeshBuffer.hpp:144
virtual dcpp::nub::vector2df & getTCoords(dcpp::uint32_kt i) override
returns texture coord of vertex i
Definition PMeshBuffer.hpp:174
virtual const dcpp::nub::aabbox3df & getBoundingBox() const override
Get the axis aligned bounding box.
Definition PMeshBuffer.hpp:104
virtual void setBoundingBox(const dcpp::nub::aabbox3df &box) override
Set the axis aligned bounding box.
Definition PMeshBuffer.hpp:113
virtual const dcpp::nub::vector2df & getTCoords(dcpp::uint32_kt i) const override
returns texture coord of vertex i
Definition PMeshBuffer.hpp:168
dcpp::nub::aabbox3df BoundingBox
Bounding box of this meshbuffer.
Definition PMeshBuffer.hpp:349
virtual dcpp::nub::vector3df & getPosition(dcpp::uint32_kt i) override
returns position of vertex i
Definition PMeshBuffer.hpp:150
virtual const dcpp::nub::vector3df & getNormal(dcpp::uint32_kt i) const override
returns normal of vertex i
Definition PMeshBuffer.hpp:156
E_PRIMITIVE_TYPE PrimitiveType
Primitive type used for rendering (triangles, lines, ...)
Definition PMeshBuffer.hpp:351
virtual const dcpp::uint16_kt * getIndices() const override
Get pointer to indices.
Definition PMeshBuffer.hpp:80
virtual dcpp::uint16_kt * getIndices() override
Get pointer to indices.
Definition PMeshBuffer.hpp:88
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override
flags the mesh as changed, reloads hardware buffers
Definition PMeshBuffer.hpp:284
virtual void * getVertices() override
Get pointer to vertices.
Definition PMeshBuffer.hpp:58
virtual dcpp::video::E_VERTEX_TYPE getVertexType() const override
Get type of vertex data stored in this buffer.
Definition PMeshBuffer.hpp:138
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
Class for holding parameters for a material renderer.
Definition SMaterial.hpp:304
E_BUFFER_TYPE
Definition EHardwareBufferFlags.hpp:29
@ EBT_INDEX
Change the index mapping.
Definition EHardwareBufferFlags.hpp:35
@ EBT_VERTEX_AND_INDEX
Change both vertex and index mapping to the same value.
Definition EHardwareBufferFlags.hpp:37
@ EBT_VERTEX
Change the vertex mapping.
Definition EHardwareBufferFlags.hpp:33
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_STANDARD
SMeshBuffer (16 bit buffers)
Definition EMeshBufferTypes.hpp:20
@ EMBT_LIGHTMAP
SMeshBufferLightMap (16 bit buffers)
Definition EMeshBufferTypes.hpp:23
@ EMBT_TANGENTS
SMeshBufferTangents (16 bit buffers)
Definition EMeshBufferTypes.hpp:26
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.hpp:14
@ EHM_NEVER
Don't store on the hardware.
Definition EHardwareBufferFlags.hpp:16
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