--- a/src/raytracer.cc Wed Mar 19 17:18:59 2008 +0100
+++ b/src/raytracer.cc Wed Mar 26 00:52:27 2008 +0100
@@ -442,11 +442,38 @@
return (void *)d;
}
-void Raytracer::render(int w, int h, Float *buffer)
+void Raytracer::render()
{
- if (!camera || !top || !buffer)
+ if (!sampler || !camera || !top)
return;
+ // create workers
+ // ...
+
+ sampler->init();
+ int sampnum = 0;
+ while ( (sampnum = sampler->initSampleSet()) > 0 )
+ {
+ Sample *sample, *prev = NULL;
+ while ( (sample = sampler->nextSample(prev)) != NULL )
+ {
+ Ray ray = camera->makeRay(sample);
+ //raystack->push(ray);
+
+ // in worker:
+ Colour col = raytrace(ray, 0, NULL);
+ sampler->saveSample(sample, col);
+
+ delete prev;
+ prev = sample;
+ }
+ }
+
+ // wait for workers
+ // ...
+
+#if 0
+
RenderrowData *d;
Float S = 0.5/w;
@@ -483,7 +510,7 @@
dbgmsg(0, "\nE pthread_create unsuccessful, return code was %d\n", rc);
exit(1);
}
- /* when 't' owerflows, reset it */
+ /* when 't' overflows, reset it */
if (t >= num_threads)
t = 0;
/* wait for next thread in fifo queue, so the descriptor can be reused;
@@ -506,6 +533,8 @@
if (pthread_join(threads[t], (void**)&d) == 0)
free(d);
#endif
+
+#endif
}
void Raytracer::addlight(Light *light)