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

SCM Repository

[sml3d] View of /src/common/sml3d-type-util-sig.sml
ViewVC logotype

View of /src/common/sml3d-type-util-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (download) (annotate)
Mon Feb 18 18:20:34 2008 UTC (11 years, 8 months ago) by jhr
File size: 2798 byte(s)
  Added formatting and fixed type errors.
(* sml3d-type-util-sig.sml
 *
 * COPYRIGHT (c) 2008 John Reppy (http://www.cs.uchicago.edu/~jhr)
 * All rights reserved.
 *)

signature SML3D_TYPE_UTIL =
  sig

  (* vector types (as per SML3d_TYPES) *)
    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 '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 'a rgb  = {r : 'a, g : 'a, b : 'a}
    type 'a rgba = {r : 'a, g : 'a, b : 'a, a : 'a}

  (* pack tuples as records *)
    val packv2 : ('a * 'a)		-> 'a vec2
    val packv3 : ('a * 'a * 'a)		-> 'a vec3
    val packv4 : ('a * 'a * 'a * 'a)	-> 'a vec4

    val packt2 : ('a * 'a)		-> 'a tex2
    val packt3 : ('a * 'a * 'a)		-> 'a tex3
    val packt4 : ('a * 'a * 'a * 'a)	-> 'a tex4

    val packc3 : ('a * 'a * 'a)		-> 'a rgb
    val packc4 : ('a * 'a * 'a * 'a)	-> 'a rgba

  (* unpack records as tuples *)
    val unpackv2 : 'a vec2 -> ('a * 'a)
    val unpackv3 : 'a vec3 -> ('a * 'a * 'a)
    val unpackv4 : 'a vec4 -> ('a * 'a * 'a * 'a)

    val unpackt2 : 'a tex2 -> ('a * 'a)
    val unpackt3 : 'a tex3 -> ('a * 'a * 'a)
    val unpackt4 : 'a tex4 -> ('a * 'a * 'a * 'a)

    val unpackc3 : 'a rgb  -> ('a * 'a * 'a)
    val unpackc4 : 'a rgba -> ('a * 'a * 'a * 'a)

  (* iterators *)
    val mapv2 : ('a -> 'b) -> 'a vec2 -> 'b vec2
    val mapv3 : ('a -> 'b) -> 'a vec3 -> 'b vec3
    val mapv4 : ('a -> 'b) -> 'a vec4 -> 'b vec4

    val mapt2 : ('a -> 'b) -> 'a tex2 -> 'b tex2
    val mapt3 : ('a -> 'b) -> 'a tex3 -> 'b tex3
    val mapt4 : ('a -> 'b) -> 'a tex4 -> 'b tex4

    val mapc3 : ('a -> 'b) -> 'a rgb -> 'b rgb
    val mapc4 : ('a -> 'b) -> 'a rgba -> 'b rgba

    val appv2 : ('a -> unit) -> 'a vec2 -> unit
    val appv3 : ('a -> unit) -> 'a vec3 -> unit
    val appv4 : ('a -> unit) -> 'a vec4 -> unit

    val appt2 : ('a -> unit) -> 'a tex2 -> unit
    val appt3 : ('a -> unit) -> 'a tex3 -> unit
    val appt4 : ('a -> unit) -> 'a tex4 -> unit

    val appc3 : ('a -> unit) -> 'a rgb -> unit
    val appc4 : ('a -> unit) -> 'a rgba -> unit

  (* string representations *)
    val fmtv2 : ('a -> string) -> 'a vec2 -> string
    val fmtv3 : ('a -> string) -> 'a vec3 -> string
    val fmtv4 : ('a -> string) -> 'a vec4 -> string

    val fmtt2 : ('a -> string) -> 'a tex2 -> string
    val fmtt3 : ('a -> string) -> 'a tex3 -> string
    val fmtt4 : ('a -> string) -> 'a tex4 -> string

    val fmtc3 : ('a -> string) -> 'a rgb  -> string
    val fmtc4 : ('a -> string) -> 'a rgba -> string

    val fmt2  : ('a -> string) -> ('a * 'a)           -> string
    val fmt3  : ('a -> string) -> ('a * 'a * 'a)      -> string
    val fmt4  : ('a -> string) -> ('a * 'a * 'a * 'a) -> string

  end

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