--- ray/src/rt/aniso.c 1996/04/24 15:47:25 2.32 +++ ray/src/rt/aniso.c 2003/02/25 02:47:22 2.35 @@ -1,13 +1,12 @@ -/* Copyright (c) 1996 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: aniso.c,v 2.35 2003/02/25 02:47:22 greg Exp $"; #endif - /* * Shading functions for anisotropic materials. */ +#include "copyright.h" + #include "ray.h" #include "otypes.h" @@ -16,17 +15,10 @@ static char SCCSid[] = "$SunId$ LBL"; #include "random.h" -extern double specthresh; /* specular sampling threshold */ -extern double specjitter; /* specular sampling jitter */ - -extern int backvis; /* back faces visible? */ - #ifndef MAXITER #define MAXITER 10 /* maximum # specular ray attempts */ #endif -static agaussamp(), getacoords(); - /* * This routine implements the anisotropic Gaussian * model described by Ward in Siggraph `92 article. @@ -68,7 +60,11 @@ typedef struct { double pdot; /* perturbed dot product */ } ANISODAT; /* anisotropic material data */ +static void getacoords(); +static void agaussamp(); + +static void diraniso(cval, np, ldir, omega) /* compute source contribution */ COLOR cval; /* returned coefficient */ register ANISODAT *np; /* material data */ @@ -182,6 +178,7 @@ double omega; /* light source size */ } +int m_aniso(m, r) /* shade ray that hit something anisotropic */ register OBJREC *m; register RAY *r; @@ -307,7 +304,7 @@ register RAY *r; } -static +static void getacoords(r, np) /* set up coordinate system */ RAY *r; register ANISODAT *np; @@ -337,7 +334,7 @@ register ANISODAT *np; } -static +static void agaussamp(r, np) /* sample anisotropic gaussian specular */ RAY *r; register ANISODAT *np; @@ -359,8 +356,8 @@ register ANISODAT *np; d = urand(ilhash(dimlist,ndims)+samplendx); multisamp(rv, 2, d); d = 2.0*PI * rv[0]; - cosp = cos(d) * np->u_alpha; - sinp = sin(d) * np->v_alpha; + cosp = tcos(d) * np->u_alpha; + sinp = tsin(d) * np->v_alpha; d = sqrt(cosp*cosp + sinp*sinp); cosp /= d; sinp /= d; @@ -397,8 +394,8 @@ register ANISODAT *np; d = urand(ilhash(dimlist,ndims)+1823+samplendx); multisamp(rv, 2, d); d = 2.0*PI * rv[0]; - cosp = cos(d) * np->u_alpha; - sinp = sin(d) * np->v_alpha; + cosp = tcos(d) * np->u_alpha; + sinp = tsin(d) * np->v_alpha; d = sqrt(cosp*cosp + sinp*sinp); cosp /= d; sinp /= d; @@ -408,7 +405,7 @@ register ANISODAT *np; else d = sqrt(-log(rv[1]) / (cosp*cosp/(np->u_alpha*np->u_alpha) + - sinp*sinp/(np->v_alpha*np->u_alpha))); + sinp*sinp/(np->v_alpha*np->v_alpha))); for (i = 0; i < 3; i++) sr.rdir[i] = np->prdir[i] + d*(cosp*np->u[i] + sinp*np->v[i]);