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

SCM Repository

[sml3d] View of /src/common/sml3d-types.sml
ViewVC logotype

View of /src/common/sml3d-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (download) (annotate)
Wed Feb 20 14:24:34 2008 UTC (11 years, 9 months ago) by jhr
File size: 1481 byte(s)
  Types have moved to common.
(* sml3d-types.sml
 *
 * COPYRIGHT (c) 2008 John Reppy (http://www.cs.uchicago.edu/~jhr)
 * All rights reserved.
 *
 * Names for the common types used in the SML3d APIs.
 *)

structure SML3dTypes : SML3D_TYPES =
  struct

  (* scalars *)
    type byte = Int8.int
    type ubyte = Word8.word
    type short = Int16.int
    type ushort = Word16.word
    type uint = Word32.word
    type float = Real32.real
    type double = Real64.real

  (* 2-, 3-, and 4-dimensional vectors; used for positions and normals *)
    type 'a vec2 = {x : 'a, y : 'a}
    type 'a vec3 = {x : 'a, y : 'a, z : 'a}
    type 'a vec4 = {x : 'a, y : 'a, z : 'a, w : 'a}

    type vec2f = float vec2
    type vec3f = float vec3
    type vec4f = float vec4

    type vec2d = double vec2
    type vec3d = double vec3
    type vec4d = double vec4

  (* texture coordinates *)
    type 'a tex1 = 'a
    type 'a tex2 = {s : 'a, t : 'a}
    type 'a tex3 = {s : 'a, t : 'a, r : 'a}
    type 'a tex4 = {s : 'a, t : 'a, r : 'a, q : 'a}
    type tex1f = float tex1
    type tex2f = float tex2
    type tex3f = float tex3
    type tex4f = float tex4
    type tex1d = double tex1
    type tex2d = double tex2
    type tex3d = double tex3
    type tex4d = double tex4

  (* 3- and 4-channel colors *)
    type 'a rgb = {r : 'a, g : 'a, b : 'a}
    type 'a rgba = {r : 'a, g : 'a, b : 'a, a : 'a}
    type color3ub = ubyte rgb
    type color4ub = ubyte rgba
    type color3f = float rgb
    type color4f = float rgba

  end

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