erebus

view liberebus/src/scene.h @ 40:9d6368850fe1

minor enhancements and bugfixes to the console stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 10 Jun 2014 10:53:19 +0300
parents 6204e4d3f445
children 2e817711d0f6
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 clear();
35 void set_env(const Environment &env);
36 Environment &get_env();
37 const Environment &get_env() const;
39 Color get_env_color() const;
40 Color get_env_color(const Ray &ray) const;
42 void add_object(Object *obj);
43 int get_object_count() const;
44 Object *get_object(int idx) const;
46 void add_node(SceneNode *node);
47 int get_node_count() const;
48 SceneNode *get_node(int idx) const;
50 void use_camera(Camera *cam);
51 Camera *get_active_camera() const;
53 void update(long msec = 0);
55 bool intersect(const Ray &ray, RayHit *hit) const;
57 bool load(const char *fname);
58 bool load(FILE *fp);
60 bool proc_cmd(int argc, char **argv);
61 };
63 #endif // SCENE_H_