G3dBuild.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Glassner, September 21, 1989 5:38:13 pm PDT
Bloomenthal, July 15, 1992 11:32 pm PDT
DIRECTORY G3dBasic, G3dQuaternion, G3dScene, G3dShape, G3dSweep, G3dRender, Random, Rope;
G3dBuild: CEDAR DEFINITIONS
~ BEGIN
Basic Types
AxisAngle: TYPE ~ G3dQuaternion.AxisAngle;
BlendType: TYPE ~ G3dSweep.BlendType;
Context3d: TYPE ~ G3dRender.Context3d;
ParseState: TYPE ~ G3dScene.ParseState;
RandomStream: TYPE ~ Random.RandomStream;
ROPE: TYPE ~ Rope.ROPE;
SceneProc: TYPE ~ G3dScene.SceneProc;
Shape: TYPE ~ G3dShape.Shape;
Triple: TYPE ~ G3dBasic.Triple;
TripleSequence: TYPE ~ G3dBasic.TripleSequence;
Local Types
SweepPaths: TYPE ~ REF SweepPathsRep;
SweepPathsRep:
TYPE ~
RECORD [
shapeFile: ROPE ¬ NIL,
shapeBlend: BlendType ¬ smooth,
scaleFile: ROPE ¬ NIL,
scaleBlend: BlendType ¬ smooth,
rotateFile: ROPE ¬ NIL,
rotateBlend: BlendType ¬ smooth,
translateFile: ROPE ¬ NIL,
translateBlend: BlendType ¬ smooth,
pathFile: ROPE ¬ NIL,
pathBlend: BlendType ¬ smooth
];
Field: TYPE ~ REF FieldRep;
FieldRep:
TYPE ~
RECORD [
the all-pervading field
on: BOOL ¬ FALSE,
center: Triple ¬ [0.0, 0.0, 0.0],
amplitude: REAL ¬ 1.0,
radius: REAL ¬ 1.0,
power: REAL ¬ 1.0,
offset: REAL ¬ 0.0
];
State: TYPE ~ REF StateRep;
StateRep:
TYPE ~
RECORD [
field: Field ¬ NIL,
sweepPaths: SweepPaths ¬ NIL,
randomStream: RandomStream
];
Constants
pi: REAL = 3.141593;
piOver2: REAL = 1.570796;
piTimes2: REAL = 6.283186;
degToRad: REAL = 1.745329e-2;
radToDeg: REAL = 57.29577;
ImplA Procs
Get Build State
GetBuildState:
PUBLIC
PROC
[ps: ParseState]
RETURNS [State];
Instantiates a state for the build system if one is not already present
Primitive Sweep Convenience Procedures
TranslateShapeAlongZ :
PUBLIC
PROC
[
shape: Shape,
distance: REAL ¬ 1.0,
anchor: BOOL ¬ FALSE
] RETURNS [Shape];
Timesaver for simple translations
TranslateShape:
PUBLIC
PROC
[
shape: Shape,
lo, hi: Triple,
anchor: BOOL ¬ FALSE
] RETURNS [Shape];
Timesaver for translations
RevolveShape:
PUBLIC
PROC
[
shape: Shape,
steps: INT ¬ 10,
loAngle: REAL ¬ 0.0, -- angle extreme in degrees
hiAngle: REAL ¬ 360.0, -- angle extreme in degrees
axis: Triple ¬ [0.0, 0.0, 1.0],
anchor: BOOL ¬ FALSE,
objClosed: BOOL ¬ FALSE
] RETURNS [Shape];
Timesaver for rotations
Polygonal Surface Procedures
MakeSphere: PUBLIC SceneProc;
MakeCylinder: PUBLIC SceneProc;
MakeCone: PUBLIC SceneProc;
MakeTorus: PUBLIC SceneProc;
MakeNGon: PUBLIC SceneProc;
MakeAnnulus: PUBLIC SceneProc;
Shape Saving and Book-keeping Procedures
ShapeFromTripleSequence:
PUBLIC
PROC [ts: TripleSequence]
RETURNS [Shape];
Construct a shape from a sequence of triples
ShapeFromTripleList:
PUBLIC
PROC [tl:
LIST
OF Triple]
RETURNS [Shape];
Construct a shape from a list of triples
ResampleTriples:
PUBLIC
PROC [ts: TripleSequence, steps:
INT, close:
BOOL, curved:
BOOL ¬
TRUE]
RETURNS [TripleSequence];
Interpolate a TripleSequence into a new TripleSequence with the specified number of points.
Build's Private Procedures
LoadShape:
PUBLIC
PROC [ps: ParseState, state: State, shape: Shape];
Save a shape that has been constructed
UpdateShape:
PUBLIC
PROC [ps: ParseState, state: State, shape: Shape];
Inherit material and other information in the ParseState
AutoName:
PUBLIC
PROC [context3d: Context3d, type:
ROPE]
RETURNS [
ROPE];
Construct a name of the given type by appending the current shape number
AutoUTexture:
PUBLIC
PROC [shape: Shape];
Apply texture coordinates to the object as a function of Z
Sweep Surface Procedures
ClearSweepPaths: PUBLIC SceneProc;
ChangeSweepPaths: PUBLIC SceneProc;
MakeSweep: PUBLIC SceneProc;
ImplB Procs
Calls for Polygon-by-polygon Procedures
PolyStellate: PUBLIC SceneProc;
PolyFrame: PUBLIC SceneProc;
PolyDilate: PUBLIC SceneProc;
PolyRotate: PUBLIC SceneProc;
PolyExplodeP: PUBLIC SceneProc;
PolyInscribe: PUBLIC SceneProc;
PolyCorners: PUBLIC SceneProc;
PolyCutCorners: PUBLIC SceneProc;
PolySplotch: PUBLIC SceneProc;
PolyFan: PUBLIC SceneProc;
PolyStar: PUBLIC SceneProc;
Impls for Polygon-by-polygon Procedures
These procedures simply provide a client interface for the above shape hacks.
StellateShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 1.0, bases: BOOL ¬ TRUE];
FrameShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 1.0];
DilateShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 1.0];
RotateShape: PUBLIC PROC [shape: Shape, theta: REAL ¬ piOver2];
ExplodePShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 1.0, f: Field];
InscribeShape: PUBLIC PROC [shape: Shape, alpha: REAL ¬ 0.5];
CutCornersShape: PUBLIC PROC [shape: Shape, alpha: REAL ¬ 0.5, corners: BOOL ¬ TRUE];
SplotchShape: PUBLIC PROC [shape: Shape, sides: INT ¬ 10, size: REAL ¬ 1.0];
FanShape: PUBLIC PROC [shape: Shape, alpha: REAL ¬ 0.5];
StarShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 0.5];
Calls for Vertex-by-vertex Procedures
ExplodeV: PUBLIC SceneProc;
Impls for Vertex-by-vertex Procedures
These procedures simply provide a client interface for the above vertex hacks.
ExplodeVShape: PUBLIC PROC [shape: Shape, factor: REAL ¬ 1.0, f: Field];
END.