INTERFACE TrArShade; (* Shading and visibility operations on triangle arrangements. *) IMPORT TrArScene, HLR3; FROM TrArScene IMPORT TriangleList, MaxLights; PROCEDURE Visible( VAR tri: TriangleList; (* Triangles to paint *) opq: TriangleList; (* Opaque triangles *) READONLY obs: HLR3.Point; ); (* Given a list "tri" of triangles, replaces it by a list of all parts of those triangles that are not hidden from "obs" by the opaque triangles "opq". The list nodes of "tri" may be reused, and must be disjoint from the list nodes of "opq". *) PROCEDURE Shadow( VAR tri: TriangleList; (* Triangles to illuminate *) opq: TriangleList; (* Opaque triangles *) READONLY lightPos: HLR3.Point; lightNo: [0..MaxLights-1]; ); (* Given a list "tri" of triangles, splits each element of "sc" into parts that are wholly illuminated or wholly shadowed by the opaque triangles "opq" relative to the given light source. The pieces are returned in "tri", with the illumination field "light[lightNo]" set to TRUE or FALSE, as appropriate. *) PROCEDURE ClipToWindow( VAR sc: TriangleList; (* Scene to clip. *) READONLY w2i: HLR3.PMap; (* World to Image transform matrix. *) xmin, xmax: LONGREAL; (* Image X range. *) ymin, ymax: LONGREAL; (* Image Y range. *) zmax: LONGREAL; (* Image Z (nearness) range. *) ); (* Given a list of triangles "sc", returns the parts of it that lie inside or on the boundary of the image volume "[xmin__xmax] x [ymin__ymax] x [zmin__zmax]" in the Image coordinate system. *) PROCEDURE AuxVisible( VAR tri: TriangleList; (* Triangles to analyze. *) opq: TriangleList; (* Opaque triangles. *) READONLY obs: HLR3.Point; (* Observer. *) invF: BOOLEAN; (* TRUE to return invisible parts. *) VAR vis, inv: TriangleList; (* Visible and invisible parts. *) ); (* Given a list "tri" of triangles, prepends onto "vis" and "inv" the parts of those triangles that are visible and hidden from the point "obs" by the opaque triangles in "opq". A point "p" is deemed to be invisible iff the segment from "obs" to "p" crosses one of the triangles in "opq". The invisible parts are returned only if "invF" is TRUE. Assumes that two triangles with same "plane" field are coplanar and hence cannot hide each other. The procedure will reuse the list nodes of "tri", which must be disjoint from the nodes of "opq". *) END TrArShade.