src/raytracer.h
author Radek Brich <radek.brich@devl.cz>
Sat, 24 Nov 2007 21:55:41 +0100
branchpyrit
changeset 12 f4fcabf05785
parent 11 4d192e13ee84
child 16 20bceb605f48
permissions -rw-r--r--
kd-tree: traversal algorithm (KdTree::nearest_intersection)

/*
 * 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;

	Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal);
public:
	Raytracer(): lights(), bg_colour(0.0, 0.0, 0.0), ao_samples(0) { top = new KdTree(); };
	~Raytracer() {};
	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);
};

#endif