SurfaceRender.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Crow, April 11, 1989 11:28:54 am PDT
DIRECTORY
Imager USING [ Rectangle],
ShapeUtilities USING [ ShapePatch ],
G3dRender USING [ Context, ContextProc, Patch, PatchProc, PtrPatch, ShapeInstance,
ShapeProc, ShapeSequence, Triple ];
SurfaceRender:
CEDAR
DEFINITIONS
~ BEGIN
Definitions
Context: TYPE ~ G3dRender.Context;
ContextProc: TYPE ~ G3dRender.ContextProc;
Triple: TYPE ~ G3dRender.Triple;
Patch: TYPE ~ G3dRender.Patch;
PtrPatch: TYPE ~ G3dRender.PtrPatch;
PatchProc: TYPE ~ G3dRender.PatchProc;
ShapePatch: TYPE ~ ShapeUtilities.ShapePatch;
ShapeInstance: TYPE ~ G3dRender.ShapeInstance;
ShapeProc: TYPE ~ G3dRender.ShapeProc;
ShapeSequence: TYPE ~ G3dRender.ShapeSequence;
Utility Procedures
FlushLog: PROC [context: REF Context];
GetPtrPatchClipState:
PROC[ shape:
REF ShapeInstance, patch:
REF PtrPatch];
Flush log buffers for safety (in case of crashes, etc.)
Procedures for Updating Context
ValidateContext:
PROC[ context:
REF Context ];
Updates all aspects of context (seen individually below), incorporates changes since last call
ValidateDisplay:
PROC[ context:
REF Context ];
Updates display to react to changes to viewer or initialize new display
ValidateView:
PROC[ context:
REF Context ];
Makes new matrices for initialization or changed viewing parameters, etc.
ValidateShape: ShapeProc;
Check that position and other info up to date. Calls type-specific routine such as the following. Returns FALSE if clipped out or otherwise not displayable
ValidatePolyhedron: ShapeProc;
Builds new matrices, color values, etc. reflecting changes or for initialization.
ValidateRopeShape: ShapeProc;
GetBoundingSphere: PROC[shape: REF ShapeInstance];
SetView:
PROC[context:
REF Context, eyePoint, ptOfInterest: Triple,
fieldOfView:
REAL .0,
rollAngle:
REAL ← 0.0, upDirection: Triple ← [ 0., 0., 1.],
hitherLimit:
REAL ← .01, yonLimit:
REAL ← 1000.0];
Sets view parameters and builds new eyespace matrix
SetEyeSpace:
PROC[ context:
REF Context ];
Builds new eyespace matrix
WindowFromViewPort:
PROC[context:
REF Context]
RETURNS[
REF Imager.Rectangle];
Fits window to shape of viewport
Procedures for Sorting and Display
LoadPrioritySequence: PROC[context: REF Context, sortOrder: LIST OF REF ANY ← NIL]
RETURNS[LIST OF REF ANY, CARDINAL];
This builds a priority-ordered sequence of patch references, splitting polygons where needed
LoadDepthSequence: PROC[context: REF Context, sortOrder: LIST OF REF ANY ← NIL]
RETURNS[LIST OF REF ANY, CARDINAL];
This builds a depth-ordered sequence of patch references
DoBackToFront:
PROC[ context:
REF Context, sortInfo:
LIST OF REF
ANY,
action:
PROC[
REF ShapePatch]];
Does action for each patch in sorted sequence running through sequence backward
DoFrontToBack:
PROC[ context:
REF Context, sortInfo:
LIST OF REF
ANY,
action:
PROC[
REF ShapePatch]];
Does action for each patch in order in sorted sequence
DoForPatches:
PROC[context:
REF Context, set:
REF ShapeSequence,
patchAction:
PROC[
REF ShapePatch],
shapeAction:
PROC[
REF ShapeInstance]];
Does action for each patch in order encountered in context
CombineBoxes:
PROC[context:
REF Context];
finds bounding box for all object's bounding boxes in scene (for speedups in matting)
ShowObjects:
PROC[ context:
REF Context, frontToBack:
BOOLEAN ←
FALSE ];
Displays entire context
OutputPolygon: PatchProc;
RopeDisplay: PatchProc;
Displays a single polygon, handling differing rendering modes, backfacing cull, clipping
Frame Generation and Animation
MakeFrame: ContextProc;
Makes new image from context, clears frame first, adds background, etc.
ShowShapes: ContextProc;
Makes image without clearing frame, for compositing contexts, etc.
END.