Draw3D Module
Pipe-friendly drawing DSL for 3D rendering. Each function takes a RenderBuffer3D as its last argument, adds the corresponding command, and returns the buffer for chaining.
Commands are built via Command3D and added to the buffer.
Usage:
buffer
|> Draw3D.beginCamera worldCamera
|> Draw3D.drawModel model transform
|> Draw3D.addPointLight { Position = pos; Color = Color.White; Intensity = 1f; Radius = 10f; CastsShadows = false; ShadowBias = ValueNone }
|> Draw3D.endCamera
|> Draw3D.drop
Functions and values
| Function or value |
Description
|
Full Usage:
addDirectionalLight light buffer
Parameters:
DirectionalLight3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Adds a directional light to the scene.
|
Full Usage:
addPointLight light buffer
Parameters:
PointLight3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Adds a point light to the scene.
|
Full Usage:
addSpotLight light buffer
Parameters:
SpotLight3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
|
Full Usage:
beginCamera camera buffer
Parameters:
Camera3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
|
Full Usage:
beginCameraWith config buffer
Parameters:
Camera3DConfig
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Begins a 3D camera with explicit rendering config (viewport, clear, post-process).
|
Full Usage:
beginEffect shader buffer
Parameters:
Shader
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Opens a per-group shading scope: draws between this and Draw3D.endEffect are shaded by shader instead of the default PBR shader. The shader inherits the gathered scene data (camera matrices, lights, material, bones, time) — not the PBR shader itself: it need only declare the uniform subset it consumes, and absent uniforms are skipped. This lets a toon/cel/wireframe shader reuse the scene's camera + lighting without re-implementing the gather. The scope closes at Draw3D.endEffect or automatically at the next Draw3D.endCamera (scopes do not persist across cameras).
Shadows + lights + animation are inherited by declaration. The scene gather (camera,
lights, the shadow pass output, material, bones, and the frame's elapsed Draw3D.drawMeshInstanced inside a scope is shaded by the
user shader when it declares
|
Full Usage:
disableShadows buffer
Parameters:
RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Disables shadow casting for subsequent geometry until re-enabled.
|
Full Usage:
drawBillboard texture position size color buffer
Parameters:
Texture2D
position : Vector3
size : Vector2
color : Color
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a billboard (camera-facing quad) with a texture.
|
Full Usage:
drawBillboardBatch textures positions sizes colors count buffer
Parameters:
Texture2D[]
positions : Vector3[]
sizes : Vector2[]
colors : Color[]
count : int
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws multiple billboards in a single batch.
Prefer this over individual
|
Full Usage:
drawImmediate action buffer
Parameters:
SceneContext -> unit
-
A callback invoked once with the frame's SceneContext.
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Runs a fully-custom draw with the scene data the pipeline gathered this frame. The callback receives a SceneContext — the active camera (view/projection/config), the accumulated lights, the shadow pass output, and the elapsed time — so a custom shader (water/refraction, screen-space, multi-pass) can read the scene without re-implementing the gather. The pipeline restores the camera scope around the callback; any other raylib device state you mutate is your responsibility.
|
Full Usage:
drawLine3D start finish color buffer
Parameters:
Vector3
finish : Vector3
color : Color
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a 3D line between two points.
|
Full Usage:
drawMesh mesh transform material buffer
Parameters:
Mesh
transform : Matrix4x4
material : Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a mesh with a world transform and material.
|
Full Usage:
drawMeshInstanced mesh transforms material instanceCount buffer
Parameters:
Mesh
transforms : Matrix4x4[]
material : Material3D
instanceCount : int
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws multiple instances of the same mesh with different transforms.
Prefer this over individual
|
Full Usage:
drawModel model transform buffer
Parameters:
Model
transform : Matrix4x4
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a raylib model with a world transform. Each sub-mesh is drawn with its corresponding raylib material, converted to Material3D automatically.
|
Full Usage:
drawSkinnedMesh mesh transform material bones buffer
Parameters:
Mesh
transform : Matrix4x4
material : Material3D
bones : Matrix4x4[]
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a skinned mesh with bone matrix data.
|
|
Terminal function that discards the buffer, silencing the unused-value warning. Does nothing.
|
Full Usage:
enableShadows buffer
Parameters:
RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Enables shadow casting for subsequent geometry until disabled.
|
Full Usage:
endCamera buffer
Parameters:
RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
|
Full Usage:
endEffect buffer
Parameters:
RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Closes the shading scope opened by Draw3D.beginEffect; subsequent draws revert to the default PBR path. No-op if no scope is open.
|
Full Usage:
modelWith model transform material buffer
Parameters:
Model
transform : Matrix4x4
material : Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a raylib model with a whole-model Material3D override — every sub-mesh uses material instead of its authored material.
|
Full Usage:
modelWithPerMesh model transform resolver buffer
Parameters:
Model
transform : Matrix4x4
resolver : int -> Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a raylib model with a per-sub-mesh material resolver. resolver
is indexed by mesh index (
|
Full Usage:
postProcess action buffer
Parameters:
PostProcessContext3D -> unit
-
Invoked once per frame with the post-process context (Depth = ValueNone).
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Enqueues a color-only post-process pass. The action runs once, after the whole scene renders
to an offscreen target; it receives a PostProcessContext3D
with the scene texture.
|
Full Usage:
postProcessWithDepth action buffer
Parameters:
PostProcessContext3D -> unit
-
Invoked once per frame with the post-process context (Depth populated).
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Enqueues a post-process pass that needs camera-POV scene depth. Same lifecycle as
Draw3D.postProcess (runs once after the scene renders,
chains in buffer order), but when at least one such action is present the pipeline exposes the
scene render target's depth attachment via
|
Full Usage:
setAmbientLight light buffer
Parameters:
AmbientLight3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Sets the ambient light for the scene.
|
Full Usage:
setShadowOrigin origin buffer
Parameters:
Vector3
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Sets the shadow origin for this frame's shadow pass.
|
Mibo