INTERFACE VGM; IMPORT Rd, Wr; TYPE T = RECORD nx, ny, nz: CARDINAL; dxdy, dxdz, dydz: CARDINAL; maxval: [0..255]; v: REF ARRAY OF ARRAY OF ARRAY OF BYTE END; BYTE = BITS 8 FOR [0..255]; PROCEDURE New( nx, ny, nz: CARDINAL; dxdy, dxdz, dydz: CARDINAL := 0; maxval: [0..255] := 255 ): T; (* Allocates a new texture, with given dimensions and all zero pixels. *) PROCEDURE Read(rd: Rd.T): T; (* Reads a 3D texture from the given stream, assumed to be in binary "vgm" file format (V5). *) PROCEDURE Write(wr: Wr.T; READONLY t: T); (* Writes "t" to the given stream, in the binary "vgm" file format (V5). *) PROCEDURE PrintParms(wr: Wr.T; READONLY t: T); (* Displays the dimensions and displacements of texture "t" on the given writer. *) PROCEDURE Reduce(READONLY t: T; VAR x, y, z: INTEGER); (* Given the grid coordinates of an arbitrary texel of 3-space, returns the coordinates of an equivalent texel in the fundamental region (the block [0..t.nx-1]x[0..t.ny-1]x[0..t.nz-1]). *) PROCEDURE Eval(READONLY t: T; x, y, z: REAL): BYTE; (* Returns the value of texture "t" at point (x,y,z) of 3-space, taking into account the periods and displacements of "t". Each texel is assumed to be a unit-side cube, and the domain of texel [0,0,0] is assumed to be the cube [0__1]^3. *) END VGM.