ezEngine  Release 25.03
ezMeshBufferResourceDescriptor Struct Reference

Public Member Functions

void Clear ()
 
ezUInt32 AddStream (ezGALVertexAttributeSemantic::Enum semantic, ezGALResourceFormat::Enum format)
 Use this function to add vertex streams to the mesh buffer. The return value is the index of the just added stream.
 
void AddCommonStreams ()
 Adds common vertex streams to the mesh buffer. More...
 
void AllocateStreams (ezUInt32 uiNumVertices, ezGALPrimitiveTopology::Enum topology=ezGALPrimitiveTopology::Triangles, ezUInt32 uiNumPrimitives=0, bool bZeroFill=false)
 After all streams are added, call this to allocate the data for the streams. If uiNumPrimitives is 0, the mesh buffer will not use indexed rendering.
 
void AllocateStreamsFromGeometry (const ezGeometry &geom, ezGALPrimitiveTopology::Enum topology=ezGALPrimitiveTopology::Triangles)
 Creates streams and fills them with data from the ezGeometry. Only the geometry matching the given topology is used. Streams that do not match any of the data inside the ezGeometry directly are skipped.
 
ezArrayPtr< const ezUInt8 > GetVertexBufferData () const
 Gives read access to the allocated vertex data.
 
ezArrayPtr< const ezUInt8 > GetIndexBufferData () const
 Gives read access to the allocated index data.
 
ezDynamicArray< ezUInt8, ezAlignedAllocatorWrapper > & GetVertexBufferData ()
 Allows write access to the allocated vertex data. This can be used for copying data fast into the array.
 
ezDynamicArray< ezUInt8, ezAlignedAllocatorWrapper > & GetIndexBufferData ()
 Allows write access to the allocated index data. This can be used for copying data fast into the array.
 
template<typename TYPE >
void SetVertexData (ezUInt32 uiStream, ezUInt32 uiVertexIndex, const TYPE &data)
 Slow, but convenient method to write one piece of vertex data at a time into the stream buffer. More...
 
ezArrayPtr< ezUInt8 > GetVertexData (ezUInt32 uiStream, ezUInt32 uiVertexIndex)
 Slow, but convenient method to access one piece of vertex data at a time into the stream buffer. More...
 
void SetPointIndices (ezUInt32 uiPoint, ezUInt32 uiVertex0)
 Writes the vertex index for the given point into the index buffer.
 
void SetLineIndices (ezUInt32 uiLine, ezUInt32 uiVertex0, ezUInt32 uiVertex1)
 Writes the two vertex indices for the given line into the index buffer.
 
void SetTriangleIndices (ezUInt32 uiTriangle, ezUInt32 uiVertex0, ezUInt32 uiVertex1, ezUInt32 uiVertex2)
 Writes the three vertex indices for the given triangle into the index buffer.
 
const ezVertexDeclarationInfoGetVertexDeclaration () const
 Allows to read the stream info of the descriptor, which is filled out by AddStream()
 
ezUInt32 GetVertexDataSize () const
 Returns the byte size of all the data for one vertex.
 
ezUInt32 GetVertexCount () const
 Return the number of vertices, with which AllocateStreams() was called.
 
ezUInt32 GetPrimitiveCount () const
 Returns the number of primitives that the array holds.
 
bool Uses32BitIndices () const
 Returns whether 16 or 32 Bit indices are to be used.
 
bool HasIndexBuffer () const
 Returns whether an index buffer is available.
 
ezBoundingBoxSphere ComputeBounds () const
 Calculates the bounds using the data from the position stream.
 
ezGALPrimitiveTopology::Enum GetTopology () const
 Returns the primitive topology.
 
ezResult RecomputeNormals ()
 

Member Function Documentation

◆ AddCommonStreams()

void ezMeshBufferResourceDescriptor::AddCommonStreams ( )

Adds common vertex streams to the mesh buffer.

The streams are added in this order (with the corresponding stream indices):

  • Position (index 0)
  • TexCoord0 (index 1)
  • Normal (index 2)
  • Tangent (index 3)

◆ GetVertexData()

ezArrayPtr<ezUInt8> ezMeshBufferResourceDescriptor::GetVertexData ( ezUInt32  uiStream,
ezUInt32  uiVertexIndex 
)
inline

Slow, but convenient method to access one piece of vertex data at a time into the stream buffer.

uiStream is the index of the data stream to write to. uiVertexIndex is the index of the vertex for which to write the data.

◆ SetVertexData()

template<typename TYPE >
void ezMeshBufferResourceDescriptor::SetVertexData ( ezUInt32  uiStream,
ezUInt32  uiVertexIndex,
const TYPE &  data 
)
inline

Slow, but convenient method to write one piece of vertex data at a time into the stream buffer.

uiStream is the index of the data stream to write to. uiVertexIndex is the index of the vertex for which to write the data. data is the piece of data to write to the stream.


The documentation for this struct was generated from the following files: