overview | basic concepts | gops | gprims | animation | rendering | math | index

basic concepts


gprims, gops, graphics state | models, avars | al types

AL Types

In addition to Scheme data types, AL defines a few mathematical data types (e.g. vec3), array types (e.g. vec3list), and syntactical forms (e.g. paramlists). These types and syntax are used in many AL procedures.


Parameter Lists

Many of the procedures in AL (cameras, shaders, and gprims) use parameter lists. A parameter list consists of an arbitrary number of name-value pairs. Each name-value pair sets the value of the particular parameter specified by the name. The order of the name-value pairs doesn't matter -- they can be specified in any order but for each pair, the name always comes first. The "name" is always a Scheme symbol (e.g. 'radius). The "value" can be of any type but there is always exactly one value.

If a particular parameter is not specified in the parameter list, a reasonable default value is used.

For example, the camera gop has the following definition.

(camera name type paramlist)

The camera gop requires two parameters, the name of the camera and the camera type (e.g. "perspective"). The "perspective" camera has several options which can be set in the parameter list including the position ("from"), the point that the camera is looking at ("to"), and the field of view ("fov"). These options all have values by default, but different values can be set using the parameter list syntax. The examples below show valid usages of the "perspective" camera gop:

  1. (camera "main" "perspective")
  2. (camera "main" "perspective" 'from (vec3 1 1 3))
  3. (camera "cam2" "perspective" 'to (vec3 0 .5 0) 'from (vec3 1 1 3) 'fov 45)


Vec2, Vec3, Vec4

The vec2, vec3, and vec4 types are used to represent 2D, 3D, and 4D points (or vectors) respectively. For the full set of operations on these types, see AL math.

Vec2, vec3, and vec4 are represented in Scheme using the following notation (x, y, z, and w are reals):

#< x y >
#< x y z >
#< x y z w >

In addition, the following functions construct a new vec2, vec3, or vec4 respectively. x, y, z, and w again are reals.

(vec2 x y)
(vec3 x y z)
(vec4 x y z w)

Therefore, in AL (vec3 1.0 -2 -.3) is equivalent to '#<1.0 -2 -.3>.


Mat3, Mat4

AL also defines two types for 3x3 and 4x4 matrices: mat3 and mat4 respectively. Elements are stored in row-major order. For more detail including math operations on these types, see AL math.

Mat3 and mat4 are represented in Scheme using the following notation (each element, aij, is a real):

#< a00 a01 a02 a10 a11 ... a22 >
#< a00 a01 a02 a03 a10 a11 ... a33 >

In addition, the following functions construct a new mat3 or mat4 respectively. Each element, aij, is a real.

(mat3 a00 a01 a02 a10 a11 ... a22)
(mat4 a00 a01 a02 a03 a10 a11 ... a33)


Array Types

AL uses several secondary types for dealing with arrays of points, texture coordinates, vertex indices, etc. In AL, these arrays can be stored in either a Scheme list or Scheme vector.

Vec2list, vec3list, and vec4list are homogeneous Scheme lists or vectors containing a sequence of vec2s, vec3s, or vec4s respectively. The following are equivalent vec3lists:

(list #<1.0 2 3.5> #<-1 1.2 4> #<-9 4.3 2>)
(vector #<1.0 2 3.5> #<-1 1.2 4> #<-9 4.3 2>)

A reallist is a homogeneous Scheme list or vector containing a sequence of reals. The following are equivalent reallists:

(list 1.0 -9 3.2 4 17.3)
(vector 1.0 -9 3.2 4 17.3)

An indexlist is a list or vector containing integers or indexlists. Indexlists are most commonly used to specify vertex indicies for polygonal geometry but may have other uses. Example indexlists:

(list 3 3 3 4 3)
(vector 0 1 2 3 4 5)
'((1 2 3 0) (4 5))
'#(#(1 2 3 0) #(4 5))


AL: The Animation Language is Copyright © 1995,1996, Stephen F. May

Last updated: 10/30/96 / Steve May ( smay@cgrg.ohio-state.edu )
Any comments or suggestions appreciated.