Logo Mibo

InstancedRenderContext<'T, 'K> Type

Contextual object for instanced cell grid rendering. Bundles the key/material/transform functions and manages internal reusable storage and snapshot pooling to avoid per-frame allocations.

Constructors

Constructor Description

InstancedRenderContext(getKey, getMeshesMaterialAndShader, getTransform)

Full Usage: InstancedRenderContext(getKey, getMeshesMaterialAndShader, getTransform)

Parameters:
Returns: InstancedRenderContext<'T, 'K>

Overload constructor for per-sub-mesh shaders: each triple may carry a Shader voption. A ValueSome shader wraps that sub-mesh's instanced draw in its own BeginEffect/EndEffect scope; ValueNone uses the default PBR instanced path. Existing two-element contexts are unaffected.

getKey : 'T -> 'K
getMeshesMaterialAndShader : 'T -> (Mesh * Material3D * Shader voption)[]
getTransform : Vector3 -> 'T -> Matrix4x4
Returns: InstancedRenderContext<'T, 'K>

InstancedRenderContext(getKey, getMeshesAndMaterial, getTransform)

Full Usage: InstancedRenderContext(getKey, getMeshesAndMaterial, getTransform)

Parameters:
Returns: InstancedRenderContext<'T, 'K>
getKey : 'T -> 'K
getMeshesAndMaterial : 'T -> (Mesh * Material3D)[]
getTransform : Vector3 -> 'T -> Matrix4x4
Returns: InstancedRenderContext<'T, 'K>

Instance members

Instance member Description

this.GetKey

Full Usage: this.GetKey

Returns: 'T -> 'K
Returns: 'T -> 'K

this.GetMeshesAndMaterial

Full Usage: this.GetMeshesAndMaterial

Returns: 'T -> (Mesh * Material3D)[]
Returns: 'T -> (Mesh * Material3D)[]

this.GetTransform

Full Usage: this.GetTransform

Returns: Vector3 -> 'T -> Matrix4x4
Returns: Vector3 -> 'T -> Matrix4x4

this.RenderInstanced

Full Usage: this.RenderInstanced

Parameters:

RenderInstanced over the anchors of an occupancy: one instance per anchor, and each anchor's rectangle reaches the transform. A covered cell draws nothing of its own, so a plate stays one instance.

buffer : RenderBuffer3D
grid : CellGrid2D<'T>
occupancy : Occupancy

this.RenderInstanced

Full Usage: this.RenderInstanced

Parameters:

Fills the context from every populated cell of a 2D footprint grid — square or hex — and emits the instanced draws, one per key. This is the heightmap replacement for the retired whole-volume renderers. Each cell is its own instance, so a cell that covers several cells draws at one cell; use the occupancy member for those.

buffer : RenderBuffer3D
grid : CellGrid2D<'T>

this.RenderInstancedWithEffect

Full Usage: this.RenderInstancedWithEffect

Parameters:

RenderInstanced with an occupancy and per-key effect scoping, like RenderInstancedWithEffect.

buffer : RenderBuffer3D
grid : CellGrid2D<'T>
occupancy : Occupancy
shaderForKey : 'K -> Shader voption

this.RenderInstancedWithEffect

Full Usage: this.RenderInstancedWithEffect

Parameters:

RenderInstanced wrapping each key's draws in a BeginEffect/EndEffect scope when shaderForKey returns ValueSome.

buffer : RenderBuffer3D
grid : CellGrid2D<'T>
shaderForKey : 'K -> Shader voption

this.RenderWindowInstanced

Full Usage: this.RenderWindowInstanced

Parameters:

RenderWindowInstanced over the anchors of an occupancy: the world-space window becomes a cell range, and every anchor whose rectangle intersects it is drawn — so an instance that covers a window cell from an anchor outside the window stays drawn.

buffer : RenderBuffer3D
left : int
top : int
right : int
bottom : int
grid : CellGrid2D<'T>
occupancy : Occupancy

this.RenderWindowInstanced

Full Usage: this.RenderWindowInstanced

Parameters:

Like RenderInstanced but restricted to a world-space window (left/top/right/bottom in int world coordinates). Hex grids cull with an orientation-aware window. A cell-windowed walk drops a large instance once its anchor leaves the window: use the occupancy member for a map with spans.

buffer : RenderBuffer3D
left : int
top : int
right : int
bottom : int
grid : CellGrid2D<'T>

this.RenderWindowInstancedWithEffect

Full Usage: this.RenderWindowInstancedWithEffect

Parameters:

RenderWindowInstanced with an occupancy and per-key effect scoping.

buffer : RenderBuffer3D
left : int
top : int
right : int
bottom : int
grid : CellGrid2D<'T>
occupancy : Occupancy
shaderForKey : 'K -> Shader voption

this.RenderWindowInstancedWithEffect

Full Usage: this.RenderWindowInstancedWithEffect

Parameters:

RenderWindowInstanced with per-key effect scoping, like RenderInstancedWithEffect.

buffer : RenderBuffer3D
left : int
top : int
right : int
bottom : int
grid : CellGrid2D<'T>
shaderForKey : 'K -> Shader voption

this.ResetFrameBuffers

Full Usage: this.ResetFrameBuffers

Returns pooled snapshot arrays to ArrayPool and clears internal tracking state. Call once per frame before invoking renderInstanced or renderVolumeInstanced.

Skippable if GC pressure from instanced rendering is acceptable, but recommended for steady-state zero-alloc rendering.

Static members

Static member Description

InstancedRenderContext.Rect(getKey, getMeshesAndMaterial, getTransform)

Full Usage: InstancedRenderContext.Rect(getKey, getMeshesAndMaterial, getTransform)

Parameters:
Returns: InstancedRenderContext<'T, 'K>

Builds a context whose transform receives the rectangle each instance covers — the anchor's own cell on the cell-walk members, the anchor's rectangle on the occupancy members — so one model scales to the cells it stands for: InstancedRenderContext<Cell, string>.Rect(getKey, getMeshesAndMaterial, getTransform).

getKey : 'T -> 'K
getMeshesAndMaterial : 'T -> (Mesh * Material3D)[]
getTransform : CellRect -> Vector3 -> 'T -> Matrix4x4
Returns: InstancedRenderContext<'T, 'K>

Type something to start searching.