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

Comparing ray/src/rt/virtuals.c (file contents):
Revision 1.19 by greg, Tue Jul 30 18:23:45 1991 UTC vs.
Revision 1.26 by greg, Mon Aug 26 10:10:43 1991 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19  
20   #include  "random.h"
21  
22 < #define  MINSAMPLES     5               /* minimum number of pretest samples */
23 < #define  STESTMAX       30              /* maximum seeks per sample */
22 > #define  MINSAMPLES     16              /* minimum number of pretest samples */
23 > #define  STESTMAX       32              /* maximum seeks per sample */
24  
25  
26   double  getdisk();
# Line 44 | Line 44 | markvirtuals()                 /* find and mark virtual sources */
44                  if (!isvlight(objptr(o->omod)->otype))
45                          continue;
46                  if (sfun[o->otype].of == NULL ||
47 <                                sfun[o->otype].of->getpleq == NULL)
48 <                        objerror(o, USER, "illegal material");
47 >                                sfun[o->otype].of->getpleq == NULL) {
48 >                        objerror(o,WARNING,"secondary sources not supported");
49 >                        continue;
50 >                }
51                  if (nvobjects == 0)
52                          vobject = (OBJECT *)malloc(sizeof(OBJECT));
53                  else
# Line 199 | Line 201 | MAT4  pm;
201                  if (source[sn].sflags & SFLAT) {        /* behind source? */
202                          multv3(nsnorm, source[sn].snorm, pm);
203                          normalize(nsnorm);
204 <                        if (!checkspot(&ourspot, nsnorm))
204 >                        if (nsflags & SSPOT && !checkspot(&ourspot, nsnorm))
205                                  return(-1);
206                  }
207          }
# Line 285 | Line 287 | register int  sn;      /* target source number */
287          getplaneq(onorm, o);
288                                  /* set number of rays to sample */
289          if (source[sn].sflags & SDISTANT) {
290 <                n = (2./3.*PI*PI)*or2/(thescene.cusize*thescene.cusize)*
291 <                                vspretest + .5;
290 >                                        /* 32. == heuristic constant */
291 >                n = 32.*or2/(thescene.cusize*thescene.cusize)*vspretest + .5;
292                  infront = DOT(onorm, source[sn].sloc) > 0.;
293          } else {
294                  for (i = 0; i < 3; i++)
295                          offsdir[i] = source[sn].sloc[i] - oc[i];
296 <                n = or2/DOT(offsdir,offsdir)*vspretest + .5;
296 >                d = DOT(offsdir,offsdir);
297 >                if (d <= FTINY)
298 >                        n = 2.*PI * vspretest + .5;
299 >                else
300 >                        n = 2.*PI * (1.-sqrt(1./(1.+or2/d)))*vspretest + .5;
301                  infront = DOT(onorm, offsdir) > 0.;
302          }
303          if (n < MINSAMPLES) n = MINSAMPLES;
# Line 313 | Line 319 | register int  sn;      /* target source number */
319   #endif
320                                  return(f);      /* too small a target! */
321                          }
322 +                        multisamp(offsdir, 3, urand(sn*931+5827+ssn));
323                          for (i = 0; i < 3; i++)
324 <                                offsdir[i] = or*(1. -
318 <                                        2.*urand(urind(931*i+5827,ssn)));
324 >                                offsdir[i] = or*(1. - 2.*offsdir[i]);
325                          ssn++;
326                          for (i = 0; i < 3; i++)
327                                  sr.rorg[i] = oc[i] + offsdir[i];
# Line 343 | Line 349 | register int  sn;      /* target source number */
349                  nok++;
350                                          /* check against obstructions */
351                  rayclear(&sr);
352 <                sr.revf = raytrace;
347 <                rayvalue(&sr);
348 <                if (bright(sr.rcol) > FTINY)
352 >                if (!localhit(&sr, &thescene) || sr.ro == source[sn].so)
353                          nhit++;
354                  if (nhit > 0 && nhit < nok) {
355   #ifdef DEBUG

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines