BYTE* RayTrace (Camera camera, const Scene& scene) { RayTracer ray_tracer; int width = scene.width; int height = scene.height; int pix = width * height; BYTE* image = new BYTE[3*pix]; for (int i = 0 ; i < height ; i++) for (int j = 0 ; j < width ; j++) { Ray ray = ray_tracer.GenerateRay(camera, i, j, height, width); Color color = ray_tracer.Trace(ray, scene, 0, i, j); int base = 3 * ((height-i-1) * width + j); image[base + 0] = color.Bbyte(); image[base + 1] = color.Gbyte(); image[base + 2] = color.Rbyte(); if (i % 40 == 0 && j == 0) printf("%d %d\n",i, j); } return image; }