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

Comparing ray/src/rt/srcsupp.c (file contents):
Revision 1.8 by greg, Tue Jun 25 16:42:03 1991 UTC vs.
Revision 1.11 by greg, Wed Aug 14 08:19:20 1991 UTC

# Line 27 | Line 27 | SRCFUNC  sfun[NUMOTYPE];               /* source dispatch table */
27  
28   initstypes()                    /* initialize source dispatch table */
29   {
30 <        extern VSMATERIAL  mirror_vs;
30 >        extern VSMATERIAL  mirror_vs, direct1_vs, direct2_vs;
31          extern int  fsetsrc(), ssetsrc(), sphsetsrc(), rsetsrc();
32          extern double  fgetplaneq(), rgetplaneq();
33          extern double  fgetmaxdisk(), rgetmaxdisk();
# Line 37 | Line 37 | initstypes()                   /* initialize source dispatch table */
37          static SOBJECT  rsobj = {rsetsrc, rgetplaneq, rgetmaxdisk};
38  
39          sfun[MAT_MIRROR].mf = &mirror_vs;
40 +        sfun[MAT_DIRECT1].mf = &direct1_vs;
41 +        sfun[MAT_DIRECT2].mf = &direct2_vs;
42          sfun[OBJ_FACE].of = &fsobj;
43          sfun[OBJ_SOURCE].of = &ssobj;
44          sfun[OBJ_SPHERE].of = &sphsobj;
# Line 413 | Line 415 | register RAY  *r;
415   }
416  
417  
418 < #define  wrongsource(m, r)      (m->otype!=MAT_ILLUM && \
419 <                                r->rsrc>=0 && \
420 <                                source[r->rsrc].so!=r->ro)
418 > #define  wrongsource(m, r)      (r->rsrc>=0 && \
419 >                                source[r->rsrc].so!=r->ro && \
420 >                                (m->otype!=MAT_ILLUM || \
421 >                        objptr(source[r->rsrc].so->omod)->otype==MAT_ILLUM))
422  
423 + #define  distglow(m, r)         (m->otype==MAT_GLOW && \
424 +                                r->rot > m->oargs.farg[3])
425 +
426   #define  badambient(m, r)       ((r->crtype&(AMBIENT|SHADOW))==AMBIENT && \
427 <                                !(m->otype==MAT_GLOW&&r->rot>m->oargs.farg[3]))
427 >                                !distglow(m, r))
428  
429   #define  passillum(m, r)        (m->otype==MAT_ILLUM && \
430                                  !(r->rsrc>=0&&source[r->rsrc].so==r->ro))
431  
432 + #define  srcignore(m, r)        (directinvis && !(r->crtype&SHADOW) && \
433 +                                !distglow(m, r))
434  
435 +
436   m_light(m, r)                   /* ray hit a light source */
437   register OBJREC  *m;
438   register RAY  *r;
# Line 433 | Line 442 | register RAY  *r;
442                  return;
443                                                  /* check for passed illum */
444          if (passillum(m, r)) {
436
445                  if (m->oargs.nsargs < 1 || !strcmp(m->oargs.sarg[0], VOIDID))
446                          raytrans(r);
447                  else
448                          rayshade(r, modifier(m->oargs.sarg[0]));
449 <
450 <                                                /* otherwise treat as source */
451 <        } else {
449 >                return;
450 >        }
451 >                                        /* otherwise treat as source */
452                                                  /* check for behind */
453 <                if (r->rod < 0.0)
454 <                        return;
453 >        if (r->rod < 0.0)
454 >                return;
455 >                                                /* check for invisibility */
456 >        if (srcignore(m, r))
457 >                return;
458                                                  /* get distribution pattern */
459 <                raytexture(r, m->omod);
459 >        raytexture(r, m->omod);
460                                                  /* get source color */
461 <                setcolor(r->rcol, m->oargs.farg[0],
462 <                                  m->oargs.farg[1],
463 <                                  m->oargs.farg[2]);
461 >        setcolor(r->rcol, m->oargs.farg[0],
462 >                          m->oargs.farg[1],
463 >                          m->oargs.farg[2]);
464                                                  /* modify value */
465 <                multcolor(r->rcol, r->pcol);
455 <        }
465 >        multcolor(r->rcol, r->pcol);
466   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines