if(!(vox = vox_create(VOX_SZ, VOX_SZ, height_pixels, color_pixels))) {
panic(get_pc(), "vox_create");
}
- vox_proj(vox, 45, 2, VOX_SZ / 5);
+ vox_proj(vox, 30, 2, 80);
nframes = 0;
return 0;
#define FBWIDTH 160
#define FBHEIGHT 128
/* map size */
-#define XSZ 256
-#define YSZ 256
-#define XSHIFT 8
-#define XMASK 0xff
-#define YMASK 0xff
-#define HSCALE 20
+#define XSZ 512
+#define YSZ 512
+#define XSHIFT 9
+#define XMASK 0x1ff
+#define YMASK 0x1ff
+#define HSCALE 40
#define NO_LERP
#define XLERP(a, b, t, fp) \
((((a) << (fp)) + ((b) - (a)) * (t)) >> fp)
-static uint16_t lerp_rgb(int r0, int g0, int b0, int r1, int g1, int b1, int32_t t);
+static inline uint16_t lerp_rgb(int r0, int g0, int b0, int r1, int g1, int b1, int32_t t);
enum {
SLICELEN = 1
vox->zfar = zfar;
vox->nslices = vox->zfar - vox->znear;
- free(vox->slicelen);
if(!(vox->slicelen = iwram_sbrk(vox->nslices * sizeof *vox->slicelen))) {
panic(get_pc(), "vox_proj: failed to allocate slice length table (%d)\n", vox->nslices);
return;
vox_begin(vox);
for(i=0; i<vox->nslices; i++) {
+ if(i >= 25 && (i & 1)) continue;
vox_render_slice(vox, i);
}
}
color = last_col;
} else {
hval = vox->height[offs] - vox->vheight;
- hval = hval * HSCALE / (vox->znear + n) + vox->horizon;
+ hval = hval * HSCALE / z + vox->horizon;
if(hval > FBHEIGHT) hval = FBHEIGHT;
color = vox->color[offs];
last_offs = offs;
}
}
-static uint16_t lerp_rgb(int r0, int g0, int b0, int r1, int g1, int b1, int32_t t)
+static inline uint16_t lerp_rgb(int r0, int g0, int b0, int r1, int g1, int b1, int32_t t)
{
int r = XLERP(r0, r1, t, 16);
int g = XLERP(g0, g1, t, 16);