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

Comparing ray/src/rt/normal.c (file contents):
Revision 2.29 by greg, Fri Sep 15 15:47:30 1995 UTC vs.
Revision 2.30 by greg, Tue Sep 26 15:05:32 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 201 | Line 201 | register RAY  *r;
201          multcolor(nd.mcolor, r->pcol);          /* modify material color */
202          mirtest = transtest = 0;
203          mirdist = transdist = r->rot;
204 <                                                /* get specular component */
205 <        if ((nd.rspec = m->oargs.farg[3]) > FTINY) {
206 <                nd.specfl |= SP_REFL;
207 <                                                /* compute specular color */
208 <                if (m->otype == MAT_METAL)
209 <                        copycolor(nd.scolor, nd.mcolor);
210 <                else
211 <                        setcolor(nd.scolor, 1.0, 1.0, 1.0);
212 <                scalecolor(nd.scolor, nd.rspec);
213 <                                                /* check threshold */
214 <                if (!(nd.specfl & SP_PURE) && specthresh >= nd.rspec-FTINY)
215 <                        nd.specfl |= SP_RBLT;
216 <                                                /* compute reflected ray */
217 <                for (i = 0; i < 3; i++)
218 <                        nd.vrefl[i] = r->rdir[i] + 2.*nd.pdot*nd.pnorm[i];
219 <                                                /* penetration? */
220 <                if (hastexture && DOT(nd.vrefl, r->ron) <= FTINY)
221 <                        for (i = 0; i < 3; i++)         /* safety measure */
222 <                                nd.vrefl[i] = r->rdir[i] + 2.*r->rod*r->ron[i];
223 <
224 <                if (!(r->crtype & SHADOW) && nd.specfl & SP_PURE) {
225 <                        RAY  lr;
226 <                        if (rayorigin(&lr, r, REFLECTED, nd.rspec) == 0) {
227 <                                VCOPY(lr.rdir, nd.vrefl);
228 <                                rayvalue(&lr);
229 <                                multcolor(lr.rcol, nd.scolor);
230 <                                addcolor(r->rcol, lr.rcol);
231 <                                if (!hastexture && nd.specfl & SP_FLAT) {
232 <                                        mirtest = 2.*bright(lr.rcol);
233 <                                        mirdist = r->rot + lr.rt;
234 <                                }
235 <                        }
236 <                }
237 <        }
204 >        nd.rspec = m->oargs.farg[3];
205                                                  /* compute transmission */
206          if (m->otype == MAT_TRANS) {
207                  nd.trans = m->oargs.farg[5]*(1.0 - nd.rspec);
# Line 278 | Line 245 | register RAY  *r;
245          if (r->crtype & SHADOW) {               /* the rest is shadow */
246                  r->rt = transdist;
247                  return(1);
248 +        }
249 +                                                /* get specular reflection */
250 +        if (nd.rspec > FTINY) {
251 +                nd.specfl |= SP_REFL;
252 +                                                /* compute specular color */
253 +                if (m->otype == MAT_METAL)
254 +                        copycolor(nd.scolor, nd.mcolor);
255 +                else
256 +                        setcolor(nd.scolor, 1.0, 1.0, 1.0);
257 +                scalecolor(nd.scolor, nd.rspec);
258 +                                                /* check threshold */
259 +                if (!(nd.specfl & SP_PURE) && specthresh >= nd.rspec-FTINY)
260 +                        nd.specfl |= SP_RBLT;
261 +                                                /* compute reflected ray */
262 +                for (i = 0; i < 3; i++)
263 +                        nd.vrefl[i] = r->rdir[i] + 2.*nd.pdot*nd.pnorm[i];
264 +                                                /* penetration? */
265 +                if (hastexture && DOT(nd.vrefl, r->ron) <= FTINY)
266 +                        for (i = 0; i < 3; i++)         /* safety measure */
267 +                                nd.vrefl[i] = r->rdir[i] + 2.*r->rod*r->ron[i];
268 +
269 +                if (!(r->crtype & SHADOW) && nd.specfl & SP_PURE) {
270 +                        RAY  lr;
271 +                        if (rayorigin(&lr, r, REFLECTED, nd.rspec) == 0) {
272 +                                VCOPY(lr.rdir, nd.vrefl);
273 +                                rayvalue(&lr);
274 +                                multcolor(lr.rcol, nd.scolor);
275 +                                addcolor(r->rcol, lr.rcol);
276 +                                if (!hastexture && nd.specfl & SP_FLAT) {
277 +                                        mirtest = 2.*bright(lr.rcol);
278 +                                        mirdist = r->rot + lr.rt;
279 +                                }
280 +                        }
281 +                }
282          }
283                                                  /* diffuse reflection */
284          nd.rdiff = 1.0 - nd.trans - nd.rspec;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines