跳转到内容

DrawAPI

此内容尚不支持你的语言。

Defined in: draw.ts:74

begin(viewProjection): void

Defined in: draw.ts:79

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: draw.ts:122

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: draw.ts:132

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: draw.ts:193

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: draw.ts:209

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: draw.ts:85

Ends the current draw frame and submits all commands. Must be called after all draw commands.

void


getDrawCallCount(): number

Defined in: draw.ts:168

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

number


getPrimitiveCount(): number

Defined in: draw.ts:173

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

number


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

Defined in: draw.ts:94

Draws a line between two points.

Vec2

Start point

Vec2

End point

Color

RGBA color

number

Line thickness in pixels (default: 1)

void


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

Defined in: draw.ts:103

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: draw.ts:112

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: draw.ts:179

Sets the blend mode for subsequent draw operations.

BlendMode

The blend mode to use

void


setDepth(depth): void

Defined in: draw.ts:163

Sets the current depth for sorting within a layer.

number

Z depth value

void


setDepthTest(enabled): void

Defined in: draw.ts:185

Enables or disables depth testing.

boolean

True to enable depth testing

void


setLayer(layer): void

Defined in: draw.ts:157

Sets the current render layer.

number

Layer index (higher layers render on top)

void


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

Defined in: draw.ts:141

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: draw.ts:151

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