I've added a visualization system that displays animated 3D objects right in your console window!
- ASCII Display System - View 3D graphics in your terminal
- Interactive Demo - Watch multiple 3D objects move and rotate in real-time
- Bezier Path Animation - Objects follow smooth curved paths
- Multiple Objects - Cube, pyramid, and more spinning together
Choose ONE option:
Option A: MinGW (Recommended - Lightweight)
# Install via Chocolatey (run as Administrator)
choco install mingw -yOption B: Visual Studio
- Download from: https://visualstudio.microsoft.com/downloads/
- Install "Desktop development with C++"
cd "C:\Users\SAMPR\OneDrive\Desktop\GitHub Projects\C-graphic-driver\libtiny3d"
.\build-simple.ps1Or if you prefer batch files:
.\build-simple.bat.\build\bin\interactive.exeThe interactive demo shows:
- Rotating Cube - Following a curved path (top)
- Spinning Pyramid - Following another path (bottom)
- Center Cube - Rotating in place at the center
- Real-time Animation - Smooth 60 FPS motion
- ASCII Art Rendering - 3D wireframes displayed using text characters
- Cube (8 vertices, 12 edges)
- Pyramid (5 vertices, 8 edges)
- Bezier Curves - Smooth curved motion paths
- Rotation - Objects spin on multiple axes
- Path Following - Objects move along predefined curves
- Depth Sorting - Proper wireframe rendering
- Resolution: 800x800 internal canvas
- Console Output: 120x40 character display
- Grayscale: 65-level ASCII grayscale for depth
- Frame Rate: ~60 FPS
Currently the demo runs automatically. Press Ctrl+C to exit.
Want to add your own objects? Edit demo/interactive.cpp:
// Define vertices
vec3_t my_shape_vertices[4] = {
{0, 1, 0}, // Top
{-1, -1, 0}, // Bottom left
{1, -1, 0}, // Bottom right
{0, -1, 2} // Back
};
// Define edges
const int my_shape_edges[6][2] = {
{0,1}, {0,2}, {0,3},
{1,2}, {2,3}, {3,1}
};
// In the render loop:
mat4 modelD = multiply(
mat4::translation(2, 0, -7), // Position
mat4::rotation_xyz(t, t * 2, 0) // Rotation
);
renderer_wireframe(
canvas,
my_shape_vertices, 4,
my_shape_edges, 6,
modelD, view, projection,
SCREEN_W, SCREEN_H
);// Modify the Bezier control points
vec3_t pathA0(-5, 2, -8); // Start
vec3_t pathA1(-5, -2, -8); // Control 1
vec3_t pathA2( 5, -2, -8); // Control 2
vec3_t pathA3( 5, 2, -8); // Endconst int DISPLAY_W = 120; // Width in characters
const int DISPLAY_H = 40; // Height in charactersdemo/
├── main.cpp - Original static demo
├── interactive.cpp - NEW: Animated 3D demo
include/
├── display.h - NEW: Display system header
src/
├── display.cpp - NEW: ASCII display implementation
- Add More Shapes - Create complex 3D models
- Interactive Input - Add keyboard controls
- Camera Movement - Implement camera rotation
- Color Support - Use ANSI colors in terminal
- Export to Image - Save frames as image files
Demo runs too fast/slow?
- Adjust the sleep time in the render loop
- Change:
int sleep_time = 16 - (int)elapsed.count();(16ms = ~60 FPS)
ASCII art looks weird?
- Use Windows Terminal or PowerShell 7+ for best results
- Try adjusting
DISPLAY_WandDISPLAY_Hto fit your console
Want smooth graphics?
- Maximize your console window
- Use a monospace font (Consolas, Courier New)
Experiment with different shapes, paths, and animations. The library is yours to explore!