DrawAPI
此内容尚不支持你的语言。
Defined in: draw.ts:74
Methods
Section titled “Methods”begin()
Section titled “begin()”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.
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: draw.ts:122
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: draw.ts:132
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: draw.ts:193
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: 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).
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: draw.ts:85
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: draw.ts:168
Gets the number of draw calls in the current/last frame.
Returns
Section titled “Returns”number
getPrimitiveCount()
Section titled “getPrimitiveCount()”getPrimitiveCount():
number
Defined in: draw.ts:173
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: draw.ts:94
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
rect()
Section titled “rect()”rect(
position,size,color,filled?):void
Defined in: draw.ts:103
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: draw.ts:112
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: draw.ts:179
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: draw.ts:163
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: draw.ts:185
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: draw.ts:157
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: draw.ts:141
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: draw.ts:151
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