/* normal3d.f -- translated by f2c (version 20061008). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include "f2c.h" /* Common Block Declarations */ struct { integer ntx, nty, npx, npy; } raster_; #define raster_1 raster_ struct { real xcent, ycent, scale, eyepos, sxcent, sycent, tmat[16] /* was [4][4] */, tinv[16] /* was [4][4] */, tinvt[16] /* was [4][4] */, srot[16] /* was [4][4] */, srtinv[16] /* was [4][4] */, srtinvt[16] /* was [4][4] */, rafter[16] /* was [4][4] */, tafter[3]; } matrices_; #define matrices_1 matrices_ struct { integer assout; logical verbose; } asscom_; #define asscom_1 asscom_ struct { real trulim[6] /* was [3][2] */, zlim[2], frontclip, backclip; integer isolation; } niceties_; #define niceties_1 niceties_ /* Table of constant values */ static integer c__3 = 3; static integer c__1 = 1; static integer c__2 = 2; static integer c_n1 = -1; static integer c__9 = 9; static logical c_false = FALSE_; static integer c__4 = 4; static integer c__8 = 8; static real c_b295 = 0.f; static real c_b304 = 1.f; static integer c__0 = 0; /* Main program */ int MAIN__(void) { /* Format strings */ static char fmt_1[] = "(a)"; static char fmt_22[] = "(2i6)"; static char fmt_12[] = "(a,1x,1f6.2,a)"; static char fmt_14[] = "(1x,3f8.4,12x,a)"; static char fmt_13[] = "(1x,f9.5,1x,f4.1,1x,f9.5,3x,f4.1,5x,a)"; static char fmt_91[] = "(3f10.5,1x,3f10.5,1x,3f10.5,1x,3f6.3)"; static char fmt_92[] = "(3f10.5,1x,f10.5,1x,3f6.3)"; static char fmt_93[] = "(3f10.5,1x,f10.5,1x,3f10.5,1x,f10.5,1x,3f6.3)"; static char fmt_94[] = "(f5.0,1x,f5.2,1x,3f7.3,1x,f6.3,3x,4f6.1)"; static char fmt_702[] = "(a)"; static char fmt_801[] = "(3f10.4,2x,3f6.3)"; static char fmt_802[] = "(4f10.4,1x,f4.2,1x,i4,1x,i4,2x,3f6.3)"; static char fmt_803[] = "(4f10.4,4x,3f6.3,/,10(1x,f10.4))"; static char fmt_775[] = "(\002Post-rotation matrix: \002,3(/,3f10.4))"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3[2]; real r__1, r__2, r__3; logical L__1; char ch__1[88], ch__2[89]; icilist ici__1; olist o__1; cllist cl__1; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_cmp(char *, char *, ftnlen, ftnlen), s_rsli(icilist *), do_lio( integer *, integer *, char *, ftnlen), e_rsli(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void), s_rsfi(icilist *), e_rsfi(void), f_open(olist *), s_wsle(cilist * ), e_wsle(void), s_rsfe(cilist *), e_rsfe(void); double sqrt(doublereal); integer s_rsle(cilist *), e_rsle(void); double cos(doublereal), sin(doublereal); integer f_clos(cllist *); /* Local variables */ static char fullname[128], fontname[80]; static real fontsize, d__; static integer i__, j, k, l, n; static real x, y, z__; static char fontalign[80]; static real p1, p2; extern /* Subroutine */ int liblookup_(char *, char *, ftnlen, ftnlen); static integer ii; static real ra, sb, xa, ya, za, sg, xb, yb, zb, sr, xn, yn, zn, r1a, r2a, x1a, y1a, z1a, x2a, y2a, z2a, x3a, y3a, z3a, x1b, y1b, z1b, x2b, y2b, z2b, x3b, y3b, z3b, red; extern doublereal det_(real *); static real buf[100], blu; static integer nax, nay; static real grn, xnb, ynb, znb, opt[4]; static char labelstring[128]; static integer idet[19]; static char line[132]; static integer narg, kbrk; static real smag; static integer ndet; static real plen; static integer sdet[19], mdet; extern logical qinp_(real *, real *, logical *, real *); static logical skip; static real glow; static integer gopt; extern /* Subroutine */ int exit_(integer *); static real temp; extern integer ungz_(char *, char *, ftnlen, ftnlen); static logical hflag; static real bkgnd[3]; extern integer iargc_(void); static logical sflag; static char flags[80]; static logical inflg, xflag; static real phong; static char infmt__[80]; static real sspec; static char title[132]; static real zclip; static integer input; static real ambien; extern /* Subroutine */ int chkrgb_(real *, real *, real *, char *, ftnlen); static integer ialign, scheme; extern /* Subroutine */ int getarg_(integer *, char *, ftnlen); static integer inmode; static real sepang; static integer nplane, ilevel; static logical shadow; static integer iphong; static real speclr; static logical inflgs[19], isquad; static char tmpnam[80]; static real source[3]; static char infmts[80*19]; static real strait, qtrans[17]; static integer lentmp, gphong; extern /* Subroutine */ int assert_(logical *, char *, ftnlen); static real primar, diffus, cossep, sinsep, cosphi, sinphi; extern /* Subroutine */ int qsetup_(void); static integer npropm, nquads, intype; extern /* Subroutine */ int transf_(real *, real *, real *); static integer nnorms; static real sphong, clrity; static integer nlabels; static real glowrad; static integer ncylind, nplanes, ntriang, nsphere, nbounds, ibptype; static real glowsrc[3]; static integer ntransp; /* Fortran I/O blocks */ static cilist io___18 = { 0, 0, 0, "(A,A)", 0 }; static icilist io___19 = { 1, flags, 1, "(1f6.0)", 80, 1 }; static cilist io___20 = { 0, 0, 0, "(/,A,A)", 0 }; static cilist io___21 = { 0, 0, 0, "(A)", 0 }; static cilist io___22 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___23 = { 0, 0, 0, "(4X,A,1X,A)", 0 }; static cilist io___24 = { 0, 0, 0, 0, 0 }; static cilist io___25 = { 0, 0, 0, 0, 0 }; static cilist io___26 = { 0, 0, 0, 0, 0 }; static cilist io___27 = { 0, 0, 0, 0, 0 }; static cilist io___28 = { 0, 0, 0, 0, 0 }; static cilist io___29 = { 0, 0, 0, 0, 0 }; static cilist io___30 = { 0, 0, 0, 0, 0 }; static cilist io___31 = { 0, 0, 0, 0, 0 }; static cilist io___34 = { 0, 0, 0, fmt_1, 0 }; static cilist io___36 = { 0, 6, 0, fmt_1, 0 }; static cilist io___37 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___38 = { 1, 0, 0, "(A)", 0 }; static cilist io___39 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___40 = { 0, 6, 0, fmt_1, 0 }; static cilist io___41 = { 0, 1, 0, fmt_1, 0 }; static cilist io___42 = { 0, 2, 0, fmt_1, 0 }; static cilist io___43 = { 0, 0, 1, fmt_1, 0 }; static icilist io___45 = { 1, line, 0, 0, 132, 1 }; static cilist io___46 = { 0, 0, 1, fmt_1, 0 }; static icilist io___47 = { 1, line, 0, 0, 132, 1 }; static cilist io___48 = { 0, 0, 1, fmt_1, 0 }; static icilist io___49 = { 1, line, 0, 0, 132, 1 }; static cilist io___51 = { 0, 6, 0, fmt_22, 0 }; static cilist io___52 = { 0, 6, 0, fmt_22, 0 }; static cilist io___53 = { 0, 6, 0, fmt_22, 0 }; static cilist io___54 = { 0, 1, 0, fmt_22, 0 }; static cilist io___55 = { 0, 1, 0, fmt_22, 0 }; static cilist io___56 = { 0, 1, 0, fmt_22, 0 }; static cilist io___57 = { 0, 2, 0, fmt_22, 0 }; static cilist io___58 = { 0, 2, 0, fmt_22, 0 }; static cilist io___59 = { 0, 2, 0, fmt_22, 0 }; static cilist io___60 = { 0, 0, 0, fmt_1, 0 }; static icilist io___61 = { 0, line, 0, 0, 132, 1 }; static cilist io___63 = { 0, 6, 0, fmt_1, 0 }; static cilist io___64 = { 0, 1, 0, fmt_1, 0 }; static cilist io___65 = { 0, 2, 0, fmt_1, 0 }; static cilist io___66 = { 0, 0, 0, fmt_1, 0 }; static icilist io___67 = { 0, line, 0, 0, 132, 1 }; static cilist io___69 = { 0, 6, 0, fmt_1, 0 }; static cilist io___70 = { 0, 1, 0, fmt_1, 0 }; static cilist io___71 = { 0, 2, 0, fmt_1, 0 }; static cilist io___72 = { 0, 0, 0, fmt_1, 0 }; static icilist io___73 = { 0, line, 0, 0, 132, 1 }; static cilist io___76 = { 0, 6, 0, fmt_1, 0 }; static cilist io___77 = { 0, 1, 0, fmt_1, 0 }; static cilist io___78 = { 0, 2, 0, fmt_1, 0 }; static cilist io___79 = { 0, 0, 0, fmt_1, 0 }; static icilist io___80 = { 0, line, 0, 0, 132, 1 }; static cilist io___82 = { 0, 6, 0, fmt_1, 0 }; static cilist io___83 = { 0, 1, 0, fmt_1, 0 }; static cilist io___84 = { 0, 2, 0, fmt_1, 0 }; static cilist io___86 = { 0, 0, 0, fmt_1, 0 }; static icilist io___87 = { 0, line, 0, 0, 132, 1 }; static cilist io___89 = { 0, 6, 0, fmt_1, 0 }; static cilist io___90 = { 0, 1, 0, fmt_1, 0 }; static cilist io___91 = { 0, 2, 0, fmt_1, 0 }; static cilist io___92 = { 0, 0, 0, fmt_1, 0 }; static icilist io___93 = { 0, line, 0, 0, 132, 1 }; static cilist io___95 = { 0, 6, 0, fmt_1, 0 }; static cilist io___96 = { 0, 1, 0, fmt_1, 0 }; static cilist io___97 = { 0, 2, 0, fmt_1, 0 }; static cilist io___99 = { 0, 0, 0, fmt_1, 0 }; static icilist io___100 = { 0, line, 0, 0, 132, 1 }; static cilist io___101 = { 0, 6, 0, fmt_1, 0 }; static cilist io___102 = { 0, 1, 0, fmt_1, 0 }; static cilist io___103 = { 0, 2, 0, fmt_1, 0 }; static cilist io___104 = { 0, 0, 0, fmt_1, 0 }; static icilist io___105 = { 0, line, 0, 0, 132, 1 }; static cilist io___107 = { 0, 6, 0, fmt_1, 0 }; static cilist io___109 = { 0, 0, 0, 0, 0 }; static cilist io___110 = { 0, 0, 0, 0, 0 }; static cilist io___111 = { 0, 0, 0, 0, 0 }; static cilist io___112 = { 0, 6, 0, 0, 0 }; static cilist io___113 = { 0, 6, 0, 0, 0 }; static cilist io___114 = { 0, 6, 0, 0, 0 }; static cilist io___115 = { 0, 6, 0, 0, 0 }; static cilist io___116 = { 0, 0, 0, fmt_12, 0 }; static cilist io___122 = { 0, 2, 0, fmt_14, 0 }; static cilist io___123 = { 0, 1, 0, fmt_14, 0 }; static cilist io___124 = { 0, 1, 0, fmt_13, 0 }; static cilist io___125 = { 0, 1, 0, fmt_13, 0 }; static cilist io___126 = { 0, 1, 0, fmt_13, 0 }; static cilist io___127 = { 0, 1, 0, fmt_13, 0 }; static cilist io___128 = { 0, 2, 0, fmt_13, 0 }; static cilist io___129 = { 0, 2, 0, fmt_13, 0 }; static cilist io___130 = { 0, 2, 0, fmt_13, 0 }; static cilist io___131 = { 0, 2, 0, fmt_13, 0 }; static cilist io___132 = { 0, 1, 0, fmt_14, 0 }; static cilist io___133 = { 0, 1, 0, 0, 0 }; static cilist io___134 = { 0, 1, 0, 0, 0 }; static cilist io___135 = { 0, 1, 0, 0, 0 }; static cilist io___136 = { 0, 1, 0, 0, 0 }; static cilist io___137 = { 0, 2, 0, fmt_14, 0 }; static cilist io___138 = { 0, 2, 0, 0, 0 }; static cilist io___139 = { 0, 2, 0, 0, 0 }; static cilist io___140 = { 0, 2, 0, 0, 0 }; static cilist io___141 = { 0, 2, 0, 0, 0 }; static cilist io___147 = { 0, 0, 0, fmt_1, 0 }; static icilist io___148 = { 0, line, 0, 0, 132, 1 }; static cilist io___150 = { 0, 6, 0, fmt_1, 0 }; static cilist io___151 = { 0, 1, 0, fmt_1, 0 }; static cilist io___152 = { 0, 2, 0, fmt_1, 0 }; static cilist io___153 = { 0, 0, 0, 0, 0 }; static cilist io___154 = { 0, 0, 0, "(A)", 0 }; static cilist io___156 = { 0, 6, 0, "(A1)", 0 }; static cilist io___157 = { 0, 1, 0, "(A1)", 0 }; static cilist io___158 = { 0, 2, 0, "(A1)", 0 }; static cilist io___161 = { 0, 0, 0, "(A)", 0 }; static cilist io___163 = { 0, 6, 0, "(A1)", 0 }; static cilist io___164 = { 0, 1, 0, "(A1)", 0 }; static cilist io___165 = { 0, 2, 0, "(A1)", 0 }; static cilist io___178 = { 0, 0, 1, "(A)", 0 }; static cilist io___179 = { 0, 6, 0, fmt_1, 0 }; static icilist io___180 = { 0, line, 1, 0, 132, 1 }; static cilist io___181 = { 0, 6, 0, fmt_1, 0 }; static cilist io___184 = { 0, 0, 0, 0, 0 }; static cilist io___185 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___186 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___187 = { 0, 6, 0, fmt_1, 0 }; static cilist io___188 = { 0, 6, 0, "(I2)", 0 }; static cilist io___189 = { 0, 0, 1, 0, 0 }; static cilist io___191 = { 0, 0, 1, infmt__, 0 }; static cilist io___205 = { 0, 6, 0, fmt_91, 0 }; static cilist io___210 = { 0, 6, 0, fmt_92, 0 }; static cilist io___213 = { 0, 6, 0, fmt_93, 0 }; static cilist io___224 = { 0, 6, 0, fmt_91, 0 }; static cilist io___225 = { 0, 6, 0, fmt_91, 0 }; static cilist io___226 = { 0, 6, 0, fmt_91, 0 }; static cilist io___235 = { 0, 6, 0, fmt_94, 0 }; static cilist io___236 = { 0, 0, 1, "(A)", 0 }; static cilist io___238 = { 0, 6, 0, "(A9,1X,F9.3)", 0 }; static cilist io___239 = { 0, 6, 0, "(A8,2X,F9.3)", 0 }; static cilist io___251 = { 0, 6, 0, "(A14,I3,3(1X,F10.5),3F9.5)", 0 }; static cilist io___252 = { 0, 6, 0, fmt_1, 0 }; static cilist io___253 = { 0, 0, 1, "(A)", 0 }; static icilist io___254 = { 0, line, 0, 0, 132, 1 }; static cilist io___259 = { 0, 6, 0, fmt_1, 0 }; static cilist io___260 = { 0, 0, 1, fmt_702, 0 }; static cilist io___263 = { 0, 6, 0, fmt_801, 0 }; static cilist io___264 = { 0, 6, 0, fmt_1, 0 }; static cilist io___270 = { 0, 6, 0, fmt_802, 0 }; static cilist io___273 = { 0, 6, 0, fmt_803, 0 }; static cilist io___274 = { 0, 0, 1, fmt_702, 0 }; static cilist io___275 = { 0, 6, 0, fmt_1, 0 }; static cilist io___276 = { 0, 6, 0, "('FRONTCLIP ',f7.3)", 0 }; static icilist io___277 = { 0, line+9, 0, 0, 123, 1 }; static cilist io___278 = { 0, 6, 0, "('BACKCLIP ',f7.3)", 0 }; static cilist io___279 = { 1, 0, 0, 0, 0 }; static cilist io___280 = { 0, 0, 0, fmt_775, 0 }; static cilist io___282 = { 0, 0, 0, 0, 0 }; static cilist io___283 = { 0, 6, 0, "('DUMMY ROTATION')", 0 }; static cilist io___284 = { 1, 0, 0, 0, 0 }; static cilist io___285 = { 0, 6, 0, "('DUMMY TRANSLATION')", 0 }; static cilist io___286 = { 0, 6, 0, fmt_1, 0 }; static cilist io___287 = { 0, 0, 0, "(A,A)", 0 }; static cilist io___288 = { 0, 0, 0, 0, 0 }; static cilist io___289 = { 0, 0, 0, 0, 0 }; static cilist io___290 = { 0, 0, 0, 0, 0 }; static cilist io___291 = { 0, 0, 0, 0, 0 }; static cilist io___292 = { 0, 0, 0, 0, 0 }; static cilist io___293 = { 0, 0, 0, 0, 0 }; static cilist io___294 = { 0, 0, 0, 0, 0 }; static cilist io___295 = { 0, 0, 0, 0, 0 }; static cilist io___296 = { 0, 0, 0, 0, 0 }; static cilist io___297 = { 0, 0, 0, 0, 0 }; static cilist io___298 = { 0, 0, 0, 0, 0 }; static cilist io___299 = { 0, 0, 0, 0, 0 }; static cilist io___300 = { 0, 0, 0, 0, 0 }; static cilist io___301 = { 0, 0, 0, 0, 0 }; static cilist io___302 = { 0, 0, 0, 0, 0 }; static cilist io___303 = { 0, 0, 0, 0, 0 }; static cilist io___304 = { 0, 0, 0, "(3F10.4)", 0 }; /* Version 2.6e 19-Apr-2002 */ /* EAM Jan 1996 - Initial release as part of version 2.2 */ /* EAM Aug 1996 - Add -expand option to deal with file indirection */ /* EAM Feb 1997 - Handle additional MATERIAL records */ /* -stereo flag to generate left.r3d and right.r3d */ /* EAM Apr 1997 - now handles labels and glowlights */ /* EAM May 1997 - (well, now it does) V2.3c */ /* EAM Jul 1997 - quadric surfaces, ISOLATION */ /* EAM Oct 1997 - fix bug that prevented handling CYLFLAT objects */ /* EAM Nov 1997 - handle VERTEXRGB records, allow # as comment */ /* EAM Jul 1998 - remove Q format from LABEL input; wrong, but fewer complaints */ /* EAM Oct 1998 - check environmental variable R3D_LIB for input file indirection */ /* EAM Feb 1999 - FRONTCLIP, BACKCLIP */ /* EAM Jul 1999 - preliminary work towards a post-hoc rotation option */ /* EAM Jan 2000 - V2.5b general release */ /* EAM Feb 2000 - compatible with new object type VERTRANSP */ /* EAM Sep 2000 - V2.5e uncompress files ending in .Z or .gz */ /* EAM Feb 2001 - BOUNDING_PLANEs */ /* EAM Feb 2002 - [-stereo [TMPNAM]] [-angle AA] */ /* stereo defaults to shear (as before); force EYEPOS = 0 */ /* but specifying -angle AA switches to +/- AA separation instead */ /* You can't win: shear breaks bounding planes, AA breaks Z-clip */ /* This program is part of the Raster3D package. */ /* It is simply a stripped down version of the input section of render. */ /* It reads in a render input file, applies the transformation matrix in */ /* the header, and writes out a modified render input file describing the */ /* same image using a unitary transformation matrix and normalized object */ /* coordinates. All header records are basically passed through without */ /* interpretation except for the transformation matrix (which changes to the */ /* identity matrix) and the format lines (which are set to *). */ /* Input (line by line except where noted): */ /* - TITLE anything you like */ /* - NTX,NTY tiles in each direction */ /* - NPX,NPY pixels per tile to compute in each direction */ /* - SCHEME pixel averaging scheme (0, 1, 2, 3 or 4) */ /* - 0 no anti-aliasing, maintain alpha channel */ /* - 1 no anti-aliasing, no alpha channel */ /* - 2 means 2x2 computing pixels for 1 output pixel */ /* - 3 means 3x3 computing pixels for 2x2 output pixels */ /* - 4 like 3, but NTX..NPY specify final rather than initial raster */ /* - BKGND background colour (r,g,b in range 0 to 1) */ /* - SHADOW "shadow mode?" (T or F) */ /* - IPHONG Phong power (e.g., 20) */ /* - STRAIT straight-on (2ndary) light component (e.g., 0.1) */ /* - AMBIEN ambient light component (e.g., 0.05) */ /* - SPECLR specular reflection component (e.g., 0.30) */ /* - EYEPOS eye position (e.g., 4) */ /* - relative to 1=narrow dimension of screen */ /* - used for perspective (0.0 = no perspective) */ /* - don't put it in the transformation matrix yourself */ /* - SOURCE main light source position (x,y,z components) */ /* - vector length ignored, point source is at infinity */ /* - TMAT global transformation on input objects */ /* - postfix 4x4 matrix on 4 lines, as you would write it */ /* - upper left 3x3 must be pure rotation */ /* - lower left 1x3 is translation */ /* - lower right 1x1 is global scaling (reduction) */ /* - upper right 3x1 causes extra perspective (should be 0) */ /* - applies to homogeneous co-ordinates (x,y,z,1) */ /* - radii are only scaled down by global scaling TMAT(4,4) */ /* - INMODE object input mode (1, 2, or 3) */ /* - mode 1: all objects are triangles */ /* - mode 2: all objects are spheres */ /* - mode 3: each object will be preceded by type */ /* - INFMT or INFMTS object input format(s), 1 per line */ /* - one format for modes 1 and 2, or three for mode 3 */ /* - each is fortran format in parentheses, or single * */ /* - for 3 formats, the order of formats and details is: */ /* - triangle: x1,y1,z1,x2,y2,z2,x3,y3,z3,r,g,b */ /* - sphere: x,y,z,radius,r,g,b */ /* - trcone: x1,y1,z1,rad1,x2,y2,z2,rad2,r,g,b */ /* - cylinder: as truncated cone, but 2nd radius ignored */ /* - objects */ /* - modes 1,2: each object starts on a new line */ /* - read according to the single format given */ /* - mode 3: each object is preceded by a line giving type */ /* - type 1: triangle */ /* - type 2: sphere */ /* - type 3: cylinder with rounded ends */ /* - type 4: trcone made of spheres (not implemented) */ /* - type 5: cylinder with flat ends */ /* - type 6: plane (=triangle with infinite extent) */ /* - type 7: normal vectors for previous triangle */ /* - type 8: material definition which applies to subsequent objects */ /* - type 9: end previous material */ /* - type 10: font specifier, we need to note coordinate convention */ /* - type 11: label, we may have to modify coordinates */ /* - type 12: reserved for more labeling options */ /* - type 13: glowlight */ /* - type 14: quadric surface */ /* - type 15: don't apply TMAT to subsequent objects */ /* - type 16: global property on following line */ /* - type 17: vertex colors for previous object */ /* - type 18: vertex transparencies for previous object */ /* - type 19: variant of type 15; forces unitary coordinate sytem */ /* - type 0: no more objects (equivalent to eof) */ /* ----------------------------------------------------------------------------- */ /* Overkill: */ /* I/O units for control input, file indirection, data output, info output */ /* User-settable array limits */ /* $$$$$$$$$$$$$ ARRAY SIZE LIMITS START HERE $$$$$$$$$$$$$$ */ /* Maximum number of tiles */ /* Number of shadow tiles */ /* ** (One of these can fail to be enough when the aspect ratio is */ /* ** extreme or when the model is far from being "centred" near z=0. */ /* ** Keep them well ahead of MAXNTX, MAXNTY to be on the safe side) */ /* ** EAM - Allow soft failure and monitor required values in NSXMAX,NSYMAX */ /* Maximum number of pixels per tile */ /* Maximum number of objects */ /* ** PARAMETER (MAXOBJ = 7500) */ /* Array elements available for object details */ /* Should be roughly 10*MAXOBJ */ /* ** PARAMETER (MAXDET = 150 000, MAXSDT = 150 000) */ /* ** PARAMETER (MAXDET = 2 000 000, MAXSDT = 2 000 000) */ /* Array elements available for sorted lists ("short" lists) */ /* Increased requirements as more objects are stacked behind each other */ /* ** PARAMETER (MAXSHR = 150 000, MAXSSL = 150 000) */ /* Maximum number of MATERIAL definitions (object type 8) */ /* Maximum number of stacked transparent objects at any single pixel */ /* (any further further stacking is ignored) */ /* Maximum number of non-shadowing lights (object type 13) */ /* Maximum levels of file indirection in input stream */ /* $$$$$$$$$$$$$$$$$ END OF LIMITS $$$$$$$$$$$$$$$$$$$$$$$ */ /* Other possibly platform-dependent stuff */ /* Slop is related to the accuracy (in pixels) to which we must predict */ /* shadow edges. Too low a value causes whole triangles to be spuriously */ /* in shadow; too high a value may cause shadows to be missed altogether. */ /* Perfect accuracy in floating point calculations would allow SLOP << 1. */ /* Edgeslop is similarly a kludge for dealing with triangles whose explicit */ /* normals describe wrapping around from front-facing to back-facing. */ /* Ribbonslop is a kludge so that distortion due to perspective doesn't */ /* prevent us from identifying ribbon triangles */ /* Codes for triangle, sphere, truncated cone, and string of pearls */ /* $$$$$$$$$$$$$$$$$ END OF LIMITS $$$$$$$$$$$$$$$$$$$$$$$ */ /* Title for run */ /* Number of tiles */ /* Pixel averaging scheme */ /* Background colour */ /* "Shadow mode?" */ /* Phong power */ /* Straight-on (secondary) light source contribution */ /* Ambient light contribution */ /* Specular reflection component */ /* Primary light source position */ /* Input transformation */ /* Transformation matrix, inverse, and transposed inverse */ /* Shortest rotation from light source to +z axis */ /* Post-hoc transformation on top of original TMAT */ /* Distance (in +z) of viewing eye */ /* Input mode */ /* Buffer one line of input for decoding */ /* Input format(s) */ /* Free-format input flag */ /* Allow very long names for file indirection */ /* Stuff for shading */ /* REAL NL(3),NORMAL(3),LDOTN */ /* REAL RGBCUR(3),RGBSHD(3),RGBFUL(3) */ /* REAL SPECOL(3) */ /* Support for transparency */ /* Support for quadric surfaces */ /* Input buffer for details */ /* Copy of NOISE for ASSERT to see */ /* The number of "details" each object type is supposed to have */ /* : input, object, shadow */ /* Stuff for labels */ /* Support for a "glow" light source */ /* Support for decompression on the fly */ /* Support for BOUNDING_PLANE internal object type */ /* Keep track of actual coordinate limits (for information only) */ /* Assume no clipping */ niceties_1.backclip = -1e37f; niceties_1.frontclip = 1e37f; niceties_1.trulim[0] = 1e37f; niceties_1.trulim[1] = 1e37f; niceties_1.trulim[2] = 1e37f; niceties_1.trulim[3] = -1e37f; niceties_1.trulim[4] = -1e37f; niceties_1.trulim[5] = -1e37f; idet[0] = 12; idet[1] = 7; idet[4] = 11; idet[2] = 11; idet[5] = 12; idet[6] = 9; idet[7] = 10; idet[10] = 6; idet[12] = 10; idet[13] = 17; idet[16] = 9; idet[17] = 3; idet[3] = 20; sdet[0] = 13; sdet[1] = 4; sdet[2] = 8; sdet[13] = 14; sdet[3] = 20; sdet[5] = 1; sdet[6] = 1; sdet[7] = 1; sdet[12] = 1; sdet[16] = 1; sdet[17] = 1; /* -h option suppresses header records in output */ /* -expand option expands and in-lines all file indirection */ /* (and normalizes the in-lined data) */ /* -noexpand (the default) simply copies file indirection commands */ /* to output file */ /* -stereo will create parallel files left.r3d and right.r3d */ /* -debug requests additional output information */ /* -angle specifies angular offset of left/right views from the original */ /* e.g. -angle 3.0 sets left eye view to +3 degress, right eye to -3 degrees */ hflag = FALSE_; xflag = FALSE_; sflag = FALSE_; skip = FALSE_; nax = -1; nay = -1; sepang = 0.f; s_copy(tmpnam, "_", (ftnlen)80, (ftnlen)1); i__ = 1; narg = iargc_(); L10: if (i__ > narg) { goto L11; } getarg_(&i__, flags, (ftnlen)80); if (s_cmp(flags, "-h", (ftnlen)2, (ftnlen)2) == 0 && s_cmp(flags, "-help", (ftnlen)5, (ftnlen)5) != 0) { hflag = TRUE_; } else if (s_cmp(flags, "-exp", (ftnlen)4, (ftnlen)4) == 0) { xflag = TRUE_; } else if (s_cmp(flags, "-size", (ftnlen)5, (ftnlen)5) == 0) { ++i__; getarg_(&i__, flags, (ftnlen)80); kbrk = 2; for (k = 15; k >= 2; --k) { if (*(unsigned char *)&flags[k - 1] == 'x') { kbrk = k; } if (*(unsigned char *)&flags[k - 1] == 'X') { kbrk = k; } } ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = kbrk - 1; ici__1.iciunit = flags; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__3, &c__1, (char *)&nax, (ftnlen)sizeof(integer)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } i__2 = kbrk; ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = 15 - i__2; ici__1.iciunit = flags + i__2; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__3, &c__1, (char *)&nay, (ftnlen)sizeof(integer)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } } else if (s_cmp(flags, "-stereo", (ftnlen)7, (ftnlen)7) == 0) { sflag = TRUE_; lentmp = 1; if (i__ < narg) { i__1 = i__ + 1; getarg_(&i__1, flags, (ftnlen)80); if (*(unsigned char *)flags != '-') { for (j = 1; j <= 80; ++j) { if (*(unsigned char *)&flags[j - 1] < '!') { goto L88; } } L88: lentmp = j; /* Writing concatenation */ i__3[0] = lentmp - 1, a__1[0] = flags; i__3[1] = 1, a__1[1] = "_"; s_cat(tmpnam, a__1, i__3, &c__2, (ftnlen)80); skip = TRUE_; } } s_wsfe(&io___18); do_fio(&c__1, "tmpdir = ", (ftnlen)9); do_fio(&c__1, tmpnam, lentmp); e_wsfe(); } else if (s_cmp(flags, "-debug", (ftnlen)6, (ftnlen)6) == 0) { asscom_1.verbose = TRUE_; } else if (s_cmp(flags, "-ang", (ftnlen)4, (ftnlen)4) == 0) { if (i__ < narg) { i__1 = i__ + 1; getarg_(&i__1, flags, (ftnlen)80); i__1 = s_rsfi(&io___19); if (i__1 != 0) { goto L89; } i__1 = do_fio(&c__1, (char *)&sepang, (ftnlen)sizeof(real)); if (i__1 != 0) { goto L89; } i__1 = e_rsfi(); if (i__1 != 0) { goto L89; } skip = TRUE_; } } else if (skip) { skip = FALSE_; } else { goto L89; } ++i__; goto L10; L89: s_wsfe(&io___20); do_fio(&c__1, "Raster3D Normalization Program ", (ftnlen)31); do_fio(&c__1, "V2.7d ", (ftnlen)8); e_wsfe(); s_wsfe(&io___21); do_fio(&c__1, "syntax:", (ftnlen)7); e_wsfe(); s_wsfe(&io___22); do_fio(&c__1, " normal3d [options] < infile.r3d > outfile.r3d", (ftnlen) 47); e_wsfe(); s_wsfe(&io___23); do_fio(&c__1, "-h ", (ftnlen)16); do_fio(&c__1, "suppress header records in output", (ftnlen)33); do_fio(&c__1, "-expand ", (ftnlen)16); do_fio(&c__1, "expand and in-line all file indirection", (ftnlen)39); do_fio(&c__1, "-size HHHxVVV ", (ftnlen)16); do_fio(&c__1, "set output image size", (ftnlen)21); do_fio(&c__1, "-stereo [tmpdir]", (ftnlen)16); do_fio(&c__1, "create $$_left.r3d and $$_right.r3d in tmpdir", (ftnlen)45) ; e_wsfe(); exit_(&c_n1); L11: if (sflag) { hflag = TRUE_; o__1.oerr = 0; o__1.ounit = 1; o__1.ofnmlen = lentmp + 8; /* Writing concatenation */ i__3[0] = lentmp, a__1[0] = tmpnam; i__3[1] = 8, a__1[1] = "left.r3d"; s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)88); o__1.ofnm = ch__1; o__1.orl = 0; o__1.osta = "UNKNOWN"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; f_open(&o__1); o__1.oerr = 0; o__1.ounit = 2; o__1.ofnmlen = lentmp + 9; /* Writing concatenation */ i__3[0] = lentmp, a__1[0] = tmpnam; i__3[1] = 9, a__1[1] = "right.r3d"; s_cat(ch__2, a__1, i__3, &c__2, (ftnlen)89); o__1.ofnm = ch__2; o__1.orl = 0; o__1.osta = "UNKNOWN"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; f_open(&o__1); } /* Copy the info (also error reporting) unit number to common */ asscom_1.assout = 0; s_wsle(&io___24); do_lio(&c__9, &c__1, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", (ftnlen)38) ; do_lio(&c__9, &c__1, "%%%%%%%%%%%%%%%%%%%%%%%%%%", (ftnlen)26); e_wsle(); s_wsle(&io___25); do_lio(&c__9, &c__1, "% Raster3D normalization ", (ftnlen)37); do_lio(&c__9, &c__1, "program ", (ftnlen)8); do_lio(&c__9, &c__1, "V2.7d ", (ftnlen)8); do_lio(&c__9, &c__1, " %", (ftnlen)11); e_wsle(); s_wsle(&io___26); do_lio(&c__9, &c__1, "% -----------------------", (ftnlen)37); do_lio(&c__9, &c__1, "------------- %", (ftnlen)27); e_wsle(); s_wsle(&io___27); do_lio(&c__9, &c__1, "% If you publish figures generated by this ", ( ftnlen)43); do_lio(&c__9, &c__1, "program please cite %", (ftnlen)21); e_wsle(); s_wsle(&io___28); do_lio(&c__9, &c__1, "% Merritt & Bacon (1997) ", (ftnlen)28); do_lio(&c__9, &c__1, "Meth. Enzymol. 277, 505-524.", (ftnlen)28); do_lio(&c__9, &c__1, " %", (ftnlen)8); e_wsle(); s_wsle(&io___29); do_lio(&c__9, &c__1, "% -----------------------", (ftnlen)37); do_lio(&c__9, &c__1, "------------- %", (ftnlen)27); e_wsle(); s_wsle(&io___30); do_lio(&c__9, &c__1, "% comments & suggestions to: ", (ftnlen)30); do_lio(&c__9, &c__1, " merritt@u.washington.edu", (ftnlen)26); do_lio(&c__9, &c__1, " %", (ftnlen)8); e_wsle(); s_wsle(&io___31); do_lio(&c__9, &c__1, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", (ftnlen)38) ; do_lio(&c__9, &c__1, "%%%%%%%%%%%%%%%%%%%%%%%%%%", (ftnlen)26); e_wsle(); /* Ready for input records */ ilevel = 0; input = 5; niceties_1.isolation = 0; /* Get title */ L100: io___34.ciunit = input; s_rsfe(&io___34); do_fio(&c__1, title, (ftnlen)132); e_rsfe(); if (*(unsigned char *)title == '#') { if (! hflag) { s_wsfe(&io___36); do_fio(&c__1, title, (ftnlen)132); e_wsfe(); } goto L100; } /* 2.4h - allow file indirection for header */ if (*(unsigned char *)title == '@') { for (i__ = 132; i__ >= 2; --i__) { if (*(unsigned char *)&title[i__ - 1] != ' ') { j = i__; } } o__1.oerr = 1; o__1.ounit = 7; o__1.ofnmlen = 132 - (j - 1); o__1.ofnm = title + (j - 1); o__1.orl = 0; o__1.osta = "OLD"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; i__1 = f_open(&o__1); if (i__1 != 0) { goto L101; } s_wsfe(&io___37); do_fio(&c__1, " + Opening input file ", (ftnlen)23); do_fio(&c__1, title + (j - 1), 132 - (j - 1)); e_wsfe(); input = 7; ilevel = 1; io___38.ciunit = input; i__1 = s_rsfe(&io___38); if (i__1 != 0) { goto L101; } i__1 = do_fio(&c__1, title, (ftnlen)132); if (i__1 != 0) { goto L101; } i__1 = e_rsfe(); if (i__1 != 0) { goto L101; } if (*(unsigned char *)title == '#') { goto L100; } goto L102; L101: s_wsfe(&io___39); do_fio(&c__1, " >> Cannot open or read file ", (ftnlen)29); do_fio(&c__1, title + 1, (ftnlen)131); e_wsfe(); exit_(&c_n1); L102: ; } for (k = 132; k >= 1; --k) { if (*(unsigned char *)&title[k - 1] != ' ') { goto L103; } } L103: if (! hflag) { s_wsfe(&io___40); do_fio(&c__1, title, k); e_wsfe(); } if (sflag) { s_wsfe(&io___41); do_fio(&c__1, title, k); e_wsfe(); } if (sflag) { s_wsfe(&io___42); do_fio(&c__1, title, k); e_wsfe(); } /* Get number of tiles */ io___43.ciunit = input; i__1 = s_rsfe(&io___43); if (i__1 != 0) { goto L104; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L104; } i__1 = e_rsfe(); if (i__1 != 0) { goto L104; } i__1 = s_rsli(&io___45); if (i__1 != 0) { goto L104; } i__1 = do_lio(&c__3, &c__1, (char *)&raster_1.ntx, (ftnlen)sizeof(integer) ); if (i__1 != 0) { goto L104; } i__1 = do_lio(&c__3, &c__1, (char *)&raster_1.nty, (ftnlen)sizeof(integer) ); if (i__1 != 0) { goto L104; } i__1 = e_rsli(); if (i__1 != 0) { goto L104; } L__1 = raster_1.ntx > 0; assert_(&L__1, "ntx.le.0", (ftnlen)8); L__1 = raster_1.nty > 0; assert_(&L__1, "nty.le.0", (ftnlen)8); /* Get number of pixels per tile */ io___46.ciunit = input; i__1 = s_rsfe(&io___46); if (i__1 != 0) { goto L104; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L104; } i__1 = e_rsfe(); if (i__1 != 0) { goto L104; } i__1 = s_rsli(&io___47); if (i__1 != 0) { goto L104; } i__1 = do_lio(&c__3, &c__1, (char *)&raster_1.npx, (ftnlen)sizeof(integer) ); if (i__1 != 0) { goto L104; } i__1 = do_lio(&c__3, &c__1, (char *)&raster_1.npy, (ftnlen)sizeof(integer) ); if (i__1 != 0) { goto L104; } i__1 = e_rsli(); if (i__1 != 0) { goto L104; } /* Get pixel averaging scheme */ io___48.ciunit = input; i__1 = s_rsfe(&io___48); if (i__1 != 0) { goto L104; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L104; } i__1 = e_rsfe(); if (i__1 != 0) { goto L104; } i__1 = s_rsli(&io___49); if (i__1 != 0) { goto L104; } i__1 = do_lio(&c__3, &c__1, (char *)&scheme, (ftnlen)sizeof(integer)); if (i__1 != 0) { goto L104; } i__1 = e_rsli(); if (i__1 != 0) { goto L104; } L__1 = scheme >= 0 && scheme <= 4; assert_(&L__1, "bad scheme", (ftnlen)10); goto L105; L104: assert_(&c_false, ">>> This doesnt look like a Raster3D input file! <<<", (ftnlen)52); L105: /* Let render autotile it if npx=0 or -size on command line */ if (nax > 0 || nay > 0) { if (scheme == 3) { scheme = 4; } raster_1.ntx = nax; raster_1.nty = nay; raster_1.npx = 0; raster_1.npy = 0; } /* L22: */ if (! hflag) { s_wsfe(&io___51); do_fio(&c__1, (char *)&raster_1.ntx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.nty, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___52); do_fio(&c__1, (char *)&raster_1.npx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.npy, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___53); do_fio(&c__1, (char *)&scheme, (ftnlen)sizeof(integer)); e_wsfe(); } if (sflag) { s_wsfe(&io___54); do_fio(&c__1, (char *)&raster_1.ntx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.nty, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___55); do_fio(&c__1, (char *)&raster_1.npx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.npy, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___56); do_fio(&c__1, (char *)&scheme, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___57); do_fio(&c__1, (char *)&raster_1.ntx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.nty, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___58); do_fio(&c__1, (char *)&raster_1.npx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.npy, (ftnlen)sizeof(integer)); e_wsfe(); s_wsfe(&io___59); do_fio(&c__1, (char *)&scheme, (ftnlen)sizeof(integer)); e_wsfe(); } /* Some derived parameters */ if (raster_1.npx == 0) { raster_1.npx = 1; } if (raster_1.npy == 0) { raster_1.npy = 1; } matrices_1.xcent = raster_1.ntx * raster_1.npx / 2.f; matrices_1.ycent = raster_1.nty * raster_1.npy / 2.f; matrices_1.scale = dmin(matrices_1.xcent,matrices_1.ycent) * 2.f; /* Get background colour */ io___60.ciunit = input; s_rsfe(&io___60); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___61); do_lio(&c__4, &c__3, (char *)&bkgnd[0], (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___63); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___64); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___65); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = bkgnd[0] >= 0.f; assert_(&L__1, "bkgnd(1) < 0", (ftnlen)12); L__1 = bkgnd[1] >= 0.f; assert_(&L__1, "bkgnd(2) < 0", (ftnlen)12); L__1 = bkgnd[2] >= 0.f; assert_(&L__1, "bkgnd(3) < 0", (ftnlen)12); L__1 = bkgnd[0] <= 1.f; assert_(&L__1, "bkgnd(1) > 1", (ftnlen)12); L__1 = bkgnd[1] <= 1.f; assert_(&L__1, "bkgnd(2) > 1", (ftnlen)12); L__1 = bkgnd[2] <= 1.f; assert_(&L__1, "bkgnd(3) > 1", (ftnlen)12); /* Get "shadows" flag */ io___66.ciunit = input; s_rsfe(&io___66); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___67); do_lio(&c__8, &c__1, (char *)&shadow, (ftnlen)sizeof(logical)); e_rsli(); if (! hflag) { s_wsfe(&io___69); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___70); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___71); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } /* Get Phong power */ io___72.ciunit = input; s_rsfe(&io___72); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___73); do_lio(&c__4, &c__1, (char *)&phong, (ftnlen)sizeof(real)); e_rsli(); iphong = phong; if (! hflag) { s_wsfe(&io___76); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___77); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___78); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = iphong >= 0; assert_(&L__1, "iphong < 0", (ftnlen)10); /* Get contribution of straight-on (secondary) light source */ io___79.ciunit = input; s_rsfe(&io___79); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___80); do_lio(&c__4, &c__1, (char *)&strait, (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___82); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___83); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___84); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = strait >= 0.f; assert_(&L__1, "strait < 0", (ftnlen)10); L__1 = strait <= 1.f; assert_(&L__1, "strait > 1", (ftnlen)10); /* Derive contribution of primary light source */ primar = 1.f - strait; /* Get contribution of ambient light */ io___86.ciunit = input; s_rsfe(&io___86); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___87); do_lio(&c__4, &c__1, (char *)&ambien, (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___89); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___90); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___91); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = ambien >= 0.f; assert_(&L__1, "ambien < 0", (ftnlen)10); L__1 = ambien <= 1.f; assert_(&L__1, "ambien > 1", (ftnlen)10); /* Get component of specular reflection */ io___92.ciunit = input; s_rsfe(&io___92); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___93); do_lio(&c__4, &c__1, (char *)&speclr, (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___95); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___96); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___97); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = speclr >= 0.f; assert_(&L__1, "speclr < 0", (ftnlen)10); L__1 = speclr <= 1.f; assert_(&L__1, "speclr > 1", (ftnlen)10); /* Derive component of diffuse reflection */ L__1 = ambien + speclr <= 1.f; assert_(&L__1, "ambien+speclr > 1", (ftnlen)17); diffus = 1.f - (ambien + speclr); /* Note distance of viewing eye, but don't apply it here */ /* Force it to 0 (no perspective) for stereo */ io___99.ciunit = input; s_rsfe(&io___99); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___100); do_lio(&c__4, &c__1, (char *)&matrices_1.eyepos, (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___101); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___102); do_fio(&c__1, "0.0\tStereo is better with no perspective", (ftnlen)40) ; e_wsfe(); s_wsfe(&io___103); do_fio(&c__1, "0.0\tStereo is better with no perspective", (ftnlen)40) ; e_wsfe(); } L__1 = matrices_1.eyepos >= 0.f; assert_(&L__1, "eyepos.lt.0", (ftnlen)11); matrices_1.eyepos = 0.f; /* Get position of primary light source */ io___104.ciunit = input; s_rsfe(&io___104); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___105); do_lio(&c__4, &c__3, (char *)&source[0], (ftnlen)sizeof(real)); e_rsli(); if (! hflag) { s_wsfe(&io___107); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } /* Computing 2nd power */ r__1 = source[0]; /* Computing 2nd power */ r__2 = source[1]; /* Computing 2nd power */ r__3 = source[2]; smag = sqrt(r__1 * r__1 + r__2 * r__2 + r__3 * r__3); source[0] /= smag; source[1] /= smag; source[2] /= smag; /* Get input transformation */ if (asscom_1.verbose) { s_wsle(&io___109); do_lio(&c__9, &c__1, "tmat (v' = v * tmat):", (ftnlen)21); e_wsle(); } for (i__ = 1; i__ <= 4; ++i__) { io___110.ciunit = input; s_rsle(&io___110); for (j = 1; j <= 4; ++j) { do_lio(&c__4, &c__1, (char *)&matrices_1.tmat[i__ + (j << 2) - 5], (ftnlen)sizeof(real)); } e_rsle(); if (asscom_1.verbose) { s_wsle(&io___111); for (j = 1; j <= 4; ++j) { do_lio(&c__4, &c__1, (char *)&matrices_1.tmat[i__ + (j << 2) - 5], (ftnlen)sizeof(real)); } e_wsle(); } } if (! hflag) { s_wsle(&io___112); do_lio(&c__9, &c__1, " 1. 0. 0. 0.", (ftnlen)14); e_wsle(); s_wsle(&io___113); do_lio(&c__9, &c__1, " 0. 1. 0. 0.", (ftnlen)14); e_wsle(); s_wsle(&io___114); do_lio(&c__9, &c__1, " 0. 0. 1. 0.", (ftnlen)14); e_wsle(); s_wsle(&io___115); do_lio(&c__9, &c__1, " 0. 0. 0. 1.", (ftnlen)14); e_wsle(); } if (sflag) { /* [-angle AA] forces left/right headers with angular offset */ if (sepang > 0.f) { s_wsfe(&io___116); do_fio(&c__1, " stereo separation angle +/-", (ftnlen)28); do_fio(&c__1, (char *)&sepang, (ftnlen)sizeof(real)); do_fio(&c__1, " degrees", (ftnlen)8); e_wsfe(); cossep = cos(sepang * .017453293f); sinsep = sin(sepang * .017453293f); /* Counter-rotate light source so that both views have same illumination */ x = source[0] * cossep - source[2] * sinsep; y = source[1]; z__ = source[0] * sinsep + source[2] * cossep; s_wsfe(&io___122); do_fio(&c__1, (char *)&x, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z__, (ftnlen)sizeof(real)); do_fio(&c__1, "Primary light source", (ftnlen)20); e_wsfe(); x = source[0] * cossep + source[2] * sinsep; z__ = -source[0] * sinsep + source[2] * cossep; s_wsfe(&io___123); do_fio(&c__1, (char *)&x, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z__, (ftnlen)sizeof(real)); do_fio(&c__1, "Primary light source", (ftnlen)20); e_wsfe(); /* L13: */ s_wsfe(&io___124); do_fio(&c__1, (char *)&cossep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); r__1 = -sinsep; do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, "left eye view", (ftnlen)13); e_wsfe(); s_wsfe(&io___125); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b304, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___126); do_fio(&c__1, (char *)&sinsep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&cossep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___127); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b304, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___128); do_fio(&c__1, (char *)&cossep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&sinsep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, "right eye view", (ftnlen)14); e_wsfe(); s_wsfe(&io___129); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b304, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___130); r__1 = -sinsep; do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&cossep, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___131); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b295, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&c_b304, (ftnlen)sizeof(real)); e_wsfe(); } else { /* Otherwise left/right headers differ by a shear operation */ s_wsfe(&io___132); do_fio(&c__1, (char *)&source[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&source[1], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&source[2], (ftnlen)sizeof(real)); do_fio(&c__1, "Primary light", (ftnlen)13); e_wsfe(); s_wsle(&io___133); do_lio(&c__9, &c__1, " 1. 0. 0. 0.", (ftnlen)16); e_wsle(); s_wsle(&io___134); do_lio(&c__9, &c__1, " 0. 1. 0. 0.", (ftnlen)16); e_wsle(); s_wsle(&io___135); do_lio(&c__9, &c__1, " 0.03 0. 1. 0. Left eye view", ( ftnlen)38); e_wsle(); s_wsle(&io___136); do_lio(&c__9, &c__1, " 0. 0. 0. 1.", (ftnlen)16); e_wsle(); s_wsfe(&io___137); do_fio(&c__1, (char *)&source[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&source[1], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&source[2], (ftnlen)sizeof(real)); do_fio(&c__1, "Primary light", (ftnlen)13); e_wsfe(); s_wsle(&io___138); do_lio(&c__9, &c__1, " 1. 0. 0. 0.", (ftnlen)16); e_wsle(); s_wsle(&io___139); do_lio(&c__9, &c__1, " 0. 1. 0. 0.", (ftnlen)16); e_wsle(); s_wsle(&io___140); do_lio(&c__9, &c__1, "-0.03 0. 1. 0. Right eye view", ( ftnlen)39); e_wsle(); s_wsle(&io___141); do_lio(&c__9, &c__1, " 0. 0. 0. 1.", (ftnlen)16); e_wsle(); } } /* By popular demand, add a post-hoc rotation/translation option */ /* that uses matrices of the form used by O and molscript */ /* Initialized here to identity matrix; set by GPROP options. */ for (i__ = 1; i__ <= 4; ++i__) { for (j = 1; j <= 4; ++j) { matrices_1.rafter[i__ + (j << 2) - 5] = 0.f; } matrices_1.rafter[i__ + (i__ << 2) - 5] = 1.f; matrices_1.tafter[i__ - 1] = 0.f; } /* Compute the rotation matrix which takes the light */ /* source to the +z axis (i.e., to the viewpoint). */ /* first make p = source cross z (and normalize p) */ p1 = source[1]; p2 = -source[0]; /* p3 = 0 */ /* Computing 2nd power */ r__1 = p1; /* Computing 2nd power */ r__2 = p2; plen = sqrt(r__1 * r__1 + r__2 * r__2); if (plen > 0.f) { p1 /= plen; } if (plen > 0.f) { p2 /= plen; } /* phi is the angle between source and z (shortest route) */ cosphi = source[2]; sinphi = plen; /* Computing 2nd power */ r__1 = p1; /* Computing 2nd power */ r__2 = p1; matrices_1.srot[0] = r__1 * r__1 + (1.f - r__2 * r__2) * cosphi; matrices_1.srot[4] = p1 * p2 * (1.f - cosphi); matrices_1.srot[8] = p2 * sinphi; matrices_1.srot[1] = matrices_1.srot[4]; /* Computing 2nd power */ r__1 = p2; /* Computing 2nd power */ r__2 = p2; matrices_1.srot[5] = r__1 * r__1 + (1.f - r__2 * r__2) * cosphi; matrices_1.srot[9] = -p1 * sinphi; matrices_1.srot[2] = -matrices_1.srot[8]; matrices_1.srot[6] = -matrices_1.srot[9]; matrices_1.srot[10] = cosphi; matrices_1.srot[12] = 0.f; matrices_1.srot[13] = 0.f; matrices_1.srot[14] = 0.f; matrices_1.srot[3] = 0.f; matrices_1.srot[7] = 0.f; matrices_1.srot[11] = 0.f; matrices_1.srot[15] = 1.f; /* Quadrics will require the inverse matrix also (and its transpose) */ qsetup_(); /* Get input mode */ io___147.ciunit = input; s_rsfe(&io___147); do_fio(&c__1, line, (ftnlen)132); e_rsfe(); s_rsli(&io___148); do_lio(&c__3, &c__1, (char *)&inmode, (ftnlen)sizeof(integer)); e_rsli(); if (! hflag) { s_wsfe(&io___150); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___151); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } if (sflag) { s_wsfe(&io___152); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } L__1 = (real) inmode >= 1.f; assert_(&L__1, "bad inmode", (ftnlen)10); if (inmode > 3) { s_wsle(&io___153); do_lio(&c__9, &c__1, "Non-standard INMODE", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&inmode, (ftnlen)sizeof(integer)); e_wsle(); } /* Get input format(s) */ if (inmode == 1 || inmode == 2) { io___154.ciunit = input; s_rsfe(&io___154); do_fio(&c__1, infmt__, (ftnlen)80); e_rsfe(); if (! hflag) { s_wsfe(&io___156); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } if (sflag) { s_wsfe(&io___157); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } if (sflag) { s_wsfe(&io___158); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } ii = 0; L2: if (*(unsigned char *)infmt__ == ' ') { s_copy(infmt__, infmt__ + 1, (ftnlen)79, (ftnlen)79); *(unsigned char *)&infmt__[79] = ' '; ++ii; if (ii < 80) { goto L2; } } if (*(unsigned char *)infmt__ == '*') { inflg = TRUE_; } else { inflg = FALSE_; } } else if (inmode >= 3) { for (i__ = 1; i__ <= 3; ++i__) { io___161.ciunit = input; s_rsfe(&io___161); do_fio(&c__1, infmts + (i__ - 1) * 80, (ftnlen)80); e_rsfe(); if (! hflag) { s_wsfe(&io___163); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } if (sflag) { s_wsfe(&io___164); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } if (sflag) { s_wsfe(&io___165); do_fio(&c__1, "*", (ftnlen)1); e_wsfe(); } ii = 0; L3: if (*(unsigned char *)&infmts[(i__ - 1) * 80] == ' ') { s_copy(infmts + (i__ - 1) * 80, infmts + ((i__ - 1) * 80 + 1), (ftnlen)79, (ftnlen)79); *(unsigned char *)&infmts[(i__ - 1) * 80 + 79] = ' '; ++ii; if (ii < 80) { goto L3; } } if (*(unsigned char *)&infmts[(i__ - 1) * 80] == '*') { inflgs[i__ - 1] = TRUE_; } else { inflgs[i__ - 1] = FALSE_; } /* L4: */ } inflgs[5] = inflgs[0]; s_copy(infmts + 400, infmts, (ftnlen)80, (ftnlen)80); inflgs[6] = inflgs[0]; s_copy(infmts + 480, infmts, (ftnlen)80, (ftnlen)80); inflgs[16] = inflgs[0]; s_copy(infmts + 1280, infmts, (ftnlen)80, (ftnlen)80); inflgs[17] = inflgs[0]; s_copy(infmts + 1360, infmts, (ftnlen)80, (ftnlen)80); inflgs[7] = TRUE_; inflgs[9] = TRUE_; inflgs[10] = TRUE_; inflgs[12] = TRUE_; inflgs[13] = TRUE_; } else { assert_(&c_false, "crash 4", (ftnlen)7); } if (sflag) { cl__1.cerr = 0; cl__1.cunit = 1; cl__1.csta = 0; f_clos(&cl__1); } if (sflag) { cl__1.cerr = 0; cl__1.cunit = 2; cl__1.csta = 0; f_clos(&cl__1); } /* Done with header records */ /* As of V2.5e, keep reading until file ends */ /* >>> This is a change <<< */ /* IF (INPUT.NE.STDIN) THEN */ /* CLOSE(INPUT) */ /* INPUT = STDIN */ /* ENDIF */ npropm = 0; ntransp = 0; nsphere = 0; ncylind = 0; nplanes = 0; ntriang = 0; nquads = 0; /* Objects in, and count up objects that may impinge on each tile */ ndet = 0; mdet = 0; n = 0; /* Read in next object */ L7: if (inmode == 1 || inmode == 2) { intype = inmode; goto L8; } /* Aug 1996 - allow file indirection */ io___178.ciunit = input; i__1 = s_rsfe(&io___178); if (i__1 != 0) { goto L50; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L50; } i__1 = e_rsfe(); if (i__1 != 0) { goto L50; } if (*(unsigned char *)line == '#') { s_wsfe(&io___179); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); goto L7; } else if (*(unsigned char *)line != '@') { i__1 = s_rsli(&io___180); if (i__1 != 0) { goto L50; } i__1 = do_lio(&c__3, &c__1, (char *)&intype, (ftnlen)sizeof(integer)); if (i__1 != 0) { goto L50; } i__1 = e_rsli(); if (i__1 != 0) { goto L50; } } else if (! xflag) { s_wsfe(&io___181); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); goto L7; } else { L__1 = ilevel < 10; assert_(&L__1, "Too many levels of indirection", (ftnlen)30); j = 1; k = 132; for (i__ = 132; i__ >= 2; --i__) { if (*(unsigned char *)&line[i__ - 1] != ' ') { j = i__; } if (*(unsigned char *)&line[i__ - 1] == '#') { k = i__ - 1; } if (*(unsigned char *)&line[i__ - 1] == '!') { k = i__ - 1; } if (*(unsigned char *)&line[i__ - 1] == '\0') { k = i__ - 1; } if (*(unsigned char *)&line[i__ - 1] == '\t') { *(unsigned char *)&line[i__ - 1] = ' '; } } i__1 = k; for (i__ = j; i__ <= i__1; ++i__) { if (*(unsigned char *)&line[i__ - 1] != ' ') { l = i__; } } k = l; i__1 = k - 2; if (*(unsigned char *)&line[k - 1] == 'Z' || s_cmp(line + i__1, "gz", k - i__1, (ftnlen)2) == 0) { /* debug */ /* debug ungz will uncompress into a temporary file, which ought to be */ /* debug deleted later. Unfortunately, that's hard to do in g77, since */ /* debug it doesn't support dispose='DELETE'. */ i__1 = k; s_copy(line + i__1, "\000", k + 1 - i__1, (ftnlen)1); if (0 > ungz_(line + (j - 1), fullname, k + 1 - (j - 1), (ftnlen) 128)) { goto L74; } j = 1; k = 132; for (i__ = 132; i__ >= 2; --i__) { if (*(unsigned char *)&fullname[i__ - 1] == ' ') { k = i__ - 1; } if (*(unsigned char *)&fullname[i__ - 1] == '\0') { k = i__ - 1; } } if (asscom_1.verbose) { s_wsle(&io___184); do_lio(&c__9, &c__1, "Creating temporary file: ", (ftnlen)25); do_lio(&c__9, &c__1, fullname + (j - 1), k - (j - 1)); e_wsle(); } o__1.oerr = 1; o__1.ounit = ilevel + 7; o__1.ofnmlen = k - (j - 1); o__1.ofnm = fullname + (j - 1); o__1.orl = 0; o__1.osta = "OLD"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; i__1 = f_open(&o__1); if (i__1 != 0) { goto L74; } s_copy(fullname, line + 1, (ftnlen)128, (ftnlen)131); goto L72; /* debug */ } L70: o__1.oerr = 1; o__1.ounit = ilevel + 7; o__1.ofnmlen = k - (j - 1); o__1.ofnm = line + (j - 1); o__1.orl = 0; o__1.osta = "OLD"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; i__1 = f_open(&o__1); if (i__1 != 0) { goto L71; } s_copy(fullname, line + (j - 1), (ftnlen)128, k - (j - 1)); goto L72; L71: i__1 = k - 4; if (s_cmp(line + i__1, ".r3d", k - i__1, (ftnlen)4) != 0) { k += 4; i__1 = k - 4; s_copy(line + i__1, ".r3d", k - i__1, (ftnlen)4); goto L70; } liblookup_(line + (j - 1), fullname, k - (j - 1), (ftnlen)128); o__1.oerr = 1; o__1.ounit = ilevel + 7; o__1.ofnmlen = 128; o__1.ofnm = fullname; o__1.orl = 0; o__1.osta = "OLD"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = 0; i__1 = f_open(&o__1); if (i__1 != 0) { goto L74; } L72: for (i__ = 132; i__ >= 2; --i__) { if (*(unsigned char *)&fullname[i__ - 1] == ' ') { j = i__; } } s_wsfe(&io___185); do_fio(&c__1, " + Opening input file ", (ftnlen)23); do_fio(&c__1, fullname, j); e_wsfe(); input = ilevel + 7; ++ilevel; goto L7; L74: s_wsfe(&io___186); do_fio(&c__1, " >> Cannot open file ", (ftnlen)21); do_fio(&c__1, line + (j - 1), k - (j - 1)); e_wsfe(); goto L7; } if (intype == 0) { goto L50; } if (intype == 9) { s_wsfe(&io___187); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); niceties_1.isolation = 0; goto L7; } else { s_wsfe(&io___188); do_fio(&c__1, (char *)&intype, (ftnlen)sizeof(integer)); e_wsfe(); } if (intype == 5) { intype = 3; } L__1 = intype >= 1 && intype <= 19; assert_(&L__1, "bad object", (ftnlen)10); L__1 = intype != 4; assert_(&L__1, "Object type 4 not supported", (ftnlen)27); L8: s_copy(infmt__, infmts + (intype - 1) * 80, (ftnlen)80, (ftnlen)80); inflg = inflgs[intype - 1]; /* handle non-numerical input elsewhere */ if (intype == 10) { goto L9; } else if ((real) intype == 16.f) { goto L9; } else if (intype == 15) { niceties_1.isolation = 1; goto L7; } else if (intype == 19) { niceties_1.isolation = 2; goto L7; } else if (inflg) { io___189.ciunit = input; i__1 = s_rsle(&io___189); if (i__1 != 0) { goto L50; } i__2 = idet[intype - 1]; for (i__ = 1; i__ <= i__2; ++i__) { i__1 = do_lio(&c__4, &c__1, (char *)&buf[i__ - 1], (ftnlen)sizeof( real)); if (i__1 != 0) { goto L50; } } i__1 = e_rsle(); if (i__1 != 0) { goto L50; } } else { io___191.ciunit = input; i__1 = s_rsfe(&io___191); if (i__1 != 0) { goto L50; } i__2 = idet[intype - 1]; for (i__ = 1; i__ <= i__2; ++i__) { i__1 = do_fio(&c__1, (char *)&buf[i__ - 1], (ftnlen)sizeof(real)); if (i__1 != 0) { goto L50; } } i__1 = e_rsfe(); if (i__1 != 0) { goto L50; } } /* Allow an all-zeroes record to terminate input for the */ /* benefit of those of us who might inadvertently supply */ /* a series of blank records after our real input as a */ /* side-effect of tape blocking or sloppiness or ... */ /* 15-Dec-1999 Oops! all zeros is legal input for [at least] LABEL */ if (intype == 11) { goto L9; } i__1 = idet[intype - 1]; for (i__ = 1; i__ <= i__1; ++i__) { if (buf[i__ - 1] != 0.f) { goto L9; } } goto L50; L9: ++n; /* From this point on, we'll use the symbolic codes for objects */ if (intype == 1 || intype == 6) { /* triangle as read in */ if (intype == 1) { ++ntriang; } if (intype == 6) { ++nplane; } ndet += idet[intype - 1]; mdet += sdet[intype - 1]; x1a = buf[0]; y1a = buf[1]; z1a = buf[2]; x2a = buf[3]; y2a = buf[4]; z2a = buf[5]; x3a = buf[6]; y3a = buf[7]; z3a = buf[8]; red = buf[9]; grn = buf[10]; blu = buf[11]; chkrgb_(&red, &grn, &blu, "invalid triangle color", (ftnlen)22); L__1 = idet[intype - 1] == 12; assert_(&L__1, "idet(1).ne.12", (ftnlen)13); /* Isolated objects not transformed by TMAT */ if (niceties_1.isolation == 0) { /* update true coordinate limits */ /* Computing MIN */ r__1 = min(niceties_1.trulim[0],x1a), r__1 = min(r__1,x2a); niceties_1.trulim[0] = dmin(r__1,x3a); /* Computing MAX */ r__1 = max(niceties_1.trulim[3],x1a), r__1 = max(r__1,x2a); niceties_1.trulim[3] = dmax(r__1,x3a); /* Computing MIN */ r__1 = min(niceties_1.trulim[1],y1a), r__1 = min(r__1,y2a); niceties_1.trulim[1] = dmin(r__1,y3a); /* Computing MAX */ r__1 = max(niceties_1.trulim[4],y1a), r__1 = max(r__1,y2a); niceties_1.trulim[4] = dmax(r__1,y3a); /* Computing MIN */ r__1 = min(niceties_1.trulim[2],z1a), r__1 = min(r__1,z2a); niceties_1.trulim[2] = dmin(r__1,z3a); /* Computing MAX */ r__1 = max(niceties_1.trulim[5],z1a), r__1 = max(r__1,z2a); niceties_1.trulim[5] = dmax(r__1,z3a); /* modify the input, so to speak */ transf_(&x1a, &y1a, &z1a); transf_(&x2a, &y2a, &z2a); transf_(&x3a, &y3a, &z3a); } /* write it back out again */ s_wsfe(&io___205); do_fio(&c__1, (char *)&x1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&x2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&x3a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y3a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z3a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&red, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&grn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&blu, (ftnlen)sizeof(real)); e_wsfe(); } else if (intype == 2) { /* sphere as read in */ ++nsphere; ndet += idet[intype - 1]; mdet += sdet[intype - 1]; xa = buf[0]; ya = buf[1]; za = buf[2]; ra = buf[3]; red = buf[4]; grn = buf[5]; blu = buf[6]; chkrgb_(&red, &grn, &blu, "invalid sphere color", (ftnlen)20); L__1 = idet[intype - 1] == 7; assert_(&L__1, "idet(2).ne.7", (ftnlen)12); /* Isolated objects not transformed by TMAT */ if (niceties_1.isolation == 0) { /* update true coordinate limits */ niceties_1.trulim[0] = dmin(niceties_1.trulim[0],xa); niceties_1.trulim[3] = dmax(niceties_1.trulim[3],xa); niceties_1.trulim[1] = dmin(niceties_1.trulim[1],ya); niceties_1.trulim[4] = dmax(niceties_1.trulim[4],ya); niceties_1.trulim[2] = dmin(niceties_1.trulim[2],za); niceties_1.trulim[5] = dmax(niceties_1.trulim[5],za); /* modify the input, as it were */ transf_(&xa, &ya, &za); ra /= matrices_1.tmat[15]; } /* write it back out again */ s_wsfe(&io___210); do_fio(&c__1, (char *)&xa, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ya, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&za, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ra, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&red, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&grn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&blu, (ftnlen)sizeof(real)); e_wsfe(); } else if (intype == 3) { ++ncylind; ndet += idet[intype - 1]; mdet += sdet[intype - 1]; x1a = buf[0]; y1a = buf[1]; z1a = buf[2]; r1a = buf[3]; x2a = buf[4]; y2a = buf[5]; z2a = buf[6]; r2a = r1a; red = buf[8]; grn = buf[9]; blu = buf[10]; chkrgb_(&red, &grn, &blu, "invalid cylinder color", (ftnlen)22); L__1 = idet[intype - 1] == 11; assert_(&L__1, "idet(1).ne.11", (ftnlen)13); /* Isolated objects not transformed by TMAT */ if (niceties_1.isolation == 0) { /* update true coordinate limits */ /* Computing MIN */ r__1 = min(niceties_1.trulim[0],x1a); niceties_1.trulim[0] = dmin(r__1,x2a); /* Computing MAX */ r__1 = max(niceties_1.trulim[3],x1a); niceties_1.trulim[3] = dmax(r__1,x2a); /* Computing MIN */ r__1 = min(niceties_1.trulim[1],y1a); niceties_1.trulim[1] = dmin(r__1,y2a); /* Computing MAX */ r__1 = max(niceties_1.trulim[4],y1a); niceties_1.trulim[4] = dmax(r__1,y2a); /* Computing MIN */ r__1 = min(niceties_1.trulim[2],z1a); niceties_1.trulim[2] = dmin(r__1,z2a); /* Computing MAX */ r__1 = max(niceties_1.trulim[5],z1a); niceties_1.trulim[5] = dmax(r__1,z2a); /* modify the input, so to speak */ transf_(&x1a, &y1a, &z1a); transf_(&x2a, &y2a, &z2a); r1a /= matrices_1.tmat[15]; r2a /= matrices_1.tmat[15]; } /* write it back out again */ s_wsfe(&io___213); do_fio(&c__1, (char *)&x1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&r1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&x2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&r2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&red, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&grn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&blu, (ftnlen)sizeof(real)); e_wsfe(); } else if (intype == 7) { /* vertex normals as given (these belong to previous triangle) */ ++nnorms; ndet += idet[intype - 1]; mdet += sdet[intype - 1]; x1a = buf[0]; y1a = buf[1]; z1a = buf[2]; x2a = buf[3]; y2a = buf[4]; z2a = buf[5]; x3a = buf[6]; y3a = buf[7]; z3a = buf[8]; if (niceties_1.isolation == 0) { /* Apply rotation matrix, but not translation components */ x1b = x1a * matrices_1.tmat[0] + y1a * matrices_1.tmat[1] + z1a * matrices_1.tmat[2]; y1b = x1a * matrices_1.tmat[4] + y1a * matrices_1.tmat[5] + z1a * matrices_1.tmat[6]; z1b = x1a * matrices_1.tmat[8] + y1a * matrices_1.tmat[9] + z1a * matrices_1.tmat[10]; x2b = x2a * matrices_1.tmat[0] + y2a * matrices_1.tmat[1] + z2a * matrices_1.tmat[2]; y2b = x2a * matrices_1.tmat[4] + y2a * matrices_1.tmat[5] + z2a * matrices_1.tmat[6]; z2b = x2a * matrices_1.tmat[8] + y2a * matrices_1.tmat[9] + z2a * matrices_1.tmat[10]; x3b = x3a * matrices_1.tmat[0] + y3a * matrices_1.tmat[1] + z3a * matrices_1.tmat[2]; y3b = x3a * matrices_1.tmat[4] + y3a * matrices_1.tmat[5] + z3a * matrices_1.tmat[6]; z3b = x3a * matrices_1.tmat[8] + y3a * matrices_1.tmat[9] + z3a * matrices_1.tmat[10]; /* Also apply post-rotation, if any */ x1a = matrices_1.rafter[0] * x1b + matrices_1.rafter[4] * y1b + matrices_1.rafter[8] * z1b; y1a = matrices_1.rafter[1] * x1b + matrices_1.rafter[5] * y1b + matrices_1.rafter[9] * z1b; z1a = matrices_1.rafter[2] * x1b + matrices_1.rafter[6] * y1b + matrices_1.rafter[10] * z1b; x2a = matrices_1.rafter[0] * x2b + matrices_1.rafter[4] * y2b + matrices_1.rafter[8] * z2b; y2a = matrices_1.rafter[1] * x2b + matrices_1.rafter[5] * y2b + matrices_1.rafter[9] * z2b; z2a = matrices_1.rafter[2] * x2b + matrices_1.rafter[6] * y2b + matrices_1.rafter[10] * z2b; x3a = matrices_1.rafter[0] * x3b + matrices_1.rafter[4] * y3b + matrices_1.rafter[8] * z3b; y3a = matrices_1.rafter[1] * x3b + matrices_1.rafter[5] * y3b + matrices_1.rafter[9] * z3b; z3a = matrices_1.rafter[2] * x3b + matrices_1.rafter[6] * y3b + matrices_1.rafter[10] * z3b; } /* write it back out again */ s_wsfe(&io___224); do_fio(&c__1, (char *)&x1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z1a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&x2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z2a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&x3a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&y3a, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&z3a, (ftnlen)sizeof(real)); e_wsfe(); /* Vertex colors for preceding triangle */ /* (no transformation needed) */ } else if (intype == 17) { ndet += idet[intype - 1]; mdet += sdet[intype - 1]; chkrgb_(buf, &buf[1], &buf[2], "invalid vertex color", (ftnlen)20); chkrgb_(&buf[3], &buf[4], &buf[5], "invalid vertex color", (ftnlen)20) ; chkrgb_(&buf[6], &buf[7], &buf[8], "invalid vertex color", (ftnlen)20) ; s_wsfe(&io___225); do_fio(&c__1, (char *)&buf[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[1], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[2], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[3], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[4], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[5], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[6], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[7], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[8], (ftnlen)sizeof(real)); e_wsfe(); } else if (intype == 18) { ndet += idet[intype - 1]; mdet += sdet[intype - 1]; s_wsfe(&io___226); do_fio(&c__1, (char *)&buf[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[1], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&buf[2], (ftnlen)sizeof(real)); e_wsfe(); /* Material properties are saved with no further manipulation */ } else if (intype == 8) { ++npropm; ndet += idet[intype - 1]; mdet += sdet[intype - 1]; nbounds = 0; sphong = buf[0]; sspec = buf[1]; sr = buf[2]; sg = buf[3]; sb = buf[4]; clrity = buf[5]; opt[0] = buf[6]; opt[1] = buf[7]; opt[2] = buf[8]; opt[3] = buf[9]; s_wsfe(&io___235); do_fio(&c__1, (char *)&sphong, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&sspec, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&sr, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&sg, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&sb, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&clrity, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&opt[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&opt[1], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&opt[2], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&opt[3], (ftnlen)sizeof(real)); e_wsfe(); /* 24-Feb-1997 OPT(4) signals additional MATERIAL records */ if (opt[3] > 0.f) { i__1 = opt[3]; for (i__ = 1; i__ <= i__1; ++i__) { io___236.ciunit = input; i__2 = s_rsfe(&io___236); if (i__2 != 0) { goto L50; } i__2 = do_fio(&c__1, line, (ftnlen)132); if (i__2 != 0) { goto L50; } i__2 = e_rsfe(); if (i__2 != 0) { goto L50; } for (j = 132; j >= 1; --j) { if (*(unsigned char *)&line[j - 1] != ' ' && *(unsigned char *)&line[j - 1] != '\t') { l = j; } } if (s_cmp(line + (l - 1), "FRONTCLIP", (ftnlen)9, (ftnlen)9) == 0) { i__2 = l + 9; ici__1.icierr = 0; ici__1.iciend = 0; ici__1.icirnum = 1; ici__1.icirlen = 132 - i__2; ici__1.iciunit = line + i__2; ici__1.icifmt = 0; s_rsli(&ici__1); do_lio(&c__4, &c__1, (char *)&zclip, (ftnlen)sizeof(real)) ; e_rsli(); zclip /= matrices_1.tmat[15]; s_wsfe(&io___238); do_fio(&c__1, "FRONTCLIP", (ftnlen)9); do_fio(&c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_wsfe(); } else if (s_cmp(line + (l - 1), "BACKCLIP", (ftnlen)8, ( ftnlen)8) == 0) { i__2 = l + 8; ici__1.icierr = 0; ici__1.iciend = 0; ici__1.icirnum = 1; ici__1.icirlen = 132 - i__2; ici__1.iciunit = line + i__2; ici__1.icifmt = 0; s_rsli(&ici__1); do_lio(&c__4, &c__1, (char *)&zclip, (ftnlen)sizeof(real)) ; e_rsli(); zclip /= matrices_1.tmat[15]; s_wsfe(&io___239); do_fio(&c__1, "BACKCLIP", (ftnlen)8); do_fio(&c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_wsfe(); } else if (s_cmp(line + (l - 1), "BOUNDING_PLANE", (ftnlen)14, (ftnlen)14) == 0) { ++nbounds; i__2 = l + 14; ici__1.icierr = 0; ici__1.iciend = 0; ici__1.icirnum = 1; ici__1.icirlen = 132 - i__2; ici__1.iciunit = line + i__2; ici__1.icifmt = 0; s_rsli(&ici__1); do_lio(&c__3, &c__1, (char *)&ibptype, (ftnlen)sizeof( integer)); do_lio(&c__4, &c__1, (char *)&xb, (ftnlen)sizeof(real)); do_lio(&c__4, &c__1, (char *)&yb, (ftnlen)sizeof(real)); do_lio(&c__4, &c__1, (char *)&zb, (ftnlen)sizeof(real)); do_lio(&c__4, &c__1, (char *)&xn, (ftnlen)sizeof(real)); do_lio(&c__4, &c__1, (char *)&yn, (ftnlen)sizeof(real)); do_lio(&c__4, &c__1, (char *)&zn, (ftnlen)sizeof(real)); e_rsli(); transf_(&xb, &yb, &zb); xnb = xn * matrices_1.tmat[0] + yn * matrices_1.tmat[1] + zn * matrices_1.tmat[2]; ynb = xn * matrices_1.tmat[4] + yn * matrices_1.tmat[5] + zn * matrices_1.tmat[6]; znb = xn * matrices_1.tmat[8] + yn * matrices_1.tmat[9] + zn * matrices_1.tmat[10]; xn = matrices_1.rafter[0] * xnb + matrices_1.rafter[4] * ynb + matrices_1.rafter[8] * znb; yn = matrices_1.rafter[1] * xnb + matrices_1.rafter[5] * ynb + matrices_1.rafter[9] * znb; zn = matrices_1.rafter[2] * xnb + matrices_1.rafter[6] * ynb + matrices_1.rafter[10] * znb; temp = sqrt(xn * xn + yn * yn + zn * zn); xn /= temp; yn /= temp; zn /= temp; s_wsfe(&io___251); do_fio(&c__1, "BOUNDING_PLANE", (ftnlen)14); do_fio(&c__1, (char *)&ibptype, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&xb, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&yb, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&zb, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&xn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&yn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&zn, (ftnlen)sizeof(real)); e_wsfe(); } else { s_wsfe(&io___252); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } } } ndet += nbounds * idet[3]; mdet += nbounds * sdet[3]; /* Font alignment options: */ /* C - centered, have to transform coords */ /* L - left, "" */ /* R - right, "" */ /* O - offset, leave font offsets alone! */ } else if (intype == 10) { io___253.ciunit = input; i__1 = s_rsfe(&io___253); if (i__1 != 0) { goto L50; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L50; } i__1 = e_rsfe(); if (i__1 != 0) { goto L50; } s_rsli(&io___254); do_lio(&c__9, &c__1, fontname, (ftnlen)80); do_lio(&c__4, &c__1, (char *)&fontsize, (ftnlen)sizeof(real)); do_lio(&c__9, &c__1, fontalign, (ftnlen)80); e_rsli(); if (*(unsigned char *)fontalign == 'C') { ialign = 1; } else if (*(unsigned char *)fontalign == 'R') { ialign = 2; } else if (*(unsigned char *)fontalign == 'O') { ialign = 3; } else { ialign = 0; } s_wsfe(&io___259); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); goto L7; } else if (intype == 11) { io___260.ciunit = input; i__1 = s_rsfe(&io___260); if (i__1 != 0) { goto L50; } i__1 = do_fio(&c__1, labelstring, (ftnlen)128); if (i__1 != 0) { goto L50; } i__1 = e_rsfe(); if (i__1 != 0) { goto L50; } ++nlabels; xa = buf[0]; ya = buf[1]; za = buf[2]; if (niceties_1.isolation == 0) { if (ialign != 3) { transf_(&xa, &ya, &za); } } red = buf[3]; grn = buf[4]; blu = buf[5]; chkrgb_(&red, &grn, &blu, "invalid label color", (ftnlen)19); s_wsfe(&io___263); do_fio(&c__1, (char *)&xa, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ya, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&za, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&red, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&grn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&blu, (ftnlen)sizeof(real)); e_wsfe(); s_wsfe(&io___264); do_fio(&c__1, labelstring, (ftnlen)128); e_wsfe(); goto L7; } else if (intype == 13) { glowsrc[0] = buf[0]; glowsrc[1] = buf[1]; glowsrc[2] = buf[2]; glowrad = buf[3]; glow = buf[4]; gopt = buf[5]; gphong = buf[6]; /* Isolated objects not transformed by TMAT */ if (niceties_1.isolation == 0) { transf_(glowsrc, &glowsrc[1], &glowsrc[2]); glowrad /= matrices_1.tmat[15]; } red = buf[7]; grn = buf[8]; blu = buf[9]; chkrgb_(&red, &grn, &blu, "invalid glow light color", (ftnlen)24); s_wsfe(&io___270); do_fio(&c__3, (char *)&glowsrc[0], (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&glowrad, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&glow, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&gopt, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&gphong, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&red, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&grn, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&blu, (ftnlen)sizeof(real)); e_wsfe(); goto L7; } else if (intype == 14) { ++nquads; isquad = qinp_(buf, qtrans, &c_false, &buf[49]); xa = (qtrans[0] - matrices_1.xcent) / matrices_1.scale; ya = (qtrans[1] - matrices_1.ycent) / matrices_1.scale; za = qtrans[2] / matrices_1.scale; ra = qtrans[3] / matrices_1.scale; s_wsfe(&io___273); do_fio(&c__1, (char *)&xa, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ya, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&za, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ra, (ftnlen)sizeof(real)); for (i__ = 5; i__ <= 17; ++i__) { do_fio(&c__1, (char *)&qtrans[i__ - 1], (ftnlen)sizeof(real)); } e_wsfe(); } else if ((real) intype == 16.f) { io___274.ciunit = input; i__1 = s_rsfe(&io___274); if (i__1 != 0) { goto L50; } i__1 = do_fio(&c__1, line, (ftnlen)132); if (i__1 != 0) { goto L50; } i__1 = e_rsfe(); if (i__1 != 0) { goto L50; } for (j = 132; j >= 1; --j) { if (*(unsigned char *)&line[j - 1] != ' ' && *(unsigned char *)& line[j - 1] != '\t') { l = j; } } if (s_cmp(line + (l - 1), "FOG", (ftnlen)3, (ftnlen)3) == 0) { s_wsfe(&io___275); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } else if (s_cmp(line + (l - 1), "FRONTCLIP", (ftnlen)9, (ftnlen)9) == 0) { i__1 = l + 9; ici__1.icierr = 0; ici__1.iciend = 0; ici__1.icirnum = 1; ici__1.icirlen = 132 - i__1; ici__1.iciunit = line + i__1; ici__1.icifmt = 0; s_rsli(&ici__1); do_lio(&c__4, &c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_rsli(); zclip /= matrices_1.tmat[15]; s_wsfe(&io___276); do_fio(&c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_wsfe(); } else if (s_cmp(line + (l - 1), "BACKCLIP", (ftnlen)8, (ftnlen)8) == 0) { s_rsli(&io___277); do_lio(&c__4, &c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_rsli(); zclip /= matrices_1.tmat[15]; s_wsfe(&io___278); do_fio(&c__1, (char *)&zclip, (ftnlen)sizeof(real)); e_wsfe(); } else if (s_cmp(line + (l - 1), "ROTATION", (ftnlen)8, (ftnlen)8) == 0) { i__2 = l + 8; ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = 132 - i__2; ici__1.iciunit = line + i__2; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L771; } for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 3; ++j) { i__1 = do_lio(&c__4, &c__1, (char *)&matrices_1.rafter[ i__ + (j << 2) - 5], (ftnlen)sizeof(real)); if (i__1 != 0) { goto L771; } } } i__1 = e_rsli(); if (i__1 != 0) { goto L771; } goto L772; L771: io___279.ciunit = input; i__1 = s_rsle(&io___279); if (i__1 != 0) { goto L48; } for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 3; ++j) { i__1 = do_lio(&c__4, &c__1, (char *)&matrices_1.rafter[ i__ + (j << 2) - 5], (ftnlen)sizeof(real)); if (i__1 != 0) { goto L48; } } } i__1 = e_rsle(); if (i__1 != 0) { goto L48; } L772: /* L774: */ s_wsfe(&io___280); for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 3; ++j) { do_fio(&c__1, (char *)&matrices_1.rafter[i__ + (j << 2) - 5], (ftnlen)sizeof(real)); } } e_wsfe(); d__ = det_(matrices_1.rafter); if ((r__1 = 1.f - dabs(d__), dabs(r__1)) > .02f) { s_wsle(&io___282); do_lio(&c__9, &c__1, ">>> Warning: Post-rotation matrix has " "determinant", (ftnlen)49); do_lio(&c__4, &c__1, (char *)&d__, (ftnlen)sizeof(real)); e_wsle(); } qsetup_(); s_wsfe(&io___283); e_wsfe(); } else if (s_cmp(line + (l - 1), "TRANSLATION", (ftnlen)11, (ftnlen) 11) == 0) { io___284.ciunit = input; i__1 = s_rsle(&io___284); if (i__1 != 0) { goto L48; } for (i__ = 1; i__ <= 3; ++i__) { i__1 = do_lio(&c__4, &c__1, (char *)&matrices_1.tafter[i__ - 1], (ftnlen)sizeof(real)); if (i__1 != 0) { goto L48; } } i__1 = e_rsle(); if (i__1 != 0) { goto L48; } s_wsfe(&io___285); e_wsfe(); } else { s_wsfe(&io___286); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } goto L7; L48: s_wsfe(&io___287); do_fio(&c__1, ">> Unrecognized or incomplete GPROP option ", (ftnlen) 43); do_fio(&c__1, line, (ftnlen)132); e_wsfe(); } else if (intype == 4) { assert_(&c_false, ">>> Object type 4 not supported", (ftnlen)31); } else { assert_(&c_false, "crash 50", (ftnlen)8); } goto L7; /* here for end of objects */ L50: if (ilevel > 0) { --ilevel; if (asscom_1.verbose) { s_wsle(&io___288); do_lio(&c__9, &c__1, " - closing indirect input file", (ftnlen)30) ; e_wsle(); } cl__1.cerr = 0; cl__1.cunit = input; cl__1.csta = 0; f_clos(&cl__1); if (ilevel == 0) { input = 5; } else { --input; } goto L7; } s_wsle(&io___289); do_lio(&c__9, &c__1, "-------------------------------", (ftnlen)31); e_wsle(); if (nplanes != 0) { s_wsle(&io___290); do_lio(&c__9, &c__1, "planes =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&nplanes, (ftnlen)sizeof(integer)); e_wsle(); } if (nsphere != 0) { s_wsle(&io___291); do_lio(&c__9, &c__1, "spheres =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&nsphere, (ftnlen)sizeof(integer)); e_wsle(); } if (ncylind != 0) { s_wsle(&io___292); do_lio(&c__9, &c__1, "cylinders =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&ncylind, (ftnlen)sizeof(integer)); e_wsle(); } if (ntriang != 0) { s_wsle(&io___293); do_lio(&c__9, &c__1, "triangles =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&ntriang, (ftnlen)sizeof(integer)); e_wsle(); } if (nquads != 0) { s_wsle(&io___294); do_lio(&c__9, &c__1, "quadric surfaces =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&nquads, (ftnlen)sizeof(integer)); e_wsle(); } if (ntransp != 0) { s_wsle(&io___295); do_lio(&c__9, &c__1, "transparent objs =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&ntransp, (ftnlen)sizeof(integer)); e_wsle(); } s_wsle(&io___296); do_lio(&c__9, &c__1, "-------------------------------", (ftnlen)31); e_wsle(); s_wsle(&io___297); do_lio(&c__9, &c__1, "Compare these to the array dimensions in render:", ( ftnlen)48); e_wsle(); if (npropm != 0) { s_wsle(&io___298); do_lio(&c__9, &c__1, "special materials =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&npropm, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " (check against MAXMAT)", (ftnlen)25); e_wsle(); } s_wsle(&io___299); do_lio(&c__9, &c__1, "total objects =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " (check against MAXOBJ)", (ftnlen)25); e_wsle(); s_wsle(&io___300); do_lio(&c__9, &c__1, "details =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&ndet, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " (check against MAXDET)", (ftnlen)25); e_wsle(); s_wsle(&io___301); do_lio(&c__9, &c__1, "shadow details =", (ftnlen)19); do_lio(&c__3, &c__1, (char *)&mdet, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " (check against MAXSDT)", (ftnlen)25); e_wsle(); s_wsle(&io___302); do_lio(&c__9, &c__1, "-------------------------------", (ftnlen)31); e_wsle(); /* Sort objects, fill in "short lists" as indices into main list */ /* (note that it would lend itself better to "parallel */ /* processing" to form the short lists first and then */ s_wsle(&io___303); do_lio(&c__9, &c__1, "True center of input coordinates (not used):", ( ftnlen)44); e_wsle(); xa = (niceties_1.trulim[0] + niceties_1.trulim[3]) / 2.f; ya = (niceties_1.trulim[1] + niceties_1.trulim[4]) / 2.f; za = (niceties_1.trulim[2] + niceties_1.trulim[5]) / 2.f; s_wsfe(&io___304); do_fio(&c__1, (char *)&xa, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&ya, (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&za, (ftnlen)sizeof(real)); e_wsfe(); exit_(&c__0); return 0; } /* MAIN__ */ /* Subroutine */ int assert_(logical *logic, char *dammit, ftnlen dammit_len) { /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Local variables */ extern /* Subroutine */ int exit_(integer *); /* Fortran I/O blocks */ static cilist io___305 = { 0, 0, 0, 0, 0 }; if (*logic) { return 0; } io___305.ciunit = asscom_1.assout; s_wsle(&io___305); do_lio(&c__9, &c__1, "ERROR >>>>>> ", (ftnlen)13); do_lio(&c__9, &c__1, dammit, dammit_len); e_wsle(); /* STOP 1234 */ exit_(&c_n1); return 0; } /* assert_ */ /* Subroutine */ int transf_(real *x, real *y, real *z__) { /* System generated locals */ logical L__1; /* Local variables */ static real g[4], h__[4]; extern /* Subroutine */ int assert_(logical *, char *, ftnlen); /* Input transformation */ /* Transformation matrix, inverse of transpose, and transposed inverse */ /* Shortest rotation from light source to +z axis */ /* Post-hoc transformation on top of original TMAT */ h__[0] = *x * matrices_1.tmat[0] + *y * matrices_1.tmat[1] + *z__ * matrices_1.tmat[2] + matrices_1.tmat[3]; h__[1] = *x * matrices_1.tmat[4] + *y * matrices_1.tmat[5] + *z__ * matrices_1.tmat[6] + matrices_1.tmat[7]; h__[2] = *x * matrices_1.tmat[8] + *y * matrices_1.tmat[9] + *z__ * matrices_1.tmat[10] + matrices_1.tmat[11]; h__[3] = *x * matrices_1.tmat[12] + *y * matrices_1.tmat[13] + *z__ * matrices_1.tmat[14] + matrices_1.tmat[15]; /* Apply post-hoc rotation and translation also */ g[0] = matrices_1.rafter[0] * h__[0] + matrices_1.rafter[4] * h__[1] + matrices_1.rafter[8] * h__[2] + matrices_1.tafter[0]; g[1] = matrices_1.rafter[1] * h__[0] + matrices_1.rafter[5] * h__[1] + matrices_1.rafter[9] * h__[2] + matrices_1.tafter[1]; g[2] = matrices_1.rafter[2] * h__[0] + matrices_1.rafter[6] * h__[1] + matrices_1.rafter[10] * h__[2] + matrices_1.tafter[2]; L__1 = h__[3] != 0.f; assert_(&L__1, "infinite vector", (ftnlen)15); *x = g[0] / h__[3]; *y = g[1] / h__[3]; *z__ = g[2] / h__[3]; return 0; } /* transf_ */ /* Subroutine */ int chkrgb_(real *red, real *grn, real *blu, char *message, ftnlen message_len) { /* System generated locals */ logical L__1; /* Local variables */ extern /* Subroutine */ int assert_(logical *, char *, ftnlen); L__1 = *red >= 0.f; assert_(&L__1, message, message_len); L__1 = *grn >= 0.f; assert_(&L__1, message, message_len); L__1 = *blu >= 0.f; assert_(&L__1, message, message_len); L__1 = *red <= 1.f; assert_(&L__1, message, message_len); L__1 = *grn <= 1.f; assert_(&L__1, message, message_len); L__1 = *blu <= 1.f; assert_(&L__1, message, message_len); return 0; } /* chkrgb_ */ /* Subroutine */ int liblookup_(char *name__, char *fullname, ftnlen name_len, ftnlen fullname_len) { /* System generated locals */ integer i__1; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); /* Local variables */ static integer i__, j, len; static char r3dlib[132]; extern /* Subroutine */ int getenv_(char *, char *, ftnlen, ftnlen); getenv_("R3D_LIB", r3dlib, (ftnlen)7, (ftnlen)132); s_copy(fullname, " ", (ftnlen)128, (ftnlen)1); len = 0; for (i__ = 1; i__ <= 132; ++i__) { if (*(unsigned char *)&r3dlib[i__ - 1] != ' ') { len = i__; } } if (len == 0) { s_copy(fullname, name__, (ftnlen)128, name_len); return 0; } else { s_copy(fullname, r3dlib, len, len); i__1 = len; s_copy(fullname + i__1, "/", len + 1 - i__1, (ftnlen)1); j = len + 2; } len = 0; L100: ++len; if (*(unsigned char *)&name__[len - 1] != ' ') { goto L100; } --len; s_copy(fullname + (j - 1), name__, j + len - 1 - (j - 1), len); len = j + len - 1; return 0; } /* liblookup_ */ doublereal det_(real *a) { /* System generated locals */ real ret_val; /* Parameter adjustments */ a -= 5; /* Function Body */ ret_val = a[5] * a[10] * a[15] + a[9] * a[14] * a[7] + a[6] * a[11] * a[ 13] - a[5] * a[14] * a[11] - a[15] * a[9] * a[6] - a[13] * a[10] * a[7]; return ret_val; } /* det_ */ /* Main program alias */ int normal3d_ () { MAIN__ (); return 0; }