G3dClipXfmShade.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Crow, May 17, 1989 11:07:59 am PDT
DIRECTORY G3dRender;
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: ATOM ← NIL,
oneSided: BOOL ← TRUE,
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];
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 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).
Procedures for Transformations
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 Shading Patches
BackFacing:
PROC [context: Context, poly:
REF Patch, useEyeSpace:
BOOL ←
FALSE]
RETURNS [FacingDir];
Tests if polygon faces away from viewer, thus on back side of object.
ShadePoly:
PROC [context: Context, poly:
REF Patch];