1 |
– |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Draw small sources into image in case we missed them. |
6 |
+ |
* |
7 |
+ |
* External symbols declared in ray.h |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "copyright.h" |
11 |
+ |
|
12 |
|
#include "ray.h" |
13 |
|
|
14 |
|
#include "view.h" |
338 |
|
/* free old source list if one */ |
339 |
|
for (sp = sphead; sp != NULL; sp = sphead) { |
340 |
|
sphead = sp->next; |
341 |
< |
free((char *)sp); |
341 |
> |
free((void *)sp); |
342 |
|
} |
343 |
|
/* loop through all sources */ |
344 |
|
for (i = nsources; i--; ) { |
357 |
|
} |
358 |
|
} |
359 |
|
|
360 |
< |
/* add sources smaller than rad to computed subimage */ |
360 |
> |
void /* add sources smaller than rad to computed subimage */ |
361 |
|
drawsources(pic, zbf, x0, xsiz, y0, ysiz) |
362 |
|
COLOR *pic[]; /* subimage pixel value array */ |
363 |
|
float *zbf[]; /* subimage distance array (opt.) */ |
367 |
|
int nsv, npv; |
368 |
|
int xmin, xmax, ymin, ymax, x, y; |
369 |
|
FLOAT cxy[2]; |
370 |
< |
double pa; |
370 |
> |
double w; |
371 |
|
RAY sr; |
372 |
|
register SPLIST *sp; |
373 |
|
register int i; |
416 |
|
continue; /* missed/blocked */ |
417 |
|
/* modify pixel */ |
418 |
|
if (zbf[y-y0] != NULL && |
419 |
< |
sr.rt < zbf[y-y0][x-x0]) |
419 |
> |
sr.rt < 0.999*zbf[y-y0][x-x0]) |
420 |
|
zbf[y-y0][x-x0] = sr.rt; |
421 |
< |
pa = poly_area(ppoly, npv); |
422 |
< |
scalecolor(sr.rcol, pa*hres*vres); |
423 |
< |
scalecolor(pic[y-y0][x-x0], (1.-pa*hres*vres)); |
421 |
> |
else if (!bigdiff(sr.rcol, pic[y-y0][x-x0], |
422 |
> |
0.001)) /* source sample */ |
423 |
> |
setcolor(pic[y-y0][x-x0], 0., 0., 0.); |
424 |
> |
w = poly_area(ppoly, npv) * hres * vres; |
425 |
> |
scalecolor(sr.rcol, w); |
426 |
> |
scalecolor(pic[y-y0][x-x0], 1.-w); |
427 |
|
addcolor(pic[y-y0][x-x0], sr.rcol); |
428 |
|
} |
429 |
|
} |