erebus
annotate liberebus/src/scene.h @ 12:ea4bcf186d66
whatever
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 24 May 2014 21:52:19 +0300 |
parents | 93894c232d65 |
children | 6204e4d3f445 |
rev | line source |
---|---|
nuclear@2 | 1 #ifndef SCENE_H_ |
nuclear@2 | 2 #define SCENE_H_ |
nuclear@2 | 3 |
nuclear@2 | 4 #include <vector> |
nuclear@2 | 5 #include "snode.h" |
nuclear@2 | 6 #include "camera.h" |
nuclear@8 | 7 #include "color.h" |
nuclear@8 | 8 |
nuclear@8 | 9 struct Environment { |
nuclear@8 | 10 Color bgcolor; |
nuclear@8 | 11 Color ambient; |
nuclear@8 | 12 // TODO map & image-based lighting |
nuclear@8 | 13 |
nuclear@8 | 14 Environment(); |
nuclear@8 | 15 }; |
nuclear@2 | 16 |
nuclear@2 | 17 class Scene { |
nuclear@2 | 18 private: |
nuclear@8 | 19 Environment env; |
nuclear@8 | 20 |
nuclear@2 | 21 std::vector<Object*> objects; |
nuclear@2 | 22 std::vector<SceneNode*> nodes; |
nuclear@2 | 23 |
nuclear@4 | 24 SceneNode *root; |
nuclear@4 | 25 |
nuclear@2 | 26 Camera *active_cam; |
nuclear@2 | 27 |
nuclear@2 | 28 public: |
nuclear@2 | 29 Scene(); |
nuclear@2 | 30 ~Scene(); |
nuclear@2 | 31 |
nuclear@8 | 32 void set_env(const Environment &env); |
nuclear@8 | 33 Environment &get_env(); |
nuclear@8 | 34 const Environment &get_env() const; |
nuclear@8 | 35 |
nuclear@8 | 36 Color get_env_color() const; |
nuclear@8 | 37 Color get_env_color(const Ray &ray) const; |
nuclear@8 | 38 |
nuclear@2 | 39 void add_object(Object *obj); |
nuclear@2 | 40 int get_object_count() const; |
nuclear@2 | 41 Object *get_object(int idx) const; |
nuclear@2 | 42 |
nuclear@2 | 43 void add_node(SceneNode *node); |
nuclear@2 | 44 int get_node_count() const; |
nuclear@2 | 45 SceneNode *get_node(int idx) const; |
nuclear@2 | 46 |
nuclear@4 | 47 void use_camera(Camera *cam); |
nuclear@4 | 48 Camera *get_active_camera() const; |
nuclear@4 | 49 |
nuclear@4 | 50 void update(long msec = 0); |
nuclear@4 | 51 |
nuclear@2 | 52 bool intersect(const Ray &ray, RayHit *hit) const; |
nuclear@4 | 53 |
nuclear@4 | 54 bool load(const char *fname); |
nuclear@2 | 55 }; |
nuclear@2 | 56 |
nuclear@2 | 57 #endif // SCENE_H_ |