DIRECTORY Rope USING [ROPE], Vector2 USING [VEC], ScanConvert USING [RealSequence], Vector3d USING [Triple, Quad], ThreeDBasics USING [AllOut, ClipState, Context, FacingDir, NoneOut, OutCode, Patch, PatchSequence, PtrPatch, PtrPatchSequence, ShapeInstance, ShapeSequence, Vertex, VertexInfo, VertexInfoSequence]; ThreeDSurfaces: CEDAR DEFINITIONS ~ BEGIN Context: TYPE ~ ThreeDBasics.Context; Pair: TYPE ~ Vector2.VEC; -- [ x, y: REAL]; Triple: TYPE ~ Vector3d.Triple; -- [ x, y, z: REAL]; Quad: TYPE ~ Vector3d.Quad; -- [ x, y, z, w: REAL]; RealSequence: TYPE ~ ScanConvert.RealSequence; OutCode: TYPE ~ ThreeDBasics.OutCode; NoneOut: OutCode ~ ThreeDBasics.NoneOut; AllOut: OutCode ~ ThreeDBasics.AllOut; Vertex: TYPE ~ ThreeDBasics.Vertex; VertexInfo: TYPE ~ ThreeDBasics.VertexInfo; VertexInfoSequence: TYPE ~ ThreeDBasics.VertexInfoSequence; FacingDir: TYPE ~ ThreeDBasics.FacingDir; Patch: TYPE ~ ThreeDBasics.Patch; PatchProcs: TYPE ~ RECORD[ expand: PatchExpandProc, subdivide: PatchExpandProc, display: PatchDisplayProc, displayLines: PatchDisplayProc ]; PatchSequence: TYPE ~ ThreeDBasics.PatchSequence; PtrPatch: TYPE ~ ThreeDBasics.PtrPatch; PtrPatchSequence: TYPE ~ ThreeDBasics.PtrPatchSequence; ShapePatch: TYPE ~ RECORD[shape: REF ShapeInstance, patch, next: INT]; SortSequence: TYPE ~ RECORD[SEQUENCE length: CARDINAL OF REF ShapePatch]; ClipState: TYPE ~ ThreeDBasics.ClipState; ShapeInstance: TYPE ~ ThreeDBasics.ShapeInstance; GetPatch: PROC[size: NAT] RETURNS[REF Patch]; ReleasePatch: PROC[p: REF Patch]; ShapePatchToPatch: PROC[ context: REF Context, sPatch: REF ThreeDSurfaces.ShapePatch ] RETURNS [patch: REF Patch]; ReadShape: PROC[shape: REF ShapeInstance, fileName: Rope.ROPE]; -- full format shape read CloneShape: PROC[newshape, oldShape: REF ShapeInstance]; -- copy shape data WriteShape: PROC[shape: REF ShapeInstance, fileName: Rope.ROPE, -- full format shape write xyz: BOOL _ TRUE, normal, color, trans, texture, polyClr: BOOL _ FALSE]; ClipPoly: PROC[ context: REF Context, poly: REF Patch] RETURNS [REF Patch]; GetPatchClipState: PROC[ patch: REF Patch]; PatchExpandProc: TYPE ~ PROC[ shape: REF ShapeInstance, patch: REF PtrPatch, limitType: ATOM, limit: REAL] RETURNS[ v: REF VertexInfoSequence, p: REF PtrPatchSequence ]; PatchDisplayProc: TYPE ~ PROC[ context: REF Context, patch: REF Patch, limitType: ATOM, limit: REAL, action: PROC[context: REF Context, patch: REF Patch] ]; ShapeExpand: PROC[ context: REF Context, shape: REF ShapeInstance, limitType: ATOM _ NIL, limit: REAL _ 0.0] RETURNS [REF ShapeInstance]; ShapeSubdivide: PROC[ context: REF Context, shape: REF ShapeInstance, limitType: ATOM _ NIL, limit: REAL _ 0.0] RETURNS [REF ShapeInstance]; RegisterSurfaceType: PROC[ context: REF Context, type: ATOM, procs: REF PatchProcs ]; BackFacing: PROC[ poly: REF Patch, useEyeSpace: BOOLEAN _ FALSE] RETURNS [FacingDir]; ShadePoly: PROC[ context: REF Context, poly: REF Patch]; GetShades: PROC[context: REF Context, shape: REF ShapeInstance]; GetPolyNormals: PROC[shape: REF ShapeInstance]; GetVtxNormals: PROC[shape: REF ShapeInstance]; LoadSortSequence: PROC[context: REF Context, sortOrder: LIST OF REF ANY _ NIL] RETURNS[LIST OF REF ANY]; DoBackToFront: PROC[ context: REF Context, sortInfo: LIST OF REF ANY, action: PROC[REF ShapePatch]]; DoFrontToBack: PROC[ context: REF Context, sortInfo: LIST OF REF ANY, action: PROC[REF ShapePatch]]; DoForPatches: PROC[context: REF Context, set: REF ThreeDBasics.ShapeSequence, patchAction: PROC[REF ShapePatch], shapeAction: PROC[REF ThreeDBasics.ShapeInstance]]; ShowObjects: PROC[ context: REF Context, frontToBack: BOOLEAN _ FALSE ]; ShowWireFrameObjects: PROC[context: REF Context]; OutputPatchEdges: PROC[context: REF Context, patch: REF Patch]; OutputPatch: PROC[context: REF Context, patch: REF Patch]; END. ΌThreeDSurfaces.mesa Copyright c 1984 by Xerox Corporation. All rights reserved. Last Edited by: Crow, October 14, 1986 11:53:26 am PDT Basic Types Vertex Definitions Patch Definitions RECORD[type: ATOM _ NIL, oneSided: BOOLEAN _ TRUE, nVtces: NAT _ 0, clipState: ClipState _ in, props: Atom.PropList _ NIL, vtx: SEQUENCE maxLength: NAT OF VertexInfo]; RECORD [SEQUENCE length: CARDINAL OF REF Patch]; RECORD[type: ATOM _ NIL, oneSided: BOOLEAN _ TRUE, nVtces: NAT _ 0, clipState: ClipState _ in, props: Atom.PropList _ NIL, vtxPtr: SEQUENCE length: NAT OF NAT]; RECORD[SEQUENCE length: CARDINAL OF REF PtrPatch]; Shape Definitions Utility Procedures Procedures for Reading and Writing Shape Descriptions Procedures for Transformations and Clipping Procedures for expansion of/to polygons Expands a patch in one step to displayable polygons Expands and displays the patch in whatever way it chooses, using the supplied action proc Expands a whole shape, calling procedures supplied by the surface type Subdivide a whole shape once, calling procedures supplied by the surface type Mechanism for a surface type to register its expansion, subdivision, and display procedures Procedures for Shading Surfaces Procedures for Sorting and Display This builds a back-to-front ordered sequence of patch references These call a procedure for each polygon in a set of objects These render entire scenes These scan convert an individual patch ΚΩ˜Iheadšœ™šœ Οmœ1™