(***********************************************************************) (* *) (* JoCamls'R Us - a not so simple ray tracer in JoCaml *) (* *) (* Luc Maranget, projet Moscova, INRIA Rocquencourt *) (* *) (* Copyright 2007 Institut National de Recherche en Informatique et *) (* en Automatique. This file is distributed under the terms of the *) (* GNU Public License version 2, http://www.gnu.org/licenses/gpl.txt *) (* *) (* Important: based upon the ray tracer of the Camls'R'Us team *) (* written at the occasion of the ICFP programming contest 2000 *) (* Copyright 2000 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* *) (***********************************************************************) open Point open Config 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 set_fudge_factor, ": set fudge factor"; "-graphic", Arg.Unit (fun () -> opt.graphic <- true), ": show the images as they are being computed"; "-demo", Arg.Unit (fun () -> opt.graphic <- true), ": same as option -graphic"; "-dump", Arg.Unit (fun () -> opt.dump_tree <- true), ": dump the scene"; "-no_bs", Arg.Unit (fun () -> opt.no_bs <- true), ": disable bounding spheres"; "-no_dl", Arg.Unit (fun () -> opt.no_dl <- true), ": disable depth limitation"; "-no_sort", Arg.Unit (fun () -> opt.no_sort <- true), ": disable object sorting"; "-antialias", Arg.Unit (fun () -> opt.antialias <- Super 2), ": to draw a Go Ban"; "-2", Arg.Unit (fun () -> opt.antialias <- Super 2), ": alias for -antialias"; "-3", Arg.Unit (fun () -> opt.antialias <- Super 3), ": another antialias"; "-4", Arg.Unit (fun () -> opt.antialias <- Super 4), ": yet another antialias"; "-adapt", Arg.Unit (fun () -> opt.antialias <- Adapt), ": adaptive antialias"; "-xv", Arg.Unit (fun () -> opt.start_xv <- true), ": start xv for each image"; "-progress", Arg.Unit (fun () -> opt.progress <- true), ": tell when images are started and finished"; "-v", Arg.Unit (fun () -> opt.progress <- true), ": alias for -progress"; "-inside_object_color", Arg.String (fun s -> opt.inside_object_color <- parse_color s), ": set color displayed if observer is inside an object"; "-horizon_color", Arg.String (fun s -> opt.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 ) (Printf.sprintf "Usage: %s [options] [host[:port]]