File: CSGGraphics.mesa
Last edited by Bier on August 15, 1983 4:10 pm
Contents: A place to keep the current 3d transform, and the 3d (perspective) drawing routines
DIRECTORY
CoordSys,
Graphics,
GraphicsColor,
Matrix3d,
Rope,
Shading,
SVArtwork,
SVPolygon3d,
SVVector3d;
CSGGraphics: DEFINITIONS =
BEGIN
Artwork: TYPE = REF ArtworkObj;
ArtworkObj: TYPE = SVArtwork.ArtworkObj;
Camera: TYPE = REF CameraObj;
Color: TYPE = GraphicsColor.Color;
CoordSystem: TYPE = REF CoordSysObj;
CoordSysObj: TYPE = CoordSys.CoordSysObj;
DrawStyle: TYPE = {wire, shaded, rayCast, normals}; -- if you change this, remember to update DrawStyleToRope and RopeToDrawStyle below.
Matrix4by4: TYPE = Matrix3d.Matrix4by4;
Plane: TYPE = SVPolygon3d.Plane;
Point3d: TYPE = Matrix3d.Point3d;
Point2d: TYPE = Matrix3d.Point2d;
Poly3d: TYPE = REF Poly3dObj;
Poly3dObj: TYPE = SVPolygon3d.Poly3dObj;
LightSource: TYPE = REF LightSourceObj;
LightSourceObj: TYPE = Shading.LightSourceObj;
LightSourceList: TYPE = Shading.LightSourceList; -- LIST OF LightSource;
StrokeEnds: TYPE = Graphics.StrokeEnds;
Vector: TYPE = SVVector3d.Vector;
CameraObj: TYPE = RECORD [
viewName: Rope.ROPE,
coordSys: CoordSystem,
screenCS: CoordSystem,
resolution: REAL,
focalLength: REAL,
frame: FrameBox,
clippingPlanes: LIST OF Plane,
visibleAssemblies: LIST OF Rope.ROPE,
style: DrawStyle,
colorFilm: BOOL,
quality: QualityMode,
abort: BOOLFALSE];
QualityMode: TYPE = {fast, quality};
FrameBox: TYPE = REF FrameBoxObj;
FrameBoxObj: TYPE = RECORD [
downLeft: Point2d,
upRight: Point2d,
fullScreen: BOOL]; -- these points are in CAMERA coordinates
CreateCamera: PROC [viewName: Rope.ROPE, coordSys: CoordSystem, screenCS: CoordSystem, resolution: REAL, focalLength: REAL, clippingPlanes: LIST OF Plane, visibleAssemblies: LIST OF Rope.ROPE, style: DrawStyle] RETURNS [camera: Camera];
PlaceCamera: PROC [camera: Camera, focus: Point3d, origin: Point3d, slant: REAL];
SetFocalLengthCamera: PROC [camera: Camera, focalLength: REAL];
SetQualityCamera: PROC [camera: Camera, qual: QualityMode];
how you wish to make the speed/print quality trade off.
ColorFilmCamera: PROC [camera: Camera, colorFilm: BOOL];
If black and white film is used, all colors will be changed to shades of gray before being shown
Clip: PROC [dc: Graphics.Context, camera: Camera];
Clip future drawing operations to the bounding frame of camera.
GetPerspective: PROC [point3d: Point3d, camera: Camera] RETURNS [point2d: Point2d];
LocalToCamera: PROC [localPoint: Point3d, localCS: CoordSystem] RETURNS [cameraPoint: Point3d];
LocalToWorld: PROC [localPt: Point3d, localCS: CoordSystem] RETURNS [worldPt: Point3d];
VectorToWorld: PROC [vector: Vector, localCS: CoordSystem] RETURNS [worldVector: Vector];
DrawFrame: PROC [dc: Graphics.Context, camera: Camera];
Make a line drawing of the rectangular bounding frame of camera.
SetCP: PROC [dc: Graphics.Context, point3d: Point3d, camera: Camera, localCS: CoordSystem];
MoveTo: PROC [path: Graphics.Path, point3d: Point3d, camera: Camera, localCS: CoordSystem];
SetCPAbsolute: PROC [dc: Graphics.Context, point3d: Point3d, camera: Camera];
MoveToAbsolute: PROC [path: Graphics.Path, point3d: Point3d, camera: Camera];
LineTo: PROC [path: Graphics.Path, point3d: Point3d, camera: Camera, localCS: CoordSystem];
DrawTo: PROC [dc: Graphics.Context, point3d: Point3d, camera: Camera, localCS: CoordSystem];
LineToAbsolute: PROC [path: Graphics.Path, point3d: Point3d, camera: Camera];
DrawToAbsolute: PROC [dc: Graphics.Context, point3d: Point3d, camera: Camera];
DrawStroke: PROC [dc: Graphics.Context, path: Graphics.Path, width: REAL ← 1,
closed: BOOLEANFALSE, ends: StrokeEnds ← butt];
DrawLine: PROC [dc: Graphics.Context, start: Point3d, end: Point3d, camera: Camera, localCS: CoordSystem];
DrawOnScreen: PROC [dc: Graphics.Context, screenPoint1, screenPoint2: Point2d, camera: Camera];
DrawHorizonOfPlane: PROC [dc: Graphics.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
Plane in local coordinates.
DrawHorizonOfPlaneAbsolute: PROC [dc: Graphics.Context, plane: Plane, camera: Camera];
Plane in CAMERA coordinates.
DrawInfiniteLine: PROC [dc: Graphics.Context, p1, p2: Point3d, camera: Camera, localCS: CoordSystem];
p1 and p2 are assumed to be in local coordinates.
DrawInfiniteLineAbsolute: PROC [dc: Graphics.Context, p1, p2: Point3d, camera: Camera, localCS: CoordSystem];
p1 and p2 are assumed to be in CAMERA coordinates.
DrawInfinitePlaneWireFrame: PROC [dc: Graphics.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
plane is assumed to be in local coordinates.
DrawInfinitePlaneWireFrameAbsolute: PROC [dc: Graphics.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
plane is assumed to be in CAMERA coordinates.
DrawInfinitePlaneShaded: PROC [dc: Graphics.Context, plane: Plane, artwork: Artwork, lightSources: LightSourceList, camera: Camera, localCS: CoordSystem];
plane is assumed to be in local coordinates.
DrawInfinitePlaneShadedAbsolute: PROC [dc: Graphics.Context, plane: Plane, artwork: Artwork, lightSources: LightSourceList, camera: Camera];
plane is assumed to be in CAMERA coordinates.
DrawArea: PROC [dc: Graphics.Context, normal: Vector, poly3d: Poly3d, artwork: Artwork, lightSources: LightSourceList, camera: Camera, localCS: CoordSystem];
normal and poly3d in local coordinates.
DrawAreaNormalAbsolute: PROC [dc: Graphics.Context, normal: Vector, poly3d: Poly3d, artwork: Artwork, lightSources: LightSourceList, camera: Camera, localCS: CoordSystem];
normal is assumed to be in Camera coordinates. poly3d in local coordinates.
DrawAreaAbsolute: PROC [dc: Graphics.Context, poly3d: Poly3d, camera: Camera];
Area is drawn a solid color so normal information is not needed. poly3d in Camera coordinates.
DrawStyleToRope: PROC [drawStyle: DrawStyle] RETURNS [rope: Rope.ROPE];
RopeToDrawStyle: PROC [rope: Rope.ROPE] RETURNS [drawStyle: DrawStyle, success: BOOL];
END.