#define SCENE_HXX
#include <vector>
+#include <string>
+#include <fstream>
+
#include "Ray.hxx"
#include "Camera.hxx"
public:
Scene();
virtual ~Scene();
-
+
// add another primitive to the scene
void Add(Primitive* p);
// add another light source to the scene
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<Light*> lights() const;
- const Camera* camera() const;
- // lights
- std::vector<Light*> 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<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