Skip to main content

Grabber

Description:

  A grabber which is used to render a part of the scene to a texture by a grid of vertices.

Usage:

local node = Node()
node.size = Size(500, 500)
local grabber = node:grab(true)
grabber:moveUV(0, 0, Vec2(0, 0.1))

camera

Type: Field.

Description:

  The camera used to render the texture.

Signature:

camera: Camera

effect

Type: Field.

Description:

  The sprite effect applied to the texture.

Signature:

effect: SpriteEffect

blendFunc

Type: Field.

Description:

  The blend function applied to the texture.

Signature:

blendFunc: BlendFunc

clearColor

Type: Field.

Description:

  The clear color used to clear the texture.

Signature:

clearColor: Color

setPos

Type: Function.

Description:

  Sets the position of a vertex in the grabber grid.

Signature:

setPos: function(self: Grabber, x: integer, y: integer, pos: Vec2, z?: number --[[0.0]])

Parameters:

ParameterTypeDescription
xintegerThe x-index of the vertex in the grabber grid.
yintegerThe y-index of the vertex in the grabber grid.
posVec2The new position of the vertex.
znumber[optional] The new z-coordinate of the vertex (default: 0.0).

getPos

Type: Function.

Description:

  Gets the position of a vertex in the grabber grid.

Signature:

getPos: function(self: Grabber, x: integer, y: integer): Vec2

Parameters:

ParameterTypeDescription
xintegerThe x-index of the vertex in the grabber grid.
yintegerThe y-index of the vertex in the grabber grid.

Returns:

Return TypeDescription
Vec2The position of the vertex.

getColor

Type: Function.

Description:

  Gets the color of a vertex in the grabber grid.

Signature:

getColor: function(self: Grabber, x: integer, y: integer): Color

Parameters:

ParameterTypeDescription
xintegerThe x-index of the vertex in the grabber grid.
yintegerThe y-index of the vertex in the grabber grid.

Returns:

Return TypeDescription
ColorThe color of the vertex.

setColor

Type: Function.

Description:

  Sets the color of a vertex in the grabber grid.

Signature:

setColor: function(self: Grabber, x: integer, y: integer, color: Color)

Parameters:

ParameterTypeDescription
xintegerThe x-index of the vertex in the grabber grid.
yintegerThe y-index of the vertex in the grabber grid.
colorColorThe new color of the vertex.

moveUV

Type: Function.

Description:

  Sets the UV coordinates of a vertex in the grabber grid.

Signature:

moveUV: function(self: Grabber, x: integer, y: integer, offset: Vec2)

Parameters:

ParameterTypeDescription
xintegerThe x-index of the vertex in the grabber grid.
yintegerThe y-index of the vertex in the grabber grid.
offsetVec2The new UV coordinates of the vertex.