ccdemos/spheres_shadow.cc
branchpyrit
changeset 60 a23b5089b9c3
parent 48 a4913301c626
child 72 7c3f38dff082
equal deleted inserted replaced
59:64e456ab823d 60:a23b5089b9c3
   116 
   116 
   117 		struct image *img;
   117 		struct image *img;
   118 		new_image(&img, w, h, 3);
   118 		new_image(&img, w, h, 3);
   119 
   119 
   120 		Float *fd = fdata;
   120 		Float *fd = fdata;
   121 		for (char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) {
   121 		for (unsigned char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) {
   122 			if (*fd > 1.0)
   122 			if (*fd > 1.0)
   123 				*cd = 255;
   123 				*cd = 255;
   124 			else
   124 			else
   125 				*cd = (unsigned char)(*fd * 255.0);
   125 				*cd = (unsigned char)(*fd * 255.0);
   126 		}
   126 		}