rayzor

view src/scene.h @ 17:79609d482762

the renderer renders, also fixed an unnoticed matrix conversion problem between scenegraph and min3d
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 14 Apr 2014 07:34:45 +0300
parents be616b58df99
children 6b11a3f8706e
line source
1 #ifndef SCENE_H_
2 #define SCENE_H_
4 #include <string>
5 #include <vector.h>
6 #include "snode.h"
7 #include "object.h"
8 #include "light.h"
9 #include "camera.h"
10 #include "raytrace.h"
12 enum { SCN_BG_LOW, SCN_BG_MID, SCN_BG_HIGH };
14 class Scene {
15 private:
16 char *name;
17 vector<SceneNode*> nodes;
19 vector<Object*> objects;
20 vector<Light*> lights;
21 vector<Camera*> cameras;
22 Camera *active_cam;
24 Vector3 bg[3];
25 Vector3 ambient;
26 float fog_exp;
28 vector<int> sel;
30 public:
31 Scene();
32 ~Scene();
34 void clear();
36 void set_name(const char *name);
37 const char *get_name() const;
39 void set_background(const Vector3 &col, int idx = -1);
40 const Vector3 &get_background(int idx = -1) const;
41 Vector3 get_background(const Ray &ray) const;
43 void set_ambient(const Vector3 &col);
44 const Vector3 &get_ambient() const;
46 void add(SceneNode *node);
48 int get_node_count() const;
49 int get_object_count() const;
50 int get_light_count() const;
51 int get_camera_count() const;
53 SceneNode *get_node(int idx);
54 const SceneNode *get_node(int idx) const;
55 Object *get_object(int idx);
56 const Object *get_object(int idx) const;
57 Light *get_light(int idx);
58 const Light *get_light(int idx) const;
59 Camera *get_camera(int idx);
60 const Camera *get_camera(int idx) const;
62 void set_active_camera(Camera *cam);
63 Camera *get_active_camera() const;
65 void draw() const;
67 void select(int s);
68 void clear_selection();
69 int get_selection_count() const;
70 int get_selection(int idx = 0) const;
72 bool intersect(const Ray &ray, RayHit *hit = 0) const;
73 };
75 #endif // SCENE_H_