Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/geometry/camera.sml
ViewVC logotype

View of /trunk/sml3d/src/geometry/camera.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 768 - (download) (annotate)
Mon Feb 15 20:58:03 2010 UTC (9 years, 8 months ago) by jhr
File size: 1475 byte(s)
  Working on camera, view, and frustum
(* camera.sml
 *
 * COPYRIGHT (c) 2010 John Reppy (http://cs.uchicago.edu/~jhr)
 * All rights reserved.
 *
 * A camera is an abstraction of the view matrix used to map from world
 * space to camera (or eye) space.  Cameras are treated as immutable
 * values consisting of a position and orientation.
 *)

structure Camera : sig

  (* the position and orientation of a camera relative to world space. *)
    type camera

  (* the position of the camera in world coordinates *)
    val positionf : camera -> Vec3f.vec3
    val positiond : camera -> Vec3d.vec3

  (* orientation vectors; these form an ortho-normal basis, with the
   * camera-space X-axis defined by the left vector, the Y-axis defined
   * by the up vector, and the Z-axis defined by the at vector.
   *)
    val leftVecf : camera -> Vec3f.vec
    val leftVecd : camera -> Vec3d.vec
    val upVecf : camera -> Vec3f.vec
    val upVecd : camera -> Vec3d.vec
    val atVecf : camera -> Vec3f.vec
    val atVecd : camera -> Vec3d.vec

  (* transform world-space points, vectors, and normal vectors to camera
   * space.
   *)
    val transformPt   : camera -> Vec3f.vec3 -> Vec3f.vec3
    val transformVec  : camera -> Vec3f.vec3 -> Vec3f.vec3
    val transformNorm : camera -> Vec3f.vec3 -> Vec3f.vec3

  (* interpolate between cameras *)
    val interpolate : camera * camera -> float -> camera

  (* get the model-view matrix for the camera *)
    val getMatrix : camera -> Matrix4f.mat

  end = struct

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0