DIRECTORY Atom, CedarProcess, G2dBasic, G3dBasic, G3dLight, G3dMatrix, G3dShape, Imager, ImagerPixel, ImagerSample, ImagerColor, IO, Rope, ViewerClasses; G3dRender: CEDAR DEFINITIONS ~ BEGIN Error: SIGNAL [code: ATOM, reason: ROPE]; -- we're able to resume this error Box: TYPE ~ G2dBasic.Box; Pair: TYPE ~ G3dBasic.Pair; Triple: TYPE ~ G3dBasic.Triple; Light: TYPE ~ G3dLight.Light; LightSequence: TYPE ~ G3dLight.LightSequence; Matrix: TYPE ~ G3dMatrix.Matrix; Shape: TYPE ~ G3dShape.Shape; ShapeSequence: TYPE ~ G3dShape.ShapeSequence; Rectangle: TYPE ~ Imager.Rectangle; RGB: TYPE ~ ImagerColor.RGB; PixelMap: TYPE ~ ImagerPixel.PixelMap; SampleMap: TYPE ~ ImagerSample.SampleMap; ROPE: TYPE ~ Rope.ROPE; DisplayMode: TYPE ~ {gray, dither, fullColor}; RenderData: TYPE ~ REF RenderDataRep; RenderDataRep: TYPE ~ RECORD [ renderStyle: RenderStyle ¬ faceted, color: RGB ¬ [1, 1, 1], diffuseReflectivity: REAL ¬ 1.0, specularReflectivity: REAL ¬ 0.0, metallicity: REAL ¬ 0.0, shininess: REAL ¬ 0.0, transmittance: REAL ¬ 0.0, textures: LIST OF TextureMap ¬ NIL ]; RenderStyle: TYPE ~ { faceted, smooth, lines, shadedLines, hiddenLines, linesWnormals, controlPoints }; TextureStyle: TYPE ~ {none, intensity, color, bump, function}; TextureMap: TYPE ~ REF TextureMapRep; TextureMapRep: TYPE ~ RECORD [ style: TextureStyle, name: ROPE, range: Pair, -- circumvent seam matching scale: Pair, bumpHeight: REAL, filter: BOOL ]; Context3d: TYPE ~ REF Context3dRep; Context3dRep: TYPE ~ RECORD [ props: Atom.PropList ¬ NIL, -- catchall clientData: REF ANY ¬ NIL, -- data storage for a client clear: BOOL ¬ FALSE, -- clear screen before rendering? antiAliasing: BOOL ¬ FALSE, -- flag for antialiasing and alpha buffer backgroundColor: RGB ¬ [0.7, 0.5, 1.0], -- background backgroundName: ROPE ¬ NIL, backgroundImage: SampleMap ¬ NIL, matteBackground: BOOL ¬ TRUE, -- matte background? frameNumber: NAT ¬ 0, -- current frame for animation routines eyePoint: Triple ¬ [1.0, -5.0, 2.0], -- 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 view direction upDirection: Triple ¬ [0.0, 0.0, 1.0], -- "heads-up" direction (redundant) fieldOfView: REAL ¬ 40.0, -- horizontal angle for field of view window: Rectangle ¬ [0,0,0,0], -- clips field of view in eyespace hitherLimit: REAL ¬ 1.0, -- anything closer to eyepoint is clipped yonLimit: REAL ¬ 1000.0, -- further from eyepoint is clipped scale: REAL ¬ 1.0, -- scale applied to view transformation view: Matrix ¬ NIL, -- world space to eyespace viewport: Rectangle ¬ [0,0,0,0], -- in floating pt. display coordinates screenExtent: Box ¬ [[0, 0], [0, 0]], -- bounds area (while building image) displayMode: DisplayMode ¬ dither -- type of image to be displayed ]; Create: PROC RETURNS [Context3d]; SetViewFromParameters: PROC [ context3d: Context3d, fieldOfView: REAL ¬ 40.0, scale: REAL ¬ 1.0, moves, rotates: Triple ¬ []]; SetView: PROC [ context3d: Context3d, eyePoint: Triple, lookAt: Triple, fieldOfView: REAL ¬ 40.0, rollAngle: REAL ¬ 0.0, upDirection: Triple ¬ [0., 0., 1.], hitherLimit: REAL ¬ .01, yonLimit: REAL ¬ 1000.0]; SetViewport: PROC [context3d: Context3d, size: Rectangle]; SetWindow: PROC [context3d: Context3d, size: Rectangle]; NameBackgroundColor: PROC [context3d: Context3d, color: ROPE]; SetBackgroundColor: PROC [context3d: Context3d, color: RGB]; SetBackgroundImage: PROC [context3d: Context3d, name: ROPE]; EnableClear: PROC [context3d: Context3d, on: BOOL]; MatteBackground: PROC [context3d: Context3d, matte: BOOL]; RenderDataFrom: PROC [shape: Shape] RETURNS [data: RenderData]; SetRenderStyle: PROC [shape: Shape, renderStyle: RenderStyle]; SetDiffuse: PROC [shape: Shape, diffuseReflectivity: REAL]; SetSpecular: PROC [shape: Shape, specularReflectivity: REAL]; SetMetallicity: PROC [shape: Shape, metallicity: REAL]; SetShininess: PROC [shape: Shape, shininess: REAL]; SetColor: PROC [shape: Shape, color: RGB]; SetTransmittance: PROC [shape: Shape, transmittance: REAL]; SetInvisible: PROC [shape: Shape]; SetVisible: PROC [shape: Shape]; ShowBackfaces: PROC [shape: Shape]; HideBackfaces: PROC [shape: Shape]; AddAxes: PROC [ context3d: Context3d, origin: Triple ¬ [0, 0, 0], size: REAL ¬ 1.0, scale: Triple ¬ [1, 1, 1], nReticles: NAT ¬ 20]; SetTextureMap: PROC [ shape: Shape, fileName: ROPE, textureStyle: TextureStyle ¬ intensity, textureFiltering: BOOL ¬ FALSE] RETURNS [error: ROPE]; GetTextureMap: PROC [shape: Shape, textureName: ROPE] RETURNS [TextureMap]; OffsetTextureCoords: PROC [shape: Shape, offset: Pair]; SetTextureScale: PROC [shape: Shape, textureName: ROPE, scale: Pair ¬ [1.0, 1.0]]; SetTextureRange: PROC [shape: Shape, textureName: ROPE, range: Pair]; SetTextureFiltering: PROC [shape: Shape, textureName: ROPE, on: BOOL]; SetBumpHeight: PROC [shape: Shape, textureName: ROPE, height: REAL ¬ 1.0]; Render: PROC [context3d: Context3d, image: REF, fork: BOOL ¬ TRUE] RETURNS [error: ROPE]; RenderToFile: PROC [ context3d: Context3d, fileName: ROPE, fork: BOOL ¬ TRUE, abekas: BOOL ¬ FALSE]; WaitTilRenderDone: PROC; IsRendering: PROC [context3d: Context3d] RETURNS [BOOL]; AbortRender: PROC [context3d: Context3d]; SetAntiAliasing: PROC [context3d: Context3d, on: BOOL ¬ TRUE]; AntiAliasingNeeded: PROC [context3d: Context3d] RETURNS [BOOL]; GetBuffer: PROC [context3d: Context3d, type: ATOM] RETURNS [SampleMap]; AtomFromTextureStyle: PROC [textureStyle: TextureStyle] RETURNS [ATOM]; AtomFromDisplayMode: PROC [displayMode: DisplayMode] RETURNS [ATOM]; RopeFromDisplayMode: PROC [displayMode: DisplayMode] RETURNS [ROPE]; RopeFromRenderStyle: PROC [renderStyle: RenderStyle] RETURNS [ROPE]; RopeFromTextureStyle: PROC [textureStyle: TextureStyle] RETURNS [ROPE]; END. @ G3dRender.mesa Copyright Σ 1985, 1989, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, July 15, 1992 10:42 pm PDT Crow, October 30, 1990 6:22 pm PST Glassner, November 7, 1989 12:00:16 pm PST Errors Imported Types Local Types Miscellany Rendering Background Scene Camera Display Context3d Allocate a default. View Set the context3d view according to parameters. Set the context3d view according to camera geometry. If fieldOfView = 0, it will be set to 40. Display full image (with possibly different aspect ratio) in portion of screen. Display only that part of full-screen image which lies within the window. Background Set background color using color naming scheme. Set background color. Use named image file as background image for scene instead of solid color. Enable clearing before rendering; if disabled (on = FALSE) images may be composited using successive renderings. If false, prevent final background matte step thereby preserving alpha buffer. Shapes Return rendering information associated with the shape. Change the rendering style for a shape. Set the shape's diffuse reflection. Set the shape's specular reflection. Set the shape's metallicity. Set the shape's shininess. Set the color for the given shape. Change the transmittance of the shape; transmittance = 0 is opaque. N.B: Rendering of transparent objects occurs only when anti-aliasing is enabled. Maintain data but don't display the shape. Undo SetInvisible. Render back-facing polygons (for transparent or non-closed shapes, or debugging). Don't render back-facing polygons (for transparent or non-closed shapes, or debugging). Add a set of coordinate axes to the 3d context. size is the length of an axis; the scales are the numeric size of each axis. Textures Read in the appropriate texture map for the given shape. Return the named texture map associated with shape. Offset the texture coordinates for the given shape. Set the texture scale for the given shape. Circumvent seam matching; range to exceed twice the range for all shape polygons. Turn on/off the texture filtering for the given shape. Set the bump scale factor for this shape. Rendering Perform the rendering process onto the given image. Typically image is an Imager.Context. If fork, fork the rendering process; otherwise, return upon completion of the rendering. Render and then store to a file Wait until a rendering process finishes. Does not distinguish between different context3ds. Return true iff context3d is rendering (forked or not). Abort any current rendering within context3d. This will draw images using the alpha buffer; texture mapping is enabled. 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. Get a sample map from the context3d; return NIL if no such map. Miscellany Return an atom for non-typed operations. Return an atom for non-typed operations. Return the rope representing displayMode. Return the rope representing renderStyle. Return the rope representing textureStyle. Κ %•NewlineDelimiter –"cedarcode" style™™Jšœ Οeœ=™HJ™'J™"J™*J˜JšΟk œxžœ˜™J˜—šΡbln œžœž ˜Jšœž˜—headšΟl™Jš Οnœž œžœ žœΟc"˜T—š ™JšΟtœžœ£˜Jšœ žœ˜Jšœ žœ˜"Jšœ žœ˜!Jšœžœ˜.Jšœ žœ˜#Jšœ žœ˜!Jšœžœ˜.Jšœžœ £œ £˜&Jšžœžœžœ˜!Jšœ žœ˜)Jšœ žœ˜+Jšžœžœžœ˜—š  ™ šœ Πksžœ˜0J˜—Jšœ žœžœ˜'šœžœžœ˜J˜'Jšœ žœ ˜Jšœžœ˜"Jšœžœ˜"Jšœžœ˜Jšœ žœ˜Jšœžœ˜Jšœžœžœž˜'J˜J˜—šœ žœ˜J˜J˜J˜J˜ J˜ J˜J˜ J˜J˜—šœžœ,˜@J˜—Jšœžœžœ˜'šœžœžœ˜Jšœžœ ˜Jšœ žœ˜Jšœ’˜.J˜Jšœžœ˜Jšœ ž˜Jšœ˜J˜—Jšœ žœžœ˜%šœžœžœ˜™ Jšœžœ’ ˜,Jšœžœžœžœ’˜<—™ Jšœ žœžœ’!˜=Jšœžœžœ’)˜J—™ Jšœžœ’ ˜6Jšœžœžœ˜Jšœžœ˜"Jšœžœžœ’˜5—™Jšœžœ ’'˜C—šœ™Jšœ)’ ˜IJšœ'’$˜KJšœ žœ ’(˜FJšœ+’#˜NJšœžœ ’%˜EJšœ"’#˜EJšœžœ ’)˜HJšœ žœ ’#˜BJšœ žœ ’'˜BJšœžœ’˜5—šœ™Jšœ%’&˜KJšœ(’'˜OJšœ&’ ˜F—J˜——šΠbl ™ š‘œžœžœ ˜!J™——š ™š‘œžœ˜J˜Jšœ žœ˜Jšœžœ˜J˜J™/J˜—š‘œžœ˜J˜J˜J˜Jšœ žœ˜Jšœ žœ˜J˜$Jšœ žœ˜Jšœ žœ ˜J™_J˜—š‘ œžœ)˜:J™P—š‘ œžœ)˜8J™I——š  ™ š‘œžœžœ˜>J™0—š‘œžœžœ˜J™'J™—šΠbn œΟsžœ%žœ˜;J™#J™—š¦ œ§žœ&žœ˜=J™$J™—š¦œ§žœžœ˜7J™J™—š¦ œ§žœžœ˜3J™J™—š‘œžœžœ˜*J™"J™—š‘œžœžœ˜;J™CJšΟb¦¨œL™PJ™—š‘ œžœ˜"J™*J™—š‘ œžœ˜ J™J™—š‘ œžœ˜#J™QJ™—š‘ œžœ˜#J™WJ™—š‘œžœ˜J˜J˜Jšœžœ˜Jšœ§œ ˜Jšœ žœ˜J™/J™L——š ™š‘ œžœ˜Jšœ ˜ Jšœ žœ˜J˜'Jšœžœžœ˜Jšžœ žœ˜J™8J™—š‘ œžœžœžœ˜KJ™3J™—š‘œžœ˜7J™3J™—š‘œžœžœ˜RJ™*J™—š‘œžœžœ˜EJ™QJ™—š‘œžœžœžœ˜FJ™6J™—š‘ œžœžœ žœ˜JJ™)——š  ™ š‘œžœžœžœžœžœ žœ˜YJ™ZJ™XJ™—š‘ œžœ˜Jšœ˜Jšœ žœ˜Jšœžœžœ˜Jšœžœžœ˜J™!—š‘œžœ˜J™\J˜—š‘ œžœžœžœ˜8J™7J™—š‘ œžœ˜)J™-J™—š‘œžœžœžœ˜>J™IJ™—š‘œžœžœžœ˜?J™\J™VJ™—š‘ œžœžœžœ ˜GJšœ,§œ™?——š  ™ š‘œžœžœžœ˜GJ™(J™—š‘œžœžœžœ˜DJ™(J™—š‘œžœžœžœ˜DJ™)J™—š‘œžœžœžœ˜DJ™)J™—š‘œžœžœžœ˜GJ™*—J˜—šžœ˜J˜—J˜J˜—…—z,ί