108 |
|
return(-1); |
109 |
|
} |
110 |
|
if (!direc || ourview.type == VT_PAR) { |
111 |
< |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
111 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
112 |
|
if (!localhit(&thisray, &thescene)) { |
113 |
|
error(COMMAND, "not a local object"); |
114 |
|
return(-1); |
122 |
|
VCOPY(vec, thisray.rdir); |
123 |
|
else |
124 |
|
VCOPY(vec, thisray.rop); |
125 |
< |
} else if (direc) |
126 |
< |
for (i = 0; i < 3; i++) |
127 |
< |
vec[i] -= ourview.vp[i]; |
128 |
< |
if (normalize(vec) == 0.0) |
129 |
< |
return(-1); |
125 |
> |
} else if (direc) { |
126 |
> |
for (i = 0; i < 3; i++) |
127 |
> |
vec[i] -= ourview.vp[i]; |
128 |
> |
if (normalize(vec) == 0.0) { |
129 |
> |
error(COMMAND, "point at view origin"); |
130 |
> |
return(-1); |
131 |
> |
} |
132 |
> |
} |
133 |
|
return(0); |
134 |
|
} |
135 |
|
|
170 |
|
h/hresolu, v/vresolu)) < -FTINY) { |
171 |
|
setcolor(thisray.rcol, 0.0, 0.0, 0.0); |
172 |
|
} else { |
173 |
< |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
174 |
< |
samplendx++; |
173 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
174 |
> |
samplendx = rand_samp ? random() : samplendx+1; |
175 |
|
rayvalue(&thisray); |
176 |
|
} |
177 |
|
|
400 |
|
normalize(v1); |
401 |
|
spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.)); |
402 |
|
} |
403 |
< |
if ((nv.type = ourview.type) == VT_PAR) { |
404 |
< |
nv.horiz = ourview.horiz / mag; |
405 |
< |
nv.vert = ourview.vert / mag; |
403 |
> |
if (nv.type == VT_PAR) { |
404 |
> |
nv.horiz /= mag; |
405 |
> |
nv.vert /= mag; |
406 |
|
d = 0.0; /* don't move closer */ |
407 |
|
for (i = 0; i < 3; i++) |
408 |
|
d += (vc[i] - ourview.vp[i])*ourview.vdir[i]; |
409 |
|
} else { |
410 |
|
d = sqrt(dist2(ourview.vp, vc)) / mag; |
411 |
< |
if ((nv.vfore = ourview.vfore) > FTINY) { |
411 |
> |
if (nv.vfore > FTINY) { |
412 |
|
nv.vfore += d - d*mag; |
413 |
|
if (nv.vfore < 0.0) nv.vfore = 0.0; |
414 |
|
} |
415 |
< |
if ((nv.vaft = ourview.vaft) > FTINY) { |
415 |
> |
if (nv.vaft > FTINY) { |
416 |
|
nv.vaft += d - d*mag; |
417 |
|
if (nv.vaft <= nv.vfore) nv.vaft = 0.0; |
418 |
|
} |
419 |
+ |
nv.vdist /= mag; |
420 |
|
} |
421 |
|
for (i = 0; i < 3; i++) |
422 |
|
nv.vp[i] = vc[i] - d*nv.vdir[i]; |