include/raytracer.h
branchpyrit
changeset 82 930a2d3ecaed
parent 78 9569e9f35374
child 84 6f7fe14782c2
equal deleted inserted replaced
81:9dbb9c8c115b 82:930a2d3ecaed
    55 	Colour bg_colour;
    55 	Colour bg_colour;
    56 	int ao_samples;
    56 	int ao_samples;
    57 	Float ao_distance, ao_angle;
    57 	Float ao_distance, ao_angle;
    58 	int num_threads;
    58 	int num_threads;
    59 	int max_depth;
    59 	int max_depth;
       
    60 	bool use_packets;
    60 
    61 
    61 	Vector3 SphereDistribute(int i, int n, Float extent, Vector3 &normal);
    62 	Vector3 SphereDistribute(int i, int n, Float extent, Vector3 &normal);
    62 
    63 
    63 	Sample *sample_queue;
    64 	Sample *sample_queue;
    64 	int sample_queue_pos, sample_queue_size, sample_queue_count;
    65 	int sample_queue_pos, sample_queue_size, sample_queue_count;
    65 	bool end_of_samples;
    66 	bool end_of_samples;
    66 	pthread_mutex_t sample_queue_mutex, sampler_mutex;
    67 	pthread_mutex_t sample_queue_mutex, sampler_mutex;
    67 	pthread_cond_t sample_queue_cond, worker_ready_cond;
    68 	pthread_cond_t sample_queue_cond, worker_ready_cond;
    68 
    69 
       
    70 	Colour shader_evalulate(Ray &ray, int depth, Shape *origin_shape,
       
    71 		Float nearest_distance, Shape *nearest_shape);
       
    72 	void raytracePacket(Ray *rays, Colour *results);
    69 	static void *raytrace_worker(void *d);
    73 	static void *raytrace_worker(void *d);
    70 public:
    74 public:
    71 	Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0., 0., 0.),
    75 	Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0., 0., 0.),
    72 		ao_samples(0), num_threads(2), max_depth(3)
    76 		ao_samples(0), num_threads(2), max_depth(3), use_packets(true)
    73 	{
    77 	{
    74 		pthread_mutex_init(&sample_queue_mutex, NULL);
    78 		pthread_mutex_init(&sample_queue_mutex, NULL);
    75 		pthread_mutex_init(&sampler_mutex, NULL);
    79 		pthread_mutex_init(&sampler_mutex, NULL);
    76 		pthread_cond_init (&sample_queue_cond, NULL);
    80 		pthread_cond_init (&sample_queue_cond, NULL);
    77 		pthread_cond_init (&worker_ready_cond, NULL);
    81 		pthread_cond_init (&worker_ready_cond, NULL);