Module Raytrace

type rgb = float * float * float
type light =
  1. | Sun of {
    1. towards : Vec3.t;
    2. color : rgb;
    }
  2. | Lamp of {
    1. position : Vec3.t;
    2. radius : float;
    3. color : rgb;
    }
  3. | Spot of {
    1. position : Vec3.t;
    2. aim : Vec3.t;
    3. angle : float;
    4. falloff : float;
    5. color : rgb;
    }
type scene = {
  1. camera : Camera.t;
  2. solids : Solid.t list;
  3. lights : light list;
  4. ambient : float;
  5. background : int;
}
type algorithm =
  1. | Ray_casting
  2. | Lambert
  3. | Shadow_rays
  4. | Whitted
  5. | Soft_shadows
  6. | Path_tracing
val algorithms : algorithm list
val latest : algorithm
val default_algorithm : algorithm
val name : algorithm -> string
type acceleration =
  1. | Brute_force
  2. | Bvh of Bvh.split
type options = {
  1. algorithm : algorithm;
  2. epsilon : float;
  3. acceleration : acceleration;
  4. depth : int;
  5. cutoff : float;
  6. samples : int;
  7. seed : int;
}
val default_options : options
val camera_ray_through : Camera.t -> width:int -> height:int -> float -> float -> Ray.t * float * float
val camera_ray : Camera.t -> width:int -> height:int -> x:int -> y:int -> Ray.t * float * float
val nearest : ?min_t:float -> ?max_t:float -> Ray.t -> Solid.t list -> (float * Solid.t) option
val shadowed : epsilon:float -> Solid.t list -> Vec3.t -> light -> bool
type world
val world : ?options:options -> scene -> world
val reflect : Vec3.t -> Vec3.t -> Vec3.t
val refract : Vec3.t -> Vec3.t -> eta:float -> (Vec3.t * float) option
val schlick : n1:float -> n2:float -> float -> float
val trace : world -> Ray.t -> min_t:float -> max_t:float -> int
val tests : world -> int
val boxes : world -> int
val secondary_rays : world -> int
val saved_rays : world -> int
val pixel : world -> width:int -> height:int -> x:int -> y:int -> int
val render : ?options:options -> scene -> width:int -> height:int -> Rgba_image.t
val passes : int list
type progress
val start : ?options:options -> scene -> width:int -> height:int -> progress
val advance : progress -> rays:int -> unit
val finished : progress -> bool
val rays_shot : progress -> int
val pass : progress -> int
val world_of : progress -> world
val picture : progress -> Rgba_image.t