152 |
|
|
153 |
|
|
154 |
|
srcvalue(r) /* punch ray to source and compute value */ |
155 |
< |
RAY *r; |
155 |
> |
register RAY *r; |
156 |
|
{ |
157 |
|
register SRCREC *sp; |
158 |
|
|
161 |
|
/* check intersection */ |
162 |
|
if (!(*ofun[sp->so->otype].funp)(sp->so, r)) |
163 |
|
return; |
164 |
< |
raycont(r); /* compute contribution */ |
164 |
> |
if (!rayshade(r, r->ro->omod)) /* compute contribution */ |
165 |
> |
goto nomat; |
166 |
|
return; |
167 |
|
} |
168 |
|
/* compute intersection */ |
170 |
|
(*ofun[sp->so->otype].funp)(sp->so, r)) { |
171 |
|
if (sp->sa.success >= 0) |
172 |
|
sp->sa.success++; |
173 |
< |
raycont(r); /* compute contribution */ |
173 |
> |
if (!rayshade(r, r->ro->omod)) /* compute contribution */ |
174 |
> |
goto nomat; |
175 |
|
return; |
176 |
|
} |
177 |
+ |
/* we missed our mark! */ |
178 |
|
if (sp->sa.success < 0) |
179 |
|
return; /* bitched already */ |
180 |
|
sp->sa.success -= AIMREQT; |
183 |
|
sprintf(errmsg, "aiming failure for light source \"%s\"", |
184 |
|
sp->so->oname); |
185 |
|
error(WARNING, errmsg); /* issue warning */ |
186 |
+ |
return; |
187 |
+ |
nomat: |
188 |
+ |
objerror(r->ro, USER, "material not found"); |
189 |
|
} |
190 |
|
|
191 |
|
|
324 |
|
( sr.ro != source[scp->sno].so || |
325 |
|
source[scp->sno].sflags & SFOLLOW )) { |
326 |
|
/* follow entire path */ |
327 |
< |
raycont(&sr); |
327 |
> |
if (!raycont(&sr)) |
328 |
> |
objerror(sr.ro, USER, "material not found"); |
329 |
|
if (trace != NULL) |
330 |
|
(*trace)(&sr); /* trace execution */ |
331 |
|
if (bright(sr.rcol) <= FTINY) |
445 |
|
{ |
446 |
|
/* check for over-counting */ |
447 |
|
if (badcomponent(m, r)) |
448 |
< |
return; |
448 |
> |
return(1); |
449 |
|
if (wrongsource(m,r)) |
450 |
< |
return; |
450 |
> |
return(1); |
451 |
|
/* check for passed illum */ |
452 |
|
if (passillum(m, r)) { |
453 |
< |
if (m->oargs.nsargs < 1 || !strcmp(m->oargs.sarg[0], VOIDID)) |
454 |
< |
raytrans(r); |
455 |
< |
else |
456 |
< |
rayshade(r, modifier(m->oargs.sarg[0])); |
450 |
< |
return; |
453 |
> |
if (m->oargs.nsargs && strcmp(m->oargs.sarg[0], VOIDID)) |
454 |
> |
return(rayshade(r, modifier(m->oargs.sarg[0]))); |
455 |
> |
raytrans(r); |
456 |
> |
return(1); |
457 |
|
} |
458 |
|
/* otherwise treat as source */ |
459 |
|
/* check for behind */ |
460 |
|
if (r->rod < 0.0) |
461 |
< |
return; |
461 |
> |
return(1); |
462 |
|
/* check for invisibility */ |
463 |
|
if (srcignore(m, r)) |
464 |
< |
return; |
464 |
> |
return(1); |
465 |
|
/* check for outside spot */ |
466 |
|
if (m->otype==MAT_SPOT && spotout(r, makespot(m), r->rot>=FHUGE)) |
467 |
< |
return; |
467 |
> |
return(1); |
468 |
|
/* get distribution pattern */ |
469 |
|
raytexture(r, m->omod); |
470 |
|
/* get source color */ |
473 |
|
m->oargs.farg[2]); |
474 |
|
/* modify value */ |
475 |
|
multcolor(r->rcol, r->pcol); |
476 |
+ |
return(1); |
477 |
|
} |