Scene::CalcBounds(), including Box::Extend(Box&), Box::Clear()
[MicroTrace.git] / Scene.hxx
index 18deb79..baafce6 100644 (file)
--- a/Scene.hxx
+++ b/Scene.hxx
@@ -2,9 +2,13 @@
 #define SCENE_HXX
 
 #include <vector>
+#include <string>
+#include <fstream>
+
 
 #include "Ray.hxx"
 #include "Camera.hxx"
+#include "Light.hxx"
 #include "Primitive.hxx"
 
 class Scene
@@ -15,7 +19,9 @@ public:
   
   // add another primitive to the scene
   void Add(Primitive* p);
+  // add another light source to the scene
+  void Add(Light* l);
+
   // intersect the ray with all objects in the scene
   virtual bool Intersect(Ray& ray);
   // find occluder
@@ -24,16 +30,45 @@ 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<Light*> 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;
   
   // primitives
   std::vector<Primitive*> m_primitives;
+  // lights
+  std::vector<Light*> m_lights;
+
+  // shader used by loading routine
+  Shader* m_shader;
+
+  // storage for vertices and face indices
+  std::vector<Vec3f> m_vertices, m_faces;
+  Vec3f m_centroid;
+
+  // scene bounding box
+  Box m_scene_box;
 };
 #endif
This page took 0.020265 seconds and 4 git commands to generate.