Plasma Engine  2.0
Loading...
Searching...
No Matches
plMeshBufferResourceDescriptor Struct Reference

Public Member Functions

void Clear ()
 
plUInt32 AddStream (plGALVertexAttributeSemantic::Enum semantic, plGALResourceFormat::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.
 
void AllocateStreams (plUInt32 uiNumVertices, plGALPrimitiveTopology::Enum topology=plGALPrimitiveTopology::Triangles, plUInt32 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 plGeometry &geom, plGALPrimitiveTopology::Enum topology=plGALPrimitiveTopology::Triangles)
 Creates streams and fills them with data from the plGeometry. Only the geometry matching the given topology is used. Streams that do not match any of the data inside the plGeometry directly are skipped.
 
plArrayPtr< const plUInt8 > GetVertexBufferData () const
 Gives read access to the allocated vertex data.
 
plArrayPtr< const plUInt8 > GetIndexBufferData () const
 Gives read access to the allocated index data.
 
plDynamicArray< plUInt8, plAlignedAllocatorWrapper > & GetVertexBufferData ()
 Allows write access to the allocated vertex data. This can be used for copying data fast into the array.
 
plDynamicArray< plUInt8, plAlignedAllocatorWrapper > & 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 (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.
 
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.
 
void SetPointIndices (plUInt32 uiPoint, plUInt32 uiVertex0)
 Writes the vertex index for the given point into the index buffer.
 
void SetLineIndices (plUInt32 uiLine, plUInt32 uiVertex0, plUInt32 uiVertex1)
 Writes the two vertex indices for the given line into the index buffer.
 
void SetTriangleIndices (plUInt32 uiTriangle, plUInt32 uiVertex0, plUInt32 uiVertex1, plUInt32 uiVertex2)
 Writes the three vertex indices for the given triangle into the index buffer.
 
const plVertexDeclarationInfoGetVertexDeclaration () const
 Allows to read the stream info of the descriptor, which is filled out by AddStream()
 
plUInt32 GetVertexDataSize () const
 Returns the byte size of all the data for one vertex.
 
plUInt32 GetVertexCount () const
 Return the number of vertices, with which AllocateStreams() was called.
 
plUInt32 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.
 
plBoundingBoxSphere ComputeBounds () const
 Calculates the bounds using the data from the position stream.
 
plGALPrimitiveTopology::Enum GetTopology () const
 Returns the primitive topology.
 
plResult RecomputeNormals ()
 

Member Function Documentation

◆ AddCommonStreams()

void plMeshBufferResourceDescriptor::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()

plArrayPtr< plUInt8 > plMeshBufferResourceDescriptor::GetVertexData ( plUInt32 uiStream,
plUInt32 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 plMeshBufferResourceDescriptor::SetVertexData ( plUInt32 uiStream,
plUInt32 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: