Render 3D models in your terminal or app. Sloth is a software rasterizer that turns triangles into charxels (a character + a colour). It does this via a simple triangle-grid intersection method to determine if a triangle is in a character. It then uses a really simple shading scale to determine which character to use based on brightness. Colour is determined by the Vertex color for OBJ and the model color for STL.
cargo add rendersloth
```rust use rendersloth::*;
let mut context = Rasterizer::new(40, 40);
// Convert your OBJ to a simpler format for rendering
let mut meshes: Vec
// Scale the camera to the model context.update(&meshes)?; let transform = Mat4::IDENTITY; // Draw the meshes to the context's built-in framebuffer context.draw_all(transform, meshes)?;
// Print the screen's contents context.flush()?; ```
sh
cargo install rendersloth --features build-cli
sh
rendersloth --file-name models/Pikachu.obj
Maxgy – Rustfmt lint donbright – STL model loading added, Rustfmt lint jonathandturner – Crossterm port