ezEngine Release 26.3
Loading...
Searching...
No Matches
ezMeshBufferResourceDescriptor Struct Reference

Public Member Functions

void Clear ()
 
void AddStream (ezMeshVertexStreamType::Enum type, bool bUseHighPrecision=false)
 Use this function to add vertex streams to the mesh buffer.
 
void AddCommonStreams (bool bUseHighPrecision=false)
 Adds common vertex streams to the mesh buffer.
 
void AddStreamConfig (const ezMeshVertexStreamConfig &streamConfig)
 Adds all streams from the given stream config.
 
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.
 
ezUInt32 GetNumVertexBuffers () const
 Returns the number of vertex buffer used. Note that some vertex buffers in between might be empty if unused.
 
ezArrayPtr< const ezUInt8 > GetVertexBufferData (ezMeshVertexStreamType::Enum type) 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 (ezMeshVertexStreamType::Enum type)
 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.
 
ezArrayPtr< const ezVec3GetPositionData () const
 Gives access to the position data.
 
ezArrayPtr< ezVec3GetPositionData ()
 
ezArrayPtr< const ezUInt8 > GetNormalData (ezUInt32 *out_pStride=nullptr) const
 Gives access to the normal data. Use ezMeshBufferUtils::EncodeNormal/ezMeshBufferUtils::DecodeNormal to pack/unpack the normal.
 
ezArrayPtr< ezUInt8 > GetNormalData (ezUInt32 *out_pStride=nullptr)
 
ezArrayPtr< const ezUInt8 > GetTangentData (ezUInt32 *out_pStride=nullptr) const
 Gives access to the tangent data. Use ezMeshBufferUtils::EncodeTangent/ezMeshBufferUtils::DecodeTangent to pack/unpack the tangent.
 
ezArrayPtr< ezUInt8 > GetTangentData (ezUInt32 *out_pStride=nullptr)
 
ezArrayPtr< const ezUInt8 > GetTexCoord0Data (ezUInt32 *out_pStride=nullptr) const
 Gives access to the tex coord 0 data. Use ezMeshBufferUtils::EncodeTexCoord/ezMeshBufferUtils::DecodeTexCoord to pack/unpack the tex coord.
 
ezArrayPtr< ezUInt8 > GetTexCoord0Data (ezUInt32 *out_pStride=nullptr)
 
ezArrayPtr< const ezUInt8 > GetTexCoord1Data (ezUInt32 *out_pStride=nullptr) const
 Gives access to the tex coord 1 data. Use ezMeshBufferUtils::EncodeTexCoord/ezMeshBufferUtils::DecodeTexCoord to pack/unpack the tex coord.
 
ezArrayPtr< ezUInt8 > GetTexCoord1Data (ezUInt32 *out_pStride=nullptr)
 
ezArrayPtr< const ezUInt8 > GetColor0Data (ezUInt32 *out_pStride=nullptr) const
 Gives access to the color 0 data. Use ezMeshBufferUtils::EncodeFromVec4/ezMeshBufferUtils::DecodeToVec4 to pack/unpack the color.
 
ezArrayPtr< ezUInt8 > GetColor0Data (ezUInt32 *out_pStride=nullptr)
 
ezArrayPtr< const ezUInt8 > GetColor1Data (ezUInt32 *out_pStride=nullptr) const
 Gives access to the color 1 data. Use ezMeshBufferUtils::EncodeFromVec4/ezMeshBufferUtils::DecodeToVec4 to pack/unpack the color.
 
ezArrayPtr< ezUInt8 > GetColor1Data (ezUInt32 *out_pStride=nullptr)
 
const ezVec3GetPosition (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the position of a specific vertex.
 
void SetPosition (ezUInt32 uiVertexIndex, const ezVec3 &vPos)
 
ezVec3 GetNormal (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the normal of a specific vertex.
 
void SetNormal (ezUInt32 uiVertexIndex, const ezVec3 &vNormal)
 
ezVec4 GetTangent (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the tangent of a specific vertex. The w component contains the bi-tangent sign.
 
void SetTangent (ezUInt32 uiVertexIndex, const ezVec4 &vTangent)
 
ezVec2 GetTexCoord0 (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the tex coord 0 of a specific vertex.
 
void SetTexCoord0 (ezUInt32 uiVertexIndex, const ezVec2 &vTexCoord)
 
ezVec2 GetTexCoord1 (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the tex coord 1 of a specific vertex.
 
void SetTexCoord1 (ezUInt32 uiVertexIndex, const ezVec2 &vTexCoord)
 
ezColor GetColor0 (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the color 0 of a specific vertex.
 
void SetColor0 (ezUInt32 uiVertexIndex, const ezColorLinearUB &color)
 
void SetColor0 (ezUInt32 uiVertexIndex, const ezColor &color, ezMeshVertexColorConversion::Enum conversion=ezMeshVertexColorConversion::Default)
 
ezColor GetColor1 (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the color 1 of a specific vertex.
 
void SetColor1 (ezUInt32 uiVertexIndex, const ezColorLinearUB &color)
 
void SetColor1 (ezUInt32 uiVertexIndex, const ezColor &color, ezMeshVertexColorConversion::Enum conversion=ezMeshVertexColorConversion::Default)
 
const ezVec4U16GetBoneIndices (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the bone indices of a specific vertex.
 
void SetBoneIndices (ezUInt32 uiVertexIndex, const ezVec4U16 &vIndices)
 
ezVec4 GetBoneWeights (ezUInt32 uiVertexIndex) const
 Slow, but convenient access to the bone weights of a specific vertex.
 
void SetBoneWeights (ezUInt32 uiVertexIndex, const ezVec4 &vWeights)
 
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 ezMeshVertexStreamConfigGetVertexStreamConfig () 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 ( bool  bUseHighPrecision = false)

Adds common vertex streams to the mesh buffer.

The streams are added

  • Position
  • NormalTangentAndTexCoord0

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