G3dScene.mesa
Copyright © 1988 by Xerox Corporation. All rights reserved.
Bloomenthal, February 19, 1989 1:07:59 pm PST
DIRECTORY G3dBasic, G3dRender, IO, Rope, ViewerTools;
G3dScene: CEDAR DEFINITIONS
~ BEGIN
Type Declarations;
ROPE:   TYPE ~ Rope.ROPE;
STREAM:  TYPE ~ IO.STREAM;
Context:  TYPE ~ G3dRender.Context;
SelPos:  TYPE ~ ViewerTools.SelPos;
Viewer:  TYPE ~ ViewerTools.Viewer;
LogProc:  TYPE ~ PROC [rope: ROPE];
Write Scene Descriptions to a File or Viewer
WriteCameraParameters: PROC [context: Context];
Write the camera parameters to the primary selection.
WriteParameters: PROC [context: Context, fileName: ROPENIL];
Write all the relevant parameters of the context to the specified file.
If fileName = NIL, obtain it from the current mouse selection.
If fileName = NIL and no fileName selected by the mouse, write to the primary selection.
WriteParametersToStream: PROC [context: Context, out: STREAM];
Write all the relevant parameters of the context to the output stream.
Read Scene Descriptions from a File or Viewer
MakeFrameFromFile: PROC [context: Context, fileName: ROPE];
Display a scene described in fileName; leave context unchanged.
ReadParameters: PROC [context: Context, fileName: ROPENIL, cmdOut: STREAMNIL]
RETURNS [shouldRepaint: BOOL];
Read the image tool parameters.
If fileName = NIL, obtain it from the current mouse selection.
If fileName = NIL and no fileName selected by the mouse, read from the primary selection.
Parsing the Scene Description
ParseError: ERROR [position: NAT, fileName: ROPE, viewer: Viewer];
Return character position of error within the file or viewer, whichever is non-NIL.
ViewerSelection: TYPE ~ RECORD [viewer: Viewer, selection: SelPos];
Parse: PROC [
context: Context,
operation: ROPE,
cmdOut: STREAMNIL,
log: LogProc ← NIL,
showErrors: BOOLTRUE,
fileName: ROPENIL,
viewerSelection: ViewerSelection ← [NIL, NIL]]
RETURNS [shouldRepaint: BOOL];
Perform the specified operation on the context.
operation consists of an arbitrary number of operations:
each operation is a keyword followed by arguments, if required.
fileName is the file, if any, from which the operation was read;
if it is non-NIL and showErrors is TRUE, it is used to indicate the location of errors.
viewerSelection is the viewer and selection, if any, from which the operation was selected;
if they are non-NIL and showErrors is TRUE, it is used to indicate the location of errors.
See the graphics 3d documentation for a list of operations.
If log is non-NIL, a message is sent for each operation parsed.
END.