erebus
annotate liberebus/src/scene.h @ 47:4b91c9a501d8
minor fix of strange code structure in the thread func
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 01 Feb 2016 14:56:15 +0200 |
parents | 2e817711d0f6 |
children |
rev | line source |
---|---|
nuclear@2 | 1 #ifndef SCENE_H_ |
nuclear@2 | 2 #define SCENE_H_ |
nuclear@2 | 3 |
nuclear@19 | 4 #include <stdio.h> |
nuclear@2 | 5 #include <vector> |
nuclear@41 | 6 #include <list> |
nuclear@2 | 7 #include "snode.h" |
nuclear@2 | 8 #include "camera.h" |
nuclear@8 | 9 #include "color.h" |
nuclear@8 | 10 |
nuclear@8 | 11 struct Environment { |
nuclear@8 | 12 Color bgcolor; |
nuclear@8 | 13 Color ambient; |
nuclear@8 | 14 // TODO map & image-based lighting |
nuclear@8 | 15 |
nuclear@8 | 16 Environment(); |
nuclear@8 | 17 }; |
nuclear@2 | 18 |
nuclear@41 | 19 struct ObjectInstance { |
nuclear@41 | 20 Object *obj; |
nuclear@41 | 21 SceneNode *node; |
nuclear@41 | 22 }; |
nuclear@41 | 23 |
nuclear@2 | 24 class Scene { |
nuclear@2 | 25 private: |
nuclear@8 | 26 Environment env; |
nuclear@8 | 27 |
nuclear@2 | 28 std::vector<Object*> objects; |
nuclear@2 | 29 std::vector<SceneNode*> nodes; |
nuclear@2 | 30 |
nuclear@4 | 31 SceneNode *root; |
nuclear@4 | 32 |
nuclear@2 | 33 Camera *active_cam; |
nuclear@2 | 34 |
nuclear@2 | 35 public: |
nuclear@2 | 36 Scene(); |
nuclear@2 | 37 ~Scene(); |
nuclear@2 | 38 |
nuclear@40 | 39 void clear(); |
nuclear@40 | 40 |
nuclear@8 | 41 void set_env(const Environment &env); |
nuclear@8 | 42 Environment &get_env(); |
nuclear@8 | 43 const Environment &get_env() const; |
nuclear@8 | 44 |
nuclear@8 | 45 Color get_env_color() const; |
nuclear@8 | 46 Color get_env_color(const Ray &ray) const; |
nuclear@8 | 47 |
nuclear@2 | 48 void add_object(Object *obj); |
nuclear@2 | 49 int get_object_count() const; |
nuclear@2 | 50 Object *get_object(int idx) const; |
nuclear@2 | 51 |
nuclear@2 | 52 void add_node(SceneNode *node); |
nuclear@2 | 53 int get_node_count() const; |
nuclear@2 | 54 SceneNode *get_node(int idx) const; |
nuclear@2 | 55 |
nuclear@4 | 56 void use_camera(Camera *cam); |
nuclear@4 | 57 Camera *get_active_camera() const; |
nuclear@4 | 58 |
nuclear@43 | 59 std::list<ObjectInstance> gen_light_list() const; |
nuclear@43 | 60 |
nuclear@4 | 61 void update(long msec = 0); |
nuclear@4 | 62 |
nuclear@2 | 63 bool intersect(const Ray &ray, RayHit *hit) const; |
nuclear@4 | 64 |
nuclear@4 | 65 bool load(const char *fname); |
nuclear@19 | 66 bool load(FILE *fp); |
nuclear@19 | 67 |
nuclear@19 | 68 bool proc_cmd(int argc, char **argv); |
nuclear@2 | 69 }; |
nuclear@2 | 70 |
nuclear@2 | 71 #endif // SCENE_H_ |