void get_coord(t_scene *sc, t_img_buff *cl) { double x; double y; double xend; int i; x = cl->cli_num * (800 / cl->cli_max); xend = cl->cli_num + 1; xend = xend * (800 / cl->cli_max); cl->img = xmalloc_and_set(NULL, sizeof(int) * (200 * 600)); i = 0; fprintf(stdout, "Calculating...\n"); while (x <= xend) { y = 0; while (y <= 600) { reset_eye(sc, x, y); render_pixel(sc, x, y); (cl->img)[i++] = sc->eye->intersection.color.value; y++; } x++; } cl->size = i; }
void render_frame(pixel* pixels, int64_t frame_index) { int64_t pixel_index = 0; int64_t x = 0, y = 0, z = 0; if (frame_index % frames_per_layer == 0) { int i; for (i = spheres - 1; i > 0; i--) { sphere_colors[i] = sphere_colors[i - 1]; } sphere_colors[0] = randcolor(); } for (y = 0; y < depth; y++) { for (x = 0; x < width; x++) { for (z = 0; z < height; z++, pixel_index++) { render_pixel(pixels + pixel_index, frame_index, pixel_index, x, y, z, x / xd, y / yd, z / zd); } } } }