XII Release 0.1.0
Loading...
Searching...
No Matches
xiiMeshBufferResourceDescriptor Struct Reference

Public Member Functions

void Clear ()
 
xiiUInt32 AddStream (xiiGALInputLayoutSemantic::Enum semantic, xiiGALResourceFormat::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 (xiiUInt32 uiNumVertices, xiiGALPrimitiveTopology::Enum topology=xiiGALPrimitiveTopology::TriangleList, xiiUInt32 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 xiiGeometry &geom, xiiGALPrimitiveTopology::Enum topology=xiiGALPrimitiveTopology::TriangleList)
 Creates streams and fills them with data from the xiiGeometry. Only the geometry matching the given topology is used. Streams that do not match any of the data inside the xiiGeometry directly are skipped.
 
xiiArrayPtr< const xiiUInt8 > GetVertexBufferData () const
 Gives read access to the allocated vertex data.
 
xiiArrayPtr< const xiiUInt8 > GetIndexBufferData () const
 Gives read access to the allocated index data.
 
xiiDynamicArray< xiiUInt8, xiiAlignedAllocatorWrapper > & GetVertexBufferData ()
 Allows write access to the allocated vertex data. This can be used for copying data fast into the array.
 
xiiDynamicArray< xiiUInt8, xiiAlignedAllocatorWrapper > & 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 (xiiUInt32 uiStream, xiiUInt32 uiVertexIndex, const TYPE &data)
 Slow, but convenient method to write one piece of vertex data at a time into the stream buffer.
 
xiiArrayPtr< xiiUInt8 > GetVertexData (xiiUInt32 uiStream, xiiUInt32 uiVertexIndex)
 Slow, but convenient method to access one piece of vertex data at a time into the stream buffer.
 
void SetPointIndices (xiiUInt32 uiPoint, xiiUInt32 uiVertex0)
 Writes the vertex index for the given point into the index buffer.
 
void SetLineIndices (xiiUInt32 uiLine, xiiUInt32 uiVertex0, xiiUInt32 uiVertex1)
 Writes the two vertex indices for the given line into the index buffer.
 
void SetTriangleIndices (xiiUInt32 uiTriangle, xiiUInt32 uiVertex0, xiiUInt32 uiVertex1, xiiUInt32 uiVertex2)
 Writes the three vertex indices for the given triangle into the index buffer.
 
const xiiInputLayoutInfoGetInputLayout () const
 Allows to read the stream info of the descriptor, which is filled out by AddStream()
 
xiiUInt32 GetVertexDataSize () const
 Returns the byte size of all the data for one vertex.
 
xiiUInt32 GetVertexCount () const
 Return the number of vertices, with which AllocateStreams() was called.
 
xiiUInt32 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.
 
xiiBoundingBoxSphere ComputeBounds () const
 Calculates the bounds using the data from the position stream.
 
xiiEnum< xiiGALPrimitiveTopologyGetTopology () const
 Returns the primitive topology.
 
xiiResult RecomputeNormals ()
 

Member Function Documentation

◆ AddCommonStreams()

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

xiiArrayPtr< xiiUInt8 > xiiMeshBufferResourceDescriptor::GetVertexData ( xiiUInt32 uiStream,
xiiUInt32 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 xiiMeshBufferResourceDescriptor::SetVertexData ( xiiUInt32 uiStream,
xiiUInt32 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: