Render3d.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bloomenthal, February 26, 1987 7:27:36 pm PST
DIRECTORY CedarProcess, ColorDisplay, Controls3d, ImagerColor, Matrix3d, Rope, ThreeDBasics, Vector3d, ViewerClasses;
~
BEGIN
ROPE: TYPE ~ Rope.ROPE;
Triple: TYPE ~ Vector3d.Triple;
TripleSequence: TYPE ~ Vector3d.TripleSequence;
TripleSequenceRep: TYPE ~ Vector3d.TripleSequenceRep;
NatTable: TYPE ~ ThreeDBasics.NatTable;
NatSequence: TYPE ~ ThreeDBasics.NatSequence;
RGB: TYPE ~ ImagerColor.RGB;
Matrix: TYPE ~ Matrix3d.Matrix;
Camera: TYPE ~ Controls3d.Camera;
Viewer: TYPE ~ ViewerClasses.Viewer;
Context3d: TYPE ~ REF ThreeDBasics.Context;
ShapeInstance: TYPE ~ ThreeDBasics.ShapeInstance;
Vertex: TYPE ~ ThreeDBasics.Vertex;
VertexSequence: TYPE ~ ThreeDBasics.VertexSequence;
PtrPatch: TYPE ~ ThreeDBasics.PtrPatch;
PtrPatchSequence: TYPE ~ ThreeDBasics.PtrPatchSequence;
ShadingValue: TYPE ~ ThreeDBasics.ShadingValue;
ShadingSequence: TYPE ~ ThreeDBasics.ShadingSequence;
CDState: TYPE ~ ColorDisplay.CDState;
Process: TYPE ~ CedarProcess.Process;
RenderStyle: TYPE ~ {faceted, smooth, shiny, none};
TextureType: TYPE ~ {intensity, color, bump};
origin: Triple ~ Vector3d.origin;
defaultBackground: Triple ~ [0.2, 0.2, 0.7];
nGlobalContext3d: NAT ~ 10;
Context3d Initialization
InitContext3d:
PUBLIC
PROC [background: Triple ← defaultBackground]
RETURNS [Context3d];
Initialize the ThreeDWorld context.
Presently, this will utilize the entire color display without the Viewers mechanism.
Changing the color display should cause a redraw.
NullifyThreeDContext:
PUBLIC
PROC [context3d: Context3d];
Remove the ThreeDWorld context from the set of contexts to be redrawn
when the color display changes;
Inserting Objects
AddFileShape:
PUBLIC
PROC [
context3d: Context3d,
shapeName: ROPE,
fileName: ROPE,
position: Triple ← origin,
color: RGB ← [0.7, 0.7, 0.7],
renderStyle: RenderStyle ← none];
Add a shape from file.
AddObject:
PUBLIC
PROC [
context3d: Context3d,
polygons: REF NatTable,
vertices: REF VertexSequence,
shades: REF ShadingSequence,
textures: TripleSequence ← NIL,
position: Triple ← origin,
name: ROPE ← NIL,
renderStyle: RenderStyle ← faceted,
insideVisible: BOOL ← FALSE,
matrix: Matrix ← NIL];
Add the specified object to the ThreeDWorld context.
Adjusting Objects
SetRenderStyle:
PUBLIC
PROC [
context3d: Context3d, shapeName: ROPE, renderStyle: RenderStyle];
Change the rendering style for an object.
SetInsideVisible:
PUBLIC
PROC [context3d: Context3d, shapeName:
ROPE, insideVisible:
BOOL];
Set whether back facing polygons are rendered or not.
SetObjectMatrix:
PUBLIC
PROC [context3d: Context3d, shapeName:
ROPE, matrix: Matrix];
Change the position, orientation, scale, etc. of an object.
SetTextureMap:
PUBLIC
PROC [
context3d: Context3d,
shapeName, textureAIS: ROPE,
textureType: TextureType ← intensity];
Read in the appropriate texture map for the given shape.
Iff anti-aliasing is on, this will display the given shape with the given texture.