RenderWithPixels.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Crow, March 14, 1989 3:58:12 pm PST
Glassner, March 14, 1989 2:18:44 pm PST
DIRECTORY
ImagerSample USING [RasterSampleMap],
Rope    USING [ ROPE ],
G3dRender,
ThreeDBasics USING [ Context, ContextProc, ImagerProc, Pair, PairSequence,
        Patch, PatchProc, Pixel, Quad, RealSequence, RGB,
        ShadingClass, SpotProc, Triple, VertexInfo ];
RenderWithPixels: CEDAR DEFINITIONS
~ BEGIN
Types
ROPE: TYPE ~ Rope.ROPE;
Context: TYPE ~ G3dRender.Context;
ContextProc: TYPE ~ ThreeDBasics.ContextProc;
ShadingClass: TYPE ~ ThreeDBasics.ShadingClass;
VertexInfo: TYPE ~ ThreeDBasics.VertexInfo;
Patch: TYPE ~ ThreeDBasics.Patch;
PatchProc: TYPE ~ ThreeDBasics.PatchProc;
Triple: TYPE ~ ThreeDBasics.Triple;
Quad: TYPE ~ ThreeDBasics.Quad;
RGB: TYPE ~ ThreeDBasics.RGB;
Pair: TYPE ~ ThreeDBasics.Pair;
PairSequence: TYPE ~ ThreeDBasics.PairSequence;
RealSequence: TYPE ~ ThreeDBasics.RealSequence;
RasterSampleMapArray: TYPE ~ ARRAY [0..5) OF ImagerSample.RasterSampleMap;
Pixel: TYPE ~ ThreeDBasics.Pixel;
RopeDesc: TYPE ~ RECORD[rope: ROPE, position: Pair, color: Pixel, size: REAL, font: ROPE];
LerpVtx: TYPE = RECORD [
x, y: REAL,
val: REF ThreeDBasics.RealSequence
];
LerpVtxSequence: TYPE ~ RECORD [
length: NAT,
s: SEQUENCE maxLength: NAT OF REF LerpVtx
];
FancyPatch: TYPE = RECORD [
recurseLevel: NAT ← 0,
shadingClass: REF ShadingClass,    -- procs for texturing, etc.
vtx: SEQUENCE length: NAT OF LerpVtx
];
Initializing and Updating Pixel Maps
AllocatePixelMemory: ContextProc;
Get pixel memory for things like rgb, alpha, depth, normal coding.
GetContext: PROC [type: ATOM, width, height: NAT] RETURNS[ctx: REF Context];
gets a bare context for making images independent of color display
DepthBuffering: PROC[ context: Context, on: BOOLEANTRUE ];
Sets up or destroys depth buffer in VM for context.pixels
AntiAliasing: PROC[ context: Context, on: BOOLEANTRUE ];
Sets up or destroys alpha buffer in VM for context.pixels (used for antialiasing)
NormalBuffering: PROC[ context: Context, on: BOOLEANTRUE ];
Sets up or destroys normal vector buffer in VM for context.pixels (used for Andrew's hacks)
FillInBackGround: ContextProc;
Loads background behind current image
FillInConstantBackGround: PROC[context: Context, bkgrdClr: RGB, cvrge: BYTE ← 255];
Clears frame, use with alpha buffer to load background color behind shapes
Frame Generation
BufferRendering: PROC[ context: Context, on: BOOLEANTRUE ];
Renders through buffer and blits to screen when on, directly to screen (slowly) when off
MakeFrame: ContextProc;
Makes image, clears frame, adds background, etc.
Low-level drawing
ShadeSpot: ThreeDBasics.SpotProc;
Send spot values through the vertex shading procedure
Draw2DLine: PROC[context: Context, p1, p2: Pair, color: Pixel];
Draw a line with integer endpoints
Draw2DPoly: PROC[context: Context, poly: REF PairSequence, color: Pixel];
Draw polygon avoiding floating point
DrawRope: PROC[context: Context, rope: Rope.ROPE, position: Pair,
     color: Pixel ← [255,255,128,0,0] , size: REAL ← 20, font: Rope.ROPENIL];
Put a rope in the pixels, somehow
DoRope: ThreeDBasics.ImagerProc;
Put a rope in the pixels, using calls on the imager, rope is passed as RopeDesc in data
Simple Polygon Tilers
PolygonTiler: PatchProc;
Call point for discriminating among tilers
Fancy Polygon Tilers
for Anti-aliasing, texture, etc.
FancyTiler: PROC[context: REF ThreeDBasics.Context, poly: REF Patch];
recursive implementor of tiler
RealFancyTiler: PROC[context: REF ThreeDBasics.Context, poly: REF FancyPatch];
END.