int hfilt = VOX_LINEAR, cfilt = VOX_LINEAR;
unsigned int input;
-int32_t pos[2], angle;
+int32_t pos[2], theta, phi;
+int horizon;
struct voxscape *vox;
if(!(vox = vox_open("data/height.png", "data/color.png"))) {
return -1;
}
- vox_framebuf(vox, FB_W, FB_H, fb, -1);
- vox_proj(vox, 45, 1, 300);
+ vox_framebuf(vox, FB_W, FB_H, fb);
+ vox_proj(vox, 140, 45, 1, 300);
vox_fog(vox, 260, COLOR_HORIZON);
vox_filter(vox, hfilt, cfilt);
{
int32_t fwd[2], right[2];
- if(input & INP_LTURN) angle += TURN_SPEED;
- if(input & INP_RTURN) angle -= TURN_SPEED;
+ if(input & INP_LTURN) theta += TURN_SPEED;
+ if(input & INP_RTURN) theta -= TURN_SPEED;
- fwd[0] = -SIN(angle);
- fwd[1] = COS(angle);
+ fwd[0] = -SIN(theta);
+ fwd[1] = COS(theta);
right[0] = fwd[1];
right[1] = -fwd[0];
pos[1] -= right[1];
}
- vox_view(vox, pos[0], pos[1], -30, angle);
+ vox_view(vox, pos[0], pos[1], -30, theta, phi);
}
void display(void)
if(!(dx | dy)) return;
if(mbstate[0]) {
- angle -= dx << 6;
+ theta -= dx << 6;
+ phi += dy << 8;
+ if(phi < -0x18000) phi = -0x18000;
+ if(phi > 0x18000) phi = 0x18000;
}
}