--- a/ccdemos/spheres_shadow.cc Sun Apr 27 22:55:17 2008 +0200
+++ b/ccdemos/spheres_shadow.cc Mon Apr 28 11:44:11 2008 +0200
@@ -1,7 +1,6 @@
#include "raytracer.h"
#include "octree.h"
-#include "image.h"
#include "common_sdl.h"
Camera cam;
@@ -108,24 +107,10 @@
if (argc == 2 && !strcmp(argv[1], "-r"))
{
pyrit_verbosity = 2;
- Float *fdata = (Float *) malloc(w*h*3*sizeof(Float));
- DefaultSampler sampler(fdata, w, h);
+ DefaultSampler sampler(w, h);
sampler.setOversample(2);
rt.setSampler(&sampler);
rt.render();
-
- struct image *img;
- new_image(&img, w, h, 3);
-
- Float *fd = fdata;
- for (unsigned char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) {
- if (*fd > 1.0)
- *cd = 255;
- else
- *cd = (unsigned char)(*fd * 255.0);
- }
- free(fdata);
- save_png("spheres_shadow.png", img);
- destroy_image(&img);
+ sampler.getPixmap().writePNG("spheres_shadow.png");
}
}