Rendering functions, messages and constants. The "render" namespace is accessible only from render scripts.

See RenderMessages for related messages.

Static variables

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.

staticconstant_buffer():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

staticdelete_render_target(render_target:RenderTarget):Void

Deletes a render target.

Parameters:

render_target

render target to delete

staticdisable_material():Void

Disables the currently enabled material.

If a material is currently enabled, disable it.

staticdisable_state(state:RenderState):Void

Disables a render state.

Parameters:

state

state to enable

staticdisable_texture(unit:Int):Void

Disables a texture for a render target.

Parameters:

unit

texture unit to enable disable for

staticdraw(predicate:RenderPredicate, ?constants:RenderConstantBuffer):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

constants

optional constants to use while rendering

staticdraw_debug2d():Void

Deprecated: "Use `Render.draw_debug3d` to draw visual debug info."

Draws all 2d debug graphics (Deprecated).

staticdraw_debug3d():Void

Draws all 3d debug graphics such as lines drawn with "draw_line" messages and physics visualization.

staticenable_material(material_id:String):Void

Enables a material.

If another material was already enabled, it will be automatically disabled.

Parameters:

material_id

material id to enable

staticenable_state(state:RenderState):Void

Enables a render state.

Parameters:

state

state to enable

staticenable_texture(unit:Int, render_target:RenderTarget, buffer_type:RenderBufferType):Void

Enables a texture for a render target.

Parameters:

unit

texture unit to enable texture for

render_target

render target from which to enable the specified texture unit

buffer_type

buffer type from which to enable the texture

staticget_height():Int

Gets the window height, as specified for the project.

Returns:

specified window height

staticget_render_target_height(render_target:RenderTarget, buffer_type:RenderBufferType):Int

Retrieve a buffer height from a render target.

Parameters:

render_target

render target from which to retrieve the buffer height

buffer_type

which type of buffer to retrieve the height from

Returns:

the height of the render target buffer texture

staticget_render_target_width(render_target:RenderTarget, buffer_type:RenderBufferType):Int

Retrieve a buffer width from a render target.

Parameters:

render_target

render target from which to retrieve the buffer width

buffer_type

which type of buffer to retrieve the width from

Returns:

the width of the render target buffer texture

staticget_width():Int

Gets the window width, as specified for the project.

Returns:

specified window width

staticget_window_height():Int

Gets the actual window height.

Returns:

actual window height

staticget_window_width():Int

Gets the actual window width.

Returns:

actual window width

staticpredicate(predicates:Table<Int, 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

staticrender_target(name:String, parameters:RenderTargetParameters):RenderTarget

Creates a new render target.

Creates a new render target according to the supplied specification table.

staticset_blend_func(source_factor:RenderBlendFactor, destination_factor:RenderBlendFactor):Void

Sets the blending function.

Parameters:

source_factor

source factor

destination_factor

destination factor

staticset_color_mask(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

staticset_cull_face(face_type:RenderCullFaceType):Void

Sets the cull face.

Parameters:

face_type

face type

staticset_depth_func(func:RenderCompareFunc):Void

Sets the depth test function.

Parameters:

func

depth test function

staticset_depth_mask(depth:Bool):Void

Sets the depth mask.

Parameters:

depth

depth mask

staticset_polygon_offset(factor:Float, units:Float):Void

Sets the polygon offset.

Parameters:

factor

polygon offset factor

units

polygon offset units

staticset_projection(matrix:Matrix4):Void

Sets the projection matrix to use when rendering.

Parameters:

matrix

projection matrix

staticset_render_target(render_target:RenderTarget, ?options: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:

render_target

render target to set. Render.RENDER_TARGET_DEFAULT to set the default render target

options

optional table with behaviour parameters

staticset_render_target_size(render_target:RenderTarget, width:Int, height:Int):Void

Sets the render target size.

Parameters:

render_target

render target to set size for

width

new render target width

height

new render target height

staticset_stencil_func(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

staticset_stencil_mask(mask:Int):Void

Sets the stencil mask.

Parameters:

mask

stencil mask (number)

staticset_stencil_op(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

staticset_view(matrix:Matrix4):Void

Sets the view matrix to use when rendering.

Parameters:

matrix

view matrix to set

staticset_viewport(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