SurfaceViewer.mesa
James Rauen, August 20, 1986 6:00:37 pm PDT
Last edited by: James Rauen January 13, 1988 4:15:12 pm PST
DIRECTORY
CADTypes USING [Scad, VariableRec, VisibleMask],
Geometry3dVector USING [Triple],
Rope USING [ROPE],
ThreeDBasics USING [Context];
SurfaceViewer: CEDAR DEFINITIONS ~ BEGIN
Type declarations
SurfaceRec: TYPE ~ RECORD [
scad: CADTypes.Scad,
id: NAT,
mask: REF CADTypes.VisibleMask];
SurfaceSeq: TYPE ~ RECORD [
surfaces: SEQUENCE length: NAT OF SurfaceRec];
SurfaceViewer: TYPE ~ RECORD [
context3d: REF ThreeDBasics.Context,
surfaces: REF SurfaceSeq,
numberOfSurfaces: NAT,
nextID: NAT];
Error: ERROR[why: ATOM];
Raised when something goes wrong. Possibilities are $AllFilledUp (tried to load too many surfaces), or $InvalidID (referred to a surface that doesn't exist).
CreateSurfaceViewer: PROC[] RETURNS[sviewer: REF SurfaceViewer];
Opens a color viewer and instantiates its 3D context. Position, orientation, and scope will default. Draws a frame.
GetThreeDContext: PROC[sviewer: REF SurfaceViewer] RETURNS[context3d: REF ThreeDBasics.Context];
Returns sviewer's ThreeDWorld context. This context is needed for all ThreeDWorld operations involving the sviewer. Among other things, it has a slot containing the sviewer's actual color viewer.
LoadSurface: PROC[surface: CADTypes.Scad, sviewer: REF SurfaceViewer] RETURNS[id: NAT];
Loads a surface into the SurfaceViewer context and draws a new frame. Returns an ID number for the surface, which is used to refer to the surface after it has been added. If there is no more room, raises Error[$AllFilledUp].
MaskSurface: PROC[id: NAT, mask: REF CADTypes.VisibleMask, sviewer: REF SurfaceViewer];
Masks cells in the surface indicated by id. The mask specifies which cells in the CAD should be displayed and which shouldn't. If id does not refer to a surface, raises Error[$InvalidID].
HideSurface: PROC[id: NAT, sviewer: REF SurfaceViewer];
Hides the surface indicated by id and draws a new frame. If id does not refer to a surface, raises Error[$InvalidID].
UnHideSurface: PROC[id: NAT, sviewer: REF SurfaceViewer];
Unhides the surface indicated by id and draws a new frame. If id does not refer to a surface, raises Error[$InvalidID].
DeleteSurface: PROC[id: NAT, sviewer: REF SurfaceViewer];
Removes a surface from the SurfaceViewer context and draws a new frame. If id does not refer to a surface, raises Error[$InvalidID].
FlushSurfaces: PROC[sviewer: REF SurfaceViewer];
Removes all surfaces from the SurfaceViewer context and draws a new (blank) frame.
ChangePosition: PROC[newPosition: Geometry3dVector.Triple];
Changes the observer's position to newPosition. Does not draw a new frame.
ChangeOrientation: PROC[newForward, newUp: Geometry3dVector.Triple];
Changes the observer's orientation. Does not draw a new frame.
ChangeScope: PROC[newScope: REAL];
Changes the observer's scope to newScore, whatever that means. Does not draw a new frame.
DrawFrame: PROC [sviewer: REF SurfaceViewer];
Moves the light source to the eyepoint and redraws in the color viewer..
InvokeRayTracer: PROC[variables: CADTypes.VariableRec, filename: Rope.ROPE, pixelsU, pixelsV: NAT, sviewer: REF SurfaceViewer];
Calls SurfaceTracer to generate a ray-traced image of the current view in the SurfaceViewer context. The image is written as three AIS files.
END.