File: SVSceneTypes.mesa
Created July 29, 1984 3:52:37 pm PDT
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by Bier on July 8, 1987 4:01:18 pm PDT
DIRECTORY
FunctionCache, Imager, IO, Rope, SV2d, SV3d, SVBasicTypes, SVModelTypes;
SVSceneTypes: CEDAR DEFINITIONS =
BEGIN
Artwork: TYPE = SVModelTypes.Artwork;
BoundHedron: TYPE = SVBasicTypes.BoundHedron;
BoundBox: TYPE = SVBasicTypes.BoundBox;
BoundSphere: TYPE = SVBasicTypes.BoundSphere;
Camera: TYPE = SVModelTypes.Camera;
Color: TYPE = Imager.Color;
CoordSystem: TYPE = SVModelTypes.CoordSystem;
FrameBox: TYPE = SVModelTypes.FrameBox;
LightSourceList: TYPE = SVModelTypes.LightSourceList;
Line3d: TYPE = SV3d.Line3d;
Matrix4by4: TYPE = SV3d.Matrix4by4;
Plane: TYPE = SV3d.Plane;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
PolyDatabase: TYPE = SV3d.PolyDatabase;
Projection: TYPE = SVModelTypes.Projection;
Vector3d: TYPE = SV3d.Vector3d;
Scenes
Database: TYPE = REF DatabaseObj;
DatabaseObj: TYPE = RECORD [
scenes: LIST OF Scene];
Skitter: TYPE = REF SkitterObj;
SkitterObj: TYPE = RECORD [
alive: BOOL,
cameraPt: Point2d,
skitterWorld: Matrix4by4,
attractor: SliceDescriptor,
primitive: Primitive, -- the CSG primitive corresponding to attractor
obsolete or not used
chair: SliceDescriptor,
svData: REF ANY,
mode: SkitterMode
];
SkitterMode: TYPE = {surface, tightrope, coordframe};
Scene: TYPE = REF SceneObj;
SceneObj: TYPE = RECORD [
name: Rope.ROPE,
coordSysRoot: CoordSystem, -- WORLD coordinates
lightSources: LightSourceList,
masterObjects: MasterObjectList,
assembly: Slice,
selected: SelectedData,
savedSelected: SelectedData, -- for Abort and Extend Select
tree: CSGTree,
cameras: FileCameraList,
anchor: Skitter,
cameraOrder: LIST OF Rope.ROPE,
backgroundColor: Color,
shadows: BOOL,
dirty: BOOL];
SelectedData: TYPE = RECORD [
normal: LIST OF SliceDescriptor ← NIL, -- a list of selected SliceDescriptors
normalPtr: LIST OF SliceDescriptor ← NIL, -- finger pointer to end of normal
normalPtrValid: BOOLFALSE, -- TRUE when normalPtr accurately points to end of normal
hot: LIST OF SliceDescriptor ← NIL, -- a list of hot SliceDescriptors
hotPtr: LIST OF SliceDescriptor ← NIL, -- finger pointer to end of hot
hotPtrValid: BOOLFALSE, -- TRUE when hotPtr accurately points to end of normal
active: LIST OF SliceDescriptor ← NIL, -- a list of active SliceDescriptors
activePtr: LIST OF SliceDescriptor ← NIL, -- finger pointer to end of active
activePtrValid: BOOLFALSE -- TRUE when activePtr accurately points to end of normal
];
FrameBlock: TYPE = REF FrameBlockObj;
FrameBlockObj: TYPE = RECORD [
loX, hiX, loY, hiY, loZ, hiZ: REAL];
FileCamera: TYPE = REF FileCameraObj;
FileCameraObj: TYPE = RECORD [
name: Rope.ROPE,
origin: Point3d,
focusPoint: Point3d,
slant: REAL, -- the slant of the camera counter-clockwise from horizontal in degrees.
resolution: REAL,
focalLength: REAL,
projection: Projection,
frame: FrameBox,
clippingPlanes: LIST OF Plane,
visibleAssemblies: LIST OF Rope.ROPE];
FileCameraList: TYPE = LIST OF FileCamera;
SelectionClass: TYPE = {normal, hot, active};
Slices
SliceGenerator: TYPE = REF SliceGeneratorObj;
SliceGeneratorObj: TYPE = RECORD [
list: LIST OF Slice
];
SliceDescriptorGenerator: TYPE = REF SliceDescriptorGeneratorObj;
SliceDescriptorGeneratorObj: TYPE = RECORD [
list: LIST OF SliceDescriptor
];
SliceDescriptor: TYPE = REF SliceDescriptorObj;
SliceDescriptorObj: TYPE = RECORD [
slice: Slice,
parts: SliceParts
];
SliceParts: TYPE = REF ANY;
Slice: TYPE = REF SliceObj;
SliceObj: TYPE = RECORD [
name: Rope.ROPE,
coordSys: CoordSystem,
shape: REF ANY, -- a Shape or an assembly list
Selection Bits
normalSelectedParts: SliceDescriptor,
hotSelectedParts: SliceDescriptor,
activeSelectedParts: SliceDescriptor,
Bounding Boxes
bBoxCache: FunctionCache.Cache,
Other Slice Data
onOverlay: BOOLFALSE,
mark: BOOLFALSE, -- for sweeping thru scenes by Undelete mechanism
Other Solidviews Data
artwork: Artwork,
showAs: ShowAsType ← normal,
isTool: BOOLFALSE,
toolMasterObject: MasterObject ← NIL,
sittingOn: Rope.ROPENIL -- the assembly whose surface it is sitting on.
];
ShowAsType: TYPE = {invisible, normal, tool, both};
Shape: TYPE = REF ShapeObj;
ShapeObj: TYPE = RECORD [
coordSys: CoordSystem,
mo: MasterObject];
ToolData: TYPE = REF ToolDataObj;
ToolDataObj: TYPE = RECORD [
block: FrameBlock,
infinite: BOOL,
plane: NAT,
clientData: REF ANY -- currently used for Slice objects
];
SliceList: TYPE = REF SliceListObj;
SliceListObj: TYPE = RECORD [
 list: LIST OF Slice,
 pointSetOp: PointSetOp];
CSG Tree
Remember to update DisplayListToTree.PrimitiveFromAssembly if this definition changes.
Primitive: TYPE = REF PrimitiveObj;
PrimitiveObj: TYPE = RECORD [
name: Rope.ROPE,
artwork: Artwork,
ignoreMe: BOOLFALSE,
featureData: REF ANY,
assembly: Slice,
mo: MasterObject,
sliceD: SliceDescriptor,
rayCast: RayCastProc,
rayCastNoBBoxes: RayCastNoBBoxesProc,
rayCastBoundingSpheres: RayCastBoundingSpheresProc,
localCS: CoordSystem,
scalars: Vector3d,
worldWRTPrim: Matrix4by4,
primWRTWorld: Matrix4by4,
hints: REF ANY, -- each object type may wish to store helpful information here
boundBox: BoundBox,
boundSphere: BoundSphere,
boundHedron: BoundHedron,
inverted: BOOL, -- is this shape to be subtracted?
currentRay: Ray,
rayStepX: Ray];
PointSetOp: TYPE = {union, intersection, difference};
Composite: TYPE = REF CompositeObj;
CompositeObj: TYPE = RECORD [
name: Rope.ROPE,
operation: PointSetOp,
leftSolid: REF ANY,
rightSolid: REF ANY,
boundBox: BoundBox,
boundSphere: BoundSphere];
CSGTree: TYPE = REF CSGTreeObj;
CSGTreeObj: TYPE = RECORD [
name: Rope.ROPE,
outOfDate: BOOLTRUE,
son: REF ANY,
backgroundColor: Color,
shadows: BOOL];
Ray Tracing
Surface: TYPE = REF ANY; -- may be RectSurface, TubeSurface, DiskSurface, ShellSurface...
Classification: TYPE = REF ClassificationObj;
ClassificationObj: TYPE = RECORD [
count: NAT,
params: ParameterArray,
surfaces: SurfaceArray,
stills: InOutArray,
primitives: PrimitiveArray,-- the primitive from which each surface came
classifs: InOutArray,
normals: NormalArray];
maxSceneDepth: NAT = 40;
ParameterArray: TYPE = ARRAY [1..maxSceneDepth] OF REAL;
InOutArray: TYPE = ARRAY [1..maxSceneDepth] OF BOOL;
NormalArray: TYPE = ARRAY [1..maxSceneDepth] OF Vector3d;
SurfaceArray: TYPE = REF SurfaceArrayObj;
SurfaceArrayObj: TYPE = ARRAY [1..maxSceneDepth] OF Surface;
PrimitiveArray: TYPE = ARRAY [1..maxSceneDepth] OF Primitive;
Ray: TYPE = REF RayObj;
RayObj: TYPE; -- see CSGImpl for the read record
SearchDepth: TYPE = {first, lastOfFirst, last, lastOfLevel1};
Master Object Types
MasterObject: TYPE = REF MasterObjectRec;
MasterObjectRec: TYPE = RECORD [
name: Rope.ROPE,
class: MasterObjectClass,
mainBody: REF ANYNIL, -- information independent of imaging style
lineBody: REF ANY,
shadeBody: REF ANY,
rayCastBody: REF ANY
];
MasterObjectList: TYPE = LIST OF MasterObject;
PointAndDone: TYPE = RECORD [point: Point3d, done: BOOL];
PointPairAndDone: TYPE = RECORD [lo, hi: Point3d, done: BOOL];
PointGenerator: TYPE = REF PointGeneratorObj;
PointGeneratorObj: TYPE = RECORD [
sliceD: SliceDescriptor,
toGo: NAT,
index: NAT,
classSpecific: REF ANY
];
PointPairGenerator: TYPE = REF PointPairGeneratorObj;
PointPairGeneratorObj: TYPE = RECORD [
sliceD: SliceDescriptor,
toGo: NAT,
index: NAT,
classSpecific: REF ANY
];
SelectMode: TYPE = {literal, joint, controlPoint, segment, segmentRange, traj, slice, topLevel, none};
ExtendMode: TYPE = SelectMode;
PlanarSurface: TYPE = REF PlanarSurfaceObj;
PlanarSurfaceObj: TYPE = RECORD [
whichSurface: REF ANY,
each object type will have its own way of describing its surfaces
assembly: Slice,
mo: MasterObject,
normal: Vector3d,
depth: REAL]; -- in camera coords which the master object calculates (for now)
The normal is a surface normal given in local coordinates by each assembly. It is converted to camera coordinates before it is passed back to master object class code for drawing.
PlanarSurfaceList: TYPE = LIST OF PlanarSurface;
Master Object Class Types
MasterObjectClass: TYPE = REF MasterObjectClassObj;
MasterObjectClassObj: TYPE = RECORD [
name: Rope.ROPE,
Fundamentals
copy: CopyProc,
getHedron: GetHedronProc, -- a polyhedron the bounds the object
Drawing
lineDraw: LineDrawProc,
lineDrawTransform: LineDrawTransformProc,
countSurf: CountSurfProc,
getSurf: GetSurfProc,
getSurfTransform: GetSurfTransformProc,
normalsDraw: NormalsDrawProc,
preprocess: PreprocessProc,
rayCast: RayCastProc,
rayCastNoBBoxes: RayCastNoBBoxesProc,
rayCastBoundingSpheres: RayCastBoundingSpheresProc,
drawSurf: DrawPlanarSurfaceProc,
drawSubBoxes: DrawSubBoxesProc,
drawSubSpheres: DrawSubSpheresProc,
drawSelectionFeedback: DrawSelectionFeedbackProc,
drawAttractorFeedback: DrawAttractorFeedbackProc,
Transforming
transform: TransformProc,
Textual Description
describe: DescribeProc,
describeHit: DescribeHitProc,
filein: FileinProc,
fileout: FileoutProc,
fileoutPoly: FileoutPolyProc,
Parts
emptyParts: EmptyPartsProc,
newParts: NewPartsProc,
unionParts: UnionPartsProc,
differenceParts: DifferencePartsProc,
movingParts: MovingPartsProc,
augmentParts: AugmentPartsProc,
Part Generators
pointsInDescriptor: PointsInDescriptorProc,
nextPoint: NextPointProc,
pointPairsInDescriptor: PointPairsInDescriptorProc,
nextPointPair: NextPointPairProc,
Hit Testing
closestPointToPoint: ClosestPointToPointProc,
closestPointToLine: ClosestPointToLineProc,
closestSegmentToPoint: ClosestSegmentToPointProc,
closestSegmentToLine: ClosestSegmentToLineProc,
closestFace: ClosestFaceProc,
Miscellaneous
update: UpdateProc -- change some aspect of the master object, such as how it draws itself
];
MasterObjectClassList: TYPE = LIST OF MasterObjectClass;
CopyProc: TYPE = PROC [mo: MasterObject, newName: Rope.ROPE] RETURNS [newMO: MasterObject];
GetHedronProc: TYPE = PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
DescribeProc: TYPE = PROC [sliceD: SliceDescriptor] RETURNS [rope: Rope.ROPE];
DescribeHitProc: TYPE = PROC [mo: MasterObject, hitData: REF ANY] RETURNS [rope: Rope.ROPE];
FileinProc: TYPE = PROC [f: IO.STREAM, name: Rope.ROPE, version: REAL] RETURNS [mo: MasterObject];
FileoutProc: TYPE = PROC [f: IO.STREAM, mo: MasterObject];
FileoutPolyProc: TYPE = PROC [f: IO.STREAM, mo: MasterObject];
PreprocessProc: TYPE = PROC [prim: Primitive, camera: Camera];
Drawing
RayCastProc: TYPE = PROC [cameraPoint: Point2d, localRay: Ray, sliceD: SliceDescriptor, prim: Primitive] RETURNS [class: Classification];
RayCastNoBBoxesProc: TYPE = PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive] RETURNS [class: Classification];
RayCastBoundingSpheresProc: TYPE = PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive] RETURNS [class: Classification];
LineDrawProc: TYPE = PROC[slice: Slice, dc: Imager.Context, camera: Camera];
LineDrawTransformProc: TYPE = PROC[sliceD: SliceDescriptor, dc: Imager.Context, camera: Camera, transform: Matrix4by4];
CountSurfProc: TYPE = PROC [masterObject: MasterObject] RETURNS [len: NAT];
GetSurfProc: TYPE = PROC [slice: Slice, camera: CoordSystem] RETURNS [PlanarSurfaceList];
GetSurfTransformProc: TYPE = PROC [sliceD: SliceDescriptor, camera: CoordSystem, transform: Matrix4by4] RETURNS [PlanarSurfaceList];
NormalsDrawProc: TYPE = PROC[dc: Imager.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
EmptyPartsProc: TYPE = PROC [sliceD: SliceDescriptor] RETURNS [BOOL];
NewPartsProc: TYPE = PROC [slice: Slice, hitData: REF ANY, hitPoint: Point3d, mode: SelectMode] RETURNS [sliceD: SliceDescriptor];
UnionPartsProc: TYPE = PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aPlusB: SliceDescriptor];
DifferencePartsProc: TYPE = PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aMinusB: SliceDescriptor];
MovingPartsProc: TYPE = PROC [slice: Slice, selectedParts: SliceParts] RETURNS [background, overlay, rubber, drag: SliceDescriptor];
AugmentPartsProc: TYPE = PROC [sliceD: SliceDescriptor, selectClass: SelectionClass] RETURNS [more: SliceDescriptor];
ClosestPointToPointProc: TYPE = PROC [sliceD: SliceDescriptor, testPoint: Point3d, t: REAL] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestPointToLineProc: TYPE = PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, t: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestSegmentToPointProc: TYPE = PROC [sliceD: SliceDescriptor, testPoint: Point3d, t: REAL] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestSegmentToLineProc: TYPE = PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, t: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
PointsInDescriptorProc: TYPE = PROC [sliceD: SliceDescriptor] RETURNS [PointGenerator];
NextPointProc: TYPE = PROC [pointGen: PointGenerator] RETURNS [pointAndDone: PointAndDone];
PointPairsInDescriptorProc: TYPE = PROC [sliceD: SliceDescriptor] RETURNS [PointPairGenerator];
NextPointPairProc: TYPE = PROC [pointPairGen: PointPairGenerator] RETURNS [pointPairAndDone: PointPairAndDone];
DrawPlanarSurfaceProc: TYPE = PROC [dc: Imager.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
DrawSubBoxesProc: TYPE = PROC [dc: Imager.Context, prim: Primitive, screenCS: CoordSystem];
DrawSubSpheresProc: TYPE = PROC [dc: Imager.Context, prim: Primitive, camera: Camera];
DrawSelectionFeedbackProc: TYPE = PROC [slice: Slice, selectedParts: SliceParts, hotParts: SliceParts, dc: Imager.Context, camera: Camera, dragInProgress, caretIsMoving, hideHot, quick: BOOL];
DrawAttractorFeedbackProc: TYPE = PROC [sliceD: SliceDescriptor, selectedParts: SliceParts, dragInProgress: BOOL, dc: Imager.Context, camera: Camera];
TransformProc: TYPE = PROC [sliceD: SliceDescriptor, scene: Scene, transform: Matrix4by4];
UpdateProc: TYPE = PROC [mo: MasterObject, updateData: REF ANY];
END.