00001
00002
00003
00004
00005
00006 #ifndef SCENE_H
00007 #define SCENE_H
00008
00009 #include<DynamicObject.h>
00010 #include<Camera.h>
00011 #include<Fog.h>
00012 #include<ObjectFile.h>
00013 #include<Shape.h>
00014
00015 #include<vector>
00016
00017 class Light;
00018 class Ray;
00019
00022 class Scene : public DynamicObject
00023 {
00024 DYNAMIC_OBJECT;
00025 public:
00026
00027 Scene() : camera() {}
00028 virtual ~Scene();
00029
00030 Vertex3 cameraPosition() { return camera.getPosition(); }
00031 Camera &getCamera() {
00032 return camera;
00033 };
00034 vector<Shape *> &getShapes() {
00035 return shape;
00036 }
00037 vector<Light *> &getLights() {
00038 return light;
00039 }
00040 void setRecursion(int r) { recursion = r; }
00041
00042 void update();
00043 void addTime(float t);
00044
00045 real intersect(const Ray &ray);
00046 Color4 trace(const Ray &ray, real minimum = Shape::step);
00047
00048
00049 void parseSymbol(Token &t, ObjectFile &file);
00050 void writeParams(ostream &stream);
00051
00052 protected:
00053
00054 void createSymbols();
00055
00056 Camera camera;
00057 Fog fog;
00058 vector<Shape *> shape;
00059 vector<Light *> light;
00060 int recursion;
00061
00062 private:
00063 typedef DynamicObject super;
00064 };
00065
00068 class SurfaceInfo
00069 {
00070 public:
00071 SurfaceInfo(Vertex3 &point, Vertex3 &normal, Vertex3 ray)
00072 : p(point), n(normal), r(ray) {
00073 }
00074
00075 const Vertex3 &point() const { return p; }
00076 const Vertex3 &normal() const { return n; }
00077 const Vertex3 &ray() const { return r; }
00078
00079 private:
00080 Vertex3 p;
00081 Vertex3 n;
00082 Vertex3 r;
00083 };
00084 #endif