How tjensen42/42-minirt works
Project type and purpose
• This is a C-based, command-line-launched, lightweight ray-tracer (“miniRT”) that parses a .rt scene file, constructs an in-memory scene graph, performs path-tracing, and displays the rendered image in a window via the MLX/GLFW graphics layer.
• It is a monolithic, full-stackish native application (not client/server), with clearly separated modules for parsing, math, tracing, printing/logging, and graphics.
File structure
• Top-level:
• lib/libft: utility library (strings, memory, e.g., ft_split, ft_atoi).
• lib/libmlx: the MLX/GLFW-based graphics engine (glad, shaders, window/input handling).
• scenes/: sample .rt input files (scene descriptions).
• src/: the heart of miniRT, subdivided into:
– parse/: .rt file parser (syntax rules).
– trace/: ray–object intersection, BSDF, light sampling.
– print/: debug/console output of parsed scene.
– graphic/: window creation, render loop, input handling.
– main.c: orchestrates init, parse, trace & graphics.
• Build scripts: Makefile at root invokes libft, libmlx, then compiles src/*.
• No external services; only OS windowing and file I/O.
README for additional insights
• Confirms dependency on GLFW (via libmlx).
• Usage: ./miniRT scenes/template.rt.
• Describes supported scene elements (camera, lights, primitives).
Detailed capturing of essential elements
• Break out Parser into sub-components if desired (tokenizer, syntax validator).
• That Scene Data Model is shared read-only by trace and print modules.
• That math routines are stateless helpers.
• Resource directory (scenes/) as input to File I/O.