feat: integrate TUI module and apply professional refactoring

This commit is contained in:
2026-04-16 20:39:48 +00:00
parent 42529be0f8
commit 72e0ef4022
18 changed files with 1340 additions and 2106 deletions

32
DOCUMENTATION.md Normal file
View File

@@ -0,0 +1,32 @@
# ASCII 3D Renderer - Engineering Documentation
## Overview
ASCII 3D Renderer is a sophisticated terminal-based rendering engine implemented entirely in C11. Its goal is to bring modern 3D rendering methodologies—such as Physical-Based Lighting approximations and Depth Buffering—into a constrained ASCII viewport without utilizing external graphical libraries.
## Technical Architecture
The codebase adheres strictly to functional abstractions and strict modular boundaries to enhance performance within deep rendering loops.
### Directory Structure
- `include/`: Enforces API boundaries and struct definitions across all C modules.
- `src/`: Houses the isolated functional algorithms driving vectors, physics, and input multiplexing.
### Subsystem Design
1. **Input multiplexing (`tui.c`)**
Toggling standard IO into non-blocking, non-canonical states permits smooth real-time TTY interactions. Signal states are captured instantaneously and interpreted within the main event-loop per tick, altering global behavior objects without disrupting the core voxel algorithms.
2. **Core 3D Engine (`renderer.c`)**
Calculates pseudo-normals via 3D vector traversal. Text characters initially manifest as two-dimensional `5x7` bitmaps encoded as raw bitflags (`font.c`). `renderer.c` mathematically extrudes these glyphs along a virtual Z-axis. Multi-sampled pixel rays compute intersection boundaries and calculate normal approximations by reading empty adjacencies along geometry ridges.
3. **Lighting Approximations (`lighting.c`)**
Standard Blinn-Phong equations exist within an ambient, diffuse, and specular composition loop. These color values are derived utilizing an arbitrary virtual camera and bounded to integer offsets matching one of our standard luminance dictionaries (e.g., `.:-=+*#%@`).
4. **Temporal Control (`timing.c`)**
Forces a consistent execution boundary using positive UNIX epoch resolution (`CLOCK_MONOTONIC`) mapped directly via `nanosleep`. Predictable delta steps stabilize the rotation matrix speed regardless of hardware IO constraints.
## Compilation and Dependencies
The system is pure logic—`libc` and `-lm` (for `libmath`) constitute the full scope of integration dependencies. The custom `Makefile` orchestrates compilation utilizing Standard `-O3 -flto` link time passes, alongside memory sanitizer profiles natively integrated within Clang for debugging cycles.