vox->xshift++;
}
- vox->vheight = 50;
+ vox->vheight = 80;
vox->proj_dist = 4; /* TODO */
return vox;
free(vox);
}
+int vox_height(struct voxscape *vox, int32_t x, int32_t y)
+{
+ int tx = (x >> 16) & vox->xmask;
+ int ty = (y >> 16) & vox->ymask;
+
+ return vox->height[(ty << vox->xshift) + tx];
+}
+
void vox_framebuf(struct voxscape *vox, int xres, int yres, uint32_t *fb)
{
if(xres != vox->fbwidth) {
vox->fbheight = yres;
}
-void vox_view(struct voxscape *vox, int32_t x, int32_t y, int32_t angle)
+void vox_view(struct voxscape *vox, int32_t x, int32_t y, int h, int32_t angle)
{
+ if(h < 0) {
+ h = vox_height(vox, x, y) - h;
+ }
+
vox->x = x;
vox->y = y;
+ vox->vheight = h;
vox->angle = angle;
- /* TODO precalc stuff */
vox->valid &= ~SLICELEN;
}
tx = (x >> 16) & vox->xmask;
ty = (y >> 16) & vox->ymask;
- hval = vox->height[(ty << vox->xshift) + tx] - 80;
+ hval = vox->height[(ty << vox->xshift) + tx] - vox->vheight;
hval = hval * 160 / (vox->znear + n) + 250;
if(hval > vox->fbheight) hval = vox->fbheight;
if(hval > vox->coltop[i]) {