Skip to content

FxPixel ​

This module contains functions for making and editing FoxelPixel values.

Load ​

lua
FxPixel = require "FxPixel";

Functions ​

FunctionDescription
Create (Color, Material)Creates a pixel.
GetHeight (Pixel)Returns the height of a pixel.
GetColor (Pixel)Returns the color of a pixel.
GetMaterial (Pixel)Returns the material of a pixel.
SetHeight (Pixel, Value)Sets the height of a pixel.
SetColor (Pixel, Value)Sets the color of a pixel.
SetMaterial (Pixel, Value)Sets the material of a pixel.

Create (Color, Material) ​

This function creates a pixel from the given color and material ItemIndex.

Parameters ​

Returns ​

The created FoxelPixel

Errors ​

Possible errors include FX_ITEM_INDEX_INVALID

Since ​

Version 1.0

Example ​

lua
pixel = FxPixel.Create(10, 0);

GetHeight (Pixel) ​

This function returns the height of the given pixel.

Parameters ​

Returns ​

The height

Errors ​

Possible errors include FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
height = FxPixel.GetHeight(pixel);

GetColor (Pixel) ​

This function returns the color ItemIndex of the given pixel. This index can be used for example with FxColorPalette to get the color properties.

Parameters ​

Returns ​

The color ItemIndex

Errors ​

Possible errors include FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
colorid = FxPixel.GetColor(pixel); 
color = FxColorPalette.GetItemColor(colorid);

GetMaterial (Pixel) ​

This function returns the material ItemIndex of the given pixel. This index can be used for example with FxMaterialSet to get the material properties.

Parameters ​

Returns ​

The material ItemIndex

Errors ​

Possible errors include FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
material = FxPixel.GetMaterial(pixel); 
metallic = FxMaterialMap.GetItemMetallic(material);

SetHeight (Pixel, Value) ​

This function changes the height of the given pixel and returns the updated pixel.

Parameters ​

Returns ​

The updated FoxelPixel

Errors ​

Possible errors include FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
pixel = FxPixel.SetHeight(pixel, 100);

SetColor (Pixel, Value) ​

This function changes the color of the given pixel and returns the updated pixel.

Parameters ​

Returns ​

The updated FoxelPixel

Errors ​

Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID

Since ​

Version 1.0

Example ​

lua
pixel = FxPixel.SetColor(pixel, 100);

SetMaterial (Pixel, Value) ​

This function changes the material of the given pixel and returns the updated pixel.

Parameters ​

Returns ​

The updated FoxelPixel

Errors ​

Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID

Since ​

Version 1.0

Example ​

lua
pixel = FxPixel.SetMaterial(pixel, 2);