Skip to content

ShapeBatcher

interludesoftware.tick

Interlude.Tick

ShapeBatcher Class

public class ShapeBatcher : System.IDisposable

Inheritance System.Object → ShapeBatcher

Implements System.IDisposable

Constructors

ShapeBatcher(Mesh, Material) Constructor

Creates a ShapeBatcher that draws instanced SDF shapes using quadMesh and material.

public ShapeBatcher(Mesh quadMesh, Material material);

Parameters

quadMesh UnityEngine.Mesh

material UnityEngine.Material

Properties

ShapeBatcher.BatchCount Property

Returns the number of batches recorded since the last Reset().

public int BatchCount { get; }

Property Value

System.Int32

Methods

ShapeBatcher.AddToBatch(DrawCommand) Method

Appends command as a new Interlude.Tick.ShapeBatcher.ShapeInstance to the active batch.

public void AddToBatch(Interlude.Tick.DrawCommand command);

Parameters

command DrawCommand

ShapeBatcher.BeginBatch() Method

Opens a new batch starting at the current instance write head.

public void BeginBatch();

ShapeBatcher.BuildSingleInstance(DrawCommand) Method

Returns the ShapeInstance derived from command as a value, avoiding the heap array allocation of the array overload. Preferred when the caller already owns a ShapeInstance[] scratch buffer.

public static Interlude.Tick.ShapeBatcher.ShapeInstance BuildSingleInstance(Interlude.Tick.DrawCommand command);

Parameters

command DrawCommand

Returns

Interlude.Tick.ShapeBatcher.ShapeInstance

ShapeBatcher.Dispose() Method

Releases the GPU UnityEngine.GraphicsBuffer.

public void Dispose();

Implements Dispose()

ShapeBatcher.EndBatch() Method

Closes the current batch, discarding it if it contains no instances.

public void EndBatch();

ShapeBatcher.FillSingleInstance(DrawCommand, ShapeInstance[]) Method

Fills a one-element array with the ShapeInstance derived from command. Used by Drawer when issuing a single passthrough draw for a CustomShape without going through the batcher.

public static void FillSingleInstance(Interlude.Tick.DrawCommand command, out Interlude.Tick.ShapeBatcher.ShapeInstance[] data);

Parameters

command DrawCommand

data Interlude.Tick.ShapeBatcher.ShapeInstance[]

ShapeBatcher.GetBatchStartIndexAndInstanceCount(int) Method

Returns the GPU buffer start index and instance count for the batch at index.

public (int,int) GetBatchStartIndexAndInstanceCount(int index);

Parameters

index System.Int32

Returns

<System.Int32,System.Int32>

ShapeBatcher.RecordInto(CommandBuffer, int) Method

Issues a DrawMeshInstancedProcedural call for batch index into target.

public void RecordInto(CommandBuffer target, int index);

Parameters

target UnityEngine.Rendering.CommandBuffer

index System.Int32

ShapeBatcher.Reset() Method

Clears all batches and resets the instance write head for the next frame.

public void Reset();

ShapeBatcher.UploadToGPU() Method

Uploads all accumulated instance data to the GPU structured buffer, growing the buffer if needed.

public void UploadToGPU();