How mansargs/raytracer-minirt works
miniRT parses a scene file into in-memory cameras, lights and geometric objects, loads optional texture assets, traces rays and displays the result in an interactive MLX window. The principal path is documented in README and explicit in main.c; sampled code confirms parsing dispatch, keyboard/mouse event actions and cleanup. The rendering, shading, texture loading and window subsystems are included from documented capabilities and source paths, but their internal call wiring was not sampled, so uncertain links are omitted.
Main entry points: main.c Application flow · events.c Input events · ray_trace.c Ray tracing · identifier.c Scene parser
Components 19
Scene input
- Application flow
srcs/main.c - Scene parser
srcs/parsing/identifier.c - Element parsing
srcs/parsing/elements - Input validation
srcs/parsing/validation - Scene state
hdrs/minirt.h
Ray rendering
- Ray generation
srcs/ray_tracing/ray_trace/ray_generation.c - Ray tracing
srcs/ray_tracing/ray_trace/ray_trace.c - Primitive intersections
srcs/ray_tracing/intersection - Blinn-Phong lighting
srcs/ray_tracing/blinn_phong_model - Texture mapping
srcs/ray_tracing/textures
Interactive display
- MLX window
srcs/drawing/window.c - Image rendering
srcs/drawing/render.c - Input events
srcs/drawing/events.c - Checker toggles
srcs/drawing/deactivate_checkerboard.c
Runtime support
- Dynamic vectors
srcs/container/vector.c - Vector mathematics
srcs/vec_maths - Scene cleanup
srcs/utils/free.c
Other components
- Renderer user
- MLX display
Connections 26
- Renderer user → Application flow: starts scene
- Application flow → Scene parser: parses file
- Scene parser → Input validation: validates values
- Scene parser → Element parsing: dispatches records
- Element parsing → Scene state: populates scene
- Application flow → Scene state: initializes
- Application flow → Texture mapping: loads scene assets
- Application flow → Ray generation: generates rays
- Application flow → Image rendering: renders image
- Application flow → MLX window: starts loop
- Ray generation → Ray tracing: traces pixels
- Ray tracing → Primitive intersections: tests primitives
- Ray tracing → Blinn-Phong lighting: computes shading
- Ray tracing → Texture mapping: samples maps
- Image rendering → MLX display: displays image
- MLX window → MLX display: creates window
- MLX window → Input events: registers handlers
- Input events → Scene state: updates camera mode
- Input events → Checker toggles: deactivates checker
- Input events → Ray tracing: traces clicked pixel
- Input events → MLX display: handles input loop
- Scene parser → Dynamic vectors: stores scene items
- Element parsing → Dynamic vectors: appends records
- Input events → Vector mathematics: moves camera
- Application flow → Scene cleanup: frees scene
- Scene cleanup → MLX display: destroys texture images