Expand description
§zoa
A 3D ASCII renderer library for terminal UIs.
Zoa provides tools to render 3D shapes as ASCII art in the terminal, with support for custom models (OBJ/STL), multiple character styles, color palettes, and visual effects.
§Quick Start
The easiest way to embed zoa in your ratatui app:
use zoa::ZoaWidget;
use ratatui::Frame;
let mut widget = ZoaWidget::default();
// In your render loop:
fn draw(frame: &mut Frame, widget: &mut ZoaWidget) {
widget.update(0.016); // delta time in seconds
frame.render_widget(widget, frame.area());
}§Low-level API
For more control, use the renderer directly:
use zoa::{Renderer, AsciiBuffer, Torus, CharStyle, ColorPalette};
let renderer = Renderer::default();
let mut buffer = AsciiBuffer::new(80, 24);
let torus = Torus::default();
torus.render(&renderer, &mut buffer);
for y in 0..buffer.height {
for x in 0..buffer.width {
if let Some(fragment) = buffer.get(x, y) {
let ch = CharStyle::Ascii.to_char(fragment.luminance);
let color = ColorPalette::Cyan.to_color(fragment.luminance);
// render ch with color...
}
}
}Re-exports§
pub use renderer::AsciiBuffer;pub use renderer::Camera;pub use renderer::CharStyle;pub use renderer::ColorPalette;pub use renderer::Fragment;pub use renderer::RenderMode;pub use renderer::Renderer;pub use renderer::Vec3;pub use shapes::AnimatedGif;pub use shapes::Countdown;pub use shapes::Cube;pub use shapes::Mesh;pub use shapes::ParticlePreset;pub use shapes::ParticleSystem;pub use shapes::SdfPreset;pub use shapes::SdfScene;pub use shapes::Sphere;pub use shapes::Torus;pub use shapes::Triangle;pub use widget::ZoaConfig;pub use widget::ZoaWidget;pub use widget::Shape;