added more configuration options

rework
Anton Lydike 4 years ago
parent 63ece1a9b4
commit 266f243703

@ -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;
float cam_position = 1.5;
camera_set_looking_at(&cam, pt_new(cam_position,cam_position,cam_position), pt_new(0,0,0));
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];
// get thread count from command line
if (argc < 3) {
return 1;
}
// 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);
printf("threads: %d\n", threads);
printf("pow: %f\n", pow);
Camera cam;
cam.fov = 90;
camera_set_looking_at(&cam, pt_new(cam_position, cam_position, cam_position), pt_new(0,0,0));
// 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);

@ -67,8 +67,6 @@ void camera_iterate_rays_const_angle(Camera camera, int width, int height, int t
}
}
printf("Thread %i reporting for duty\n", thread_id);
// this point is rotated for every pixel
Point curr_pt = starting_point;
// (0,0) screenspace is bottom left corner
@ -92,7 +90,6 @@ void camera_iterate_rays_const_angle(Camera camera, int width, int height, int t
int status;
for (int i = 0; i < threads - 1; i++) {
printf("Waiting for threads... %d/%d\n", i, threads);
while(wait(&status) > 0) {}
}
@ -137,7 +134,6 @@ void camera_iterate_rays_const_dist(Camera camera, int width, int height, int th
break;
}
}
printf("Thread %i reporting for duty\n", thread_id);
// this point is moved for every pixel
Point curr_pt = starting_point;
@ -171,7 +167,6 @@ void camera_iterate_rays_const_dist(Camera camera, int width, int height, int th
int status;
for (int i = 0; i < threads - 1; i++) {
printf("Waiting for threads... %d/%d\n", i, threads);
while(wait(&status) > 0) {}
}

Loading…
Cancel
Save