29 |
|
{ |
30 |
|
if (siz <= 0) { |
31 |
|
if (distsiz > 0) |
32 |
< |
free((void *)distarr); |
32 |
> |
free(distarr); |
33 |
|
distarr = NULL; |
34 |
|
distsiz = 0; |
35 |
|
return; |
36 |
|
} |
37 |
|
if (distsiz < siz) { |
38 |
|
if (distsiz > 0) |
39 |
< |
free((void *)distarr); |
39 |
> |
free(distarr); |
40 |
|
distarr = (COLORV *)malloc(sizeof(COLOR)*siz); |
41 |
|
if (distarr == NULL) |
42 |
|
error(SYSTEM, "out of memory in newdist"); |
62 |
|
{ |
63 |
|
if (direct_discount == NULL) |
64 |
|
return; |
65 |
< |
free((void *)direct_discount); |
65 |
> |
free(direct_discount); |
66 |
|
direct_discount = NULL; |
67 |
|
} |
68 |
|
|
108 |
|
VCOPY(myRay.rorg, org); |
109 |
|
VCOPY(myRay.rdir, dir); |
110 |
|
myRay.rmax = .0; |
111 |
< |
rayorigin(&myRay, PRIMARY, NULL, NULL); |
111 |
> |
rayorigin(&myRay, PRIMARY|SPECULAR, NULL, NULL); |
112 |
|
myRay.rno = ndx; |
113 |
|
/* queue ray, check result */ |
114 |
|
process_ray(&myRay, ray_pqueue(&myRay)); |
123 |
|
MAT4 ixfm |
124 |
|
) |
125 |
|
{ |
126 |
< |
int nalt, nazi; |
126 |
> |
int nalt=1, nazi=1; |
127 |
|
SRCINDEX si; |
128 |
|
RAY sr; |
129 |
|
FVECT v; |
130 |
|
double d; |
131 |
|
int i, j; |
132 |
|
/* get sampling density */ |
133 |
< |
if (il->sampdens <= 0) { |
134 |
< |
nalt = nazi = 1; |
135 |
< |
} else { |
133 |
> |
if (il->sd == NULL && il->sampdens > 0) { |
134 |
|
i = PI * il->sampdens; |
135 |
|
nalt = sqrt(i/PI) + .5; |
136 |
|
nazi = PI*nalt + .5; |
154 |
|
d = -1.0001*il->thick - 5.*FTINY; |
155 |
|
else |
156 |
|
d = 5.*FTINY; |
157 |
< |
for (i = 3; i--; ) |
160 |
< |
sr.rorg[i] += d*nrm[i]; |
157 |
> |
VSUM(sr.rorg, sr.rorg, nrm, d); |
158 |
|
samplendx++; /* increment sample counter */ |
159 |
|
if (!srcray(&sr, NULL, &si)) |
160 |
|
break; /* end of sources */ |
449 |
|
raysamp(dim[1], org, dir); |
450 |
|
} |
451 |
|
/* add in direct component? */ |
452 |
< |
if (!directvis && (il->flags & IL_LIGHT || il->sd != NULL)) { |
452 |
> |
if (il->flags & IL_LIGHT || il->sd != NULL) { |
453 |
|
MAT4 ixfm; |
454 |
|
if (il->sd == NULL) { |
455 |
|
for (i = 3; i--; ) { |
657 |
|
raysamp(dim[1], org, dir); |
658 |
|
} |
659 |
|
/* add in direct component? */ |
660 |
< |
if (!directvis && (il->flags & IL_LIGHT || il->sd != NULL)) { |
660 |
> |
if (il->flags & IL_LIGHT || il->sd != NULL) { |
661 |
|
MAT4 ixfm; |
662 |
|
if (il->sd == NULL) { |
663 |
|
for (i = 3; i--; ) { |