erebus

view liberebus/src/scene.h @ 8:e2d9bf168a41

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