Skip to content

DrawAPI

Defined in: render/draw.ts:83

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.

Float32Array

void


circle(center, radius, color, filled?, segments?): void

Defined in: render/draw.ts:140

Draws a filled or outlined circle.

Vec2

Center position

number

Circle radius

Color

RGBA color

boolean

If true draws filled, if false draws outline (default: true)

number

Number of segments for approximation (default: 32)

void


circleOutline(center, radius, color, thickness?, segments?): void

Defined in: render/draw.ts:150

Draws a circle outline.

Vec2

Center position

number

Circle radius

Color

RGBA color

number

Line thickness in pixels (default: 1)

number

Number of segments for approximation (default: 32)

void


drawMesh(geometry, shader, transform): void

Defined in: render/draw.ts:211

Draws a custom mesh with a shader.

number

Geometry handle

number

Shader handle

Float32Array

Transform matrix (4x4, column-major)

void


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

number

Geometry handle

number

Material handle

Float32Array<ArrayBufferLike>

Transform matrix (4x4, column-major) — legacy raw-GLSL path only

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.

void


getDrawCallCount(): number

Defined in: render/draw.ts:186

Gets the number of draw calls in the current/last frame.

number


getPrimitiveCount(): number

Defined in: render/draw.ts:191

Gets the number of primitives drawn in the current/last frame.

number


line(from, to, color, thickness?): void

Defined in: render/draw.ts:103

Draws a line between two points.

Vec2

Start point

Vec2

End point

Color

RGBA color

number

Line thickness in pixels (default: 1)

void


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.

Vec3

Vec3

Color

number

void


rect(position, size, color, filled?): void

Defined in: render/draw.ts:121

Draws a filled or outlined rectangle.

Vec2

Center position

Vec2

Width and height

Color

RGBA color

boolean

If true draws filled, if false draws outline (default: true)

void


rectOutline(position, size, color, thickness?): void

Defined in: render/draw.ts:130

Draws a rectangle outline.

Vec2

Center position

Vec2

Width and height

Color

RGBA color

number

Line thickness in pixels (default: 1)

void


setBlendMode(mode): void

Defined in: render/draw.ts:197

Sets the blend mode for subsequent draw operations.

BlendMode

The blend mode to use

void


setDepth(depth): void

Defined in: render/draw.ts:181

Sets the current depth for sorting within a layer.

number

Z depth value

void


setDepthTest(enabled): void

Defined in: render/draw.ts:203

Enables or disables depth testing.

boolean

True to enable depth testing

void


setLayer(layer): void

Defined in: render/draw.ts:175

Sets the current render layer.

number

Layer index (higher layers render on top)

void


texture(position, size, textureHandle, tint?): void

Defined in: render/draw.ts:159

Draws a textured quad.

Vec2

Center position

Vec2

Width and height

number

GPU texture handle

Color

Color tint (default: white)

void


textureRotated(position, size, rotation, textureHandle, tint?): void

Defined in: render/draw.ts:169

Draws a rotated textured quad.

Vec2

Center position

Vec2

Width and height

number

Rotation angle in radians

number

GPU texture handle

Color

Color tint (default: white)

void