* fill the visible (top) part of each column
*/
+ARM_IWRAM
void vox_render(struct voxscape *vox)
{
int i;
}
}
+ARM_IWRAM
void vox_begin(struct voxscape *vox)
{
int i;
- memset(vox->fb, 0, FBWIDTH * FBHEIGHT * 2);
memset(vox->coltop, 0, FBWIDTH * sizeof *vox->coltop);
if(!(vox->valid & SLICELEN)) {
ARM_IWRAM
void vox_render_slice(struct voxscape *vox, int n)
{
- int i, j, hval, last_hval, colstart, colheight, col, z, offs, last_offs = -1;
+ int i, j, hval, last_hval, colstart, colheight, z, offs, last_offs = -1;
int32_t x, y, len, xstep, ystep;
uint16_t color, last_col;
uint16_t *fbptr;
x = vox->x - SIN(vox->angle) * z - xstep * (FBWIDTH / 2);
y = vox->y + COS(vox->angle) * z - ystep * (FBWIDTH / 2);
- for(i=1; i<FBWIDTH; i++) {
+ for(i=0; i<FBWIDTH; i++) {
offs = (((y >> 16) & YMASK) << XSHIFT) + ((x >> 16) & XMASK);
if(offs == last_offs) {
hval = last_hval;
int i, j, colheight;
uint16_t *fbptr;
- for(i=1; i<FBWIDTH; i++) {
+ for(i=0; i<FBWIDTH; i++) {
fbptr = vox->fb + i;
colheight = FBHEIGHT - vox->coltop[i];
for(j=0; j<colheight; j++) {
*fbptr = color;
- fbptr += FBWIDTH / 2;
+ fbptr += FBWIDTH;
}
}
}
+ARM_IWRAM
void vox_sky_grad(struct voxscape *vox, uint16_t chor, uint16_t ctop)
{
int i, j, colheight, t;
for(i=0; i<vox->fbwidth; i++) {
fbptr = vox->fb + i;
- colheight = vox->fbheight - vox->coltop[i];
+ colheight = FBHEIGHT - vox->coltop[i];
for(j=0; j<colheight; j++) {
*fbptr = grad[j];
- fbptr += vox->fbwidth;
+ fbptr += FBWIDTH;
}
}
}