Voxgen
Maintainers: @wodend
A procedural Voxel Generation Library
Provides functions for generating MagicaVoxel models using popular 3D procedural generation techniques.
So far, only 2D L Systems are implemented, for example:
All voxel generation functions provided operate on types that implement the VoxelBuffer
trait.
Raw Voxel Buffers
Manipulate a buffer of voxels by setting individual voxel values.
use ;
let mut vol = new;
// Draw a simple 2D red cross and save as a MagicaVoxel .vox file.
for x in 15..=17
vol.save?;
# Ok::
Turtle Graphics
Manipulate a VoxelBuffer
using LOGO-style turtle graphics commands.
use TurtleGraphics;
// Draw a line and save the output.
let mut turtle = new;
// Move the turtle 1 step forward (east) without drawing.
turtle.step;
// Turn the turtle pi/2 radians left (facing north).
turtle.left;
// Draw a line 2 steps down the middle of the y axis.
turtle.draw;
// Save the current drawing as a magicavoxel .vox file.
turtle.buf.save.unwrap;
L Systems
Inteprets L System strings and renders them using TurtleGraphics
.
use ;
// Render a Koch curve.
let l_system = new;
// Builder pattern for custom rendering options.
// Default path is test/volumes/{l_system_name}_{derivation_length}.vox.
new
.offset_x
.offset_y
.render;