Skip to content

SegmentBatcher

interludesoftware.tick

Interlude.Tick

SegmentBatcher Class

Instances thick-line draws (DrawCommand.DrawType.Segment) into one DrawMeshInstancedProcedural call per batch. Mirrors RectangleBatcher.

public class SegmentBatcher : System.IDisposable

Inheritance System.Object → SegmentBatcher

Implements System.IDisposable

Constructors

SegmentBatcher(Mesh, Material) Constructor

Creates a SegmentBatcher that draws instanced thick segments using quadMesh and material.

public SegmentBatcher(Mesh quadMesh, Material material);

Parameters

quadMesh UnityEngine.Mesh

material UnityEngine.Material

Properties

SegmentBatcher.BatchCount Property

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

public int BatchCount { get; }

Property Value

System.Int32

Methods

SegmentBatcher.AddToBatch(DrawCommand) Method

Appends command as a new Interlude.Tick.SegmentBatcher.SegmentInstance to the active batch.

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

Parameters

command DrawCommand

SegmentBatcher.BeginBatch() Method

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

public void BeginBatch();

SegmentBatcher.Dispose() Method

Releases the GPU UnityEngine.GraphicsBuffer.

public void Dispose();

Implements Dispose()

SegmentBatcher.EndBatch() Method

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

public void EndBatch();

SegmentBatcher.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>

SegmentBatcher.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

SegmentBatcher.Reset() Method

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

public void Reset();

SegmentBatcher.UploadToGPU() Method

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

public void UploadToGPU();