gpuray_glsl
view src/scene.h @ 0:f234630e38ff
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 09 Nov 2014 13:03:36 +0200 |
parents | |
children |
line source
1 #ifndef SCENE_H_
2 #define SCENE_H_
4 #include <vector>
5 #include "object.h"
6 #include "light.h"
7 #include "camera.h"
8 #include "texture.h"
10 class Scene {
11 protected:
12 std::vector<Object*> objects;
13 std::vector<Light*> lights;
14 Camera *camera;
16 static TargetCamera def_cam; // default camera
18 Color bgcolor;
19 TextureCube *envmap, *envmap_conv;
20 float fog_start, fog_end;
22 public:
23 Scene();
24 virtual ~Scene();
26 virtual bool load(const char *fname);
27 virtual bool save(const char *fname) const;
29 virtual void set_background_color(const Color &color);
30 virtual void set_fog(float fog_start, float fog_end);
31 virtual void get_fog(float *fog_start, float *fog_end) const;
33 virtual void set_environment_map(TextureCube *map, TextureCube *map_conv = 0);
35 virtual void add_object(Object *obj);
36 virtual Object *get_object(int i) const;
37 virtual int get_object_count() const;
39 virtual void add_light(Light *lt);
40 virtual Light *get_light(int i) const;
41 virtual int get_light_count() const;
43 virtual void set_camera(Camera *cam);
44 virtual Camera *get_camera() const;
46 virtual bool intersect(const Ray &ray, HitPoint *hit) const;
48 virtual Color env_color(const Ray &ray) const;
50 virtual void prepare_xform(long msec);
52 friend Color trace_ray(const Scene *scn, const Ray &ray, int rdepth);
53 friend Color shade(const Scene *scn, const Ray &ray, const HitPoint &hit, int rdepth);
54 };
56 #endif // SCENE_H_