From: John Tsiombikas Date: Fri, 14 Oct 2022 13:07:56 +0000 (+0300) Subject: foo X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=voxscape;a=commitdiff_plain;h=5e9496165d81a0f9923d67969dcb64a2f81ffdab foo --- diff --git a/src/main.c b/src/main.c index 5569ae6..0201cbc 100644 --- a/src/main.c +++ b/src/main.c @@ -52,7 +52,7 @@ int init(void) } 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; diff --git a/src/voxscape.c b/src/voxscape.c index df34f20..2ccb5f9 100644 --- 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)) { - 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; inslices; 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; - 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;