27 |
|
|
28 |
|
initstypes() /* initialize source dispatch table */ |
29 |
|
{ |
30 |
< |
extern VSMATERIAL mirror_vs; |
30 |
> |
extern VSMATERIAL mirror_vs, direct1_vs, direct2_vs; |
31 |
|
extern int fsetsrc(), ssetsrc(), sphsetsrc(), rsetsrc(); |
32 |
|
extern double fgetplaneq(), rgetplaneq(); |
33 |
|
extern double fgetmaxdisk(), rgetmaxdisk(); |
37 |
|
static SOBJECT rsobj = {rsetsrc, rgetplaneq, rgetmaxdisk}; |
38 |
|
|
39 |
|
sfun[MAT_MIRROR].mf = &mirror_vs; |
40 |
+ |
sfun[MAT_DIRECT1].mf = &direct1_vs; |
41 |
+ |
sfun[MAT_DIRECT2].mf = &direct2_vs; |
42 |
|
sfun[OBJ_FACE].of = &fsobj; |
43 |
|
sfun[OBJ_SOURCE].of = &ssobj; |
44 |
|
sfun[OBJ_SPHERE].of = &sphsobj; |
419 |
|
r->rsrc>=0 && \ |
420 |
|
source[r->rsrc].so!=r->ro) |
421 |
|
|
422 |
+ |
#define distglow(m, r) (m->otype==MAT_GLOW && \ |
423 |
+ |
r->rot > m->oargs.farg[3]) |
424 |
+ |
|
425 |
|
#define badambient(m, r) ((r->crtype&(AMBIENT|SHADOW))==AMBIENT && \ |
426 |
< |
!(m->otype==MAT_GLOW&&r->rot>m->oargs.farg[3])) |
426 |
> |
!distglow(m, r)) |
427 |
|
|
428 |
|
#define passillum(m, r) (m->otype==MAT_ILLUM && \ |
429 |
|
!(r->rsrc>=0&&source[r->rsrc].so==r->ro)) |
430 |
|
|
431 |
+ |
#define srcignore(m, r) (directinvis && !(r->crtype&SHADOW) && \ |
432 |
+ |
!distglow(m, r)) |
433 |
|
|
434 |
+ |
|
435 |
|
m_light(m, r) /* ray hit a light source */ |
436 |
|
register OBJREC *m; |
437 |
|
register RAY *r; |
441 |
|
return; |
442 |
|
/* check for passed illum */ |
443 |
|
if (passillum(m, r)) { |
436 |
– |
|
444 |
|
if (m->oargs.nsargs < 1 || !strcmp(m->oargs.sarg[0], VOIDID)) |
445 |
|
raytrans(r); |
446 |
|
else |
447 |
|
rayshade(r, modifier(m->oargs.sarg[0])); |
448 |
< |
|
449 |
< |
/* otherwise treat as source */ |
450 |
< |
} else { |
448 |
> |
return; |
449 |
> |
} |
450 |
> |
/* otherwise treat as source */ |
451 |
|
/* check for behind */ |
452 |
< |
if (r->rod < 0.0) |
453 |
< |
return; |
452 |
> |
if (r->rod < 0.0) |
453 |
> |
return; |
454 |
> |
/* check for invisibility */ |
455 |
> |
if (srcignore(m, r)) |
456 |
> |
return; |
457 |
|
/* get distribution pattern */ |
458 |
< |
raytexture(r, m->omod); |
458 |
> |
raytexture(r, m->omod); |
459 |
|
/* get source color */ |
460 |
< |
setcolor(r->rcol, m->oargs.farg[0], |
461 |
< |
m->oargs.farg[1], |
462 |
< |
m->oargs.farg[2]); |
460 |
> |
setcolor(r->rcol, m->oargs.farg[0], |
461 |
> |
m->oargs.farg[1], |
462 |
> |
m->oargs.farg[2]); |
463 |
|
/* modify value */ |
464 |
< |
multcolor(r->rcol, r->pcol); |
455 |
< |
} |
464 |
> |
multcolor(r->rcol, r->pcol); |
465 |
|
} |