gpuray_glsl

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/scene.h	Sun Nov 09 13:03:36 2014 +0200
     1.3 @@ -0,0 +1,56 @@
     1.4 +#ifndef SCENE_H_
     1.5 +#define SCENE_H_
     1.6 +
     1.7 +#include <vector>
     1.8 +#include "object.h"
     1.9 +#include "light.h"
    1.10 +#include "camera.h"
    1.11 +#include "texture.h"
    1.12 +
    1.13 +class Scene {
    1.14 +protected:
    1.15 +	std::vector<Object*> objects;
    1.16 +	std::vector<Light*> lights;
    1.17 +	Camera *camera;
    1.18 +
    1.19 +	static TargetCamera def_cam;	// default camera
    1.20 +
    1.21 +	Color bgcolor;
    1.22 +	TextureCube *envmap, *envmap_conv;
    1.23 +	float fog_start, fog_end;
    1.24 +
    1.25 +public:
    1.26 +	Scene();
    1.27 +	virtual ~Scene();
    1.28 +
    1.29 +	virtual bool load(const char *fname);
    1.30 +	virtual bool save(const char *fname) const;
    1.31 +
    1.32 +	virtual void set_background_color(const Color &color);
    1.33 +	virtual void set_fog(float fog_start, float fog_end);
    1.34 +	virtual void get_fog(float *fog_start, float *fog_end) const;
    1.35 +
    1.36 +	virtual void set_environment_map(TextureCube *map, TextureCube *map_conv = 0);
    1.37 +
    1.38 +	virtual void add_object(Object *obj);
    1.39 +	virtual Object *get_object(int i) const;
    1.40 +	virtual int get_object_count() const;
    1.41 +
    1.42 +	virtual void add_light(Light *lt);
    1.43 +	virtual Light *get_light(int i) const;
    1.44 +	virtual int get_light_count() const;
    1.45 +
    1.46 +	virtual void set_camera(Camera *cam);
    1.47 +	virtual Camera *get_camera() const;
    1.48 +
    1.49 +	virtual bool intersect(const Ray &ray, HitPoint *hit) const;
    1.50 +
    1.51 +	virtual Color env_color(const Ray &ray) const;
    1.52 +
    1.53 +	virtual void prepare_xform(long msec);
    1.54 +
    1.55 +	friend Color trace_ray(const Scene *scn, const Ray &ray, int rdepth);
    1.56 +	friend Color shade(const Scene *scn, const Ray &ray, const HitPoint &hit, int rdepth);
    1.57 +};
    1.58 +
    1.59 +#endif	// SCENE_H_