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

Comparing ray/src/rt/source.c (file contents):
Revision 1.39 by greg, Thu Jul 11 16:39:03 1991 UTC vs.
Revision 1.40 by greg, Tue Jul 30 18:23:41 1991 UTC

# Line 128 | Line 128 | register int  sn;              /* source number */
128          sr->rsrc = sn;                          /* remember source */
129                                                  /* get source direction */
130          if (source[sn].sflags & SDISTANT) {
131                if (source[sn].sflags & SSPOT) {        /* check location */
132                        for (i = 0; i < 3; i++)
133                                vd[i] = sr->rorg[i] - source[sn].sl.s->aim[i];
134                        d = DOT(source[sn].sloc,vd);
135                        d = DOT(vd,vd) - d*d;
136                        if (PI*d > source[sn].sl.s->siz)
137                                return(0.0);
138                }
131                                                  /* constant direction */
132                  VCOPY(sr->rdir, source[sn].sloc);
133          } else {                                /* compute direction */
# Line 162 | Line 154 | register int  sn;              /* source number */
154                  }
155                  for (i = 0; i < 3; i++)         /* offset source direction */
156                          sr->rdir[i] += vd[i];
157 +                                                /* normalize */
158 +                d = normalize(sr->rdir);
159  
160 <        } else if (source[sn].sflags & SDISTANT)
161 <                                                /* already normalized */
162 <                return(source[sn].ss2);
160 >        } else if (!(source[sn].sflags & SDISTANT))
161 >                                                /* normalize direction */
162 >                d = normalize(sr->rdir);
163  
164 <        if ((d = normalize(sr->rdir)) == 0.0)
165 <                                                /* at source! */
164 >        if (source[sn].sflags & SDISTANT) {
165 >                if (source[sn].sflags & SSPOT) {        /* check location */
166 >                        for (i = 0; i < 3; i++)
167 >                                vd[i] = sr->rorg[i] - source[sn].sl.s->aim[i];
168 >                        d = DOT(sr->rdir,vd);
169 >                        d = DOT(vd,vd) - d*d;
170 >                        if (PI*d > source[sn].sl.s->siz)
171 >                                return(0.0);
172 >                }
173 >                return(source[sn].ss2);         /* domega constant */
174 >        }
175 >                                                /* check direction */
176 >        if (d == 0.0)
177                  return(0.0);
173        
174        if (source[sn].sflags & SDISTANT)
175                                                /* domega constant */
176                return(source[sn].ss2);
177
178                                                  /* check proximity */
179          if (source[sn].sflags & SPROX &&
180                          d > source[sn].sl.prox)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines