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.2 by greg, Sat Jan 4 19:53:53 1992 UTC vs.
Revision 2.3 by greg, Sat Jan 4 23:36:42 1992 UTC

# Line 41 | Line 41 | static char SCCSid[] = "$SunId$ LBL";
41   #define  SP_REFL        01              /* has reflected specular component */
42   #define  SP_TRAN        02              /* has transmitted specular */
43   #define  SP_PURE        010             /* purely specular (zero roughness) */
44 + #define  SP_FLAT        020             /* flat reflecting surface */
45  
46   typedef struct {
47          OBJREC  *mp;            /* material pointer */
# Line 66 | Line 67 | double  omega;                 /* light source size */
67   {
68          double  ldot;
69          double  dtmp;
70 +        int     i;
71          COLOR  ctmp;
72  
73          setcolor(cval, 0.0, 0.0, 0.0);
# Line 91 | Line 93 | double  omega;                 /* light source size */
93                   *  Compute specular reflection coefficient using
94                   *  gaussian distribution model.
95                   */
96 <                                                /* roughness + source */
97 <                dtmp = 2.0*np->alpha2 + omega/(2.0*PI);
96 >                                                /* roughness */
97 >                dtmp = 2.0*np->alpha2;
98 >                                                /* + source if flat */
99 >                if (np->specfl & SP_FLAT)
100 >                        dtmp += omega/(2.0*PI);
101                                                  /* gaussian */
102                  dtmp = exp((DOT(np->vrefl,ldir)-1.)/dtmp)/(2.*PI)/dtmp;
103                                                  /* worth using? */
# Line 236 | Line 241 | register RAY  *r;
241  
242          if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
243                  return;                         /* 100% pure specular */
244 +
245 +        if (r->ro->otype == OBJ_FACE || r->ro->otype == OBJ_RING)
246 +                nd.specfl |= SP_FLAT;
247  
248          if (nd.specfl & (SP_REFL|SP_TRAN) && !(nd.specfl & SP_PURE))
249                  gaussamp(r, &nd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines