DrawAPI
Defined in: render/draw.ts:83
Methods
Section titled “Methods”begin()
Section titled “begin()”begin(
viewProjection):void
Defined in: render/draw.ts:88
Begins a new draw frame with the given view-projection matrix. Must be called before any draw commands.
Parameters
Section titled “Parameters”viewProjection
Section titled “viewProjection”Float32Array
Returns
Section titled “Returns”void
circle()
Section titled “circle()”circle(
center,radius,color,filled?,segments?):void
Defined in: render/draw.ts:140
Draws a filled or outlined circle.
Parameters
Section titled “Parameters”center
Section titled “center”Center position
radius
Section titled “radius”number
Circle radius
RGBA color
filled?
Section titled “filled?”boolean
If true draws filled, if false draws outline (default: true)
segments?
Section titled “segments?”number
Number of segments for approximation (default: 32)
Returns
Section titled “Returns”void
circleOutline()
Section titled “circleOutline()”circleOutline(
center,radius,color,thickness?,segments?):void
Defined in: render/draw.ts:150
Draws a circle outline.
Parameters
Section titled “Parameters”center
Section titled “center”Center position
radius
Section titled “radius”number
Circle radius
RGBA color
thickness?
Section titled “thickness?”number
Line thickness in pixels (default: 1)
segments?
Section titled “segments?”number
Number of segments for approximation (default: 32)
Returns
Section titled “Returns”void
drawMesh()
Section titled “drawMesh()”drawMesh(
geometry,shader,transform):void
Defined in: render/draw.ts:211
Draws a custom mesh with a shader.
Parameters
Section titled “Parameters”geometry
Section titled “geometry”number
Geometry handle
shader
Section titled “shader”number
Shader handle
transform
Section titled “transform”Float32Array
Transform matrix (4x4, column-major)
Returns
Section titled “Returns”void
drawMeshWithMaterial()
Section titled “drawMeshWithMaterial()”drawMeshWithMaterial(
geometry,material,transform?):void
Defined in: render/draw.ts:227
Draws a custom mesh with a material.
A material whose shader was compiled from a .esshader (Material.compileShader)
draws through the reflected MaterialConstants path: its #pragma param values and
render state come straight from the engine material store, the shader positions
itself via the injected FrameConstants (and params), and transform is unused —
this path runs on every backend. A raw-GLSL material (Material.createShader) uses
the legacy loose-uniform stream with u_projection/u_model and transform
(identity when omitted).
Parameters
Section titled “Parameters”geometry
Section titled “geometry”number
Geometry handle
material
Section titled “material”number
Material handle
transform?
Section titled “transform?”Float32Array<ArrayBufferLike>
Transform matrix (4x4, column-major) — legacy raw-GLSL path only
Returns
Section titled “Returns”void
end():
void
Defined in: render/draw.ts:94
Ends the current draw frame and submits all commands. Must be called after all draw commands.
Returns
Section titled “Returns”void
getDrawCallCount()
Section titled “getDrawCallCount()”getDrawCallCount():
number
Defined in: render/draw.ts:186
Gets the number of draw calls in the current/last frame.
Returns
Section titled “Returns”number
getPrimitiveCount()
Section titled “getPrimitiveCount()”getPrimitiveCount():
number
Defined in: render/draw.ts:191
Gets the number of primitives drawn in the current/last frame.
Returns
Section titled “Returns”number
line()
Section titled “line()”line(
from,to,color,thickness?):void
Defined in: render/draw.ts:103
Draws a line between two points.
Parameters
Section titled “Parameters”Start point
End point
RGBA color
thickness?
Section titled “thickness?”number
Line thickness in pixels (default: 1)
Returns
Section titled “Returns”void
line3D()
Section titled “line3D()”line3D(
from,to,color,thickness?):void
Defined in: render/draw.ts:112
Draws a line between two points in space.
The ribbon is widened across the view, so it reads as a line from wherever the camera is. Thickness is in WORLD units rather than pixels — a distant line thins out the way the geometry beside it does.
Parameters
Section titled “Parameters”thickness?
Section titled “thickness?”number
Returns
Section titled “Returns”void
rect()
Section titled “rect()”rect(
position,size,color,filled?):void
Defined in: render/draw.ts:121
Draws a filled or outlined rectangle.
Parameters
Section titled “Parameters”position
Section titled “position”Center position
Width and height
RGBA color
filled?
Section titled “filled?”boolean
If true draws filled, if false draws outline (default: true)
Returns
Section titled “Returns”void
rectOutline()
Section titled “rectOutline()”rectOutline(
position,size,color,thickness?):void
Defined in: render/draw.ts:130
Draws a rectangle outline.
Parameters
Section titled “Parameters”position
Section titled “position”Center position
Width and height
RGBA color
thickness?
Section titled “thickness?”number
Line thickness in pixels (default: 1)
Returns
Section titled “Returns”void
setBlendMode()
Section titled “setBlendMode()”setBlendMode(
mode):void
Defined in: render/draw.ts:197
Sets the blend mode for subsequent draw operations.
Parameters
Section titled “Parameters”The blend mode to use
Returns
Section titled “Returns”void
setDepth()
Section titled “setDepth()”setDepth(
depth):void
Defined in: render/draw.ts:181
Sets the current depth for sorting within a layer.
Parameters
Section titled “Parameters”number
Z depth value
Returns
Section titled “Returns”void
setDepthTest()
Section titled “setDepthTest()”setDepthTest(
enabled):void
Defined in: render/draw.ts:203
Enables or disables depth testing.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
True to enable depth testing
Returns
Section titled “Returns”void
setLayer()
Section titled “setLayer()”setLayer(
layer):void
Defined in: render/draw.ts:175
Sets the current render layer.
Parameters
Section titled “Parameters”number
Layer index (higher layers render on top)
Returns
Section titled “Returns”void
texture()
Section titled “texture()”texture(
position,size,textureHandle,tint?):void
Defined in: render/draw.ts:159
Draws a textured quad.
Parameters
Section titled “Parameters”position
Section titled “position”Center position
Width and height
textureHandle
Section titled “textureHandle”number
GPU texture handle
Color tint (default: white)
Returns
Section titled “Returns”void
textureRotated()
Section titled “textureRotated()”textureRotated(
position,size,rotation,textureHandle,tint?):void
Defined in: render/draw.ts:169
Draws a rotated textured quad.
Parameters
Section titled “Parameters”position
Section titled “position”Center position
Width and height
rotation
Section titled “rotation”number
Rotation angle in radians
textureHandle
Section titled “textureHandle”number
GPU texture handle
Color tint (default: white)
Returns
Section titled “Returns”void