3#include <Core/ResourceManager/Resource.h>
4#include <Foundation/Math/BoundingBoxSphere.h>
5#include <Foundation/Memory/AllocatorWrapper.h>
6#include <RendererCore/RendererCoreDLL.h>
7#include <RendererFoundation/Descriptors/Descriptors.h>
14 PL_DECLARE_POD_TYPE();
16 plGALVertexAttributeSemantic::Enum m_Semantic;
17 plUInt8 m_uiVertexBufferSlot = 0;
18 plGALResourceFormat::Enum m_Format;
41 plUInt32 AddStream(plGALVertexAttributeSemantic::Enum semantic, plGALResourceFormat::Enum format);
50 void AddCommonStreams();
54 void AllocateStreams(plUInt32 uiNumVertices, plGALPrimitiveTopology::Enum topology = plGALPrimitiveTopology::Triangles, plUInt32 uiNumPrimitives = 0,
bool bZeroFill =
false);
58 void AllocateStreamsFromGeometry(
const plGeometry& geom, plGALPrimitiveTopology::Enum topology = plGALPrimitiveTopology::Triangles);
77 template <
typename TYPE>
78 void SetVertexData(plUInt32 uiStream, plUInt32 uiVertexIndex,
const TYPE& data)
80 reinterpret_cast<TYPE&
>(m_VertexStreamData[m_uiVertexSize * uiVertexIndex + m_VertexDeclaration.m_VertexStreams[uiStream].m_uiOffset]) = data;
87 plArrayPtr<plUInt8> GetVertexData(plUInt32 uiStream, plUInt32 uiVertexIndex) {
return m_VertexStreamData.GetArrayPtr().
GetSubArray(m_uiVertexSize * uiVertexIndex + m_VertexDeclaration.m_VertexStreams[uiStream].m_uiOffset); }
90 void SetPointIndices(plUInt32 uiPoint, plUInt32 uiVertex0);
93 void SetLineIndices(plUInt32 uiLine, plUInt32 uiVertex0, plUInt32 uiVertex1);
96 void SetTriangleIndices(plUInt32 uiTriangle, plUInt32 uiVertex0, plUInt32 uiVertex1, plUInt32 uiVertex2);
108 plUInt32 GetPrimitiveCount()
const;
120 plGALPrimitiveTopology::Enum
GetTopology()
const {
return m_Topology; }
125 plGALPrimitiveTopology::Enum m_Topology;
126 plUInt32 m_uiVertexSize;
127 plUInt32 m_uiVertexCount;
147 PL_ALWAYS_INLINE plUInt32 GetPrimitiveCount()
const {
return m_uiPrimitiveCount; }
149 PL_ALWAYS_INLINE
plGALBufferHandle GetVertexBuffer()
const {
return m_hVertexBuffer; }
151 PL_ALWAYS_INLINE
plGALBufferHandle GetIndexBuffer()
const {
return m_hIndexBuffer; }
153 PL_ALWAYS_INLINE plGALPrimitiveTopology::Enum GetTopology()
const {
return m_Topology; }
164 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage)
override;
168 plUInt32 m_uiPrimitiveCount = 0;
171 plGALPrimitiveTopology::Enum m_Topology = plGALPrimitiveTopology::Enum::Default;
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
PL_FORCE_INLINE plArrayPtr< T > GetSubArray(plUInt32 uiStart, plUInt32 uiCount) const
Creates a sub-array from this array.
Definition ArrayPtr.h:148
Definition DynamicArray.h:81
Definition RendererFoundationDLL.h:418
Provides functions to generate standard geometric shapes, such as boxes, spheres, cylinders,...
Definition Geometry.h:17
This class provides a base class for hashable structs (e.g. descriptor objects).
Definition HashableStruct.h:17
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition MeshBufferResource.h:134
const plVertexDeclarationInfo & GetVertexDeclaration() const
Returns the vertex declaration used by this mesh buffer.
Definition MeshBufferResource.h:156
const plBoundingBoxSphere & GetBounds() const
Returns the bounds of the mesh.
Definition MeshBufferResource.h:159
The base class for all resources.
Definition Resource.h:10
Interface for binary in (read) streams.
Definition Stream.h:22
Definition MeshBufferResource.h:33
void SetVertexData(plUInt32 uiStream, plUInt32 uiVertexIndex, const TYPE &data)
Slow, but convenient method to write one piece of vertex data at a time into the stream buffer.
Definition MeshBufferResource.h:78
bool HasIndexBuffer() const
Returns whether an index buffer is available.
Definition MeshBufferResource.h:114
bool Uses32BitIndices() const
Returns whether 16 or 32 Bit indices are to be used.
Definition MeshBufferResource.h:111
plUInt32 GetVertexCount() const
Return the number of vertices, with which AllocateStreams() was called.
Definition MeshBufferResource.h:105
plArrayPtr< plUInt8 > GetVertexData(plUInt32 uiStream, plUInt32 uiVertexIndex)
Slow, but convenient method to access one piece of vertex data at a time into the stream buffer.
Definition MeshBufferResource.h:87
const plVertexDeclarationInfo & GetVertexDeclaration() const
Allows to read the stream info of the descriptor, which is filled out by AddStream()
Definition MeshBufferResource.h:99
plUInt32 GetVertexDataSize() const
Returns the byte size of all the data for one vertex.
Definition MeshBufferResource.h:102
plGALPrimitiveTopology::Enum GetTopology() const
Returns the primitive topology.
Definition MeshBufferResource.h:120
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition MeshBufferResource.h:24
Definition MeshBufferResource.h:13
plUInt16 m_uiOffset
at which byte offset the first element starts
Definition MeshBufferResource.h:19
plUInt16 m_uiElementSize
the number of bytes for this element type (depends on the format); this is not the stride between ele...
Definition MeshBufferResource.h:20