Canvas - awesome-llama/procedural-sandbox GitHub Wiki

The canvas is the 3D cuboid environment of voxels. Its dimensions are given with three variables containing positive integers only:

  • canvas_size_x
  • canvas_size_y
  • canvas_size_z

Voxels are indexed from 0. A canvas with size x of 4 would have voxels located at 0,1,2,3. The canvas wraps on the X and Y axes allowing for seamless texture generation. Indices out of range will wrap. Indices for the Z axis however do not wrap, those out of range will be discarded or return empty strings (Scratch's behaviour with out-of-range list indices). As this project is mostly catered to 2D textures, most canvases will be considerably wider than they are tall.

All voxels are stored in a goboscript struct list named canvas. These compile to Scratch lists for each voxel attribute: r, g, b, opacity, emission. All attributes store double-precision floating-point numbers in the inclusive interval of 0.0 to 1.0. The 3 color channels are stored in the sRGB color space. Opacity and emission are linear.

The canvas and 3D world uses a right-handed east-counter-clockwise coordinate system. Angles are measured in degrees.