How marcefrasson/minirt works
Project type and purpose
• This is a standalone, single‐process, full‐monolith C application: a ray‐tracer that reads a simple scene description file, builds an in‐memory representation of primitives (spheres, planes, etc.), performs ray‐casting with Phong shading, and outputs to a window (via MiniLibX) or to a bitmap.
File structure
• Top‐level:
• Makefile, install scripts, README – build & install logic
• libs: libft (common C helpers), install_mlx.sh (MiniLibX installer)
• parsing/ – scene‐file lexer & parser
• render/ – ray‐tracer core (ray generation, intersection, shading, window/bitmap)
• utils/ – vector algebra primitives
• scenes/ – example scene files (.rt)
a. CLI Launcher
• Entrypoint (miniRT main)
• Handles arguments and kicks off parsing
b. Parser Module (parsing/)
• Reads .rt file
• Tokenizes lines, validates syntax
• Produces in‐memory Scene data structure (cameras, lights, objects)
c. Core Data Structures (in includes/miniRT.h)
d. Vector Math Utilities (utils/)
• Vector add, subtract, dot/cross, normalize, scale
e. Rendering Engine (render/)
• Ray generator (per pixel)
• Shading (Phong: ambient + diffuse + specular + reflection)
• Secondary rays (reflection recursion)
f. Output Modules
• Bitmap writer (render/bitmap.c): export .bmp file
g. External Libraries
• libft – core C utilities (strings, lists, memory)
• MiniLibX – lightweight graphics API
Relationships and data flows
• CLI → Parser: passes scene file path
• Parser → Core Data Structures: populates Scene struct
• Scene + Camera + Utils → Rendering Engine: per‐pixel ray generation
• Rendering Engine → Intersection & Shading modules → Framebuffer
• Framebuffer → Output Module (Window or Bitmap) → OS/Display
Architectural patterns & design principles
• Layered modular structure: Parser → Core data → Renderer → Output
• Single responsibility per module/directory
• Reusable utility library (libft) separated from domain logic
• Data‐oriented design: scene stored in plain structs, passed to pure functions
[ ] Clear module/component names matching directory names
[ ] Notes on key technologies: C, libft, MiniLibX
[ ] Detailed annotation of the Render Pipeline stages