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.10 by greg, Thu Jul 18 14:43:07 1991 UTC vs.
Revision 1.13 by greg, Fri Sep 13 13:44:10 1991 UTC

# Line 49 | Line 49 | initstypes()                   /* initialize source dispatch table */
49   int
50   newsource()                     /* allocate new source in our array */
51   {
52 + #define SRCINC  4
53          if (nsources == 0)
54 <                source = (SRCREC *)malloc(sizeof(SRCREC));
55 <        else
54 >                source = (SRCREC *)malloc(SRCINC*sizeof(SRCREC));
55 >        else if (nsources%SRCINC == 0)
56                  source = (SRCREC *)realloc((char *)source,
57 <                                (unsigned)(nsources+1)*sizeof(SRCREC));
57 >                                (unsigned)(nsources+SRCINC)*sizeof(SRCREC));
58          if (source == NULL)
59                  return(-1);
60          source[nsources].sflags = 0;
61          source[nsources].nhits = 1;
62          source[nsources].ntests = 2;    /* initial hit probability = 1/2 */
63          return(nsources++);
64 + #undef SRCINC
65   }
66  
67  
# Line 392 | Line 394 | register RAY  *r;
394                  first = 0; last = nsources-1;
395          }
396          for (i = first; i <= last; i++)
397 <                if (source[i].sflags & SDISTANT)
397 >                if ((source[i].sflags & (SDISTANT|SVIRTUAL)) == SDISTANT)
398                          /*
399                           * Check to see if ray is within
400                           * solid angle of source.
# Line 415 | Line 417 | register RAY  *r;
417   }
418  
419  
420 < #define  wrongsource(m, r)      (m->otype!=MAT_ILLUM && \
421 <                                r->rsrc>=0 && \
422 <                                source[r->rsrc].so!=r->ro)
420 > #define  wrongsource(m, r)      (r->rsrc>=0 && \
421 >                                source[r->rsrc].so!=r->ro && \
422 >                                (m->otype!=MAT_ILLUM || \
423 >                        objptr(source[r->rsrc].so->omod)->otype==MAT_ILLUM))
424  
425   #define  distglow(m, r)         (m->otype==MAT_GLOW && \
426                                  r->rot > m->oargs.farg[3])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines