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; Falloff = 2f; 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:
animatedModelWith am transform material buffer
Parameters:
AnimatedModel
transform : Matrix
material : Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws an animated model with a whole-model Material3D
override. Bone palette is derived internally from the state, same as
|
Full Usage:
animatedModelWithPerMesh am transform resolver buffer
Parameters:
AnimatedModel
transform : Matrix
resolver : int -> Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws an animated model with a per-mesh-part material resolver (flat index over
|
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 effect buffer
Parameters:
Effect
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Opens a per-group shading scope: draws between this and Draw3D.endEffect are shaded by effect instead of the default PBR effect. The effect inherits the gathered scene data (camera matrices, lights, material, bones) — 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 effect 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.drawInstanced inside a scope is shaded by the user
effect when it exposes an
|
Full Usage:
disableShadows buffer
Parameters:
RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Disables shadow casting for subsequent geometry until re-enabled.
|
Full Usage:
drawAnimatedModel am transform buffer
Parameters:
AnimatedModel
transform : Matrix
buffer : RenderBuffer3D
Returns: RenderBuffer3D
|
Draws an animated model. The 3D analog of the 2D
|
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 raw device access AND the scene data the pipeline gathered this frame. The callback receives a SceneContext — the graphics device, the active camera (view/projection/config), the accumulated lights, the shadow pass output, and the elapsed time — so a custom effect (water/refraction, screen-space, multi-pass) can read the scene without re-implementing the gather. The pipeline restores the viewport + camera scope around the callback; any other device state you mutate is your responsibility.
|
Full Usage:
drawInstanced mesh transforms material instanceCount buffer
Parameters:
PrimitiveMesh
transforms : Matrix[]
material : Material3D
instanceCount : int
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws static instanced bulk (terrain/props) of an effectless
PrimitiveMesh. Auto-PBR + lights + shadows.
Used by
|
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:
drawMeshEffect meshPart transform effect buffer
Parameters:
ModelMeshPart
transform : Matrix
effect : Effect
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a mesh part with a user-supplied Effect
(escape hatch). The pipeline sets
|
Full Usage:
drawModel model transform buffer
Parameters:
Model
transform : Matrix
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a static model with a world transform. Auto-PBR + lights + shadows; the model's
baked native effect is read via
|
Full Usage:
drawPrimitive mesh transform material buffer
Parameters:
PrimitiveMesh
transform : Matrix
material : Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws an effectless PrimitiveMesh with a PBR material. Auto-PBR + lights + shadows.
|
|
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 : Matrix
material : Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a static model with a whole-model Material3D override — every mesh part uses material instead of its authored material. Auto-PBR + lights + shadows.
|
Full Usage:
modelWithPerMesh model transform resolver buffer
Parameters:
Model
transform : Matrix
resolver : int -> Material3D
buffer : RenderBuffer3D
Returns: RenderBuffer3D
Modifiers: inline |
Draws a static model with a per-mesh-part material resolver. resolver
is indexed by a flat counter over
|
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
carrying the scene texture, a fullscreen quad, and the device.
|
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 also renders
scene depth to an R32F target and exposes it 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