ColorDisplayRender.mesa
Last Edited by: Crow, December 4, 1987 7:28:30 pm PST
DIRECTORY
Terminal    USING [ Virtual ],
Rope     USING [ ROPE ],
Imager    USING [ Context ],
ThreeDBasics  USING [ Context, ContextProc, ImagerProc, Pair, Pixel, RGB, Triple ];
ColorDisplayRender: CEDAR DEFINITIONS
~ BEGIN
Types
ROPE: TYPE ~ Rope.ROPE;
Context: TYPE ~ ThreeDBasics.Context;
ContextProc: TYPE ~ ThreeDBasics.ContextProc;
Pixel: TYPE ~ ThreeDBasics.Pixel;
Pair: TYPE ~ ThreeDBasics.Pair;
Triple: TYPE ~ ThreeDBasics.Triple;
RGB: TYPE ~ ThreeDBasics.RGB;
Colors
MappedRGB: PROC[context: REF Context, clr: Pixel] RETURNS[Pixel];
Calculates pseudocolor value from RGB and leaves in red field
LoadStd8BitClrMap: PROC [vt: Terminal.Virtual];
Sets up custom 6x6x6 color cube map for dithering
LoadColorRamp: PROC [ vt: Terminal.Virtual, clr1: RGB ← [0,0,0], clr2: RGB ← [255,255,255],
        exponent: RGB ← [.43,.43,.43] ];
Load ramp running between two colors and bent by exponent, defaults give std grey map
Low-level drawing
Draw2DRope: PROC[ context: REF Context, rope: ROPE, position: Pair,
       color: Pixel ← [255,255,255,0,0], size: REAL ← 20, font: ROPENIL ];
Put a string of characters on the screen
Frame Generation and Animation
MakeFrame: ContextProc;
Compute image described by context
StuffBuf: ThreeDBasics.ImagerProc;
Transfer buffered image to viewer or imager context
Load context.viewPort from viewer specification
MakeHiResFrame: PROC[ context: REF Context, width, height: NAT, name: Rope.ROPE,
        keepLog: BOOLEANTRUE ];
Compute image described by context at supplied size, write out to named AIS file, keeps log
DitherImage: PROC[dstContext, rgbContext: REF Context];
Take rgb image in rgbContext and dither into dstContext
Orbit: PROC[ context: REF Context, lookingFrom, lookingAt, axis, base: Triple,
    moveEPNotCI: BOOLEANTRUE,
    framesPerRev: NAT ← 16, startAt: NAT ← 0, endAt: NAT ← 32767,
    filename: Rope.ROPENIL
    ];
Calculate elliptical orbit about center of interest (or eyepoint if moveEPNotCI is FALSE), write images to series of numbered files if filename # NIL
MakeFramesFromTo: PROC[ context: REF Context,
         lookingFrom, lookingAt, toLookingFrom, toLookingAt: Triple,
         framesOnLine: NAT, startAt, endAt: NAT ← 0,
         filename: Rope.ROPENIL ];
Calculate and display (if a displayed context) frames along a straightline path
MakeFramesOnPath: PROC[ context: REF Context, lookingFrom, lookingAt: LIST OF Triple,
         framesOnPath: NAT, startAt, endAt: NAT ← 0,
         filename: Rope.ROPENIL, closed: BOOLEANTRUE ];
Calculate and display (if a displayed context) frames along a cubic path through control points
END.