/*
* C++ RayTracer
* file: raytracer.h
*
* Radek Brich, 2006
*/
#ifndef RAYTRACER_H
#define RAYTRACER_H
#include <vector>
#include "kdtree.h"
#include "scene.h"
using namespace std;
class Raytracer;
struct RenderrowData {
Raytracer *rt;
int w;
float vx, vy, dx, dy;
Vector3 eye;
float *iter;
};
//static void *renderrow(void *data);
class Raytracer
{
Container *top;
vector<Light*> lights;
Colour bg_colour;
int ao_samples;
float ao_distance, ao_angle;
int num_threads;
Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal);
public:
Raytracer(): lights(), bg_colour(0.0, 0.0, 0.0), ao_samples(0), num_threads(4)
{ top = new KdTree(); };
~Raytracer() { delete top; };
float *render(int w, int h);
Colour raytrace(Ray &ray, int depth, Shape *origin_shape);
void addshape(Shape *shape) { top->addShape(shape); };
void addlight(Light *light);
void ambientocclusion(int samples, float distance, float angle);
void setThreads(int num) { num_threads = num; };
};
#endif