G3dShadeClipXfm.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Crow, May 16, 1989 3:03:48 pm PDT
DIRECTORY G3dRender;
G3dShadeClipXfm: CEDAR DEFINITIONS
~ BEGIN
Basic Types
Pixel:     TYPE ~ G3dRender.Pixel;     -- [ r, g, b, a, z: CARDINAL]
Triple:    TYPE ~ G3dRender.Triple;     -- [ x, y, z: REAL];
RGB:     TYPE ~ G3dRender.RGB;
Matrix:    TYPE ~ G3dRender.Matrix;
OutCode:    TYPE ~ G3dRender.OutCode;
ClipState:    TYPE ~ G3dRender.ClipState;
Context:    TYPE ~ G3dRender.Context;
CtlPointSequence: TYPE ~ G3dRender.CtlPointSequence;
Shape:    TYPE ~ G3dRender.Shape;
ShadingSequence: TYPE ~ G3dRender.ShadingSequence;
Patch Definitions
FacingDir:   TYPE ~ G3dRender.FacingDir;
CtlPtInfo:    TYPE ~ G3dRender.CtlPtInfo;
Patch:     TYPE ~ G3dRender.Patch;
        RECORD [
        type:     ATOMNIL,
        oneSided:    BOOLTRUE,
        nVtces:    NAT ← 0,
        clipState:    ClipState ← unknown,
        dir:     FacingDir ← unknown,
        props:     PropList ← NIL,
        ctlPt:     SEQUENCE maxLength: NAT OF CtlPtInfo
        ];
PatchSequence: TYPE ~ G3dRender.PatchSequence;
       RECORD [SEQUENCE length: CARDINAL OF REF Patch];
Caching Procedures
GetCtlPtInfo: PROC RETURNS [REF CtlPtInfo];
Gets vertex from automatically expanding pool.
ReleaseCtlPtInfo: PROC [vtx: REF CtlPtInfo];
Returns vertex to pool.
GetPatch: PROC [size: NAT] RETURNS [REF Patch];
Gets patch from automatically expanding pool.
ReleasePatch: PROC [p: REF Patch];
Returns patch to pool.
Procedures for Derived Data for Shapes
GetPolyNmls: PUBLIC PROC[context: Context, shape: Shape];
Calculate normals for all polygons in shape.
GetVtxNmls: PROC [context: Context, shape: Shape];
Sum normals for vertices given by adjacent polygon corners, only for polygons!
Procedures for Transformations and Clipping
ClipBoundingSphere: PROC[context: Context, shape: Shape, xfm: Matrix]
       RETURNS[G3dRender.ClipState];
ClipPoly: PROC [context: Context, poly: REF Patch] RETURNS [REF Patch];
Clips one polygon (or polyline) to current state of context.
GetPatchClipState: PROC[ patch: REF Patch];
Gets clips state (in, out, clipped) for one patch
GetClipCodeForPt: PROC [context: Context, pt: Triple] RETURNS [clip: OutCode];
Evaluates clip codes for vertices (for easy acceptance and rejection tests).
XfmPtToEyeSpace: PROC [context: Context, pt: Triple, xfm: Matrix ← NIL]
RETURNS [Triple, OutCode];
Transforms triple from object space to eyespace.
XfmPtToDisplay: PROC [context: Context, pt: Triple, shape: Shape ← NIL]
RETURNS [Triple];
Transforms triple from eyespace to display coordinates.
Procedures for expansion of/to polygons
RegisterStandardSurface: PROC [context: Context, type: ATOM];
Procedures for Shading Patches
BackFacing: PROC [context: Context, poly: REF Patch, useEyeSpace: BOOLFALSE]
RETURNS [FacingDir];
Tests if polygon faces away from viewer, thus on back side of object.
ShadePoly: PROC [context: Context, poly: REF Patch];
END.