FxVoxel โ
This module contains functions for creating and editing FoxelVoxel values.
Load โ
FxVoxel = require "FxVoxel";Functions โ
| Function | Description |
|---|---|
| Create (Color, Material) | Creates a voxel. |
| Flip (Voxel, Axis) | Flips a voxel. |
| GetColor (Voxel) | Returns the color of a voxel. |
| GetMaterial (Voxel) | Returns the material of a voxel. |
| GetRotation (Voxel) | Returns the rotation of a voxel. |
| GetShape (Voxel) | Returns the shape of a voxel. |
| Rotate90 (Voxel, Axis, Steps) | Rotates a voxel in 90ยฐ steps. |
| SetColor (Voxel, Value) | Sets the color of a voxel. |
| SetMaterial (Voxel, Value) | Sets the material of a voxel. |
| SetRotation (Voxel, Value) | Sets the rotation of a voxel. |
| SetShape (Voxel, Value) | Sets the shape of a voxel. |
Create (Color, Material) โ
This function creates a voxel from the given color and material ItemIndex. All other properties are set to their default values.
Parameters โ
Returns โ
The created FoxelVoxel
Errors โ
Possible errors include FX_ITEM_INDEX_INVALID
Since โ
Version 1.0
Example โ
voxel = FxVoxel.Create(10, 0);Flip (Voxel, Axis) โ
This function flips a voxel along the given axis and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel to flip
- Axis: The flip Axis3D
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
-- flip voxel along x-axis
voxel = FxVoxel.Flip(voxel, 0);GetColor (Voxel) โ
This function returns the color ItemIndex of the given voxel. This index can be used for example with FxColorPalette to get the color properties.
Parameters โ
- Voxel: The FoxelVoxel to query
Returns โ
The color ItemIndex of the voxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
colorid = FxVoxel.GetColor(voxel);
color = FxColorPalette.GetItemColor(colorid);GetMaterial (Voxel) โ
This function returns the material of the given voxel. This index can be used for example with FxMaterialSet to get the material properties.
Parameters โ
- Voxel: The FoxelVoxel to query
Returns โ
The material ItemIndex of the voxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
material = FxVoxel.GetMaterial(voxel);
metallic = FxMaterialMap.GetItemMetallic(material);GetRotation (Voxel) โ
This function returns the cube rotation of the given voxel.
Parameters โ
- Voxel: The FoxelVoxel to query
Returns โ
The CubeRotation of the voxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
rotation = FxVoxel.GetRotation(voxel);GetShape (Voxel) โ
This function returns the shape of the given voxel.
Parameters โ
- Voxel: The FoxelVoxel to query
Returns โ
The VoxelShape of the voxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
shape = FxVoxel.GetShape(voxel);Rotate90 (Voxel, Axis, Steps) โ
This function rotates the voxel around the given axis and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel to rotate
- Axis: The rotation Axis3D
- Steps: The number of 90ยฐ rotation steps
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
-- rotate voxel 180ยฐ around y-axis
voxel = FxVoxel.Rotate90(voxel, 1, 2);SetColor (Voxel, Value) โ
This function changes the color of the given voxel and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel
- Value: The new color ItemIndex
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID
Since โ
Version 1.0
Example โ
voxel = FxVoxel.SetColor(voxel, 100);SetMaterial (Voxel, Value) โ
This function changes the material of the given voxel and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel
- Value: The new material ItemIndex
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID
Since โ
Version 1.0
Example โ
voxel = FxVoxel.SetMaterial(voxel, 2);SetRotation (Voxel, Value) โ
This function changes the rotation of the given voxel and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel
- Value: The new CubeRotation
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
voxel = FxVoxel.SetRotation(voxel, 15);SetShape (Voxel, Value) โ
This function changes the shape of the given voxel and returns the updated voxel.
Parameters โ
- Voxel: The FoxelVoxel
- Value: The new VoxelShape
Returns โ
The updated FoxelVoxel
Errors โ
Possible errors include FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
voxel = FxVoxel.SetShape(voxel, 2);