X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/9fa235f6c621a9737be66359dc6bed473f1823d9..68b3409314cb3fe96300a72a5f2ac04e95c7b7da:/Scene.hxx diff --git a/Scene.hxx b/Scene.hxx index 74154eb..baafce6 100644 --- a/Scene.hxx +++ b/Scene.hxx @@ -2,6 +2,9 @@ #define SCENE_HXX #include +#include +#include + #include "Ray.hxx" #include "Camera.hxx" @@ -13,7 +16,7 @@ class Scene public: Scene(); virtual ~Scene(); - + // add another primitive to the scene void Add(Primitive* p); // add another light source to the scene @@ -23,22 +26,49 @@ public: virtual bool Intersect(Ray& ray); // find occluder virtual bool Occluded(Ray& ray); - + // trace the given ray and shade it, returnt the color of the shaded ray Vec3f RayTrace(Ray& ray); + + // acces to camera and light sources + const Camera* camera() const; + std::vector lights() const; - const Camera* camera() const; - // lights - std::vector m_lights; + // set new camera + void setCamera(const Camera* camera); + + // reads in a scene description + void ParseOBJ(const std::string& file, float factor); + // calculate scene bounding box + void CalcBounds(); + + const Box& GetSceneBox() const; private: Scene(const Scene& ); Scene& operator=(const Scene& ); + void parseOBJLine(const std::string& line); + void parseVertex(std::istringstream& iss); + void parseFace(std::istringstream& iss); + void buildTriangleList(float scale); + Camera* m_camera; // background color Vec3f m_bgColor; - + // primitives std::vector m_primitives; + // lights + std::vector m_lights; + + // shader used by loading routine + Shader* m_shader; + + // storage for vertices and face indices + std::vector m_vertices, m_faces; + Vec3f m_centroid; + + // scene bounding box + Box m_scene_box; }; #endif