void DrawIndexedInstancedIndirect( GpuBuffer<T> vertexBuffer, GpuBuffer indexBuffer, Material material, GpuBuffer indirectBuffer, System.UInt32 bufferOffset, RenderAttributes attributes, Sandbox.Graphics/PrimitiveType primitiveType )
void DrawIndexedInstancedIndirect( GpuBuffer indexBuffer, Material material, GpuBuffer indirectBuffer, System.UInt32 bufferOffset, RenderAttributes attributes, Sandbox.Graphics/PrimitiveType primitiveType )

robot_2Generated
code_blocksInput

Description

The DrawIndexedInstancedIndirect method is used to render geometry using indirect drawing commands. This method allows for drawing indexed, instanced geometry by utilizing indirect buffers, which can be useful for dynamic or procedurally generated content where the number of instances or indices is not known at compile time.

Usage

To use the DrawIndexedInstancedIndirect method, you need to provide the following parameters:

  • vertexBuffer: A GpuBuffer<T> containing the vertex data.
  • indexBuffer: A GpuBuffer containing the index data.
  • material: A Material object that defines the appearance of the geometry.
  • indirectBuffer: A GpuBuffer that contains the indirect draw commands.
  • bufferOffset: A UInt32 specifying the offset in the indirect buffer where the draw command begins.
  • attributes: A RenderAttributes object that specifies additional rendering attributes.
  • primitiveType: A Graphics.PrimitiveType enum value that defines the type of primitives to render (e.g., triangles, lines).

Example

// Example usage of DrawIndexedInstancedIndirect
var commandList = new CommandList();
var vertexBuffer = new GpuBuffer<VertexType>();
var indexBuffer = new GpuBuffer();
var material = new Material();
var indirectBuffer = new GpuBuffer();
uint bufferOffset = 0;
var attributes = new RenderAttributes();
var primitiveType = Graphics.PrimitiveType.TriangleList;

commandList.DrawIndexedInstancedIndirect(
    vertexBuffer,
    indexBuffer,
    material,
    indirectBuffer,
    bufferOffset,
    attributes,
    primitiveType
);