camera y position control by arrows UP/DOWN
This commit is contained in:
parent
1197e69fa4
commit
549d59e873
8
window.c
8
window.c
@ -46,7 +46,7 @@ struct cam_t {
|
||||
float theta;
|
||||
};
|
||||
|
||||
static cam_t _cam = {0, 1.0f, 50, 0};
|
||||
static cam_t _cam = {0, 1.0f, 10, 0};
|
||||
|
||||
static float _v = 0.1f;
|
||||
|
||||
@ -184,10 +184,10 @@ void draw(void) {
|
||||
|
||||
// EARTH
|
||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||
rotate(nmv, (a / 365.2425f), 0.0f, 1.0f, 0.0f);
|
||||
rotate(nmv, (a / 365.2425f), 0.0f, 1.0f, 0.0f);
|
||||
translate(nmv, 30.0f, 1.0f, 0.0f);
|
||||
scale(nmv, (1/108.0f) * 12.0f, (1/108.0f) * 12.0f, (1/108.0f) * 12.0f);
|
||||
rotate(nmv, a, 0.234f, 1.0f, 0.0f);
|
||||
rotate(nmv, a, 0.234f, 1.0f, 0.0f);
|
||||
transform_n_raster(_planet[2], nmv, projMat);
|
||||
|
||||
// MARS
|
||||
@ -251,8 +251,10 @@ void key(int keycode) {
|
||||
double dtheta = M_PI, step = 5.0;
|
||||
switch(keycode) {
|
||||
case GL4DK_UP:
|
||||
_cam.y += 5 * dtheta;
|
||||
break;
|
||||
case GL4DK_DOWN:
|
||||
_cam.y -= 5 * dtheta;
|
||||
break;
|
||||
case GL4DK_RIGHT:
|
||||
_s += 30.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user