#pragma once #include #include #include #include #include namespace prism { // World-space coordinates. Colors are linear-light RGB, each component in [0, 1]. struct Vec3 { double x{}, y{}, z{}; }; struct Color { double r{}, g{}, b{}; }; struct Camera { Vec3 position; Vec3 look_at; double vertical_fov_degrees{}; }; struct Sphere { Vec3 center; double radius{}; Color color; }; // These values own their strings and containers. References to a Scene borrow it. struct Scene { std::uint32_t version{}; std::string title; std::uint32_t width{}, height{}; Camera camera; Color background; Vec3 light_direction; // Direction FROM a surface TOWARD the light. double ground_y{}; Color ground_color; std::vector spheres; }; enum class ErrorCode { invalid_scene, allocation, io }; struct Error { ErrorCode code; std::string message; // Fixed diagnostics: never echo arbitrary input or file contents. }; inline constexpr std::uint32_t max_dimension = 2048; inline constexpr std::size_t max_pixels = 2'097'152; inline constexpr std::size_t max_spheres = 32; inline constexpr std::size_t max_intersection_work = 33'554'432; [[nodiscard]] Scene demo_scene(); [[nodiscard]] std::expected validate_scene(const Scene& scene); } // namespace prism