toggle overview + fixed movement to the planets

This commit is contained in:
Volodymyr Patuta 2020-12-28 16:18:53 +01:00
parent 33c7215e02
commit 0ec41a0c8d

View File

@ -67,6 +67,7 @@ static float _s = 1.0f;
static int _movement = 1; static int _movement = 1;
static int _p = -1; static int _p = -1;
static float _a = 0.0f; static float _a = 0.0f;
static int _overview = 0;
/*!\brief paramètre l'application et lance la boucle infinie. */ /*!\brief paramètre l'application et lance la boucle infinie. */
int main(int argc, char ** argv) { int main(int argc, char ** argv) {
@ -192,53 +193,53 @@ static void goto_obj(float * mvMat) {
switch (_p) { switch (_p) {
case 1: case 1:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 4.2f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(4.5f, 1.0f, 0.0f); move_to(4.2f, 1.0f, 0.5f);
break; break;
case 2: case 2:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 7.9f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(8.5f, 1.0f, 0.0f); move_to(7.9f, 1.0f, 1.0f);
break; break;
case 3: case 3:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 10.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(10.5f, 1.0f, 0.0f); move_to(10.0f, 1.0f, 1.0f);
break; break;
case 4: case 4:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 15.2f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(15.5f, 1.0f, 0.0f); move_to(15.2f, 1.0f, 0.5f);
break; break;
case 5: case 5:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 30.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(35.0f, 1.0f, 0.0f); move_to(30.0f, 1.0f, 5.0f);
break; break;
case 6: case 6:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 50.4f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(55.0f, 1.0f, 0.0f); move_to(50.4f, 1.0f, 5.0f);
break; break;
case 7: case 7:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 65.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(67.0f, 1.0f, 0.0f); move_to(65.0f, 1.0f, 5.0f);
break; break;
case 8: case 8:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 75.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(77.0f, 1.0f, 0.0f); move_to(75.0f, 1.0f, 4.0f);
break; break;
case 9: case 9:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 85.4f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(85.5f, 1.0f, 0.0f); move_to(85.4f, 1.0f, 0.1f);
break; break;
case 0: case 0:
_a = 0; _a = 0;
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 10,1,0,0,1,0); lookAt(mvMat, _cam.x, _cam.y, _cam.z, 0, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
move_to(5.0f, 1.0f, 0.0f); move_to(0.0f, 1.0f, 10.0f);
break; break;
} }
} }
@ -553,10 +554,19 @@ void key(int keycode) {
break; break;
case GL4DK_o: case GL4DK_o:
if (_movement) { if (_movement) {
_cam.x = 0; if (!_overview) {
_cam.y = 200.0f; _overview = !_overview;
_cam.z = 0; _cam.x = 0.0f;
_cam.theta = 0; _cam.y = 200.0f;
_cam.z = 0.0f;
_cam.theta = 0.0f;
} else {
_overview = !_overview;
_cam.x = 0.0f;
_cam.y = 1.0f;
_cam.z = 10.0f;
_cam.theta = 0.0f;
}
} }
break; break;
case GL4DK_r: case GL4DK_r: