DIRECTORY Rope USING [ ROPE ], IO USING [ STREAM ], Imager USING [ Rectangle ], ThreeDBasics USING [ Context, NatTable, PairSequence, Patch, RealSequence, RGB, RGBSequence, ShapeInstance, ShapeSequence, Triple, TripleSequence ]; SceneUtilities: CEDAR DEFINITIONS ~ BEGIN RGB: TYPE ~ ThreeDBasics.RGB; RGBSequence: TYPE ~ ThreeDBasics.RGBSequence; RealSequence: TYPE ~ ThreeDBasics.RealSequence; PairSequence: TYPE ~ ThreeDBasics.PairSequence; TripleSequence: TYPE ~ ThreeDBasics.TripleSequence; Triple: TYPE ~ ThreeDBasics.Triple; -- RECORD [ x, y, z: REAL]; NatTable: TYPE ~ ThreeDBasics.NatTable; Patch: TYPE ~ ThreeDBasics.Patch; ShapeInstance: TYPE ~ ThreeDBasics.ShapeInstance; ShapeSequence: TYPE ~ ThreeDBasics.ShapeSequence; Context: TYPE ~ ThreeDBasics.Context; GetRope: PROC[input: IO.STREAM] RETURNS[Rope.ROPE]; CreateDefaultContext: PROC[] RETURNS [REF Context]; PrependWorkingDirectory: PROC[context: REF Context, file: Rope.ROPE] RETURNS[Rope.ROPE]; TackOnExtension: PUBLIC PROC[file, extension: Rope.ROPE] RETURNS[Rope.ROPE]; GetTmpContext: PROC [srcCtx: REF Context] RETURNS[dstCtx: REF Context]; CopyContextData: PROC [dstCtx, srcCtx: REF Context]; CopyContextShapes: PROC [dstCtx, srcCtx: REF Context]; StartLog: PROC [context: REF Context] RETURNS[IO.STREAM]; FlushLog: PROC [context: REF Context]; CloseLog: PROC [context: REF Context]; ForcePrioritySort: PROC[context: REF Context, on: BOOLEAN _ TRUE]; SetWindow: PROC[context: REF Context, size: Imager.Rectangle]; SetViewPort: PROC[context: REF Context, size: Imager.Rectangle]; SetAmbientLight: PROC [context: REF Context, color: Rope.ROPE]; SetBackgroundColor: PROC [context: REF Context, color: RGB]; GetBackgroundColor: PROC [context: REF Context] RETURNS [color: RGB]; NameBackgroundColor: PROC [context: REF Context, color: Rope.ROPE]; SetBackgroundImage: PROC [context: REF Context, aisFile: Rope.ROPE]; SetBackgroundContext: PROC [context, bkGrdCtx: REF Context ]; SetLight: PROC[context: REF Context, name: Rope.ROPE, position: Triple, color: RGB _ [1, 1, 1] ]; DeleteLight: PROC[context: REF Context, name: Rope.ROPE]; SaveOnFile: PROC[context: REF Context, fileName: Rope.ROPE]; RestoreFromFile: PROC[context: REF Context, fileName: Rope.ROPE]; MakeFrameFromFile: PROC[context: REF Context, fileName: Rope.ROPE]; ReadScene: PROC[context: REF Context, input: IO.STREAM]; WriteScene: PROC[context: REF Context, output: IO.STREAM]; SetTexture: PROC [shape: REF ShapeInstance, textures: REF PairSequence]; SetVertexProps: PROC [ shape: REF ShapeInstance, normals, colors, textures, transmittance: BOOL]; ReadShape: PROC[shape: REF ShapeInstance, fileName: Rope.ROPE]; CloneShape: PROC[newshape, oldShape: REF ShapeInstance]; AddShapeAt: PROC[ context: REF Context, shapeName: Rope.ROPE, fileName: Rope.ROPE, position: Triple _ [0.,0.,0.] ]; WriteShape: PROC[context: REF Context, shapeName: Rope.ROPE, fileName: Rope.ROPE, transformed: BOOL _ FALSE, xyz: BOOL _ TRUE, normal, color, trans, texture, polyClr: BOOL _ FALSE]; NewShape: PROC[ name: Rope.ROPE, type: ATOM _ $ConvexPolygon ] RETURNS[REF ShapeInstance]; ShapeFromData: PROC[ name: Rope.ROPE _ NIL, surface: REF NatTable, vertices, normals: REF TripleSequence _ NIL, colors: REF RGBSequence _ NIL, trnsmttnce: REF RealSequence _ NIL, txtrCoord: REF PairSequence _ NIL, insideVisible, faceted: BOOL _ FALSE, type: ATOM _ $ConvexPolygon ] RETURNS[REF ShapeInstance]; ShapeFromRope: PROC[ name: Rope.ROPE _ NIL, message: Rope.ROPE, color: Rope.ROPE _ NIL, size: REAL _ 0.5, font: Rope.ROPE _ NIL ] RETURNS[REF ShapeInstance]; ChangeRopeMessage: PUBLIC PROC[ context: REF Context, shapeName: Rope.ROPE, newMessage: Rope.ROPE ]; FindShape: PROC[ context: REF Context, shapeName: Rope.ROPE ] RETURNS[REF ShapeInstance]; AddShape: PROC[ context: REF Context, shape: REF ShapeInstance ]; DeleteShape: PROC[ context: REF Context, shapeName: Rope.ROPE ]; CopyShape: PROC[ context: REF Context, shapeName, newName: Rope.ROPE _ NIL ] RETURNS[REF ShapeInstance]; CopyShapeDirect: PROC[ shape: REF ShapeInstance, newName: Rope.ROPE _ NIL ] RETURNS[REF ShapeInstance]; PlaceShape: PROC[ context: REF Context, shapeName: Rope.ROPE, location: Triple]; MoveShape: PROC[ context: REF Context, shapeName: Rope.ROPE, delta: Triple]; RotateShapeLocal: PROC[ context: REF Context, shapeName: Rope.ROPE, theta: REAL]; RotateShape: PROC[ context: REF Context, shapeName: Rope.ROPE, axisBase, axisEnd: Triple, theta: REAL ]; OrientShape: PROC[ context: REF Context, shapeName: Rope.ROPE, axis: Triple]; Hide: PROC[context: REF Context, shapeName: Rope.ROPE]; Reveal: PROC[context: REF Context, shapeName: Rope.ROPE]; SetColor: PROC[context: REF Context, shapeName: Rope.ROPE, color: RGB]; SetFaceted: PROC[context: REF Context, shapeName: Rope.ROPE]; SetSmooth: PROC[context: REF Context, shapeName: Rope.ROPE]; SetHiddenLines: PROC[context: REF Context, shapeName: Rope.ROPE]; SetNormaledLines: PROC[context: REF Context, shapeName: Rope.ROPE]; SetLines: PROC[context: REF Context, shapeName: Rope.ROPE]; SetShadedLines: PROC[context: REF Context, shapeName: Rope.ROPE]; SetShiny: PROC[context: REF Context, shapeName: Rope.ROPE, shininess: REAL _ 50.0]; SetDull: PROC[context: REF Context, shapeName: Rope.ROPE]; SetTransparent: PROC[context: REF Context, shapeName: Rope.ROPE, t: REAL _ 0.8]; SetOpaque: PROC[context: REF Context, shapeName: Rope.ROPE]; IncludeBackFaces: PROC[context: REF Context, shapeName: Rope.ROPE]; RemoveBackFaces: PROC[context: REF Context, shapeName: Rope.ROPE]; END.  SceneUtilities.mesa Copyright c 1984, 1986 by Xerox Corporation. All rights reserved. Last Edited by: Crow, April 9, 1988 3:24:29 pm PDT Bloomenthal, September 6, 1988 5:06:07 pm PDT Basic Types Utility Procedures Procedures for Setting up and using Contexts sets up context with blue background, white light source over left shoulder, view from 12 units or so, rendering through fancy renderer adds working directory from context to name adds extension ".interpress" to end of name if there is no existing extension copies context so temporary modifications can be made copies all but display copies all shapes so that they can be modified without affecting the original descriptions open typescript log for safety from potential disasters close when done to flush Procedures for Defining and Altering Environments Set up to do priority sort on polygons to get intersecting surfaces Set window (for viewing subimage). Window is bounded by -1.0 <= x, y <= 1.0. Context.aspectRatio (default 4/3) further bounds window so longest side runs from -1.0 to 1.0. Any subimage within the bounded region may be displayed by setting a smaller window. The window aspect ratio must match the viewport aspect ratio to get a non-distorted image. Changes position and size of area affected on display. Viewport is defined in terms of pixels. Non-square pixels must be compensated for here. View and Lighting control Set ambient light color Set background color Install a new light source in the scene, or change a previously named one Install a new light source in the scene, or change a previously named one Scene Input/Output Write out a whole scene to a named file Read in a whole scene from a named file Display a scene stored in a file, leave context unchanged Read in a whole scene in a format produced below Write out a whole scene in a simple format Procedures for Reading and Writing Shape Descriptions Assign the texture coordinates for the given shape. Indicate the validity of vertex normals, colors, textures, and transmittance for the shape. full format shape read from file copy shape data, used where new instance of previously read file is desired 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 write shape to file, fields set to TRUE will be written, coordinates will be transformed to world space (shape.position applied) if "transformed" is TRUE Procedures for Manipulating Shapes Returns a new, empty shape data structure, loads name into proper field, loads class builds a shape data structure using the supplied data, NIL parameters are ignored except for "vertices" and "surface" which must be supplied, "faceted" = TRUE assumes that colors are to be applied to facets rather than vertices builds a shape data structure for displaying a message or label in the scene. Shape is two-dimensional, always facing the eyepoint, but changes in size with perspective. Changes the message displayed for a rope shape Finds shape data, given its name Adds a shape to a context Removes a shape from a context Makes a copy of a shape, using name to find it in context Makes a copy of a shape Places local origin of shape at absolute position in world space Moves local origin of shape by given amount in world space Rotation about vertical axis in local shape coordinates or axis last defined by RotateShape Rotation about arbitrary axis in local shape coordinates Tilts vertical axis of shape into given axis, done after above rotation Maintain data but don't display Undo Hide Procedures for Shading Surfaces Set up shape for Faceted display, set colors and normals for all patches Set up shape for Smooth (Gouraud Shaded) display Set up shape for Hidden Line drawing display Set up shape for Hidden Line with normals display Set up shape for Line drawing display Sets glossiness (size of highlight) for surface, higher shininess means smaller, crisper highlight Sets transparency for surface, t ranges from 0.0 (opaque) to 1.0 (clear) Sets one sided flag on each patch false (if surface uses standard PtrPatch type) Sets one sided flag on each patch true (if surface uses standard PtrPatch type) Κυ˜IheadšΟb™šœ Οmœ7™BJšœ2™2Icode™-J˜šΟk ˜ Jšœ ŸœŸœ˜JšŸœŸœŸœ˜Idefaultšœ Ÿœ˜MšœŸœ7ŸœZ˜©——head2šœŸœŸ ˜!JšœŸ˜—head3š ™ JšŸœŸœŸœ˜Jšœ Ÿœ˜-JšœŸœ˜/JšœŸœ˜/JšœŸœ˜3JšœŸœΟc˜FJšœ Ÿœ˜'JšœŸœ˜!IunitšœŸœ˜1MšœŸœ˜1Pšœ Ÿœ˜&—š™Jš ΟnœŸœŸœŸœŸœŸœ ˜4—š,œ™-š‘œŸœŸœŸœ ˜3Jš ˆ™ˆ—š ‘œŸœ ŸœŸœŸœŸœ˜XJš ,™,—š ‘œŸœŸœŸœŸœŸœ˜LJš œ  ?™MJ˜—aš ‘ œŸœ Ÿœ Ÿœ Ÿœ ˜GQš 6™6— š‘œŸœŸœ ˜4Qš ™— š‘œŸœŸœ ˜6Q™\— š ‘œŸœ Ÿœ ŸœŸœŸœ˜9Qš ™— š‘œŸœ Ÿœ ˜&Qšœ'™'— š‘œŸœ Ÿœ ˜&Q™——š1™1š ‘œŸœ ŸœŸœŸœ˜BJ™D—š‘ œŸœ Ÿœ"˜>Jš ΰ™ΰ—š‘ œŸœ Ÿœ"˜@Jš ™——š™š‘œŸœ ŸœŸœ˜?J™—š‘œŸœ ŸœŸœ˜