File: SVGraphics.mesa
Last edited by Bier on June 30, 1987 4:00:09 pm PDT
Contents: A place to keep the current 3d transform, and the 3d (perspective) drawing routines
DIRECTORY
Imager, ImagerPath, Rope, SV2d, SV3d, SVModelTypes;
SVGraphics: CEDAR DEFINITIONS =
BEGIN
Artwork: TYPE = SVModelTypes.Artwork;
Color: TYPE = Imager.Color;
CoordSystem: TYPE = SVModelTypes.CoordSystem;
DrawStyle: TYPE = SVModelTypes.DrawStyle;
Matrix4by4: TYPE = SV3d.Matrix4by4;
Plane: TYPE = SV3d.Plane;
Point3d: TYPE = SV3d.Point3d;
Point2d: TYPE = SV2d.Point2d;
Poly3d: TYPE = SV3d.Poly3d;
QualityMode: TYPE = SVModelTypes.QualityMode;
LightSource: TYPE = SVModelTypes.LightSource;
LightSourceList: TYPE = SVModelTypes.LightSourceList; -- LIST OF LightSource;
StrokeEnd: TYPE = Imager.StrokeEnd;
Vector3d: TYPE = SV3d.Vector3d;
Camera: TYPE = SVModelTypes.Camera;
FrameBox: TYPE = SVModelTypes.FrameBox;
Projection: TYPE = SVModelTypes.Projection;
CreateCamera: PROC [viewName: Rope.ROPE, coordSys: CoordSystem, screenCS: CoordSystem, resolution: REAL, focalLength: REAL, projection: Projection, frame: FrameBox, clippingPlanes: LIST OF Plane, visibleAssemblies: LIST OF Rope.ROPE, style: DrawStyle, colorFilm: BOOL, useBoundBoxes: BOOL, useBoundSpheresForShadows: BOOL] 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: Imager.Context, camera: Camera];
Clip future drawing operations to the bounding frame of camera.
DoProjection:
PROC [point3d: Point3d, camera: Camera]
RETURNS [newPoint: Point2d];
Does perspective or orthogonal projection as required by camera.
LocalToCamera: PROC [localPoint: Point3d, localCS: CoordSystem, cameraCS: CoordSystem] RETURNS [cameraPoint: Point3d];
LocalToWorld: PROC [localPt: Point3d, localCS: CoordSystem] RETURNS [worldPt: Point3d];
VectorToWorld: PROC [vector: Vector3d, localCS: CoordSystem] RETURNS [worldVector: Vector3d];
DrawFrame:
PROC [dc: Imager.Context, camera: Camera];
Make a line drawing of the rectangular bounding frame of camera.
DRAW LINE SEGMENTS OR PATHS (all segments are clipped in 3d)
SetCP: PROC [dc: Imager.Context, point3d: Point3d, camera: Camera, localCamera: Matrix4by4];
SetCPAbsolute:
PROC [dc: Imager.Context, point3d: Point3d, camera: Camera];
Like SetCP but assumes point3d is in CAMERA coords.
DrawTo: PROC [dc: Imager.Context, point3d: Point3d, camera: Camera, localCamera: Matrix4by4];
DrawToAbsolute:
PROC [dc: Imager.Context, point3d: Point3d, camera: Camera];
Like DrawTo but assumes point3d is in CAMERA coords.
MoveTo: PROC [path: ImagerPath.Trajectory, point3d: Point3d, camera: Camera, localCS: CoordSystem];
MoveToAbsolute:
PROC [path: ImagerPath.Trajectory, point3d: Point3d, camera: Camera];
Like MoveTo but assumes point3d is in CAMERA coords.
LineTo: PROC [path: ImagerPath.Trajectory, point3d: Point3d, camera: Camera, localCS: CoordSystem];
LineToAbsolute:
PROC [path: ImagerPath.Trajectory, point3d: Point3d, camera: Camera];
Like LineTo but assumes point3d is in CAMERA coords.
DrawStroke: PROC [dc: Imager.Context, path: ImagerPath.Trajectory, width: REAL ← 1, closed: BOOLEAN ← FALSE, ends: StrokeEnd ← butt];
DrawFilled: PROC[dc: Imager.Context, path: ImagerPath.Trajectory, parityFill: BOOLEAN ← FALSE];
CONVENIENCE ROUTINES
DrawPolygonAbsolute:
PROC [dc: Imager.Context, poly: Poly3d, width:
REAL ← 1, ends: StrokeEnd ← butt, camera: Camera];
Makes a wireframe drawing of the edges of poly assuming that the vertex coordinates are CAMERA coordinates. Clips in 3D.
DrawLine:
PROC [dc: Imager.Context, start: Point3d, end: Point3d, camera: Camera, localCS: CoordSystem];
Like DrawTo except that starting and ending points are given at the same time.
DrawLineOnScreen:
PROC [dc: Imager.Context, screenPoint1, screenPoint2: Point2d, camera: Camera];
Like DrawLine except that points are given in SCREEN coordinates.
DrawChar:
PROC [dc: Imager.Context, c:
CHARACTER, camera: Camera];
Draws a character at the current point (set by SetCP, SetCPAbsolute, DrawTo, or DrawToAbsolute).
DrawArea:
PROC [dc: Imager.Context, localNormal: Vector3d, poly3d: Poly3d, artwork: Artwork, lightSources: LightSourceList, camera: Camera, localCS: CoordSystem];
Convert the given polygon to WORLD coordinates and use the lighting model specified by artwork to compute the shading. Draw onto dc. localNormal and poly3d are in local coordinates.
DrawAreaNormalAbsolute:
PROC [dc: Imager.Context, cameraNormal: Vector3d, poly3d: Poly3d, artwork: Artwork, lightSources: LightSourceList, camera: Camera, local
World, local
Camera: Matrix4by4];
Like DrawArea, but cameraNormal is in Camera coordinates. poly3d in local coordinates as before.
DrawAreaAbsolute:
PROC [dc: Imager.Context, poly3d: Poly3d, camera: Camera];
The polygon is drawn a solid color so normal information is not needed. poly3d in Camera coordinates.
DRAW INFINITE OBJECTS
DrawHorizonOfPlane:
PROC [dc: Imager.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
Plane in local coordinates.
DrawHorizonOfPlaneAbsolute:
PROC [dc: Imager.Context, plane: Plane, camera: Camera];
Plane in CAMERA coordinates.
DrawInfiniteLine:
PROC [dc: Imager.Context, p1, p2: Point3d, camera: Camera, localCS: CoordSystem, clippedBy: Imager.Rectangle];
p1 and p2 are assumed to be in local coordinates.
DrawInfiniteLineAbsolute:
PROC [dc: Imager.Context, p1, p2: Point3d, camera: Camera, localCS: CoordSystem, clippedBy: Imager.Rectangle];
p1 and p2 are assumed to be in CAMERA coordinates.
DrawInfinitePlaneWireFrame:
PROC [dc: Imager.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
plane is assumed to be in local coordinates.
DrawInfinitePlaneWireFrameAbsolute:
PROC [dc: Imager.Context, plane: Plane, camera: Camera, localCS: CoordSystem];
plane is assumed to be in CAMERA coordinates.
DrawInfinitePlaneShaded:
PROC [dc: Imager.Context, plane: Plane, artwork: Artwork, lightSources: LightSourceList, camera: Camera, localCS: CoordSystem];
plane is assumed to be in local coordinates.
DrawInfinitePlaneShadedAbsolute:
PROC [dc: Imager.Context, plane: Plane, artwork: Artwork, lightSources: LightSourceList, camera: Camera];
plane is assumed to be in CAMERA coordinates.
DrawStyleToRope: PROC [drawStyle: DrawStyle] RETURNS [rope: Rope.ROPE];
RopeToDrawStyle: PROC [rope: Rope.ROPE] RETURNS [drawStyle: DrawStyle, success: BOOL];
ProjectionToRope: PROC [projection: Projection] RETURNS [rope: Rope.ROPE];
RopeToProjection:
PROC [rope: Rope.
ROPE]
RETURNS [projection: Projection, success:
BOOL];
END.