PolygonPackage.mesa
Last Edited by: Crow, December 6, 1983 1:28 pm
DIRECTORY
ThreeDPackage USING [Triple, Quad, Transformation3D],
Rope USING [ROPE];
PolygonPackage:
CEDAR
DEFINITIONS
~ BEGIN
Triple: TYPE ~ ThreeDPackage.Triple; -- RECORD [ x, y, z: REAL];
Quad: TYPE ~ ThreeDPackage.Quad; -- RECORD [ x, y, z, w: REAL];
ClrTriple: TYPE ~ RECORD [ r, g, b: REAL];
OutCode: TYPE ~ RECORD[bottom, top, left, right, near, far: BOOLEAN];
NoneOut: OutCode ~ [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE];
AllOut: OutCode ~ [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE];
Transformation3D: TYPE ~ ThreeDPackage.Transformation3D; -- RECORD [ a, b, c, d: Quad];
LightList: TYPE ~ LIST OF Light;
Light: TYPE ~ RECORD[ pos: Triple, clr: ClrTriple, ambient: REAL];
ClipWindow: TYPE ~ RECORD [xMin, yMin, xMax, yMax, depth: REAL];
Vertex:
TYPE ~
RECORD[ x, y, z, ex, ey, ez:
REAL, ix, iy:
INTEGER, clip: OutCode];
coordinates, eyespace coords, texture coords, imagespace coords, clip code
VertexSequenceRep: TYPE ~ RECORD[SEQUENCE length: NAT OF Vertex];
ShadingType: TYPE ~ {none, smooth, faceted, fancy};
ShadingValue:
TYPE ~
RECORD[xn, yn, zn, r, g, b, t, txtrX, txtrY:
REAL, value:
LONG
CARDINAL];
normals, color, transmittance, computed packed color value
ShadingSequenceRep: TYPE ~ RECORD[SEQUENCE length: NAT OF ShadingValue];
TextureCoord: TYPE ~ RECORD[txtrX, txtrY: REAL];
PolygonTexture: TYPE ~ RECORD[nVtces: NAT, vtx: SEQUENCE length: NAT OF TextureCoord];
PolygonTextureSequenceRep: TYPE ~ RECORD [SEQUENCE length: NAT OF REF PolygonTexture];
VertexInfo: TYPE ~ RECORD[coord: Vertex, shade: ShadingValue];
Polygon: TYPE ~ RECORD[nVtces: NAT, vtx: SEQUENCE length: NAT OF VertexInfo];
PolygonSequenceRep: TYPE ~ RECORD [SEQUENCE length: NAT OF REF Polygon];
PtrPoly: TYPE ~ RECORD[nVtces: NAT, clipState: ClipState, vtxPtr: SEQUENCE length: NAT OF NAT];
PtrPolySequenceRep: TYPE ~ RECORD[SEQUENCE length: NAT OF REF PtrPoly];
ClipState: TYPE ~ { in, out, clipped };
Object:
TYPE ~
RECORD[
name: Rope.ROPE,
numPolys, numVtces: INT,
clipState: ClipState,
shadingInValid, vtcesInValid: BOOLEAN,
centroid: Triple, boundingRadius: REAL,
eyeCntroid: Triple, eyeBndngRadius: REAL,
shading: ShadingType, color: ClrTriple, shininess, transmittance: REAL,
position: Transformation3D,
polygon: REF PtrPolySequenceRep,
vertex: REF VertexSequenceRep,
shade: REF ShadingSequenceRep,
texture: REF PolygonTextureSequenceRep
];
ObjectPolygon: TYPE ~ RECORD[object: REF Object, polygon, next: NAT];
SortSequenceRep: TYPE ~ RECORD[SEQUENCE length: NAT OF ObjectPolygon];
RGBToPixelProc: TYPE ~ PROC [r, g, b: REAL] RETURNS [CARDINAL];
GetTransforms: PUBLIC PROC[ eyePt, ptOfInterest: Triple, width, height: NAT,
fieldOfView: REAL ← 40., nearLimit: REAL ← .01 ]
RETURNS[eyeSpace: Transformation3D];
BackFacing: PROC[ poly: REF Polygon] RETURNS [BOOLEAN];
ShadePoly: PROC[ poly: REF Polygon, light: LightList] RETURNS [REF Polygon];
ClipPoly: PROC[ poly, poly2: REF Polygon, shading, normals: BOOLEAN]
RETURNS [REF Polygon, REF Polygon];
GetObject: PROC[fileName: Rope.ROPE] RETURNS[REF Object];
GetColors:
PROC[colorFile: Rope.
ROPE, object:
REF Object, numExpected:
INT];
Read texture coordinates from named file and enter in the corresponding vertices
GetCoords: PUBLIC PROC[coordinateFile: Rope.ROPE, object: REF Object, numExpected: INT];
GetSolidColor: PROC[color: ClrTriple, object: REF Object, numExpected: INT];
GetPolyNormals: PROC[object: REF Object];
GetVtxNormals: PROC[object: REF Object];
XfmVtces: PROC[object: REF Object, xfm: Transformation3D] RETURNS[ClipState];
GetShades: PROC[object: REF Object, lights: LightList, Proc: RGBToPixelProc];
LoadSortSequence: PUBLIC PROC[objects: LIST OF REF Object] RETURNS[REF SortSequenceRep];
DoInSequence: PROC[sortSeq: REF SortSequenceRep, action: PROC[ObjectPolygon]];
DoForPolygons: PROC[objects: LIST OF REF Object, action: PROC[ObjectPolygon]];
ClipIntPoly: PROC[poly: ObjectPolygon];
IntShade:
PROC[xn, yn, zn:
INTEGER, lights: LightList]
RETURNS[
INTEGER];
END.