#pragma once #include struct intersection { float t; struct shape const * object; }; #ifndef INTERSECTIONS_MAX #define INTERSECTIONS_MAX 1024 #endif struct intersections { int count; struct intersection i[INTERSECTIONS_MAX]; }; struct intersection intersection(float t, struct shape const * const object) { return (struct intersection){ t, object }; } inline static void intersections(struct intersections * intersections, int count, ...) { va_list ap; va_start(ap, count); for (int i = 0; i < count; i++) { intersections->i[i] = va_arg(ap, struct intersection); } va_end(ap); intersections->count = count; }