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

raylib animated draw (GPU skinning path): emits one DrawSkinnedMesh per sub-mesh carrying the shared bone palette — no model mutation, so the same model can be drawn with several different poses in one frame. When pose is ValueNone, the pose is computed from the model's state. transform is the full world transform (the pipeline applies it directly, like every other mesh draw — model.Transform is not composed in).

am : AnimatedModel
transform : Matrix4x4
pose : BonePose voption

this.AddAnimatedModel

Full Usage: this.AddAnimatedModel

Parameters:
Modifiers: inline

raylib animated draw (legacy mutating path): applies the state's bone pose to its embedded model (raylib's UpdateModelAnimation path), then draws the model. The argument is ignored — the mutating path derives nothing from a palette; use the AnimatedModel overload for the GPU skinning path.

state : Animation3DState
transform : Matrix4x4
_pose : BonePose voption

this.AddAnimatedModelInstanced

Full Usage: this.AddAnimatedModelInstanced

Parameters:
Modifiers: inline

GPU skinning path, instanced: one DrawSkinnedMeshInstanced per sub-mesh carrying the shared flat per-instance palettes — N instances, each with its own pose, in one draw call per sub-mesh. poses carries one caller-evaluated BonePose per instance (share them with bone queries / attachment draws). The instance count is min(transforms.Length, poses.Length); 0 emits nothing. Each pose's Palette must contain at least boneCount matrices (one per bone): longer arrays are truncated to their first boneCount entries, shorter ones raise System.ArgumentException. A boneless model (boneCount = 0) emits nothing on this instanced path (matches the MonoGame backend). material overrides the authored materials (MaterialOverride.All / MaterialOverride.PerMesh). colors is MonoGame-only — ValueSome raises System.NotSupportedException. 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 : Matrix4x4[]
poses : BonePose[]
material : MaterialOverride voption
colors : Color[] voption

this.AddAnimatedModelWith

Full Usage: this.AddAnimatedModelWith

Parameters:
Modifiers: inline

GPU skinning path with a whole-model material override — see the AnimatedModelAddAnimatedModel overload.

am : AnimatedModel
transform : Matrix4x4
material : Material3D
pose : BonePose voption

this.AddAnimatedModelWith

Full Usage: this.AddAnimatedModelWith

Parameters:
Modifiers: inline

Legacy mutating path — is ignored; see the Animation3DState AddAnimatedModel overload.

state : Animation3DState
transform : Matrix4x4
material : Material3D
_pose : BonePose voption

this.AddAnimatedModelWithPerMesh

Full Usage: this.AddAnimatedModelWithPerMesh

Parameters:
Modifiers: inline

GPU skinning path with a per-mesh material resolver — see the AnimatedModelAddAnimatedModel overload. The resolver receives the sub-mesh index.

am : AnimatedModel
transform : Matrix4x4
resolver : int -> Material3D
pose : BonePose voption

this.AddAnimatedModelWithPerMesh

Full Usage: this.AddAnimatedModelWithPerMesh

Parameters:
Modifiers: inline

Legacy mutating path — is ignored; see the Animation3DState AddAnimatedModel overload.

state : Animation3DState
transform : Matrix4x4
resolver : int -> Material3D
_pose : BonePose voption

this.AddAttachedMesh

Full Usage: this.AddAttachedMesh

Parameters:
Modifiers: inline

Draws a static mesh parented to bone of the animated model am. The attachment's world transform is localTransform * boneWorld * transform (applied left-to-right). All three matrices must be in raylib's native matrix layout — build them with Raymath.* ops (boneWorld already is, coming from BonePose.WorldPoses); never mix in System.Numerics.Matrix4x4.* results, which are the transpose of the native layout. An unknown bone is a no-op — no command is emitted. When pose is ValueNone, the pose is computed from the model's state; pass the same pose given to animatedModel to avoid a second evaluation this frame.

am : AnimatedModel
bone : BoneRef
localTransform : Matrix4x4
mesh : Mesh
material : Material3D
transform : Matrix4x4
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
shader : Shader

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

Full Usage: this.AddDrawInstanced

Parameters:
Modifiers: inline
mesh : Mesh
transforms : Matrix4x4[]
material : Material3D
instanceCount : int
colors : Color[] voption

this.AddDrawMesh

Full Usage: this.AddDrawMesh

Parameters:
Modifiers: inline
mesh : Mesh
transform : Matrix4x4
material : Material3D

this.AddDrawModel

Full Usage: this.AddDrawModel

Parameters:
Modifiers: inline
model : Model
transform : Matrix4x4

this.AddDrawModelWith

Full Usage: this.AddDrawModelWith

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

this.AddDrawModelWithPerMesh

Full Usage: this.AddDrawModelWithPerMesh

Parameters:
Modifiers: inline
model : Model
transform : Matrix4x4
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.AddSkinnedMesh

Full Usage: this.AddSkinnedMesh

Parameters:
Modifiers: inline

Draws a skinned mesh with an explicit bone palette. bones carries the palette in plain System.Numerics row-major layout (bones[i] = InverseBindPose[i] * pose[i]), NOT pre-transposed — the pipeline transposes at upload where the shader contract needs it.

mesh : Mesh
transform : Matrix4x4
material : Material3D
bones : Matrix4x4[]

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.

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 exposes the scene depth attachment to post-process actions via PostProcessContext3D.Depth. Zero on frames with only color-only PostProcess actions.

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

Full Usage: this.RegisterRentedArray

Parameters:

Tracks a rented matrix array (palette or transforms copy) so it can be returned to the ArrayPool after the pipeline consumes the commands. Called from the instanced draw witnesses (AddDrawInstanced/AddAnimatedModelInstanced, both inline extension members) — they cannot see primary-constructor let bindings, so they reach the field through this public method.

arr : Matrix4x4[]

this.ReleaseRentedArrays

Full Usage: this.ReleaseRentedArrays

Returns all rented palette arrays to the shared ArrayPool. Called from Clear at frame start (safety net for arrays left over from a prior frame whose finally didn't run) and from the renderer's finally block after pipeline execution — the arrays are consumed synchronously within the same frame.

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.