Logo Mibo

RenderBuffer3D Type

An allocation-friendly buffer for 3D render commands.

Commands are accumulated each frame via RenderBuffer3D.Add, then executed in insertion order by the active pipeline. The pipeline may re-sort internally if needed for state efficiency (e.g., front-to-back, material batching), but the buffer itself does not impose an order. Uses ArrayPool for the backing store to avoid per-frame heap allocations. The buffer is designed to be cleared and repopulated each frame. RenderBuffer3D.Clear resets the count without deallocating the internal array.

Constructors

Constructor Description

RenderBuffer3D(?capacity)

Full Usage: RenderBuffer3D(?capacity)

Parameters:
    ?capacity : int

Returns: RenderBuffer3D
?capacity : int
Returns: RenderBuffer3D

Instance members

Instance member Description

this.Add

Full Usage: this.Add

Parameters:

Adds a render command to the buffer.

cmd : Command3D

this.AddAnimatedModel

Full Usage: this.AddAnimatedModel

Parameters:
Modifiers: inline

MonoGame animated draw: derives the bone palette from the state, or reuses a caller-evaluated pose shared with bone queries and attachment draws.

am : AnimatedModel
transform : Matrix
pose : BonePose voption

this.AddAnimatedModelInstanced

Full Usage: this.AddAnimatedModelInstanced

Parameters:
Modifiers: inline

Skinned + instanced draw: one draw call for N instances of the same animated model, each with its own pose. poses carries one caller-evaluated BonePose per instance (share them with bone queries / attachment draws); the witness flattens the per-instance palettes into the command's instance-major array. The instance count is min(transforms.Length, poses.Length); 0 (or a boneless model — use instanced for those) emits nothing. On the OpenGL backend the pipeline falls back to per-instance skinned draws. Each pose's Palette must hold at least one matrix per bone: a longer palette truncates to its first boneCount entries, a shorter one throws System.ArgumentException. Both transforms and the palettes are copied into pooled arrays at record time, so the caller may freely reuse or refill its arrays once this call returns.

am : AnimatedModel
transforms : Matrix[]
poses : BonePose[]
material : MaterialOverride voption
colors : Color[] voption

this.AddAnimatedModelWith

Full Usage: this.AddAnimatedModelWith

Parameters:
Modifiers: inline
am : AnimatedModel
transform : Matrix
material : Material3D
pose : BonePose voption

this.AddAnimatedModelWithPerMesh

Full Usage: this.AddAnimatedModelWithPerMesh

Parameters:
Modifiers: inline
am : AnimatedModel
transform : Matrix
resolver : int -> Material3D
pose : BonePose voption

this.AddAttachedMesh

Full Usage: this.AddAttachedMesh

Parameters:
Modifiers: inline

Draws a static mesh parented to a bone of an animated model. World = localTransform * boneWorld * transform (row-vector composition — the attachment inherits the instance's full world transform). An unknown bone is a no-op: no command is emitted. Pass the same pose given to AddAnimatedModel to avoid a second pose evaluation this frame.

am : AnimatedModel
bone : BoneRef
localTransform : Matrix
mesh : PrimitiveMesh
material : Material3D
transform : Matrix
pose : BonePose voption

this.AddBeginCamera

Full Usage: this.AddBeginCamera

Parameters:
Modifiers: inline

this.AddBeginCameraConfig

Full Usage: this.AddBeginCameraConfig

Parameters:
Modifiers: inline

this.AddBeginEffect

Full Usage: this.AddBeginEffect

Parameters:
Modifiers: inline
effect : Effect

this.AddBillboard

Full Usage: this.AddBillboard

Parameters:
Modifiers: inline
texture : Texture2D
position : Vector3
size : Vector2
color : Color
rotation : float32
sourceRect : Rectangle
blend : BlendMode voption

this.AddBillboardBatch

Full Usage: this.AddBillboardBatch

Parameters:
Modifiers: inline
textures : Texture2D[]
positions : Vector3[]
sizes : Vector2[]
colors : Color[]
count : int
rotations : float32[]
sourceRects : Rectangle[]
blend : BlendMode voption

this.AddDirectionalLight

Full Usage: this.AddDirectionalLight

Parameters:
Modifiers: inline

this.AddDisableShadows3D

Full Usage: this.AddDisableShadows3D

Modifiers: inline

this.AddDrawImmediate

Full Usage: this.AddDrawImmediate

Parameters:
Modifiers: inline
action : SceneContext -> unit
_layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddDrawInstancedSlice

Full Usage: this.AddDrawInstancedSlice

Parameters:
Modifiers: inline

Draws many instances of a slice of a mesh within shared content-pipeline vertex/index buffers: vertexOffset is the part's first vertex (baseVertex) and startIndex the part's first index. Self-contained buffers pass 0, 0.

The mesh record must describe the part, not the whole shared buffer: PrimitiveCount is the part's triangle count (the draw is sized by it) and Bounds is the part's local-space bounding sphere (the shadow pass frustum-culls by it).

mesh : PrimitiveMesh
transforms : Matrix[]
material : Material3D
instanceCount : int
colors : Color[] voption
vertexOffset : int
startIndex : int

this.AddDrawMeshSlice

Full Usage: this.AddDrawMeshSlice

Parameters:
Modifiers: inline

Draws a slice of a mesh within shared content-pipeline vertex/index buffers: vertexOffset is the part's first vertex (baseVertex) and startIndex the part's first index. Self-contained buffers pass 0, 0.

The mesh record must describe the part, not the whole shared buffer: PrimitiveCount is the part's triangle count (the draw is sized by it) and Bounds is the part's local-space bounding sphere (the shadow pass frustum-culls by it).

mesh : PrimitiveMesh
transform : Matrix
material : Material3D
vertexOffset : int
startIndex : int

this.AddDrawModel

Full Usage: this.AddDrawModel

Parameters:
Modifiers: inline
model : Model
transform : Matrix

this.AddDrawModelWith

Full Usage: this.AddDrawModelWith

Parameters:
Modifiers: inline
model : Model
transform : Matrix
material : Material3D

this.AddDrawModelWithPerMesh

Full Usage: this.AddDrawModelWithPerMesh

Parameters:
Modifiers: inline
model : Model
transform : Matrix
resolver : int -> Material3D

this.AddEnableShadows3D

Full Usage: this.AddEnableShadows3D

Modifiers: inline

this.AddEndCamera

Full Usage: this.AddEndCamera

Parameters:
Modifiers: inline

this.AddEndEffect

Full Usage: this.AddEndEffect

Modifiers: inline

this.AddLine3D

Full Usage: this.AddLine3D

Parameters:
Modifiers: inline
start : Vector3
finish : Vector3
color : Color

this.AddPointLight

Full Usage: this.AddPointLight

Parameters:
Modifiers: inline
light : PointLight3D

this.AddPostProcess

Full Usage: this.AddPostProcess

Parameters:
Modifiers: inline
action : PostProcessContext3D -> unit

this.AddPostProcessWithDepth

Full Usage: this.AddPostProcessWithDepth

Parameters:
Modifiers: inline
action : PostProcessContext3D -> unit

this.AddSetAmbientLight

Full Usage: this.AddSetAmbientLight

Parameters:
Modifiers: inline

this.AddSetShadowOrigin

Full Usage: this.AddSetShadowOrigin

Parameters:
Modifiers: inline
origin : Vector3

this.AddSpotLight

Full Usage: this.AddSpotLight

Parameters:
Modifiers: inline
light : SpotLight3D

this.CameraBlockCount

Full Usage: this.CameraBlockCount

Returns: int

Number of BeginCamera/BeginCameraConfig commands added since the last Clear. Lets a pipeline skip the per-camera-block plan (and its allocations) for single-camera frames.

Returns: int

this.Clear

Full Usage: this.Clear

Clears all commands from the buffer without deallocating the backing array. Call this at the start of each frame before populating with new commands.

Resets the count every frame (clearing thousands of struct-DU slots per frame is a hot-path cost we avoid), but periodically zeroes the backing array (~every 300 frames) so stale managed refs (Model/Texture2D/Effect) in slots above count can't keep unloaded assets alive indefinitely after a scene shrinks. Dispose also clears. This matches RenderBuffer2D.Clear and the raylib buffers.

this.Count

Full Usage: this.Count

Returns: int

The number of commands currently in the buffer.

Returns: int

this.DepthPostProcessCount

Full Usage: this.DepthPostProcessCount

Returns: int

Number of PostProcessWithDepth commands added since the last Clear. When > 0, the pipeline produces a camera-POV depth target this frame so depth-needing effects (fog, depth-of-field, SSAO) can sample PostProcessContext3D.Depth. Zero on frames with only color-only PostProcess actions, so the depth pass is skipped entirely.

Returns: int

this[i]

Full Usage: this[i]

Parameters:
    i : int

Returns: Command3D

Gets the command at the specified index.

i : int
Returns: Command3D

this.PostProcessCount

Full Usage: this.PostProcessCount

Returns: int

Number of PostProcess/PostProcessWithDepth commands added since the last Clear. Lets a pipeline skip the post-process drain (and its per-frame allocation) when the view emits none.

Returns: int

this.ReleaseRentedArrays

Full Usage: this.ReleaseRentedArrays

Returns all rented arrays to the pool. Called automatically from Clear and by the renderer after the pipeline has executed for the frame.

this.RentMatrixArray

Full Usage: this.RentMatrixArray

Parameters:
    needed : int

Returns: Matrix[]

Rents a Matrix[] from the shared ArrayPool and tracks it for automatic return at the end of the frame. Used by the instanced draw witnesses for the scratch palette and per-command transforms copies consumed synchronously within the same frame.

needed : int
Returns: Matrix[]

this.ShadowCasterLightCount

Full Usage: this.ShadowCasterLightCount

Returns: int

Number of light commands with CastsShadows = true added since the last Clear. A conservative gate for shadow-geometry collection: zero means no shadow-casting light exists in the buffer, so collection can be skipped outright. (Conservative because any casting directional counts, not just the first — only DirLights[0] can actually cast.)

Returns: int

this.Sort

Full Usage: this.Sort

Parameters:

Sorts commands using the provided comparer. Pipelines may call this internally to optimize draw order.

comparer : IComparer<Command3D>

Type something to start searching.