ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rtrace.c
(Generate patch)

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.27 by greg, Sat Feb 22 02:07:29 2003 UTC vs.
Revision 2.58 by greg, Sat Dec 12 23:08:13 2009 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   *  rtrace.c - program and variables for individual ray tracing.
6   */
7  
8 < /* ====================================================================
9 < * The Radiance Software License, Version 1.0
10 < *
11 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
12 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
13 < *
14 < * Redistribution and use in source and binary forms, with or without
15 < * modification, are permitted provided that the following conditions
16 < * are met:
17 < *
18 < * 1. Redistributions of source code must retain the above copyright
19 < *         notice, this list of conditions and the following disclaimer.
20 < *
21 < * 2. Redistributions in binary form must reproduce the above copyright
22 < *       notice, this list of conditions and the following disclaimer in
23 < *       the documentation and/or other materials provided with the
24 < *       distribution.
25 < *
26 < * 3. The end-user documentation included with the redistribution,
27 < *           if any, must include the following acknowledgment:
28 < *             "This product includes Radiance software
29 < *                 (http://radsite.lbl.gov/)
30 < *                 developed by the Lawrence Berkeley National Laboratory
31 < *               (http://www.lbl.gov/)."
32 < *       Alternately, this acknowledgment may appear in the software itself,
33 < *       if and wherever such third-party acknowledgments normally appear.
34 < *
35 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
36 < *       and "The Regents of the University of California" must
37 < *       not be used to endorse or promote products derived from this
38 < *       software without prior written permission. For written
39 < *       permission, please contact [email protected].
40 < *
41 < * 5. Products derived from this software may not be called "Radiance",
42 < *       nor may "Radiance" appear in their name, without prior written
43 < *       permission of Lawrence Berkeley National Laboratory.
44 < *
45 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
49 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 < * SUCH DAMAGE.
57 < * ====================================================================
58 < *
59 < * This software consists of voluntary contributions made by many
60 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
61 < * information on Lawrence Berkeley National Laboratory, please see
62 < * <http://www.lbl.gov/>.
63 < */
8 > #include "copyright.h"
9  
10   /*
11   *  Input is in the form:
# Line 76 | Line 21 | static const char      RCSid[] = "$Id$";
21   *  irradiance values are desired.
22   */
23  
24 < #include  "ray.h"
24 > #include  <time.h>
25  
26 + #include  "platform.h"
27 + #include  "ray.h"
28 + #include  "ambient.h"
29 + #include  "source.h"
30   #include  "otypes.h"
82
31   #include  "resolu.h"
32 + #include  "random.h"
33  
34 < CUBE  thescene;                         /* our scene */
35 < OBJECT  nsceneobjs;                     /* number of objects in our scene */
34 > extern int  inform;                     /* input format */
35 > extern int  outform;                    /* output format */
36 > extern char  *outvals;                  /* output values */
37  
38 < int  dimlist[MAXDIM];                   /* sampling dimensions */
39 < int  ndims = 0;                         /* number of sampling dimensions */
90 < int  samplendx = 0;                     /* index for this sample */
38 > extern int  imm_irrad;                  /* compute immediate irradiance? */
39 > extern int  lim_dist;                   /* limit distance? */
40  
41 < int  imm_irrad = 0;                     /* compute immediate irradiance? */
42 < int  lim_dist = 0;                      /* limit distance? */
41 > extern char  *tralist[];                /* list of modifers to trace (or no) */
42 > extern int  traincl;                    /* include == 1, exclude == 0 */
43  
44 < int  inform = 'a';                      /* input format */
45 < int  outform = 'a';                     /* output format */
97 < char  *outvals = "v";                   /* output specification */
44 > extern int  hresolu;                    /* horizontal resolution */
45 > extern int  vresolu;                    /* vertical resolution */
46  
47 < int  do_irrad = 0;                      /* compute irradiance? */
47 > static int  castonly = 0;
48  
49 < void  (*trace)() = NULL;                /* trace call */
50 <
51 < extern void  ambnotify(), tranotify();
104 < void  (*addobjnotify[])() = {ambnotify, tranotify, NULL};
105 < char  *tralist[128];                    /* list of modifers to trace (or no) */
106 < int  traincl = -1;                      /* include == 1, exclude == 0 */
107 < #define  MAXTSET        511             /* maximum number in trace set */
49 > #ifndef  MAXTSET
50 > #define  MAXTSET        8191            /* maximum number in trace set */
51 > #endif
52   OBJECT  traset[MAXTSET+1]={0};          /* trace include/exclude set */
53  
110 int  hresolu = 0;                       /* horizontal (scan) size */
111 int  vresolu = 0;                       /* vertical resolution */
112
113 double  dstrsrc = 0.0;                  /* square source distribution */
114 double  shadthresh = .05;               /* shadow threshold */
115 double  shadcert = .5;                  /* shadow certainty */
116 int  directrelay = 2;                   /* number of source relays */
117 int  vspretest = 512;                   /* virtual source pretest density */
118 int  directvis = 1;                     /* sources visible? */
119 double  srcsizerat = .2;                /* maximum ratio source size/dist. */
120
121 COLOR  cextinction = BLKCOLOR;          /* global extinction coefficient */
122 COLOR  salbedo = BLKCOLOR;              /* global scattering albedo */
123 double  seccg = 0.;                     /* global scattering eccentricity */
124 double  ssampdist = 0.;                 /* scatter sampling distance */
125
126 double  specthresh = .15;               /* specular sampling threshold */
127 double  specjitter = 1.;                /* specular sampling jitter */
128
129 int  backvis = 1;                       /* back face visibility */
130
131 int  maxdepth = 6;                      /* maximum recursion depth */
132 double  minweight = 4e-3;               /* minimum ray weight */
133
134 char  *ambfile = NULL;                  /* ambient file name */
135 COLOR  ambval = BLKCOLOR;               /* ambient value */
136 int  ambvwt = 0;                        /* initial weight for ambient value */
137 double  ambacc = 0.2;                   /* ambient accuracy */
138 int  ambres = 128;                      /* ambient resolution */
139 int  ambdiv = 512;                      /* ambient divisions */
140 int  ambssamp = 0;                      /* ambient super-samples */
141 int  ambounce = 0;                      /* ambient bounces */
142 char  *amblist[128];                    /* ambient include/exclude list */
143 int  ambincl = -1;                      /* include == 1, exclude == 0 */
144
145
54   static RAY  thisray;                    /* for our convenience */
55  
56 < static void  oputo(), oputd(), oputv(), oputl(), oputL(),
57 <                oputp(), oputn(), oputN(), oputs(), oputw(), oputm();
56 > typedef void putf_t(double v);
57 > static putf_t puta, putd, putf;
58  
59 < static void  ourtrace(), tabin();
60 < static void  (*ray_out[16])(), (*every_out[16])();
61 < static int  castonly = 0;
59 > typedef void oputf_t(RAY *r);
60 > static oputf_t  oputo, oputd, oputv, oputV, oputl, oputL, oputc, oputp,
61 >                oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputtilde;
62  
63 < static void  puta(), putf(), putd();
63 > static void setoutput(char *vs);
64 > extern void tranotify(OBJECT obj);
65 > static void bogusray(void);
66 > static void rad(FVECT org, FVECT dir, double dmax);
67 > static void irrad(FVECT org, FVECT dir);
68 > static int printvals(RAY *r);
69 > static int getvec(FVECT vec, int fmt, FILE *fp);
70 > static void tabin(RAY *r);
71 > static void ourtrace(RAY *r);
72  
73 < static void  (*putreal)();
73 > static oputf_t *ray_out[16], *every_out[16];
74 > static putf_t *putreal;
75  
159 void    bogusray(), rad(), irrad(), printvals();
76  
161
77   void
78 < quit(code)                      /* quit program */
79 < int  code;
78 > quit(                   /* quit program */
79 >        int  code
80 > )
81   {
82 < #ifndef  NIX
83 <        headclean();            /* delete header file */
84 <        pfclean();              /* clean up persist files */
82 >        if (ray_pnprocs > 0)    /* close children if any */
83 >                ray_pclose(0);          
84 > #ifndef  NON_POSIX
85 >        else if (!ray_pnprocs) {
86 >                headclean();    /* delete header file */
87 >                pfclean();      /* clean up persist files */
88 >        }
89   #endif
90          exit(code);
91   }
92  
93  
94   char *
95 < formstr(f)                              /* return format identifier */
96 < int  f;
95 > formstr(                                /* return format identifier */
96 >        int  f
97 > )
98   {
99          switch (f) {
100          case 'a': return("ascii");
# Line 185 | Line 106 | int  f;
106   }
107  
108  
109 < void
110 < rtrace(fname)                           /* trace rays from file */
111 < char  *fname;
109 > extern void
110 > rtrace(                         /* trace rays from file */
111 >        char  *fname
112 > )
113   {
114 <        long  vcount = hresolu>1 ? hresolu*vresolu : vresolu;
114 >        unsigned long  vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu
115 >                                              : vresolu;
116          long  nextflush = hresolu;
117          FILE  *fp;
118          double  d;
# Line 201 | Line 124 | char  *fname;
124                  sprintf(errmsg, "cannot open input file \"%s\"", fname);
125                  error(SYSTEM, errmsg);
126          }
204 #ifdef MSDOS
127          if (inform != 'a')
128 <                setmode(fileno(fp), O_BINARY);
207 < #endif
128 >                SET_FILE_BINARY(fp);
129                                          /* set up output */
130          setoutput(outvals);
131          switch (outform) {
# Line 218 | Line 139 | char  *fname;
139          default:
140                  error(CONSISTENCY, "botched output format");
141          }
142 +        if (ray_pnprocs > 1)
143 +                ray_fifo_out = printvals;
144          if (hresolu > 0) {
145                  if (vresolu > 0)
146                          fprtresolu(hresolu, vresolu, stdout);
# Line 229 | Line 152 | char  *fname;
152  
153                  d = normalize(direc);
154                  if (d == 0.0) {                         /* zero ==> flush */
155 +                        if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
156 +                                error(USER, "lost children");
157                          bogusray();
158 <                        if (--nextflush <= 0 || vcount <= 0) {
158 >                        if (--nextflush <= 0 || !vcount) {
159                                  fflush(stdout);
160                                  nextflush = hresolu;
161                          }
162 <                } else {
238 <                        samplendx++;
239 <                                                        /* compute and print */
162 >                } else {                                /* compute and print */
163                          if (imm_irrad)
164                                  irrad(orig, direc);
165                          else
166                                  rad(orig, direc, lim_dist ? d : 0.0);
167                                                          /* flush if time */
168 <                        if (--nextflush == 0) {
168 >                        if (!--nextflush) {
169 >                                if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
170 >                                        error(USER, "lost children");
171                                  fflush(stdout);
172                                  nextflush = hresolu;
173                          }
174                  }
175                  if (ferror(stdout))
176                          error(SYSTEM, "write error");
177 <                if (--vcount == 0)                      /* check for end */
177 >                if (vcount && !--vcount)                /* check for end */
178                          break;
179          }
180 <        fflush(stdout);
181 <        if (vcount > 0)
182 <                error(USER, "read error");
180 >        if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
181 >                error(USER, "unable to complete processing");
182 >        if (fflush(stdout) < 0)
183 >                error(SYSTEM, "write error");
184 >        if (vcount)
185 >                error(USER, "unexpected EOF on input");
186          if (fname != NULL)
187                  fclose(fp);
188   }
189  
190  
191 < setoutput(vs)                           /* set up output tables */
192 < register char  *vs;
191 > static void
192 > trace_sources(void)                     /* trace rays to light sources, also */
193   {
194 <        extern void  (*trace)();
195 <        register void (**table)() = ray_out;
194 >        int     sn;
195 >        
196 >        for (sn = 0; sn < nsources; sn++)
197 >                source[sn].sflags |= SFOLLOW;
198 > }
199  
200 +
201 + static void
202 + setoutput(                              /* set up output tables */
203 +        char  *vs
204 + )
205 + {
206 +        oputf_t **table = ray_out;
207 +
208          castonly = 1;
209          while (*vs)
210                  switch (*vs++) {
211 +                case 'T':                               /* trace sources */
212 +                        if (!*vs) break;
213 +                        trace_sources();
214 +                        /* fall through */
215                  case 't':                               /* trace */
216 +                        if (!*vs) break;
217                          *table = NULL;
218                          table = every_out;
219                          trace = ourtrace;
# Line 285 | Line 229 | register char  *vs;
229                          *table++ = oputv;
230                          castonly = 0;
231                          break;
232 +                case 'V':                               /* contribution */
233 +                        *table++ = oputV;
234 +                        if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
235 +                                error(WARNING,
236 +                                        "-otV accuracy depends on -aa 0 -as 0");
237 +                        break;
238                  case 'l':                               /* effective distance */
239                          *table++ = oputl;
240                          castonly = 0;
241                          break;
242 +                case 'c':                               /* local coordinates */
243 +                        *table++ = oputc;
244 +                        break;
245                  case 'L':                               /* single ray length */
246                          *table++ = oputL;
247                          break;
# Line 308 | Line 261 | register char  *vs;
261                  case 'w':                               /* weight */
262                          *table++ = oputw;
263                          break;
264 +                case 'W':                               /* coefficient */
265 +                        *table++ = oputW;
266 +                        if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
267 +                                error(WARNING,
268 +                                        "-otW accuracy depends on -aa 0 -as 0");
269 +                        break;
270                  case 'm':                               /* modifier */
271                          *table++ = oputm;
272                          break;
273 +                case 'M':                               /* material */
274 +                        *table++ = oputM;
275 +                        break;
276 +                case '~':                               /* tilde */
277 +                        *table++ = oputtilde;
278 +                        break;
279                  }
280          *table = NULL;
281   }
282  
283  
284 < void
285 < bogusray()                      /* print out empty record */
284 > static void
285 > bogusray(void)                  /* print out empty record */
286   {
287          thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] =
288          thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0;
289 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
289 >        thisray.rmax = 0.0;
290 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
291          printvals(&thisray);
292   }
293  
294  
295 < void
296 < rad(org, dir, dmax)             /* compute and print ray value(s) */
297 < FVECT  org, dir;
298 < double  dmax;
295 > static void
296 > rad(            /* compute and print ray value(s) */
297 >        FVECT  org,
298 >        FVECT  dir,
299 >        double  dmax
300 > )
301   {
302          VCOPY(thisray.rorg, org);
303          VCOPY(thisray.rdir, dir);
304          thisray.rmax = dmax;
305 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
305 >        if (!castonly && ray_pnprocs > 1) {
306 >                if (ray_fifo_in(&thisray) < 0)
307 >                        error(USER, "lost children");
308 >                return;
309 >        }
310 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
311          if (castonly) {
312 <                if (!localhit(&thisray, &thescene))
312 >                if (!localhit(&thisray, &thescene)) {
313                          if (thisray.ro == &Aftplane) {  /* clipped */
314                                  thisray.ro = NULL;
315                                  thisray.rot = FHUGE;
316                          } else
317                                  sourcehit(&thisray);
318 +                }
319          } else
320 <                rayvalue(&thisray);
320 >                ray_trace(&thisray);
321          printvals(&thisray);
322   }
323  
324  
325 < void
326 < irrad(org, dir)                 /* compute immediate irradiance value */
327 < FVECT  org, dir;
325 > static void
326 > irrad(                  /* compute immediate irradiance value */
327 >        FVECT  org,
328 >        FVECT  dir
329 > )
330   {
331 <        register int  i;
332 <
333 <        for (i = 0; i < 3; i++) {
334 <                thisray.rorg[i] = org[i] + dir[i];
335 <                thisray.rdir[i] = -dir[i];
336 <        }
361 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
331 >        VSUM(thisray.rorg, org, dir, 1.1e-4);
332 >        thisray.rdir[0] = -dir[0];
333 >        thisray.rdir[1] = -dir[1];
334 >        thisray.rdir[2] = -dir[2];
335 >        thisray.rmax = 0.0;
336 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
337                                          /* pretend we hit surface */
338 <        thisray.rot = 1.0-1e-4;
338 >        thisray.rot = 1e-5;
339          thisray.rod = 1.0;
340          VCOPY(thisray.ron, dir);
341 <        for (i = 0; i < 3; i++)         /* fudge factor */
367 <                thisray.rop[i] = org[i] + 1e-4*dir[i];
341 >        VSUM(thisray.rop, org, dir, 1e-4);
342                                          /* compute and print */
343          (*ofun[Lamb.otype].funp)(&Lamb, &thisray);
344          printvals(&thisray);
345   }
346  
347  
348 < void
349 < printvals(r)                    /* print requested ray values */
350 < RAY  *r;
348 > static int
349 > printvals(                      /* print requested ray values */
350 >        RAY  *r
351 > )
352   {
353 <        register void  (**tp)();
353 >        oputf_t **tp;
354  
355          if (ray_out[0] == NULL)
356 <                return;
356 >                return(0);
357          for (tp = ray_out; *tp != NULL; tp++)
358                  (**tp)(r);
359          if (outform == 'a')
360                  putchar('\n');
361 +        return(1);
362   }
363  
364  
365 < int
366 < getvec(vec, fmt, fp)            /* get a vector from fp */
367 < register FVECT  vec;
368 < int  fmt;
369 < FILE  *fp;
365 > static int
366 > getvec(         /* get a vector from fp */
367 >        FVECT  vec,
368 >        int  fmt,
369 >        FILE  *fp
370 > )
371   {
372          static float  vf[3];
373          static double  vd[3];
374          char  buf[32];
375 <        register int  i;
375 >        int  i;
376  
377          switch (fmt) {
378          case 'a':                                       /* ascii */
# Line 409 | Line 386 | FILE  *fp;
386          case 'f':                                       /* binary float */
387                  if (fread((char *)vf, sizeof(float), 3, fp) != 3)
388                          return(-1);
389 <                vec[0] = vf[0]; vec[1] = vf[1]; vec[2] = vf[2];
389 >                VCOPY(vec, vf);
390                  break;
391          case 'd':                                       /* binary double */
392                  if (fread((char *)vd, sizeof(double), 3, fp) != 3)
393                          return(-1);
394 <                vec[0] = vd[0]; vec[1] = vd[1]; vec[2] = vd[2];
394 >                VCOPY(vec, vd);
395                  break;
396          default:
397                  error(CONSISTENCY, "botched input format");
# Line 424 | Line 401 | FILE  *fp;
401  
402  
403   void
404 < tranotify(obj)                  /* record new modifier */
405 < OBJECT  obj;
404 > tranotify(                      /* record new modifier */
405 >        OBJECT  obj
406 > )
407   {
408          static int  hitlimit = 0;
409 <        register OBJREC  *o = objptr(obj);
410 <        register char  **tralp;
409 >        OBJREC   *o = objptr(obj);
410 >        char  **tralp;
411  
412          if (obj == OVOID) {             /* starting over */
413                  traset[0] = 0;
# Line 452 | Line 430 | OBJECT obj;
430  
431  
432   static void
433 < ourtrace(r)                             /* print ray values */
434 < RAY  *r;
433 > ourtrace(                               /* print ray values */
434 >        RAY  *r
435 > )
436   {
437 <        register void  (**tp)();
437 >        oputf_t **tp;
438  
439          if (every_out[0] == NULL)
440                  return;
# Line 467 | Line 446 | RAY  *r;
446          tabin(r);
447          for (tp = every_out; *tp != NULL; tp++)
448                  (**tp)(r);
449 <        putchar('\n');
449 >        if (outform == 'a')
450 >                putchar('\n');
451   }
452  
453  
454   static void
455 < tabin(r)                                /* tab in appropriate amount */
456 < RAY  *r;
455 > tabin(                          /* tab in appropriate amount */
456 >        RAY  *r
457 > )
458   {
459 <        register RAY  *rp;
459 >        const RAY  *rp;
460  
461          for (rp = r->parent; rp != NULL; rp = rp->parent)
462                  putchar('\t');
# Line 483 | Line 464 | RAY  *r;
464  
465  
466   static void
467 < oputo(r)                                /* print origin */
468 < register RAY  *r;
467 > oputo(                          /* print origin */
468 >        RAY  *r
469 > )
470   {
471          (*putreal)(r->rorg[0]);
472          (*putreal)(r->rorg[1]);
# Line 493 | Line 475 | register RAY  *r;
475  
476  
477   static void
478 < oputd(r)                                /* print direction */
479 < register RAY  *r;
478 > oputd(                          /* print direction */
479 >        RAY  *r
480 > )
481   {
482          (*putreal)(r->rdir[0]);
483          (*putreal)(r->rdir[1]);
# Line 503 | Line 486 | register RAY  *r;
486  
487  
488   static void
489 < oputv(r)                                /* print value */
490 < register RAY  *r;
489 > oputv(                          /* print value */
490 >        RAY  *r
491 > )
492   {
509        COLR  cout;
510        
493          if (outform == 'c') {
494 +                COLR  cout;
495                  setcolr(cout,   colval(r->rcol,RED),
496                                  colval(r->rcol,GRN),
497                                  colval(r->rcol,BLU));
# Line 522 | Line 505 | register RAY  *r;
505  
506  
507   static void
508 < oputl(r)                                /* print effective distance */
509 < register RAY  *r;
508 > oputV(                          /* print value contribution */
509 >        RAY *r
510 > )
511   {
512 +        double  contr[3];
513 +
514 +        raycontrib(contr, r, PRIMARY);
515 +        multcolor(contr, r->rcol);
516 +        (*putreal)(contr[RED]);
517 +        (*putreal)(contr[GRN]);
518 +        (*putreal)(contr[BLU]);
519 + }
520 +
521 +
522 + static void
523 + oputl(                          /* print effective distance */
524 +        RAY  *r
525 + )
526 + {
527          (*putreal)(r->rt);
528   }
529  
530  
531   static void
532 < oputL(r)                                /* print single ray length */
533 < register RAY  *r;
532 > oputL(                          /* print single ray length */
533 >        RAY  *r
534 > )
535   {
536          (*putreal)(r->rot);
537   }
538  
539  
540   static void
541 < oputp(r)                                /* print point */
542 < register RAY  *r;
541 > oputc(                          /* print local coordinates */
542 >        RAY  *r
543 > )
544   {
545 +        (*putreal)(r->uv[0]);
546 +        (*putreal)(r->uv[1]);
547 + }
548 +
549 +
550 + static void
551 + oputp(                          /* print point */
552 +        RAY  *r
553 + )
554 + {
555          if (r->rot < FHUGE) {
556                  (*putreal)(r->rop[0]);
557                  (*putreal)(r->rop[1]);
# Line 554 | Line 565 | register RAY  *r;
565  
566  
567   static void
568 < oputN(r)                                /* print unperturbed normal */
569 < register RAY  *r;
568 > oputN(                          /* print unperturbed normal */
569 >        RAY  *r
570 > )
571   {
572          if (r->rot < FHUGE) {
573                  (*putreal)(r->ron[0]);
# Line 570 | Line 582 | register RAY  *r;
582  
583  
584   static void
585 < oputn(r)                                /* print perturbed normal */
586 < RAY  *r;
585 > oputn(                          /* print perturbed normal */
586 >        RAY  *r
587 > )
588   {
589          FVECT  pnorm;
590  
# Line 589 | Line 602 | RAY  *r;
602  
603  
604   static void
605 < oputs(r)                                /* print name */
606 < register RAY  *r;
605 > oputs(                          /* print name */
606 >        RAY  *r
607 > )
608   {
609          if (r->ro != NULL)
610                  fputs(r->ro->oname, stdout);
# Line 601 | Line 615 | register RAY  *r;
615  
616  
617   static void
618 < oputw(r)                                /* print weight */
619 < register RAY  *r;
618 > oputw(                          /* print weight */
619 >        RAY  *r
620 > )
621   {
622          (*putreal)(r->rweight);
623   }
624  
625  
626   static void
627 < oputm(r)                                /* print modifier */
628 < register RAY  *r;
627 > oputW(                          /* print coefficient */
628 >        RAY  *r
629 > )
630   {
631 +        double  contr[3];
632 +
633 +        raycontrib(contr, r, PRIMARY);
634 +        (*putreal)(contr[RED]);
635 +        (*putreal)(contr[GRN]);
636 +        (*putreal)(contr[BLU]);
637 + }
638 +
639 +
640 + static void
641 + oputm(                          /* print modifier */
642 +        RAY  *r
643 + )
644 + {
645          if (r->ro != NULL)
646                  if (r->ro->omod != OVOID)
647                          fputs(objptr(r->ro->omod)->oname, stdout);
# Line 624 | Line 654 | register RAY  *r;
654  
655  
656   static void
657 < puta(v)                         /* print ascii value */
658 < double  v;
657 > oputM(                          /* print material */
658 >        RAY  *r
659 > )
660 > {
661 >        OBJREC  *mat;
662 >
663 >        if (r->ro != NULL) {
664 >                if ((mat = findmaterial(r->ro)) != NULL)
665 >                        fputs(mat->oname, stdout);
666 >                else
667 >                        fputs(VOIDID, stdout);
668 >        } else
669 >                putchar('*');
670 >        putchar('\t');
671 > }
672 >
673 >
674 > static void
675 > oputtilde(                      /* output tilde (spacer) */
676 >        RAY  *r
677 > )
678 > {
679 >        fputs("~\t", stdout);
680 > }
681 >
682 >
683 > static void
684 > puta(                           /* print ascii value */
685 >        double  v
686 > )
687   {
688          printf("%e\t", v);
689   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines