Texture:clear
EditClears 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
| Name | Type | Default | Description |
| hex | number | The hexcode color to clear to. | |
| layer | number | 1 | The index of the first layer to clear. |
| layerCount | number | nil | The number of layers to clear. If nil, clears the rest of the layers. |
| mipmap | number | 1 | The index of the first mipmap to clear. |
| mipmapCount | number | nil | The number of mipmaps to clear. If nil, clears the rest of the mipmaps. |
Returns
Nothing
Arguments
| Name | Type | Default | Description |
| r | number | The red component of the clear color. | |
| g | number | The green component of the clear color. | |
| b | number | The blue component of the clear color. | |
| a | number | The alpha component of the clear color. | |
| layer | number | 1 | The index of the first layer to clear. |
| layerCount | number | nil | The number of layers to clear. If nil, clears the rest of the layers. |
| mipmap | number | 1 | The index of the first mipmap to clear. |
| mipmapCount | number | nil | The number of mipmaps to clear. If nil, clears the rest of the mipmaps. |
Returns
Nothing
Arguments
| Name | Type | Default | Description |
| t | {number} | A table with color components. | |
| layer | number | 1 | The index of the first layer to clear. |
| layerCount | number | nil | The number of layers to clear. If nil, clears the rest of the layers. |
| mipmap | number | 1 | The index of the first mipmap to clear. |
| mipmapCount | number | nil | The number of mipmaps to clear. If nil, clears the rest of the mipmaps. |
Returns
Nothing
Arguments
| Name | Type | Default | Description |
| v | vector | A vector with the clear color (alpha will be 1). | |
| layer | number | 1 | The index of the first layer to clear. |
| layerCount | number | nil | The number of layers to clear. If nil, clears the rest of the layers. |
| mipmap | number | 1 | The index of the first mipmap to clear. |
| mipmapCount | number | nil | 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.
When clearing a 3D texture, the layer and layerCount arguments are ignored, and all of the layers in a mipmap level will be cleared.