erebus

view liberebus/src/scene.h @ 41:2e817711d0f6

console: proper input line windowing and clipping
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 10 Jun 2014 12:28:56 +0300
parents 9d6368850fe1
children ed18af9da8f7
line source
1 #ifndef SCENE_H_
2 #define SCENE_H_
4 #include <stdio.h>
5 #include <vector>
6 #include <list>
7 #include "snode.h"
8 #include "camera.h"
9 #include "color.h"
11 struct Environment {
12 Color bgcolor;
13 Color ambient;
14 // TODO map & image-based lighting
16 Environment();
17 };
19 struct ObjectInstance {
20 Object *obj;
21 SceneNode *node;
22 };
24 class Scene {
25 private:
26 Environment env;
28 std::vector<Object*> objects;
29 std::vector<SceneNode*> nodes;
31 SceneNode *root;
33 Camera *active_cam;
35 public:
36 Scene();
37 ~Scene();
39 void clear();
41 void set_env(const Environment &env);
42 Environment &get_env();
43 const Environment &get_env() const;
45 Color get_env_color() const;
46 Color get_env_color(const Ray &ray) const;
48 void add_object(Object *obj);
49 int get_object_count() const;
50 Object *get_object(int idx) const;
52 void add_node(SceneNode *node);
53 int get_node_count() const;
54 SceneNode *get_node(int idx) const;
56 void use_camera(Camera *cam);
57 Camera *get_active_camera() const;
59 void update(long msec = 0);
61 bool intersect(const Ray &ray, RayHit *hit) const;
63 bool load(const char *fname);
64 bool load(FILE *fp);
66 bool proc_cmd(int argc, char **argv);
67 };
69 #endif // SCENE_H_