X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/dfcd78f3f458d8c4bfbc27b08ced5aae0f2e57d4..a8137256e983a49f97ff1fbecd26a1a0372f7b0b:/Scene.hxx diff --git a/Scene.hxx b/Scene.hxx index b92e9e5..baafce6 100644 --- a/Scene.hxx +++ b/Scene.hxx @@ -2,6 +2,9 @@ #define SCENE_HXX #include +#include +#include + #include "Ray.hxx" #include "Camera.hxx" @@ -27,11 +30,28 @@ public: // 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; + + // 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; @@ -40,5 +60,15 @@ private: 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