src/raytracer.cc
branchpyrit
changeset 100 c005054bf4c1
parent 95 ca7d4c665531
equal deleted inserted replaced
99:f3abdaa2e8fb 100:c005054bf4c1
    25  */
    25  */
    26 
    26 
    27 #include <pthread.h>
    27 #include <pthread.h>
    28 #include <stdio.h>
    28 #include <stdio.h>
    29 #include <stdlib.h>
    29 #include <stdlib.h>
       
    30 #include <string.h>
    30 #include <assert.h>
    31 #include <assert.h>
    31 #include "raytracer.h"
    32 #include "raytracer.h"
    32 
    33 
    33 // Hammersley spherical point distribution
    34 // Hammersley spherical point distribution
    34 // http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html
    35 // http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html
   476 		pthread_mutex_lock(&sampler_mutex);
   477 		pthread_mutex_lock(&sampler_mutex);
   477 
   478 
   478 		for (;;)
   479 		for (;;)
   479 		{
   480 		{
   480 			my_count = 0;
   481 			my_count = 0;
   481 			while ( more_samples = sampler->nextSample(&sample_queue[my_pos++]) )
   482 			while ( (more_samples = sampler->nextSample(&sample_queue[my_pos++])) != 0 )
   482 			{
   483 			{
   483 				my_count++;
   484 				my_count++;
   484 				if (my_pos >= sample_queue_size)
   485 				if (my_pos >= sample_queue_size)
   485 					my_pos = 0;
   486 					my_pos = 0;
   486 				if (my_count >= my_count_max)
   487 				if (my_count >= my_count_max)