include/raytracer.h
branchpyrit
changeset 32 8af5c17d368b
parent 31 b4e09433934a
child 34 28f6e8b9d5d1
equal deleted inserted replaced
31:b4e09433934a 32:8af5c17d368b
    32 	Colour bg_colour;
    32 	Colour bg_colour;
    33 	int ao_samples;
    33 	int ao_samples;
    34 	Float ao_distance, ao_angle;
    34 	Float ao_distance, ao_angle;
    35 	int num_threads;
    35 	int num_threads;
    36 	int subsample;
    36 	int subsample;
       
    37 	int oversample; // 0 = no, 1 = 5x, 2 = 9x, 3 = 16x
    37 	int max_depth;
    38 	int max_depth;
    38 
    39 
    39 	Vector3 SphereDistribute(int i, int n, Float extent, Vector3 &normal);
    40 	Vector3 SphereDistribute(int i, int n, Float extent, Vector3 &normal);
    40 public:
    41 public:
    41 	Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0),
    42 	Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0),
    42 		ao_samples(0), num_threads(2), subsample(8), max_depth(3) {};
    43 		ao_samples(0), num_threads(2), subsample(8), oversample(0), max_depth(3) {};
    43 	void render(int w, int h, Float *buffer);
    44 	void render(int w, int h, Float *buffer);
    44 	Colour raytrace(Ray &ray, int depth, Shape *origin_shape);
    45 	Colour raytrace(Ray &ray, int depth, Shape *origin_shape);
    45 	void addshape(Shape *shape) { top->addShape(shape); };
    46 	void addshape(Shape *shape) { top->addShape(shape); };
    46 	void addlight(Light *light);
    47 	void addlight(Light *light);
    47 	void setCamera(Camera *cam) { camera = cam; };
    48 	void setCamera(Camera *cam) { camera = cam; };
    48 	void setTop(Container *atop) { top = atop; };
    49 	void setTop(Container *atop) { top = atop; };
    49 	Container *getTop() { return top; };
    50 	Container *getTop() { return top; };
       
    51 	void setSubsample(int sub) { subsample = sub; };
    50 	int getSubsample() { return subsample; };
    52 	int getSubsample() { return subsample; };
       
    53 	void setOversample(int osa) { oversample = osa; };
       
    54 	int getOversample() { return oversample; };
    51 	void setMaxDepth(int newdepth) { max_depth = newdepth; };
    55 	void setMaxDepth(int newdepth) { max_depth = newdepth; };
    52 
    56 
    53 	void ambientocclusion(int samples, Float distance, Float angle);
    57 	void ambientocclusion(int samples, Float distance, Float angle);
    54 	void setThreads(int num) { num_threads = num; };
    58 	void setThreads(int num) { num_threads = num; };
    55 };
    59 };