InstancedRenderContext<'T, 'K> Type
Contextual object for instanced cell-grid rendering on the MonoGame backend. Bundles the key/material/transform functions and manages internal reusable storage and snapshot pooling to avoid per-frame allocations.
Ported from Mibo.Raylib/Layout3D/Renderer3D.fs with type swaps per §5/§6.2:
Raylib_cs.Mesh→ PrimitiveMeshSystem.Numerics.Matrix4x4→ Matrix (converted at the Core↔backend boundary viaConversions).System.Numerics.Vector3→ Vector3 (same).
Mibo.Core.Layout3D (backend-agnostic) and is
reused unchanged; only the renderer glue is ported.
Constructors
| Constructor |
Description
|
Full Usage:
InstancedRenderContext(getKey, getParts, getTransform)
Parameters: Returns: InstancedRenderContext<'T, 'K>
|
Constructs a context over zero-copy ModelPart slices (e.g. ModelParts.ofModel results): each group emits one instanced command per part, folding the part's own absolute bone into a pooled per-part snapshot and passing the part's real buffer offsets. The getTransform bone fold of the two-element ctor must NOT be used here — the context applies per-part bones itself.
|
Full Usage:
InstancedRenderContext(getKey, getMeshesMaterialAndShader, getTransform)
Parameters:
'T -> 'K
getMeshesMaterialAndShader : 'T -> (PrimitiveMesh * Material3D * Effect voption)[]
getTransform : Vector3 -> 'T -> Matrix
Returns: InstancedRenderContext<'T, 'K>
|
Overload constructor for per-sub-mesh shaders: each triple may carry an
|
Full Usage:
InstancedRenderContext(getKey, getMeshesAndMaterial, getTransform)
Parameters:
'T -> 'K
getMeshesAndMaterial : 'T -> (PrimitiveMesh * Material3D)[]
getTransform : Vector3 -> 'T -> Matrix
Returns: InstancedRenderContext<'T, 'K>
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.GetKey
Returns: 'T -> 'K
|
|
|
|
|
|
Full Usage:
this.RenderCellGridInstanced
Parameters:
RenderBuffer3D
grid : CellGrid3D<'T>
shaderForKey : 'K -> Effect voption
|
Emit instanced draw commands for every occupied cell of grid, grouping cells by shaderForKey: cells whose key maps to an effect are shaded by it (when it opts into instancing), keys mapped to ValueNone keep the default PBR instanced path. See docs/graphics3d/instancing.md.
|
|
Emit instanced draw commands for every occupied cell of grid, shaded by the default PBR instanced path.
|
Full Usage:
this.RenderCellGridVolumeInstanced
Parameters:
RenderBuffer3D
bounds : BoundingBox
grid : CellGrid3D<'T>
shaderForKey : 'K -> Effect voption
|
Emit instanced draw commands for the occupied cells of grid inside bounds, grouping cells by shaderForKey: cells whose key maps to an effect are shaded by it (when it opts into instancing), keys mapped to ValueNone keep the default PBR instanced path. See docs/graphics3d/instancing.md.
|
Full Usage:
this.RenderCellGridVolumeInstanced
Parameters:
RenderBuffer3D
bounds : BoundingBox
grid : CellGrid3D<'T>
|
Emit instanced draw commands for the occupied cells of grid inside bounds, shaded by the default PBR instanced path.
|
Full Usage:
this.RenderHexGridInstanced
Parameters:
RenderBuffer3D
grid : HexGrid3D<'T>
shaderForKey : 'K -> Effect voption
|
Emit instanced draw commands for every occupied cell of the hex grid, grouping cells by shaderForKey: cells whose key maps to an effect are shaded by it (when it opts into instancing), keys mapped to ValueNone keep the default PBR instanced path. See docs/graphics3d/instancing.md.
|
|
Emit instanced draw commands for every occupied cell of the hex grid, shaded by the default PBR instanced path.
|
Full Usage:
this.RenderHexGridVolumeInstanced
Parameters:
RenderBuffer3D
bounds : BoundingBox
grid : HexGrid3D<'T>
shaderForKey : 'K -> Effect voption
|
Emit instanced draw commands for the occupied cells of the hex grid inside bounds, grouping cells by shaderForKey: cells whose key maps to an effect are shaded by it (when it opts into instancing), keys mapped to ValueNone keep the default PBR instanced path. See docs/graphics3d/instancing.md.
|
Full Usage:
this.RenderHexGridVolumeInstanced
Parameters:
RenderBuffer3D
bounds : BoundingBox
grid : HexGrid3D<'T>
|
Emit instanced draw commands for the occupied cells of the hex grid inside bounds, shaded by the default PBR instanced path.
|
Full Usage:
this.ResetFrameBuffers
|
Returns pooled snapshot arrays to ArrayPool
and clears internal tracking state. Call once per frame before
invoking Skippable if GC pressure from instanced rendering is acceptable, but recommended for steady-state zero-alloc rendering. |
Mibo