erebus

view liberebus/src/scene.h @ 19:6204e4d3f445

scene loading
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 27 May 2014 07:43:55 +0300
parents e2d9bf168a41
children 9d6368850fe1
line source
1 #ifndef SCENE_H_
2 #define SCENE_H_
4 #include <stdio.h>
5 #include <vector>
6 #include "snode.h"
7 #include "camera.h"
8 #include "color.h"
10 struct Environment {
11 Color bgcolor;
12 Color ambient;
13 // TODO map & image-based lighting
15 Environment();
16 };
18 class Scene {
19 private:
20 Environment env;
22 std::vector<Object*> objects;
23 std::vector<SceneNode*> nodes;
25 SceneNode *root;
27 Camera *active_cam;
29 public:
30 Scene();
31 ~Scene();
33 void set_env(const Environment &env);
34 Environment &get_env();
35 const Environment &get_env() const;
37 Color get_env_color() const;
38 Color get_env_color(const Ray &ray) const;
40 void add_object(Object *obj);
41 int get_object_count() const;
42 Object *get_object(int idx) const;
44 void add_node(SceneNode *node);
45 int get_node_count() const;
46 SceneNode *get_node(int idx) const;
48 void use_camera(Camera *cam);
49 Camera *get_active_camera() const;
51 void update(long msec = 0);
53 bool intersect(const Ray &ray, RayHit *hit) const;
55 bool load(const char *fname);
56 bool load(FILE *fp);
58 bool proc_cmd(int argc, char **argv);
59 };
61 #endif // SCENE_H_