Skip to content
Christian Cuevas edited this page May 30, 2021 · 13 revisions

About

Voxel is a utility class that contains various static properties and methods related to voxels. The static properties are used when creating voxel content, and the static methods assist in the creation, setting and getting of voxel data.

To clarify, the Voxel class is not instanced to make voxel data, the voxel data is itself dictionaries. Every voxel is a dictionary, not all dictionaries are voxels; That is, a dictionary that follows the defined schema, found near the top of the Voxel source code, is voxel data.

Note: Voxel is declared with class_name Voxel, which means that while Voxel-Core is active, you can access Voxel from anywhere without having to load it.

Usage

var x = Voxel.colored(Color.blue)

var y = Voxel.colored(Color.blue, { Vector3.UP: Color(0.33, 0.66, 0.33) })

var z = Voxel.uvd(Vector2(3, 2), { Vector3.RIGHT: Vector2(0, 0) },
      Color.blue, { Vector3.UP: Color(0.33, 0.66, 0.33) })

Voxel.get_color({})                 -> Color.transparent
Voxel.get_color(x)                  -> Color.blue
Voxel.get_face_color(x, Vector3.UP) -> Color.transparent
Voxel.get_face_color(y, Vector3.UP) -> Color(0.33, 0.66, 0.33)
Voxel.get_uv(y)                     -> -Vector2.ONE
Voxel.get_uv(z)                     -> Vector2(3, 2)
Voxel.get_face_uv(z, Vector3.UP)    -> -Vector2.ONE
Voxel.get_face_uv(z, Vector3.RIGHT) -> Vector2(0, 0)
Clone this wiki locally