- Rendering functions, messages and constants. The "render" namespace is accessible only from render scripts.
See RenderMessages for related messages.
Static methods
staticclear(buffers:RenderClearBuffers):Void
- Clears the active render target.
Clear buffers in the currently enabled render target with specified value.
Parameters:
buffers | Table with keys specifying which buffers to clear and values set to clear values. |
|---|
staticconstantBuffer():RenderConstantBuffer
- Create a new constant buffer..
Constant buffers are used to set shader program variables and are optionally passed to the Render.draw
function. The buffer's constant elements can be indexed like an ordinary Lua table, but you can't iterate
over them with pairs() or ipairs().
Returns:
new constant buffer
staticdeleteRenderTarget(renderTarget:RenderTarget):Void
- Deletes a render target.
Parameters:
renderTarget | render target to delete |
|---|
staticdisableMaterial():Void
- Disables the currently enabled material.
If a material is currently enabled, disable it.
staticdisableTexture(binding:EitherType<Int, HashOrString>):Void
- Disables a texture for a render target.
Parameters:
unit | texture unit to enable disable for |
|---|
staticdispatchCompute(x:Int, y:Int, z:Int, ?options:Null<RenderComputeOptions>):Void
- Dispatch the currently set compute program.
Parameters:
x | Number of workgroups in X |
|---|---|
y | Number of workgroups in Y |
z | Number of workgroups in Z |
options | Optional table with properties (e.g. constants) |
staticdraw(predicate:RenderPredicate, ?options:Null<RenderDrawOptions>):Void
- Draws all objects matching a predicate.
Draws all objects that match a specified predicate. An optional constant buffer can be
provided to override the default constants. If no constants buffer is provided, a default
system constants buffer is used containing constants as defined in materials and set through
*.set_constant() and *.reset_constant() on visual components.
Parameters:
predicate | predicate to draw for |
|---|---|
options | optional table with properties |
staticdrawDebug2d():Void
- Draws all 2d debug graphics (Deprecated).
staticdrawDebug3d(?options:Null<RenderDebugDrawOptions>):Void
- Draws all 3d debug graphics such as lines drawn with "draw_line" messages and physics visualization.
staticenableMaterial(materialId:HashOrString):Void
- Enables a material.
If another material was already enabled, it will be automatically disabled.
Parameters:
materialId | material id to enable |
|---|
staticenableTexture(binding:EitherType<Int, HashOrString>, handleOrName:EitherType<RenderTarget, TextureResourceHandle>, bufferType:RenderBufferType):Void
- Enables a texture for a render target.
Parameters:
unit | texture unit to enable texture for |
|---|---|
handleOrName | render target from which to enable the specified texture unit |
bufferType | buffer type from which to enable the texture |
staticgetHeight():Int
- Gets the window height, as specified for the project.
Returns:
specified window height
staticgetRenderTargetHeight(renderTarget:EitherType<RenderTarget, HashOrString>, bufferType:RenderBufferType):Int
- Retrieve a buffer height from a render target.
Parameters:
renderTarget | render target from which to retrieve the buffer height |
|---|---|
bufferType | which type of buffer to retrieve the height from |
Returns:
the height of the render target buffer texture
staticgetRenderTargetWidth(renderTarget:EitherType<RenderTarget, HashOrString>, bufferType:RenderBufferType):Int
- Retrieve a buffer width from a render target.
Parameters:
renderTarget | render target from which to retrieve the buffer width |
|---|---|
bufferType | which type of buffer to retrieve the width from |
Returns:
the width of the render target buffer texture
staticgetWidth():Int
- Gets the window width, as specified for the project.
Returns:
specified window width
staticpredicate(predicates:LuaArray<HashOrString>):RenderPredicate
- Creates a new render predicate.
This function returns a new render predicate for objects with materials matching the provided material tags. The provided tags are combined into a bit mask for the predicate. If multiple tags are provided, the predicate matches materials with all tags ANDed together.
The current limit to the number of tags that can be defined is 64.
Parameters:
predicates | table of tags that the predicate should match (table). |
|---|
Returns:
new predicate
staticrenderTarget(parameters:Table<RenderBufferType, RenderTargetParameters>):RenderTarget
- Creates a new render target.
Creates a new render target according to the supplied specification table.
staticsetBlendFunc(sourceFactor:RenderBlendFactor, destinationFactor:RenderBlendFactor):Void
- Sets the blending function.
Parameters:
sourceFactor | source factor |
|---|---|
destinationFactor | destination factor |
staticsetCamera(?camera:Null<HashOrString>, ?options:Null<SetCameraOptions>):Void
- Set or reset the active camera for rendering.
Parameters:
camera | Optional camera id to use. Omit or set to null to reset. |
|---|---|
options | Optional table with behaviour parameters. |
staticsetColorMask(red:Bool, green:Bool, blue:Bool, alpha:Bool):Void
- Sets the color mask.
Parameters:
red | red mask |
|---|---|
green | green mask |
blue | blue mask |
alpha | alpha mask |
staticsetCompute(?compute:Null<HashOrString>):Void
- Set or reset a compute program.
Parameters:
compute | Optional compute program to set. Omit or set to null to disable. |
|---|
staticsetDepthFunc(func:RenderCompareFunc):Void
- Sets the depth test function.
Parameters:
func | depth test function |
|---|
staticsetListener(?callback:RenderContextEvent ‑> Void):Void
- Set a listener for render context events.
Parameters:
callback | Optional callback function. Omit or set to null to remove listener. |
|---|
staticsetPolygonOffset(factor:Float, units:Float):Void
- Sets the polygon offset.
Parameters:
factor | polygon offset factor |
|---|---|
units | polygon offset units |
staticsetProjection(matrix:Matrix4):Void
- Sets the projection matrix to use when rendering.
Parameters:
matrix | projection matrix |
|---|
staticsetRenderTarget(renderarget:EitherType<RenderTarget, HashOrString>, ?options:Null<SetRenderTargetOptions>):Void
- Sets a render target. Subsequent draw operations will be to the render target until it is replaced by a subsequent call to set_render_target.
Parameters:
renderarget | render target to set. |
|---|---|
options | optional table with behaviour parameters |
staticsetRenderTargetSize(renderarget:EitherType<RenderTarget, HashOrString>, width:Int, height:Int):Void
- Sets the render target size.
Parameters:
renderarget | render target to set size for |
|---|---|
width | new render target width |
height | new render target height |
staticsetStencilFunc(func:RenderCompareFunc, ref:Float, mask:Int):Void
- Sets the stencil test function.
Parameters:
func | stencil test function |
|---|---|
ref | reference value for the stencil test |
mask | mask that is ANDed with both the reference value and the stored stencil value when the test is done |
staticsetStencilOp(sfail:RenderStencilOp, dpfail:RenderStencilOp, dppass:RenderStencilOp):Void
- Sets the stencil operator.
Parameters:
sfail | action to take when the stencil test fails |
|---|---|
dpfail | the stencil action when the stencil test passes |
dppass | the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled |
staticsetView(matrix:Matrix4):Void
- Sets the view matrix to use when rendering.
Parameters:
matrix | view matrix to set |
|---|
staticsetViewport(x:Int, y:Int, width:Int, height:Int):Void
- Sets the render viewport.
Parameters:
x | left corner |
|---|---|
y | bottom corner |
width | viewport width |
height | viewport height |