Texture:clear

Edit

Clears layers and mipmaps in a texture to a given color.

When a Texture is being used as a canvas for a Pass, the clear color can be set with Pass:setClear, which a more efficient way to clear the texture before rendering.







Clear the whole texture to zero (transparent black).

Arguments

None

Returns

Nothing

Arguments

NameTypeDefaultDescription
hexnumber The hexcode color to clear to.
layernumber1 The index of the first layer to clear.
layerCountnumbernil The number of layers to clear. If nil, clears the rest of the layers.
mipmapnumber1 The index of the first mipmap to clear.
mipmapCountnumbernil The number of mipmaps to clear. If nil, clears the rest of the mipmaps.

Returns

Nothing

Arguments

NameTypeDefaultDescription
rnumber The red component of the clear color.
gnumber The green component of the clear color.
bnumber The blue component of the clear color.
anumber The alpha component of the clear color.
layernumber1 The index of the first layer to clear.
layerCountnumbernil The number of layers to clear. If nil, clears the rest of the layers.
mipmapnumber1 The index of the first mipmap to clear.
mipmapCountnumbernil The number of mipmaps to clear. If nil, clears the rest of the mipmaps.

Returns

Nothing

Arguments

NameTypeDefaultDescription
ttable A table with color components.
layernumber1 The index of the first layer to clear.
layerCountnumbernil The number of layers to clear. If nil, clears the rest of the layers.
mipmapnumber1 The index of the first mipmap to clear.
mipmapCountnumbernil The number of mipmaps to clear. If nil, clears the rest of the mipmaps.

Returns

Nothing

Arguments

NameTypeDefaultDescription
v3Vec3 A vec3 with the clear color.
layernumber1 The index of the first layer to clear.
layerCountnumbernil The number of layers to clear. If nil, clears the rest of the layers.
mipmapnumber1 The index of the first mipmap to clear.
mipmapCountnumbernil The number of mipmaps to clear. If nil, clears the rest of the mipmaps.

Returns

Nothing

Arguments

NameTypeDefaultDescription
v4Vec4 A vec4 with the clear color.
layernumber1 The index of the first layer to clear.
layerCountnumbernil The number of layers to clear. If nil, clears the rest of the layers.
mipmapnumber1 The index of the first mipmap to clear.
mipmapCountnumbernil The number of mipmaps to clear. If nil, clears the rest of the mipmaps.

Returns

Nothing

Notes

The texture must have been created with the transfer usage to clear it.

The clear color will be interpreted as a linear color for sRGB formats.

See also