43 |
|
/* specularity flags */ |
44 |
|
#define SP_REFL 01 /* has reflected specular component */ |
45 |
|
#define SP_TRAN 02 /* has transmitted specular */ |
46 |
< |
#define SP_PURE 010 /* purely specular (zero roughness) */ |
47 |
< |
#define SP_FLAT 020 /* flat reflecting surface */ |
48 |
< |
#define SP_RBLT 040 /* reflection below sample threshold */ |
49 |
< |
#define SP_TBLT 0100 /* transmission below threshold */ |
46 |
> |
#define SP_PURE 04 /* purely specular (zero roughness) */ |
47 |
> |
#define SP_FLAT 010 /* flat reflecting surface */ |
48 |
> |
#define SP_RBLT 020 /* reflection below sample threshold */ |
49 |
> |
#define SP_TBLT 040 /* transmission below threshold */ |
50 |
|
|
51 |
|
typedef struct { |
52 |
|
OBJREC *mp; /* material pointer */ |
194 |
|
/* check threshold */ |
195 |
|
if (specthresh > FTINY && |
196 |
|
((specthresh >= 1.-FTINY || |
197 |
< |
specthresh + (.05 - .1*urand(8199+samplendx)) |
198 |
< |
> nd.rspec))) |
197 |
> |
specthresh + (.05 - .1*frandom()) > nd.rspec))) |
198 |
|
nd.specfl |= SP_RBLT; |
199 |
|
/* compute reflected ray */ |
200 |
|
for (i = 0; i < 3; i++) |
224 |
|
if (specthresh > FTINY && |
225 |
|
((specthresh >= 1.-FTINY || |
226 |
|
specthresh + |
227 |
< |
(.05 - .1*urand(7241+samplendx)) |
229 |
< |
> nd.tspec))) |
227 |
> |
(.05 - .1*frandom()) > nd.tspec))) |
228 |
|
nd.specfl |= SP_TBLT; |
229 |
|
if (r->crtype & SHADOW || |
230 |
|
DOT(r->pert,r->pert) <= FTINY*FTINY) { |
254 |
|
transtest *= bright(lr.rcol); |
255 |
|
transdist = r->rot + lr.rt; |
256 |
|
} |
257 |
< |
} |
257 |
> |
} else |
258 |
> |
transtest = 0; |
259 |
|
|
260 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |
261 |
|
return; |
265 |
|
if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY) |
266 |
|
return; /* 100% pure specular */ |
267 |
|
|
268 |
< |
if (r->ro->otype == OBJ_FACE || r->ro->otype == OBJ_RING) |
268 |
> |
if (r->ro != NULL && (r->ro->otype == OBJ_FACE || |
269 |
> |
r->ro->otype == OBJ_RING)) |
270 |
|
nd.specfl |= SP_FLAT; |
271 |
|
|
272 |
|
if (nd.specfl & (SP_REFL|SP_TRAN) && !(nd.specfl & SP_PURE)) |
366 |
|
else |
367 |
|
VCOPY(sr.rdir, np->prdir); /* else no jitter */ |
368 |
|
rayvalue(&sr); |
369 |
< |
multcolor(sr.rcol, np->scolor); |
369 |
> |
scalecolor(sr.rcol, np->tspec); |
370 |
> |
multcolor(sr.rcol, np->mcolor); /* modified by color */ |
371 |
|
addcolor(r->rcol, sr.rcol); |
372 |
|
ndims--; |
373 |
|
} |