Skip to main content

Texture

A texture object, either generated by the model or created with the TextureAPI

For this page assume:

local myTex = textures["myTexture"]

getName()​

Returns this texture name

Example:

myText:getName()

update()​

Updates the texture to the gpu, applying all the changes

Example:

myText:update()

save()​

Returns a base64 string representation of this texture

Example:

myText:save()

restore()​

Restores the texture to its original state, before any modifications

Example:

myText:restore()

setPixel(int,int,Vector4)​

Sets the RGBA color of the specified pixel

Example:

myText:setPixel(32, 32, 0, 0, 1, 1)

getPixel(int,int)​

Sets the RGBA color of the specified pixel

Example:

myText:getPixel(32, 32)

fill(int,int,int,int,int,Vector4)​

Sets the RGBA color of the entire specified region

Example:

myText:fill(0, 0, 32, 32, 0, 0, 1, 1)

getPath()​

Returns this texture resource path location

Example:

myText:getPath()

getDimensions()​

Returns a vector of this texture width and height

Example:

myText:getDimensions()

applyFunc()​

Calls the given function on the specified area of this texture, it will iterate over each pixel, and their current x, y and color will be given as arguments, the color in a RGBA Vector4 format, and the return value will set that pixel color

Invalid return values or nil takes no effects


applyMatrix()​

Transforms all pixels in the specified area of this texture by the matrix