G3dRender.mesa
Copyright Ó 1985, 1989 by Xerox Corporation. All rights reserved.
Bloomenthal, February 14, 1989 1:48:23 pm PST
Crow, April 20, 1989 11:11:58 pm PDT
DIRECTORY Atom, G3dBasic, G3dMatrix, G3dShape, Imager, ImagerPixel, ImagerSample, ImagerColor, IO, Rope, Terminal, ViewerClasses;
Types
Miscellaneous Types
ROPE: TYPE ~ Rope.ROPE;
PropList: TYPE ~ Atom.PropList;
Virtual: TYPE ~ Terminal.Virtual;
Viewer: TYPE ~ ViewerClasses.Viewer;
RefSeq: TYPE ~ REF RefSeqRep;
RefSeqRep:
TYPE ~
RECORD [
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF REF
];
Imported Sequences
RealSequence: TYPE ~ G3dBasic.RealSequence;
IntegerSequence: TYPE ~ G3dBasic.IntegerSequence;
IntSequence: TYPE ~ G3dBasic.IntSequence;
NatSequence: TYPE ~ G3dBasic.NatSequence;
NatSequenceRep: TYPE ~ G3dBasic.NatSequenceRep;
PairSequence: TYPE ~ G3dBasic.PairSequence;
IntegerPairSequence: TYPE ~ G3dBasic.IntegerPairSequence;
TripleSequence: TYPE ~ G3dBasic.TripleSequence;
QuadSequence: TYPE ~ G3dBasic.QuadSequence;
Pixel Definitions
RGB: TYPE ~ ImagerColor.RGB;
RGBSequence: TYPE ~ REF RGBSequenceRep;
RGBSequenceRep:
TYPE ~
RECORD [
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF RGB
];
NatRGB: TYPE ~ RECORD [r, g, b: NAT];
NatRGBSequence: TYPE ~ REF NatRGBSequenceRep;
NatRGBSequenceRep:
TYPE ~
RECORD [
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF NatRGB
];
Spot:
TYPE ~
RECORD [
coverage: REAL ← 1.0, -- % of pixel area covered by surface
mask: BYTE ← 255, -- code for covered area, default: all covered
partShiny: REAL ← 1.0, -- amount shiny surface shows (1.0 = all)
val: RealSequence ← NIL, -- interpolated values for shading
yIncr: RealSequence ← NIL, -- vertical increments for interpolation
xIncr: RealSequence ← NIL, -- horizontal increments for interpolation
xySwapped: BOOL, -- if TRUE, xincr and yincr are swapped
props: PropList ← NIL -- catchall
];
SpotProc:
TYPE ~
PROC [
context: Context,
shading: REF ShadingClass,
spot: REF Spot,
data: REF ANY ← NIL];
PixelPart: TYPE ~ {r, g, b, a, z}; -- addressing within Pixels
Pixel: TYPE ~ ARRAY PixelPart OF CARDINAL; -- r, g, b, alpha, z (depth)
Geometric Definitions
Pair: TYPE ~ G3dBasic.Pair;
IntegerPair: TYPE ~ G3dBasic.IntegerPair; -- RECORD [x, y: INTEGER];
Triple: TYPE ~ G3dBasic.Triple;
Quad: TYPE ~ G3dBasic.Quad; -- RECORD [x, y, z, w: REAL];
Matrix: TYPE ~ G3dMatrix.Matrix; -- REF 4 by 4 ARRAY OF REAL
MatrixRep: TYPE ~ G3dMatrix.MatrixRep;
Image Definitions
SampleMap: TYPE ~ ImagerSample.SampleMap;
PixelMap: TYPE ~ ImagerPixel.PixelMap;
Box: TYPE ~ G3dShape.Box2d; -- [min, max: Pair]
Rectangle:
TYPE ~ Imager
.Rectangle
;
--
RECORD [x, y, w, h:
REAL]
ScaleAndAddXfm:
TYPE ~
RECORD [scaleX, scaleY, scaleZ, addX, addY, addZ:
REAL];
ClipState: TYPE ~ G3dShape.ClipState; -- {in, out, clipped, unknown}
OutCode: TYPE ~ RECORD [left, right, bottom, top, near, far: BOOL];
SixSides: TYPE ~ {Left, Right, Bottom, Top, Near, Far};
Constants
NoneOut: OutCode ~ [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE];
AllOut: OutCode ~ [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE];
IdentityXfm: ScaleAndAddXfm ~ [1.0, 1.0, 1.0, 0.0, 0.0, 0.0];
Texture Definitions
TextureFunction: TYPE ~ RECORD [name: ATOM, proc: SpotProc, props: PropList];
TextureMap: TYPE ~ RECORD [type: ATOM, pixels: REF ANY, props: Atom.PropList];
SummedTexture: TYPE ~ RECORD [SEQUENCE length: NAT OF REF SumSequence];
SumSequence: TYPE ~ RECORD [SEQUENCE length: NAT OF IntSequence];
Control Point Definitions
CtlPoint:
TYPE ~
RECORD[
x,y,z: REAL ← 0.0, -- object coordinates
ex, ey, ez: REAL ← 0.0, -- eyespace coordinates
sx, sy, sz: REAL ← 0.0, -- screen coordinates
clip: OutCode ← NoneOut -- clip code
];
CtlPointSequence: TYPE ~ REF CtlPointSequenceRep;
CtlPointSequenceRep:
TYPE ~
RECORD[
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF REF CtlPoint
];
Shading:
TYPE ~
RECORD [
xn, yn, zn: REAL ← 0.0, -- normal vector to surface
exn, eyn, ezn: REAL ← 0.0, -- normal in eyespace
r, g, b: REAL ← 1.0, -- vertex color (default white) scaled by shape color
t: REAL ← 1.0, -- original transmittance
txtrX, txtrY: REAL ← 0.0, -- texture mapping coordinates
er, eg, eb, et: REAL ← 0.0 -- computed color, transmittance (for lights, etc)
];
ShadingSequence: TYPE ~ REF ShadingSequenceRep;
ShadingSequenceRep:
TYPE ~
RECORD[
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF REF Shading
];
CtlPtInfo:
TYPE ~
RECORD [
coord: CtlPoint ← [],
shade: Shading ← [],
vtxPtr: NAT ← 0,
data: REF ← NIL
];
CtlPtInfoSequence: TYPE ~ REF CtlPtInfoSequenceRep;
CtlPtInfoSequenceRep:
TYPE ~
RECORD [
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF REF CtlPtInfo
];
CtlPtInfoProc: TYPE ~ PROC [context: Context, vtx: CtlPtInfo, data: REF ANY ← NIL]
RETURNS [CtlPtInfo];
CtlPtToRealSeqProc: TYPE ~ PROC [dest: RealSequence, source: CtlPtInfo, data: REF ← NIL]
RETURNS [RealSequence];
Patch Definitions
FacingDir: TYPE ~ {front, back, unknown};
Patch:
TYPE ~
RECORD [
type: ATOM ← NIL,
oneSided: BOOL ← TRUE,
nVtces: NAT ← 0,
clipState: ClipState ← unknown,
dir: FacingDir ← unknown,
renderData: REF RenderData,
props: PropList ← NIL,
ctlPt: SEQUENCE maxLength: NAT OF CtlPtInfo
];
Implemented patch types: $ConvexPolygon, $Bezier
Standard uses for props: $Shape (parent shape)
PatchSequence: TYPE ~ REF PatchSequenceRep;
PatchSequenceRep:
TYPE ~
RECORD [
length: CARDINAL ← 0,
element: SEQUENCE maxLength: CARDINAL OF REF Patch
];
PatchProc: TYPE ~ PROC [context: Context, patch: REF Patch, data: REF ANY ← NIL]
RETURNS [REF Patch];
Shape Definitions
Shape: TYPE ~ G3dShape.Shape;
ShapeSequence:
TYPE ~ G3dShape.ShapeSequence;
RenderData:
TYPE ~
RECORD [
-- becomes shape.renderData
class: REF ShapeClass ← NIL, -- surface type, display procs
shadingClass: REF ShadingClass ← NIL, -- shading parameters and procs
props: PropList ← NIL, -- catchall ($LinesList, $Hidden)
fixedProps: PropList ← NIL, -- fixed attributes
shadingProps: PropList ← NIL, -- shading status and parameters
patch: PatchSequence ← NIL, -- built from vertex and surface data
patchesValid: BOOL ← FALSE -- FALSE if patches need update
];
Uses for RenderData.props:
$ClippedPatches, $ClippedVertices, $Hidden, $LinesList,
Uses for RenderData.fixedProps:
$Closed, $PatchColors, $PatchColorsInFile, $PatchInfo, $PatchNormalsInFile, $PatchTransmittancesInFile, $VertexColorsInFile, $VertexNormalsInFile, $VertexTextureInFile, $VertexTransmittanceInFile
Uses for RenderData.shadingProps:
$AuxiliaryVtxData, $PolygonInfoComputed, $Scale, $ShapeLerp, $TextureScale, $TxtrCoordParams, $TxtrCoordRange, $TxtrCoordType, $TxtrTranslation, $VtxInfoComputed
ShapeClass:
TYPE ~
RECORD [
type: ATOM ← NIL, -- eg, $ConvexPolygon, $Bezier, $Light, etc
validate: ShapeProc ← NIL, -- update vtces and shading after changes
display: ShapeProc ← NIL, -- display whole shape (speed optimized?)
displayPatch: PatchProc ← NIL, -- display patch
doBeforeFrame: LIST OF ShapeProc ← NIL -- do before disp. (for animation, etc)
];
ShadingClass:
TYPE ~
RECORD [
type: ATOM ← NIL, -- eg. $Default, $MappedAndSolidTexture
renderMethod: REF ← NIL, -- RenderStyle, or ShapeProc
color: RGB ← [0.7, 0.7, 0.7], -- whole object color, mixable w/ vtx color
shininess: REAL ← 0.0, -- hilight power, usu. 30.0-300.0, 0 = none
transmittance: REAL ← 0.0, -- surface transmittance of object
texture: LIST OF REF ANY ← NIL,-- textureMap, solid texture, etc.
textureScale: Pair ← [1.0, 1.0], -- scale factors for texture coordinates
bumpScale: REAL ← 1.0, -- scale factor for bump height
cnvrtVtx: CtlPtToRealSeqProc ← NIL,-- converts vertex to sequence of reals
getColor: SpotProc ← NIL, -- calculates shade at pixel
shadeVtx: CtlPtInfoProc ← NIL -- calculates shade from vertex info
];
ShapeProc:
TYPE ~
PROC [context: Context, shape: Shape, data:
REF
ANY ←
NIL]
RETURNS [Shape];
Context Definition
Context: TYPE ~ REF ContextRep;
ContextRep:
TYPE ~
RECORD [
Miscellany
class: REF ContextClass ← NIL,
stopMe: REF BOOL ← NIL, -- stop flag for bailing out (ref for inheritance)
imageReady: BOOL ← FALSE, -- flag for useable image in display
changed: BOOL ← TRUE, -- call SurfaceRender.ValidateContext if true
Scene description
frameNumber: NAT ← 0, -- current frame for animation routines
shapes: ShapeSequence ← NIL, -- current collection of shapes and lights
visibleShapes: ShapeSequence ← NIL, -- computed by SurfaceRender.ValidateContext
lightSources: ShapeSequence ← NIL, -- computed by SurfaceRender.ValidateContext
environment: PropList ← NIL, -- for reflection map, ambient light proc, etc.
View description
eyePoint: Triple ← [1.0, -5.0, 2.0], -- defines point from which view is seen
lookAt: Triple ← [0.0, 0.0, 0.0], -- defines center of image and focus
rollAngle: REAL ← 0.0, -- rotational angle about direction of view
upDirection: Triple ← [0.0, 0.0, 1.0], -- defines "heads-up" direction (redundant)
fieldOfView: REAL ← 40.0, -- horizontal angle included in field of view
window: REF Rectangle ← NIL, -- window clips field of view in eyespace
hitherLimit: REAL ← 1.0, -- anything closer to eyepoint is clipped
yonLimit: REAL ← 1000.0, -- anything further from eyepoint is clipped
clippingPlanes: ARRAY SixSides OF Quad, -- computed clip planes
eyeSpaceXfm: Matrix ← NIL, -- world space to eyespace
eyeToNdc: ScaleAndAddXfm ← IdentityXfm, -- eyespace to normalized disp. coords
ndcToPixels: ScaleAndAddXfm ← IdentityXfm, -- to screen coords
Display description
viewer: Viewer, -- viewer record if in Viewer ELSE NIL
terminal: Virtual ← NIL, -- virtual terminal for this context, if displayed
displayInValid: BOOL ← TRUE, -- true whenever display parameter updated
pixels: PixelMap ← NIL, -- where the bits are
pixelAspectRatio: REAL ← 1.0, -- physical width/height of displayed pixel
viewPort: REF Rectangle ← NIL, -- viewport in floating pt. display coordinates
preferredViewPort: Rectangle ← [0., 0., 65536., 65536.], -- maximum viewport size
screenExtent: Box ← [[0, 0], [0, 0]], -- bounds area used (while building image)
preferredRenderMode: ATOM ← NIL, -- $Pixels, $Imager (fancy vs. device indep.)
displayProps: PropList ← NIL, -- $Depth, $Alpha (Pixel posn),
-- $FullDisplayMemory, $ViewerAdjusted
Rendering Style
autoRedraw: BOOL ← FALSE, -- quick image hint, redraw if viewer changes
delayClear: BOOL ← FALSE, -- delay clearing buffer when rendering
doVisibly: BOOL ← TRUE, -- build image on display
antiAliasing: BOOL ← FALSE, -- flag for antialiasing and alpha buffer
depthBuffering: BOOL ← FALSE, -- buffer for cheap hidden-surface removal
depthResolution: NAT ← 8192, -- number of buckets for depth sorting
sortSequence: REF ← NIL, -- shapes or surfaces sorted for display
props: PropList ←
NIL
-- catchall, global uses:
$WDir - working directory
$Log - log file for messages
$BackGround - background color or context (images)
$DitherContext - for dithering RGB to pseudocolor
$OutputFile - output file for interpress or animation
$ImagerCtx - context for Imager calls, if no viewer
$SortToPriority - forces priority sort, poly intersections
];
ContextClass:
TYPE ~
RECORD [
displayType:
ATOM ←
NIL,
-- includes:
$PseudoColor,
$Gray,
$FullColor,
$ImagerGray
$ImagerDithered,
$ImagerFullClr,
$Bitmap,
$Interpress
setUpDisplayType: ContextProc, -- ensures there are bits to write, sets up colors
validateDisplay: ContextProc, -- makes sure viewPort changes, etc. take effect
render: ContextProc, -- call this to display the scene
loadBackground: ContextProc, -- clear to background
2d drawing primitives use normalized display coordinates (-1.0 < x < 1.0, -.75 < y < .75)
draw2DLine: PROC [context: Context, p1, p2: Pair, color: Pixel], -- display a line
draw2DPolygon: PROC [context: Context, poly: PairSequence, color: Pixel],
draw2DRope:
PROC [context: Context, rope:
ROPE, position: Pair,
color: Pixel ←[255,255,128,0,0], size: REAL , font: ROPE ←NIL],
displayPolygon: PatchProc, -- 3 dimensional shading
drawInViewer: PROC [context: Context, procRec: REF ImagerProcRec],
updateViewer: ContextProc
];
ContextProc: TYPE ~ PROC [context: Context, data: REF ANY ← NIL];
ImagerProc: TYPE ~ PROC [context: Context, imagerCtx: Imager.Context, data: REF ← NIL];
ImagerProcRec:
TYPE ~
RECORD [proc: ImagerProc, data:
REF
ANY ←
NIL];
RopeProc:
TYPE ~
PROC [
context: Context,
rope: ROPE,
position: Pair,
color: Pixel ← [255,255,255,0,0],
size: REAL ← 20,
font: ROPE ← NIL];
Classes Registration
RegisterDisplayClass:
PROC [class: ContextClass, type:
ATOM];
Add class to list of registered ContextClasses, containing display-specific procs, etc.
GetDisplayClass:
PROC [type:
ATOM]
RETURNS [class: ContextClass];
Retrieve registered class for use or modification.
LoadDisplayClass:
PROC [context: Context, type:
ATOM];
Set proper color map and rendering procs.
RegisterShapeClass:
PROC [class: ShapeClass, type:
ATOM];
Add class to list of registered ShapeClasses, containing surface-specific procs, etc.
GetShapeClass:
PROC [type:
ATOM]
RETURNS [class: ShapeClass];
Retrieve registered class for use or modification.
LoadShapeClass:
PROC [shape: Shape, type:
ATOM ← $ConvexPolygon];
Load ShapeClass (patch expansion and rendering procs) and ShadingClass for surface type.
RegisterShadingClass:
PROC [class: ShadingClass, type:
ATOM];
Add class to list of registered ShadingClasses, for fancy texturing procs, etc.
GetShadingClass:
PROC [type:
ATOM]
RETURNS [class: ShadingClass];
Retrieve registered class for use or modification.
LoadShadingClass:
PUBLIC
PROC [shape: Shape, type:
ATOM ← $Default];
Put ShadingClass in shape record.
Context
Create:
PROC
RETURNS [Context];
Allocate a context
.
InitializeRawColorDisplayContext:
PROC [
antiAliasing: BOOL ← TRUE,
background: RGB ← [0.2, 0.2, 0.7],
displayMode: DisplayMode ← gray]
RETURNS [context: Context];
Return an initialized Context (one light source, nominal viewpoint).
This call will utilize the entire color display without the Viewers mechanism.
CloseDisplay:
PROC [context: Context];
Shut down display gracefully, restore standard color map.
CloseColorViewers:
PROC;
Close any open viewers on the color display.
KillUntitledColorViewers:
PROC;
Kill any untitled color viewers (presumably the unwanted G3dRender viewer).
GetTmpContext: PUBLIC PROC [srcCtx: REF Context] RETURNS[dstCtx: REF Context] ~ {
CopyContextData: PUBLIC PROC [dstCtx, srcCtx: REF Context] ~ {
CopyContextShapes: PUBLIC PROC [dstCtx, srcCtx: REF Context] ~ {
View
SetViewFromParameters:
PROC [
context: Context,
fieldOfView: REAL ← 40.0,
scale: REAL ← 1.0,
moves, rotates: Triple ← []];
Set the context view according to parameters. If fieldOfView = 0, it will be set to 40.
SetView:
PROC [
context: Context,
eyePoint: Triple,
lookAt: Triple,
fieldOfView: REAL ← 40.0,
rollAngle: REAL ← 0.0,
upDirection: Triple ← [0., 0., 1.],
hitherLimit: REAL ← .01,
yonLimit: REAL ← 1000.0];
Set the context view according to camera geometry. If fieldOfView = 0, it will be set to 40.
SetViewPort: PROC [context: Context, size: Rectangle];
Lighting
SetAmbientLight:
PROC [context: Context, rgb:
RGB];
Set the ambient lighting for context.
NameAmbientLight:
PROC [context: Context, color:
ROPE];
Set ambient light color using color naming scheme
GetAmbientLight:
PROC [context: Context]
RETURNS [
RGB];
Return the ambient lighting for context.
AddLight:
PROC [context: Context, name:
ROPE, position: Triple, color:
RGB ← [1, 1, 1]];
Install a new light source in the scene, or change a previously named one.
DeleteLight:
PROC [context: Context, name:
ROPE];
Remove an existing light source from the scene
Background
NameBackgroundColor:
PROC [context: Context, color:
ROPE];
Set background color using color naming scheme
SetBackgroundColor:
PROC [context: Context, color:
RGB];
Set background color
GetBackgroundColor:
PROC [context: Context]
RETURNS [color:
RGB];
Return the background for context.
SetBackgroundImage:
PROC [context: Context, aisFile:
ROPE];
Use named AIS file as background image for scene instead of solid color
GetBackgroundImage:
PROC [context: Context]
RETURNS [
ROPE];
Return the name of the background image (NIL if none).
SetBackgroundContext:
PROC [context, bkGrdCtx: Context];
Use named 3d context as background image for scene (contexts may be stacked arbitrarily).
KillBackground:
PROC [context: Context];
Enable the background or not; over-rides background color or background image.
Shapes
RenderStyle:
TYPE ~ {faceted, smooth, lines, shadedLines, hiddenLines, linesWnormals};
AddShape:
PROC [context: Context, shape: Shape];
Add a shape to the context.
AddShapeFromFile:
PROC [
context: Context,
shapeName: ROPE,
fileName: ROPE,
position: Triple ← [0.0, 0.0, 0.0]];
Convenience function for reading in a shape from a file and positioning it in a scene;
clones previously read shape if file has been used before.
FindShape:
PROC [context: Context, shapeName:
ROPE]
RETURNS [Shape];
Return the named shape; if context = NIL or shapeName doesn't exist, return NIL.
ShapeFromRope:
PROC [
name: ROPE ← NIL,
message: ROPE,
color: ROPE ← NIL,
size: REAL ← 0.5,
font: ROPE ← NIL]
RETURNS [Shape];
Build a shape to display a message within the scene.
Shape is two-dimensional, always facing the eyepoint, but changes in size with perspective.
ChangeRopeMessage:
PUBLIC
PROC [context: Context, shapeName:
ROPE, newMessage:
ROPE];
Changes the message displayed for a rope shape
DeleteShape:
PROC [context: Context, shapeName:
ROPE];
Removes a shape from a context
DeleteAllShapes:
PROC [context: Context];
Delete all shapes (whose name does not begin with "Light") from context.
SetRenderStyle:
PROC [shape: Shape, renderStyle: RenderStyle];
Change the rendering style for a shape.
SetShininess:
PROC [shape: Shape, shininess:
REAL];
Set the shape's shininess.
SetColor:
PROC [shape: Shape, color:
RGB];
Set the color for the given shape.
SetTransmittance:
PROC [shape: Shape, transmittance:
REAL];
Change the transmittance of the shape; transmittance = 0 is opaque.
N.B: Rendering of transparent objects occurs only when anti-aliasing is enabled.
SetInvisible:
PROC [shape: Shape];
Maintain data but don't display the shape.
SetVisible:
PROC [shape: Shape];
Undo SetInvisible.
ShowBackfaces:
PROC [shape: Shape];
Render back-facing polygons (for transparent or non-closed shapes, or debugging).
HideBackfaces:
PROC [shape: Shape];
Don't render back-facing polygons (for transparent or non-closed shapes, or debugging).
Convenient access to internal structures supporting rendering
RenderDataFrom: PROC [shape: Shape] RETURNS [REF RenderData];
ShapeClassFrom:
PROC [shape: Shape]
RETURNS [
REF ShapeClass];
Return the shapeClass for this shape.
ShadingClassFrom:
PROC [shape: Shape]
RETURNS [
REF ShadingClass];
Return the shadingClass for this shape.
PatchesFrom:
PROC [shape: Shape]
RETURNS [PatchSequence];
Get shape.renderData.patch, the patch-by-patch description, of the surface, conveniently.
Textures
TextureStyle: TYPE ~ {none, intensity, color, bump, function};
TextureInfo: TYPE ~ RECORD [name: ROPE, type: TextureStyle, filtered: BOOL];
SetTextureMap:
PROC [
context: Context,
shapeName: ROPE,
aisName: ROPE,
textureStyle: TextureStyle ← intensity,
textureFiltering: BOOL ← FALSE]
RETURNS [error: ROPE];
Read in the appropriate texture map for the given shape.
Uses summed area tables if textureFiltering, else point sampling.
OffsetTextureCoords:
PROC [shape: Shape, offset: Pair];
Offset the texture coordinates for the given shape.
GetTexture:
PROC [shape: Shape]
RETURNS [PairSequence];
Return the texture coordinates associated with shape.
GetTextureInfo:
PROC [shape: Shape]
RETURNS [
LIST
OF TextureInfo];
Return a list of texture information associated with the shape.
ScaleTexture:
PROC [context: Context, shape: Shape, scale: Pair];
Scale the texture coordinates associated with shape.
SetTextureScale:
PROC [shape: Shape, scale: Pair ← [1.0, 1.0]];
Set the texture scale for the given shape.
GetTextureScale:
PROC [shape: Shape]
RETURNS [Pair ← [1.0, 1.0]];
Return the texture scale for the given shape.
SetTextureRange:
PROC [shape: Shape, textureRange: Pair];
Permits circumvention of seam matching in MappedAndSolidTexture.AdjustTexture.
textureRange should exceed twice the texture range for all polygons in shape.
SetTextureFiltering:
PROC [context: Context, shape: Shape, on:
BOOL];
Turn on/off the texture filtering for the given shape.
GetBumpScale:
PROC [shape: Shape]
RETURNS [
REAL];
Return the bump scale factor for the given shape.
SetBumpScale:
PROC [shape: Shape, scale:
REAL ← 1.0];
Set the bump scale factor for this shape.
Rendering
DisplayMode: TYPE ~ {gray, dither, fullColor};
Render:
PROC [context: Context, fork:
BOOL ←
TRUE];
Perform the rendering process.
WaitTilRenderDone:
PROC;
Wait until a rendering process finishes.
NotRendering:
PROC [context: Context]
RETURNS [
BOOL];
Return true iff context is not forked or not rendering.
AbortRender:
PROC [context: Context];
Abort any current rendering within context.
GetDisplayMode:
PROC [context: Context]
RETURNS [DisplayMode];
Return the display mode.
SetAntiAliasing:
PROC [context: Context, on:
BOOL ←
TRUE];
This will draw images using the alpha buffer; texture mapping is enabled.
AntiAliasingNeeded:
PROC [context: Context]
RETURNS [
BOOL];
Determine if anti-aliasing is needed to render the shapes in their respective shading modes.
For example, anti-aliasing is necessary for bump-mapping, transparency, solid texture.
GetBuffer:
PROC [context: Context, type:
ATOM]
RETURNS [SampleMap];
Get a sample map from the context; returns NIL if no such map.
GetAlphaBuffer:
PROC [context: Context]
RETURNS [SampleMap];
Get the alpha buffer from the context; returns NIL if no such buffer.
GetDepthBuffer:
PROC [context: Context]
RETURNS [SampleMap];
Get the depth buffer from the context; returns NIL if no such buffer.
Miscellany
PrependWorkingDirectory: PUBLIC PROC[context: REF Context, file: ROPE] RETURNS[ROPE];
TackOnExtension: PUBLIC PROC[file, extension: ROPE] RETURNS[ROPE];
IntersectRectangles:
PROC [Rectangle, Rectangle]
RETURNS [Rectangle];
Return intersection (overlapping) portion of combined rectangles.
AtomFromTextureStyle:
PROC [textureStyle: TextureStyle]
RETURNS [
ATOM];
Return an atom for non-typed operations.
AtomFromDisplayMode:
PROC [displayMode: DisplayMode]
RETURNS [
ATOM];
Return an atom for non-typed operations.
RopeFromDisplayMode:
PROC [displayMode: DisplayMode]
RETURNS [
ROPE];
Return the rope representing displayMode.
RopeFromRenderStyle:
PROC [renderStyle: RenderStyle]
RETURNS [
ROPE];
Return the rope representing renderStyle.
RopeFromTextureStyle:
PROC [textureStyle: TextureStyle]
RETURNS [
ROPE];
Return the rope representing textureStyle.