38 |
|
#define SP_TRAN 02 /* has transmitted specular */ |
39 |
|
#define SP_PURE 010 /* purely specular (zero roughness) */ |
40 |
|
#define SP_BADU 020 /* bad u direction calculation */ |
41 |
+ |
#define SP_FLAT 040 /* reflecting surface is flat */ |
42 |
|
|
43 |
|
typedef struct { |
43 |
– |
RAY *rp; /* ray pointer */ |
44 |
|
OBJREC *mp; /* material pointer */ |
45 |
+ |
RAY *rp; /* ray pointer */ |
46 |
|
short specfl; /* specularity flags, defined above */ |
47 |
|
COLOR mcolor; /* color of this material */ |
48 |
|
COLOR scolor; /* color of specular component */ |
93 |
|
* Compute specular reflection coefficient using |
94 |
|
* anisotropic gaussian distribution model. |
95 |
|
*/ |
96 |
< |
/* roughness + source */ |
97 |
< |
au2 = av2 = omega/(4.0*PI); |
96 |
> |
/* add source width if flat */ |
97 |
> |
if (np->specfl & SP_FLAT) |
98 |
> |
au2 = av2 = omega/(4.0*PI); |
99 |
> |
else |
100 |
> |
au2 = av2 = 0.0; |
101 |
|
au2 += np->u_alpha * np->u_alpha; |
102 |
|
av2 += np->v_alpha * np->v_alpha; |
103 |
|
/* half vector */ |
164 |
|
|
165 |
|
if (m->oargs.nfargs != (m->otype == MAT_TRANS2 ? 8 : 6)) |
166 |
|
objerror(m, USER, "bad number of real arguments"); |
163 |
– |
nd.rp = r; |
167 |
|
nd.mp = m; |
168 |
+ |
nd.rp = r; |
169 |
|
/* get material color */ |
170 |
|
setcolor(nd.mcolor, m->oargs.farg[0], |
171 |
|
m->oargs.farg[1], |