projects
/
voxscape
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
foo
[voxscape]
/
src
/
voxscape.c
diff --git
a/src/voxscape.c
b/src/voxscape.c
index
df34f20
..
2ccb5f9
100644
(file)
--- a/
src/voxscape.c
+++ b/
src/voxscape.c
@@
-185,7
+185,7
@@
void vox_begin(struct voxscape *vox)
memset(vox->coltop, 0, vox->fbwidth * sizeof *vox->coltop);
if(!(vox->valid & SLICELEN)) {
memset(vox->coltop, 0, vox->fbwidth * sizeof *vox->coltop);
if(!(vox->valid & SLICELEN)) {
- float theta = (float)vox->angle * M_PI / 360.0f; /* half angle */
+ float theta = (float)vox->fov * M_PI / 360.0f; /* half angle */
for(i=0; i<vox->nslices; i++) {
vox->slicelen[i] = (int32_t)((vox->znear + i) * tan(theta) * 2.0f * 65536.0f);
}
for(i=0; i<vox->nslices; i++) {
vox->slicelen[i] = (int32_t)((vox->znear + i) * tan(theta) * 2.0f * 65536.0f);
}
@@
-209,7
+209,8
@@
void vox_render_slice(struct voxscape *vox, int n)
tx = (x >> 16) & vox->xmask;
ty = (y >> 16) & vox->ymask;
tx = (x >> 16) & vox->xmask;
ty = (y >> 16) & vox->ymask;
- hval = (vox->height[(ty << vox->xshift) + tx] - vox->vheight) * vox->proj_dist / y;
+ hval = vox->height[(ty << vox->xshift) + tx];
+ hval = (hval - vox->vheight) * vox->proj_dist / (vox->znear + i);
if(hval > vox->coltop[i]) {
color = vox->color[(ty << vox->xshift) + tx];
colstart = vox->fbheight - 1 - hval;
if(hval > vox->coltop[i]) {
color = vox->color[(ty << vox->xshift) + tx];
colstart = vox->fbheight - 1 - hval;