}
vox_framebuf(vox, FB_W, FB_H, fb);
vox_proj(vox, 45, 5, 100);
- vox_view(vox, 512, 512, 0);
+ vox_view(vox, 512 << 16, 512 << 16, 0);
glfb_setup(FB_W, FB_H, GLFB_RGBA32, FB_W * 4);
return 0;
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);
}
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;