nuclear@2: #ifndef SCENE_H_ nuclear@2: #define SCENE_H_ nuclear@2: nuclear@2: #include nuclear@2: #include "snode.h" nuclear@2: #include "camera.h" nuclear@8: #include "color.h" nuclear@8: nuclear@8: struct Environment { nuclear@8: Color bgcolor; nuclear@8: Color ambient; nuclear@8: // TODO map & image-based lighting nuclear@8: nuclear@8: Environment(); nuclear@8: }; nuclear@2: nuclear@2: class Scene { nuclear@2: private: nuclear@8: Environment env; nuclear@8: nuclear@2: std::vector objects; nuclear@2: std::vector nodes; nuclear@2: nuclear@4: SceneNode *root; nuclear@4: nuclear@2: Camera *active_cam; nuclear@2: nuclear@2: public: nuclear@2: Scene(); nuclear@2: ~Scene(); nuclear@2: nuclear@8: void set_env(const Environment &env); nuclear@8: Environment &get_env(); nuclear@8: const Environment &get_env() const; nuclear@8: nuclear@8: Color get_env_color() const; nuclear@8: Color get_env_color(const Ray &ray) const; nuclear@8: nuclear@2: void add_object(Object *obj); nuclear@2: int get_object_count() const; nuclear@2: Object *get_object(int idx) const; nuclear@2: nuclear@2: void add_node(SceneNode *node); nuclear@2: int get_node_count() const; nuclear@2: SceneNode *get_node(int idx) const; nuclear@2: nuclear@4: void use_camera(Camera *cam); nuclear@4: Camera *get_active_camera() const; nuclear@4: nuclear@4: void update(long msec = 0); nuclear@4: nuclear@2: bool intersect(const Ray &ray, RayHit *hit) const; nuclear@4: nuclear@4: bool load(const char *fname); nuclear@2: }; nuclear@2: nuclear@2: #endif // SCENE_H_