open Point let graphic = ref false let dump_tree = ref false let antialias = ref false let no_bs = ref false let start_xv = ref false let inside_object_color = ref {x = 0.0; y = 0.0; z = 0.0} (* black *) let horizon_color = ref {x = 0.0; y = 0.0; z = 0.0} (* black *) let no_dl = ref false let progress = ref false let no_sort = ref false let parse_color s = try let comma1 = String.index s ',' in let comma2 = String.index_from s (comma1 + 1) ',' in { x = float_of_string(String.sub s 0 comma1); y = float_of_string(String.sub s (comma1 + 1) (comma2 - comma1 - 1)); z = float_of_string(String.sub s (comma2 + 1) (String.length s - comma2 - 1)) } with Not_found | Failure _ | Invalid_argument _ -> raise (Arg.Bad ("bad color specification " ^ s)) let _ = Arg.parse [ "-fudge", Arg.Float Misc.set_fudge_factor, ": set fudge factor"; "-graphic", Arg.Set graphic, ": open graphic console"; "-dump", Arg.Set dump_tree, ": dump the scene"; "-no_bs", Arg.Set no_bs, ": disable bounding spheres"; "-no_dl", Arg.Set no_dl, ": disable depth limitation"; "-no_sort", Arg.Set no_sort, ": disable object sorting"; "-antialias", Arg.Set antialias, ": to draw a Go Ban"; "-xv", Arg.Set start_xv, ": start xv for each image"; "-progress", Arg.Set progress, ": display progress in percents"; "-inside_object_color", Arg.String (fun s -> inside_object_color := parse_color s), ": set color displayed if observer is inside an object"; "-horizon_color", Arg.String (fun s -> horizon_color := parse_color s), ": set color of horizon (default: black)"; ] (fun s -> Printf.printf "Don't know what to do with %s" s; print_newline (); exit 1 ) "Usage: tracer [options]