|
|
|
@ -106,38 +106,52 @@ SceneObject mandelbulb_new(Point location, int iters, double power) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
int threads = 12;
|
|
|
|
|
float pow = 1;
|
|
|
|
|
Camera cam;
|
|
|
|
|
cam.fov = 90;
|
|
|
|
|
float dpi = 800;
|
|
|
|
|
|
|
|
|
|
int threads = 32;
|
|
|
|
|
int size = dpi * 27.56f; // 400dpi by 70cm size
|
|
|
|
|
float pow = 3;
|
|
|
|
|
float cam_position = 1.15;
|
|
|
|
|
int steps = 1000;
|
|
|
|
|
int iters = 500;
|
|
|
|
|
float threshold = 0.001;
|
|
|
|
|
char path[80];
|
|
|
|
|
|
|
|
|
|
float cam_position = 1.5;
|
|
|
|
|
camera_set_looking_at(&cam, pt_new(cam_position,cam_position,cam_position), pt_new(0,0,0));
|
|
|
|
|
|
|
|
|
|
// get thread count from command line
|
|
|
|
|
if (argc < 3) {
|
|
|
|
|
// get params from cli
|
|
|
|
|
if (argc < 5) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pow = atof(argv[1]);
|
|
|
|
|
steps = atoi(argv[2]);
|
|
|
|
|
iters = atoi(argv[3]);
|
|
|
|
|
threshold = atof(argv[4]);
|
|
|
|
|
|
|
|
|
|
sprintf(path, "tries/pow%.2f-%ist-%iit-%.5fth-%.0fdpi.bmp", pow, steps, iters, threshold, dpi);
|
|
|
|
|
|
|
|
|
|
printf("Rendering to %s\n", path);
|
|
|
|
|
|
|
|
|
|
Camera cam;
|
|
|
|
|
cam.fov = 90;
|
|
|
|
|
|
|
|
|
|
camera_set_looking_at(&cam, pt_new(cam_position, cam_position, cam_position), pt_new(0,0,0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("threads: %d\n", threads);
|
|
|
|
|
printf("pow: %f\n", pow);
|
|
|
|
|
|
|
|
|
|
// create basic scene with up to 10 objects
|
|
|
|
|
Scene scene = scene_new(1080, 1080, 1);
|
|
|
|
|
scene.perf_opts.max_steps = 1000;
|
|
|
|
|
scene.perf_opts.threshold = 0.0001;
|
|
|
|
|
scene.perf_opts.speed_cutoff = 5;
|
|
|
|
|
Scene scene = scene_new(size, size, 1);
|
|
|
|
|
scene.perf_opts.max_steps = steps;
|
|
|
|
|
scene.perf_opts.threshold = threshold;
|
|
|
|
|
scene.perf_opts.speed_cutoff = 10;
|
|
|
|
|
scene.background = color_new(0,0,0);
|
|
|
|
|
|
|
|
|
|
//scene_add_obj(&scene, circle_new(pt_new(SCENE_MOD / 2.0, SCENE_MOD/ 2.0, SCENE_MOD / 2.0), .2));
|
|
|
|
|
|
|
|
|
|
scene_add_obj(&scene, mandelbulb_new(pt_new(1,1,1), 200, pow));
|
|
|
|
|
scene_add_obj(&scene, mandelbulb_new(pt_new(0,0,0), iters, pow));
|
|
|
|
|
|
|
|
|
|
Image *img = render_scene(&scene, &cam, threads);
|
|
|
|
|
|
|
|
|
|
image_save_bmp(*img, argv[2]);
|
|
|
|
|
image_save_bmp(*img, path);
|
|
|
|
|
|
|
|
|
|
image_destroy_shared(*img);
|
|
|
|
|
scene_destroy(scene);
|
|
|
|
|