Header menu logo Mibo

RenderBuffer2D Type

An allocation-free buffer for 2D render commands, sorted by layer.

Commands are accumulated each frame via RenderBuffer2D.Add, sorted by layer, then executed in order via pattern matching. Uses ArrayPool for the backing store to avoid per-frame heap allocations. The buffer is designed to be cleared and repopulated each frame. RenderBuffer2D.Clear resets the count without deallocating the internal array.

Constructors

Constructor Description

RenderBuffer2D(?capacity)

Full Usage: RenderBuffer2D(?capacity)

Parameters:
    ?capacity : int

Returns: RenderBuffer2D
?capacity : int
Returns: RenderBuffer2D

Instance members

Instance member Description

this.Add

Full Usage: this.Add

Parameters:

Adds a render command to the buffer.

cmd : Command2D

this.AddBeginCamera

Full Usage: this.AddBeginCamera

Parameters:
Modifiers: inline

this.AddBeginCameraConfig

Full Usage: this.AddBeginCameraConfig

Parameters:
Modifiers: inline

this.AddBeginShader

Full Usage: this.AddBeginShader

Parameters:
Modifiers: inline

this.AddBeginTarget

Full Usage: this.AddBeginTarget

Parameters:
Modifiers: inline

this.AddBezier

Full Usage: this.AddBezier

Parameters:
Modifiers: inline
start : Vector2
control : Vector2
finish : Vector2
color : Color
thickness : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddCircleGradient

Full Usage: this.AddCircleGradient

Parameters:
Modifiers: inline
centerX : int
centerY : int
radius : float32
inner : Color
outer : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddCircleOutline

Full Usage: this.AddCircleOutline

Parameters:
Modifiers: inline
center : Vector2
radius : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddCircleSector

Full Usage: this.AddCircleSector

Parameters:
Modifiers: inline
center : Vector2
radius : float32
startAngle : float32
endAngle : float32
color : Color
segments : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddCircleSectorOutline

Full Usage: this.AddCircleSectorOutline

Parameters:
Modifiers: inline
center : Vector2
radius : float32
startAngle : float32
endAngle : float32
color : Color
segments : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddClear

Full Usage: this.AddClear

Parameters:
Modifiers: inline

this.AddClearScissor

Full Usage: this.AddClearScissor

Parameters:
Modifiers: inline

this.AddDirectionalLight

Full Usage: this.AddDirectionalLight

Parameters:
Modifiers: inline
lightCtx : LightContext2D
direction : Vector2
color : Color
intensity : float32
castsShadows : bool
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddDirectionalLightState

Full Usage: this.AddDirectionalLightState

Parameters:
Modifiers: inline

this.AddDisableShadows

Full Usage: this.AddDisableShadows

Parameters:
Modifiers: inline

this.AddDrawImmediate

Full Usage: this.AddDrawImmediate

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

this.AddEllipseOutline

Full Usage: this.AddEllipseOutline

Parameters:
Modifiers: inline
centerX : int
centerY : int
radiusH : float32
radiusV : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddEnableShadows

Full Usage: this.AddEnableShadows

Parameters:
Modifiers: inline

this.AddEndCamera

Full Usage: this.AddEndCamera

Parameters:
Modifiers: inline

this.AddEndLighting

Full Usage: this.AddEndLighting

Parameters:
Modifiers: inline

this.AddEndShader

Full Usage: this.AddEndShader

Parameters:
Modifiers: inline

this.AddEndTarget

Full Usage: this.AddEndTarget

Parameters:
Modifiers: inline

this.AddFillCircle

Full Usage: this.AddFillCircle

Parameters:
Modifiers: inline
center : Vector2
radius : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddFillEllipse

Full Usage: this.AddFillEllipse

Parameters:
Modifiers: inline
centerX : int
centerY : int
radiusH : float32
radiusV : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddFillPoly

Full Usage: this.AddFillPoly

Parameters:
Modifiers: inline
center : Vector2
sides : int
radius : float32
rotation : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddFillRect

Full Usage: this.AddFillRect

Parameters:
Modifiers: inline
x : float32
y : float32
w : float32
h : float32
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddFillRectRounded

Full Usage: this.AddFillRectRounded

Parameters:
Modifiers: inline
x : float32
y : float32
w : float32
h : float32
color : Color
roundness : float32
segments : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddFillRing

Full Usage: this.AddFillRing

Parameters:
Modifiers: inline
center : Vector2
innerR : float32
outerR : float32
startAngle : float32
endAngle : float32
color : Color
segments : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddLine

Full Usage: this.AddLine

Parameters:
Modifiers: inline
start : Vector2
finish : Vector2
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddLineStrip

Full Usage: this.AddLineStrip

Parameters:
Modifiers: inline
points : Vector2[]
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddLineThick

Full Usage: this.AddLineThick

Parameters:
Modifiers: inline
start : Vector2
finish : Vector2
color : Color
thickness : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddLitAnimatedSprite

Full Usage: this.AddLitAnimatedSprite

Parameters:
Modifiers: inline

this.AddLitSprite

Full Usage: this.AddLitSprite

Parameters:
Modifiers: inline
lightCtx : LightContext2D
sprite : SpriteState

this.AddOccluder

Full Usage: this.AddOccluder

Parameters:
Modifiers: inline

this.AddParticles

Full Usage: this.AddParticles

Parameters:
Modifiers: inline
texture : Texture2D
particles : Particle2D[]
count : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddPointLight

Full Usage: this.AddPointLight

Parameters:
Modifiers: inline

this.AddPolyOutline

Full Usage: this.AddPolyOutline

Parameters:
Modifiers: inline
center : Vector2
sides : int
radius : float32
rotation : float32
color : Color
thickness : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddPostProcess

Full Usage: this.AddPostProcess

Parameters:
Modifiers: inline
action : PostProcessContext2D -> unit

this.AddRectGradient

Full Usage: this.AddRectGradient

Parameters:
Modifiers: inline
x : float32
y : float32
w : float32
h : float32
tl : Color
bl : Color
tr : Color
br : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddRectGradientH

Full Usage: this.AddRectGradientH

Parameters:
Modifiers: inline
x : int
y : int
w : int
h : int
left : Color
right : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddRectGradientV

Full Usage: this.AddRectGradientV

Parameters:
Modifiers: inline
x : int
y : int
w : int
h : int
top : Color
bottom : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddRectOutline

Full Usage: this.AddRectOutline

Parameters:
Modifiers: inline
x : float32
y : float32
w : float32
h : float32
color : Color
thickness : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddRectRoundedOutline

Full Usage: this.AddRectRoundedOutline

Parameters:
Modifiers: inline
x : float32
y : float32
w : float32
h : float32
color : Color
roundness : float32
segments : int
thickness : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddRingOutline

Full Usage: this.AddRingOutline

Parameters:
Modifiers: inline
center : Vector2
innerR : float32
outerR : float32
startAngle : float32
endAngle : float32
color : Color
segments : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddSamplerState

Full Usage: this.AddSamplerState

Parameters:
Modifiers: inline

MonoGame-only witness — the Core Draw.SetSamplerState member has no raylib counterpart; capability gating via witness presence.

sampler : SamplerState
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddSetAmbient

Full Usage: this.AddSetAmbient

Parameters:
Modifiers: inline

this.AddSetBlend

Full Usage: this.AddSetBlend

Parameters:
Modifiers: inline

this.AddSetLineWidth

Full Usage: this.AddSetLineWidth

Parameters:
Modifiers: inline
width : float32
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddSetScissor

Full Usage: this.AddSetScissor

Parameters:
Modifiers: inline
x : int
y : int
w : int
h : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddSetViewport

Full Usage: this.AddSetViewport

Parameters:
Modifiers: inline
x : int
y : int
w : int
h : int
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddSpriteState

Full Usage: this.AddSpriteState

Parameters:
Modifiers: inline
state : SpriteState

this.AddText

Full Usage: this.AddText

Parameters:
Modifiers: inline

size→Scale; spacing DROPPED (SpriteBatch has no per-draw spacing) — the documented semantic adaptation for the differing TextState shapes.

font : SpriteFont
text : string
position : Vector2
size : float32
_spacing : float32
tint : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddTextState

Full Usage: this.AddTextState

Parameters:
Modifiers: inline
state : TextState

this.AddTriangle

Full Usage: this.AddTriangle

Parameters:
Modifiers: inline

this.AddTriangleFan

Full Usage: this.AddTriangleFan

Parameters:
Modifiers: inline
points : Vector2[]
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

this.AddTriangleStrip

Full Usage: this.AddTriangleStrip

Parameters:
Modifiers: inline
points : Vector2[]
color : Color
layer : int<MeasureProduct<RenderLayer, MeasureOne>>

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[i]

Full Usage: this[i]

Parameters:
    i : int

Returns: Command2D

Gets the command at the specified index.

i : int
Returns: Command2D

this.PostProcessCount

Full Usage: this.PostProcessCount

Returns: int

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

Returns: int

this.Sort

Full Usage: this.Sort

Sorts commands by layer in ascending order, preserving insertion order for same-layer commands. Uses precomputed int64 keys (layer in high 32 bits, insertion index in low 32 bits) to avoid repeated pattern matching during comparisons and guarantee stable sort. Must be called after RenderBuffer2D.Clear and population, before iteration.

Type something to start searching.