FxPixel ​
This module contains functions for making and editing FoxelPixel values.
Load ​
FxPixel = require "FxPixel";Functions ​
| Function | Description |
|---|---|
| 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 ​
pixel = FxPixel.Create(10, 0);GetHeight (Pixel) ​
This function returns the height of the given pixel.
Parameters ​
- Pixel: The FoxelPixel to query
Returns ​
The height
Errors ​
Possible errors include FX_VALUE_INVALID
Since ​
Version 1.0
Example ​
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 ​
- Pixel: The FoxelPixel to query
Returns ​
The color ItemIndex
Errors ​
Possible errors include FX_VALUE_INVALID
Since ​
Version 1.0
Example ​
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 ​
- Pixel: The FoxelPixel to query
Returns ​
The material ItemIndex
Errors ​
Possible errors include FX_VALUE_INVALID
Since ​
Version 1.0
Example ​
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 ​
- Pixel: The FoxelPixel
- Value: New height value
Returns ​
The updated FoxelPixel
Errors ​
Possible errors include FX_VALUE_INVALID
Since ​
Version 1.0
Example ​
pixel = FxPixel.SetHeight(pixel, 100);SetColor (Pixel, Value) ​
This function changes the color of the given pixel and returns the updated pixel.
Parameters ​
- Pixel: The FoxelPixel
- Value: The new color ItemIndex
Returns ​
The updated FoxelPixel
Errors ​
Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID
Since ​
Version 1.0
Example ​
pixel = FxPixel.SetColor(pixel, 100);SetMaterial (Pixel, Value) ​
This function changes the material of the given pixel and returns the updated pixel.
Parameters ​
- Pixel: The FoxelPixel
- Value: The new material ItemIndex
Returns ​
The updated FoxelPixel
Errors ​
Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID
Since ​
Version 1.0
Example ​
pixel = FxPixel.SetMaterial(pixel, 2);