src/raytracer.h
author Radek Brich <radek.brich@devl.cz>
Sat, 17 Nov 2007 17:47:06 +0100
branchpyrit
changeset 5 2d97ea5e711a
parent 4 c73bc405ee7a
child 7 bf17f9f84c91
permissions -rw-r--r--
resolve warnings from current g++

/*
 * C++ RayTracer
 * file: raytracer.h
 *
 * Radek Brich, 2006
 */

#ifndef RAYTRACER_H
#define RAYTRACER_H

#include <vector>

#include "scene.h"

using namespace std;

/* axis-aligned bounding box */
class AABB
{
};

class ShapeList: public vector<Shape*>
{
	AABB extends() { return AABB(); };
};

class Raytracer;
struct RenderrowData {
	Raytracer *rt;
	int w;
	float vx, vy, dx, dy;
	Vector3 eye;
	float *iter;
};
//static void *renderrow(void *data);

class Raytracer
{
	ShapeList shapes;
	vector<Light*> lights;
	Colour bg_colour;
	int ao_samples;
	float ao_distance, ao_angle;

	Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal);
	inline Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
		float &nearest_distance);
public:
	Raytracer(): shapes(), lights(), bg_colour(0.0, 0.0, 0.0), ao_samples(0) {};
	~Raytracer() {};
	float *render(int w, int h);
	Colour raytrace(Ray &ray, int depth, Shape *origin_shape);
	void addshape(Shape *shape);
	void addlight(Light *light);

	void ambientocclusion(int samples, float distance, float angle);
};

#endif