#ifndef SCENE_H #define SCENE_H #include "common/color.h" #include "common/ray.h" #include "common/texture.h" #include "common/vector3d.h" #include #include #include // Forward declarations class Light; class Shader; class Scene { public: // Constructor / Destructor Scene() = default; virtual ~Scene() = default; // Get std::vector> const &lights() const { return this->lights_; } std::vector> const &primitives() const { return this->primitives_; } // Set void setBackgroundColor(Color const &color) { this->backgroundColor = color; } void setEnvironmentMap(std::shared_ptr const &map) { this->environmentMap = map; } // Setup functions void add(const std::shared_ptr &light); void add(const std::shared_ptr &primitive); void addObj(char const *fileName, Vector3d const &scale, Vector3d const &translation, const std::shared_ptr &shader, bool flipU = false, bool flipV = false); // .obj loading function static std::vector> loadObj(char const *fileName, Vector3d const &scale, Vector3d const &translation, const std::shared_ptr &shader, bool flipU = false, bool flipV = true); // Raytracing functions Color traceRay(Ray &ray) const; virtual bool findIntersection(Ray &ray) const = 0; virtual bool findOcclusion(Ray &ray) const = 0; virtual Color getTransparency(Ray &ray, float maxDistance) const = 0; protected: Color backgroundColor; std::shared_ptr environmentMap; private: std::vector> lights_; std::vector> primitives_; }; #endif