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

SCM Repository

[sml3d] Annotation of /trunk/sml3d/src/sml3d/gl3/vertex.sml
ViewVC logotype

Annotation of /trunk/sml3d/src/sml3d/gl3/vertex.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1412 - (view) (download)

1 : jhr 1412 (* vertex.sml
2 :     *
3 :     * COPYRIGHT (c) 2014 The SML3d Project (http://sml3d.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * TODO: support for GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV
7 :     *)
8 :    
9 :     structure Vertex =
10 :     struct
11 :    
12 :     (* attribute locations *)
13 :     eqtype attrib
14 :    
15 :     (* attribute locations can be specified as numeric values (corresponding to "layout"
16 :     * location specifications in shader programs). These functions convert between the
17 :     * abstract type and the concrete numeric representation.
18 :     *)
19 :     val fromWord : word -> attrib
20 :     val toWord : attrib -> word
21 :    
22 :     val maxVertexAttribs : unit -> int
23 :    
24 :     (***** Vertex specification *****)
25 :    
26 :     (* specifying individual attributes [glVertexAttrib] *)
27 :     val attrib1s : attrib * SML3dTypes.short -> unit
28 :     val attrib1f : attrib * SML3dTypes.float -> unit
29 :     val attrib1d : attrib * SML3dTypes.double -> unit
30 :     val attribI1i : attrib * SML3dTypes.int -> unit
31 :     val attribI1ui : attrib * SML3dTypes.uint -> unit
32 :     val attrib2s : attrib * SML3dTypes.short * SML3dTypes.short -> unit
33 :     val attrib2f : attrib * SML3dTypes.float * SML3dTypes.float -> unit
34 :     val attrib2d : attrib * SML3dTypes.double * SML3dTypes.double -> unit
35 :     val attribI2i : attrib * SML3dTypes.int * SML3dTypes.int -> unit
36 :     val attribI2ui : attrib * SML3dTypes.uint * SML3dTypes.uint -> unit
37 :     val attrib3s : attrib * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short -> unit
38 :     val attrib3f : attrib * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float -> unit
39 :     val attrib3d : attrib * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double -> unit
40 :     val attribI3i : attrib * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int -> unit
41 :     val attribI3ui : attrib * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint -> unit
42 :     val attrib4s : attrib * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short -> unit
43 :     val attrib4f : attrib * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float -> unit
44 :     val attrib4d : attrib * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double -> unit
45 :     val attribN4ub : attrib * SML3dTypes.ubyte * SML3dTypes.ubyte * SML3dTypes.ubyte * SML3dTypes.ubyte -> unit
46 :     val attribI4i : attrib * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int -> unit
47 :     val attribI4ui : attrib * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint -> unit
48 :    
49 :     (* packed attribute values were introduced in Open GL 3.3
50 :     eqtype packing
51 :     val INT_10_10_10_2 : packing
52 :     val UNSIGNED_INT_10_10_10_2 : packing
53 :    
54 :     val attribP1ui : attrib * packing * bool * uint -> unit
55 :     val attribP2ui : attrib * packing * bool * uint -> unit
56 :     val attribP3ui : attrib * packing * bool * uint -> unit
57 :     val attribP4ui : attrib * packing * bool * uint -> unit
58 :     *)
59 :    
60 :     (***** Vertex arrays *****)
61 :    
62 :     val enableArray : attrib * bool -> unit
63 :    
64 :     (* attribute arity phantom types *)
65 :     datatype one = ONE
66 :     datatype two = TWO
67 :     datatype three = THREE
68 :     datatype four = FOUR
69 :     datatype bgra = BGRA
70 :    
71 :     type ('arity, 'ty) attrib_fmt = FMT of (GLint.int * GLenum.word)
72 :     type ('arity, 'ty) int_attrib_fmt = IFMT of (GLint.int * GLenum.word)
73 :    
74 :     (* attribute array formats *)
75 :     val array1b : (one, SML3dTypes.byte) int_attrib_fmt = IFMT(1, GLConsts.GL_BYTE)
76 :     val array1ub : (one, SML3dTypes.ubyte) int_attrib_fmt = IFMT(1, GLConsts.GL_UNSIGNED_BYTE)
77 :     val array1s : (one, SML3dTypes.short) int_attrib_fmt = IFMT(1, GLConsts.GL_SHORT)
78 :     val array1us : (one, SML3dTypes.ushort) int_attrib_fmt = IFMT(1, GLConsts.GL_UNSIGNED_SHORT)
79 :     val array1i : (one, SML3dTypes.int) int_attrib_fmt = IFMT(1, GLConsts.GL_INT)
80 :     val array1ui : (one, SML3dTypes.uint) int_attrib_fmt = IFMT(1, GLConsts.GL_UNSIGNED_INT)
81 :     val array1h : (one, SML3dTypes.half) attrib_fmt = FMT(1, GLConsts.GL_HALF_FLOAT)
82 :     val array1f : (one, SML3dTypes.float) attrib_fmt = FMT(1, GLConsts.GL_FLOAT)
83 :     val array1d : (one, SML3dTypes.double) attrib_fmt = FMT(1, GLConsts.GL_DOUBLE)
84 :    
85 :     val array2b : (two, SML3dTypes.byte) int_attrib_fmt = IFMT(2, GLConsts.GL_BYTE)
86 :     val array2ub : (two, SML3dTypes.ubyte) int_attrib_fmt = IFMT(2, GLConsts.GL_UNSIGNED_BYTE)
87 :     val array2s : (two, SML3dTypes.short) int_attrib_fmt = IFMT(2, GLConsts.GL_SHORT)
88 :     val array2us : (two, SML3dTypes.ushort) int_attrib_fmt = IFMT(2, GLConsts.GL_UNSIGNED_SHORT)
89 :     val array2i : (two, SML3dTypes.int) int_attrib_fmt = IFMT(2, GLConsts.GL_INT)
90 :     val array2ui : (two, SML3dTypes.uint) int_attrib_fmt = IFMT(2, GLConsts.GL_UNSIGNED_INT)
91 :     val array2h : (two, SML3dTypes.half) attrib_fmt = FMT(2, GLConsts.GL_HALF_FLOAT)
92 :     val array2f : (two, SML3dTypes.float) attrib_fmt = FMT(2, GLConsts.GL_FLOAT)
93 :     val array2d : (two, SML3dTypes.double) attrib_fmt = FMT(2, GLConsts.GL_DOUBLE)
94 :    
95 :     val array3b : (three, SML3dTypes.byte) int_attrib_fmt = IFMT(3, GLConsts.GL_BYTE)
96 :     val array3ub : (three, SML3dTypes.ubyte) int_attrib_fmt = IFMT(3, GLConsts.GL_UNSIGNED_BYTE)
97 :     val array3s : (three, SML3dTypes.short) int_attrib_fmt = IFMT(3, GLConsts.GL_SHORT)
98 :     val array3us : (three, SML3dTypes.ushort) int_attrib_fmt = IFMT(3, GLConsts.GL_UNSIGNED_SHORT)
99 :     val array3i : (three, SML3dTypes.int) int_attrib_fmt = IFMT(3, GLConsts.GL_INT)
100 :     val array3ui : (three, SML3dTypes.uint) int_attrib_fmt = IFMT(3, GLConsts.GL_UNSIGNED_INT)
101 :     val array3h : (three, SML3dTypes.half) attrib_fmt = FMT(3, GLConsts.GL_HALF_FLOAT)
102 :     val array3f : (three, SML3dTypes.float) attrib_fmt = FMT(3, GLConsts.GL_FLOAT)
103 :     val array3d : (three, SML3dTypes.double) attrib_fmt = FMT(3, GLConsts.GL_DOUBLE)
104 :    
105 :     val array4b : (four, SML3dTypes.byte) int_attrib_fmt = IFMT(4, GLConsts.GL_BYTE)
106 :     val array4ub : (four, SML3dTypes.ubyte) int_attrib_fmt = IFMT(4, GLConsts.GL_UNSIGNED_BYTE)
107 :     val array4s : (four, SML3dTypes.short) int_attrib_fmt = IFMT(4, GLConsts.GL_SHORT)
108 :     val array4us : (four, SML3dTypes.ushort) int_attrib_fmt = IFMT(4, GLConsts.GL_UNSIGNED_SHORT)
109 :     val array4i : (four, SML3dTypes.int) int_attrib_fmt = IFMT(4, GLConsts.GL_INT)
110 :     val array4ui : (four, SML3dTypes.uint) int_attrib_fmt = IFMT(4, GLConsts.GL_UNSIGNED_INT)
111 :     val array4h : (four, SML3dTypes.half) attrib_fmt = FMT(4, GLConsts.GL_HALF_FLOAT)
112 :     val array4f : (four, SML3dTypes.float) attrib_fmt = FMT(4, GLConsts.GL_FLOAT)
113 :     val array4d : (four, SML3dTypes.double) attrib_fmt = FMT(4, GLConsts.GL_DOUBLE)
114 :    
115 :     (* arrays with reverse-order components *)
116 :     val arrayBGRAb : (bgra, SML3dTypes.byte) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_BYTE)
117 :     val arrayBGRAub : (bgra, SML3dTypes.ubyte) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_UNSIGNED_BYTE)
118 :     val arrayBGRAs : (bgra, SML3dTypes.short) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_SHORT)
119 :     val arrayBGRAus : (bgra, SML3dTypes.ushort) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_UNSIGNED_SHORT)
120 :     val arrayBGRAi : (bgra, SML3dTypes.int) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_INT)
121 :     val arrayBGRAui : (bgra, SML3dTypes.uint) int_attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_UNSIGNED_INT)
122 :     val arrayBGRAh : (bgra, SML3dTypes.half) attrib_fmt = IFMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_HALF_FLOAT)
123 :     val arrayBGRAf : (bgra, SML3dTypes.float) attrib_fmt = FMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_FLOAT)
124 :     val arrayBGRAd : (bgra, SML3dTypes.double) attrib_fmt = FMT(GLenum.toIntX GLConsts.GL_BGRA, GLConsts.GL_DOUBLE)
125 :    
126 :     (* specifying floating-point attributes. The bool argument specifies whether integer arguments
127 :     * should be mapped to a normalized range ([-1..1] for signed values and [0..1] for unsigned).
128 :     *)
129 :     val attribFltArray : attrib * ('arity, 'ty) attrib_fmt -> unit
130 :     val attribArray : attrib * bool * ('arity, 'ty) int_attrib_fmt -> unit
131 :     val attribIntArray : attrib * ('arity, 'ty) int_attrib_fmt -> unit
132 :    
133 :     (* like the previous three functions, but with stride and offset info too *)
134 :     val attribFltArray' : attrib * ('arity, 'ty) attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit
135 :     val attribArray' : attrib * bool * ('arity, 'ty) int_attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit
136 :     val attribIntArray' : attrib * ('arity, 'ty) int_attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit
137 :    
138 :     end

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