Class CellBufferRenderer
Manages the GPU-side rendering pipeline for a text mode cell grid. Maintains a UnityEngine.GraphicsBuffer containing Cell data and renders the grid using instanced quad rendering via RenderMeshIndirect(in RenderParams, Mesh, GraphicsBuffer, int, int). Supports partial buffer updates to minimize GPU transfer costs.
Implements
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public class CellBufferRenderer : IDisposable
Properties
IsInitialized
Gets whether the renderer is initialized and ready to draw.
Declaration
public bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Material
Gets the material used for rendering. Allows external configuration of shader properties.
Declaration
public Material Material { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Methods
Dispose()
Releases all GPU resources.
Declaration
public void Dispose()
Initialize(int, int, Texture2D)
Initializes the renderer with the specified grid dimensions and font atlas.
Declaration
public void Initialize(int rows, int columns, Texture2D atlasTexture)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rows | Number of grid rows. |
| int | columns | Number of grid columns. |
| Texture2D | atlasTexture | The SDF font atlas texture. |
Render(Vector2, Vector3, float, float, int)
Renders the cell grid at the specified world position.
Declaration
public void Render(Vector2 cellSize, Vector3 origin, float blinkTimer, float textBlinkTimer, int layer = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | cellSize | Size of each cell in world units (x=width, y=height). |
| Vector3 | origin | World-space origin of the grid (top-left corner). |
| float | blinkTimer | Current cursor blink timer value (0-1). |
| float | textBlinkTimer | Current text blink timer value (0-1). |
| int | layer | Rendering layer. |
Resize(int, int)
Updates the grid dimensions. Recreates the GPU buffers.
Declaration
public void Resize(int rows, int columns)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rows | New number of rows. |
| int | columns | New number of columns. |
UploadFull(Cell[])
Uploads the full cell array to the GPU buffer.
Declaration
public void UploadFull(Cell[] cells)
Parameters
| Type | Name | Description |
|---|---|---|
| Cell[] | cells | The cell array to upload. |
UploadPartial(Cell[], int, int)
Uploads a partial range of the cell array to the GPU buffer. Only the dirty range is transferred, reducing GPU bandwidth usage.
Declaration
public void UploadPartial(Cell[] cells, int startIndex, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Cell[] | cells | The full cell array. |
| int | startIndex | Start index of the dirty range. |
| int | count | Number of cells in the dirty range. |