INTERFACE Pov; (* This module contains common procedures used with the POVray tracer. Last Modification: 17-05-00 by lozada. *) IMPORT R3, LR3, Wr; PROCEDURE WritePOVPoint(wr: Wr.T; READONLY p: LR3.T); (* Writes a 3D point in POVray format. *) PROCEDURE WritePOVColor(wr: Wr.T; READONLY cr: R3.T); (* Writes a rgb color in POVray format. *) PROCEDURE WritePOVCylinder( wr: Wr.T; READONLY o,d: LR3.T; radius: REAL; READONLY cr: R3.T; tr: REAL; tag1, tag2: TEXT := ""; ); (* Defines a finity length cylinder without parallel end caps.*) PROCEDURE WritePOVSphere( wr: Wr.T; READONLY p: LR3.T; radius: REAL; READONLY cr: R3.T; tr: REAL; tag1, tag2: TEXT := ""; ); (* Defines a sphere with center in "p" and radius "radius". POVray has a highly optimized sphere primitive which renders much more quickly that the corresponding polynomial quadric shape. *) PROCEDURE WritePOVTriangle( wr: Wr.T; READONLY a,b,c: LR3.T; READONLY cr: R3.T; tr: REAL; tag1, tag2: TEXT := ""; ); (* Defines a triangle. Because triangle are perfectly flat surfaces it would requiere extremely large numbers of very smal triangles to appro- ximate a smooth, curved surface. *) PROCEDURE WritePOVTriangleTex( wr: Wr.T; READONLY a,b,c: LR3.T; <* UNUSED *> READONLY cr: R3.T; <* UNUSED *> tr: REAL; ); (* Defines a triangle as above but with a some predefined texture face. *) PROCEDURE WritePOVSquare( wr: Wr.T; READONLY a,b,c,d: LR3.T; READONLY cr: R3.T; tr: REAL; ); (* ************************************************************************* // builds a square by the union of two triangular faces, adjacent // to one common edge. // // /\ d // / \ // a /____\ c // \ / // \ / // b \/ //********************************************************************** *) PROCEDURE WritePOVTetrahedron( wr: Wr.T; READONLY u,v,w,x: LR3.T; READONLY du,dv,dw,dx: LONGREAL; color : R3.T; trans : REAL; ); (* ************************************************************************* // builds a tetrahedron sby the union of four triangular faces. // to one common edge. // v // /|\ // / | \ // x /__|__\ w // \ | / // \ | / // \|/ // u //********************************************************************** *) PROCEDURE WritePOVSmoothTriangle( wr: Wr.T; READONLY a, an: LR3.T; READONLY b, bn: LR3.T; READONLY c, cn: LR3.T; READONLY cr: R3.T; tr: REAL ); (* Much of our perception of smooth surfaces is dependent upon the way ligth and shading is done. By artificially modifying the surface normals we can simulate a triangle to be a smooth curved surface. The Smooth- Triangle primitive used the phong shading or interpolation of normals to calculate the surface normal for any point on the triangle based on nor- mal vectors which you define for the three corners. These normal vectors are prohibitivily difficult to computed by hand. Therefore smoothtrian- gles are almost always generated by utility programs. *) (* /**************************************************************************** // Define a pentagon build by the union of three triangular faces, adjacent // to pairs to one common edge. // // .b // / \ // c /___\a // | /| // | / | // |/__| // d e //****************************************************************************/ *) PROCEDURE WritePOVPenta( wr: Wr.T; READONLY a,b,c,d,e: LR3.T; READONLY cr: R3.T; tr: REAL; ); END Pov. (**************************************************************************) (* *) (* Copyright (C) 2000 Universidade Estadual de Campinas (UNICAMP) *) (* *) (* Authors: *) (* L. P. Lozada & J. Stolfi - UNICAMP *) (* *) (* This file can be freely used, distributed, and modified, provided that *) (* this copyright and authorship notice is included in every copy or *) (* derived version. *) (* *) (* DISCLAIMER: This software is offered ``as is'', without any guarantee *) (* as to fitness for any particular purpose. Neither the copyright *) (* holder nor the authors or their employers can be held responsible *) (* for any damages that may result from its use. *) (* *) (**************************************************************************)