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

Comparing ray/src/rt/aniso.c (file contents):
Revision 2.32 by greg, Wed Apr 24 15:47:25 1996 UTC vs.
Revision 2.35 by greg, Tue Feb 25 02:47:22 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  Shading functions for anisotropic materials.
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  "ray.h"
11  
12   #include  "otypes.h"
# Line 16 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15  
16   #include  "random.h"
17  
19 extern double  specthresh;              /* specular sampling threshold */
20 extern double  specjitter;              /* specular sampling jitter */
21
22 extern int  backvis;                    /* back faces visible? */
23
18   #ifndef  MAXITER
19   #define  MAXITER        10              /* maximum # specular ray attempts */
20   #endif
21  
28 static  agaussamp(), getacoords();
29
22   /*
23   *      This routine implements the anisotropic Gaussian
24   *  model described by Ward in Siggraph `92 article.
# Line 68 | Line 60 | typedef struct {
60          double  pdot;           /* perturbed dot product */
61   }  ANISODAT;            /* anisotropic material data */
62  
63 + static void     getacoords();
64 + static void     agaussamp();
65  
66 +
67 + static void
68   diraniso(cval, np, ldir, omega)         /* compute source contribution */
69   COLOR  cval;                    /* returned coefficient */
70   register ANISODAT  *np;         /* material data */
# Line 182 | Line 178 | double  omega;                 /* light source size */
178   }
179  
180  
181 + int
182   m_aniso(m, r)                   /* shade ray that hit something anisotropic */
183   register OBJREC  *m;
184   register RAY  *r;
# Line 307 | Line 304 | register RAY  *r;
304   }
305  
306  
307 < static
307 > static void
308   getacoords(r, np)               /* set up coordinate system */
309   RAY  *r;
310   register ANISODAT  *np;
# Line 337 | Line 334 | register ANISODAT  *np;
334   }
335  
336  
337 < static
337 > static void
338   agaussamp(r, np)                /* sample anisotropic gaussian specular */
339   RAY  *r;
340   register ANISODAT  *np;
# Line 359 | Line 356 | register ANISODAT  *np;
356                                  d = urand(ilhash(dimlist,ndims)+samplendx);
357                          multisamp(rv, 2, d);
358                          d = 2.0*PI * rv[0];
359 <                        cosp = cos(d) * np->u_alpha;
360 <                        sinp = sin(d) * np->v_alpha;
359 >                        cosp = tcos(d) * np->u_alpha;
360 >                        sinp = tsin(d) * np->v_alpha;
361                          d = sqrt(cosp*cosp + sinp*sinp);
362                          cosp /= d;
363                          sinp /= d;
# Line 397 | Line 394 | register ANISODAT  *np;
394                                  d = urand(ilhash(dimlist,ndims)+1823+samplendx);
395                          multisamp(rv, 2, d);
396                          d = 2.0*PI * rv[0];
397 <                        cosp = cos(d) * np->u_alpha;
398 <                        sinp = sin(d) * np->v_alpha;
397 >                        cosp = tcos(d) * np->u_alpha;
398 >                        sinp = tsin(d) * np->v_alpha;
399                          d = sqrt(cosp*cosp + sinp*sinp);
400                          cosp /= d;
401                          sinp /= d;
# Line 408 | Line 405 | register ANISODAT  *np;
405                          else
406                                  d = sqrt(-log(rv[1]) /
407                                          (cosp*cosp/(np->u_alpha*np->u_alpha) +
408 <                                         sinp*sinp/(np->v_alpha*np->u_alpha)));
408 >                                         sinp*sinp/(np->v_alpha*np->v_alpha)));
409                          for (i = 0; i < 3; i++)
410                                  sr.rdir[i] = np->prdir[i] +
411                                                  d*(cosp*np->u[i] + sinp*np->v[i]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines