RenderTarget
Description:
A RenderTarget is a buffer that allows you to render a Node into a texture.
Class Object: RenderTarget Class.
Inherits from: Object.
width
Type: Readonly Field.
Description:
The width of the rendering target.
Signature:
const width: integer
height
Type: Readonly Field.
Description:
The height of the rendering target.
Signature:
const height: integer
texture
Type: Readonly Field.
Description:
The texture generated by the rendering target.
Signature:
const texture: Texture2D
camera
Type: Field.
Description:
The camera used for rendering the scene.
Signature:
camera: Camera
render
Type: Function.
Description:
Renders a node to the target without replacing its previous contents.
Signature:
render: function(self: RenderTarget, target: Node)
Parameters:
Parameter | Type | Description |
---|---|---|
target | Node | The node to be rendered onto the render target. |
renderWithClear
Type: Function.
Description:
Clears the previous color, depth and stencil values on the render target.
Signature:
renderWithClear: function(
self: RenderTarget,
color: Color,
depth?: number --[[1]],
stencil?: number --[[0]]
)
Parameters:
Parameter | Type | Description |
---|---|---|
color | Color | The clear color used to clear the render target. |
depth | number | [optional] The value used to clear the depth buffer of the render target. Default is 1. |
stencil | number | [optional] The value used to clear the stencil buffer of the render target. Default is 0. |
renderWithClear
Type: Function.
Description:
Renders a node to the target after clearing the previous color, depth and stencil values on it.
Signature:
renderWithClear: function(
self: RenderTarget,
target: Node,
color: Color,
depth?: number --[[1]],
stencil?: integer --[[0]]
)
Parameters:
Parameter | Type | Description |
---|---|---|
target | Node | The node to be rendered onto the render target. |
color | Color | The clear color used to clear the render target. |
depth | number | [optional] The value used to clear the depth buffer of the render target. Default is 1. |
stencil | number | [optional] The value used to clear the stencil buffer of the render target. Default is 0. |
saveAsync
Type: Function.
Description:
Saves the contents of the render target to a PNG file asynchronously.
Signature:
saveAsync: function(self: RenderTarget, filename: string)
Parameters:
Parameter | Type | Description |
---|---|---|
filename | string | The name of the file to save the contents to. |