fix look at Pluto coords, removed 2 args from draw_object
This commit is contained in:
parent
57bf61d755
commit
8c8d9fbf0c
72
window.c
72
window.c
@ -30,9 +30,9 @@ static void mouse(int button, int state, int x, int y);
|
|||||||
static void goto_obj(float * mvMat);
|
static void goto_obj(float * mvMat);
|
||||||
static void move_to(float posx, float posy , float posz);
|
static void move_to(float posx, float posy , float posz);
|
||||||
static void draw_object(float * nmv, float * projMat, surface_t * obj,
|
static void draw_object(float * nmv, float * projMat, surface_t * obj,
|
||||||
float ma, float mx, float my, float mz,
|
float ma, float mx, float my,
|
||||||
float tx, float ty, float tz, float s,
|
float tx, float ty, float tz, float s,
|
||||||
float ra, float rx, float ry, float rz);
|
float ra, float rx, float ry);
|
||||||
static int get_sign(float x, float y);
|
static int get_sign(float x, float y);
|
||||||
|
|
||||||
/*!\brief un identifiant pour l'écran (de dessin) */
|
/*!\brief un identifiant pour l'écran (de dessin) */
|
||||||
@ -274,8 +274,8 @@ static void goto_obj(float * mvMat) {
|
|||||||
break;
|
break;
|
||||||
case 9: // PLUTO
|
case 9: // PLUTO
|
||||||
_a = 0;
|
_a = 0;
|
||||||
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 85.4f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 85.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||||
move_to(85.4f, 1.0f, 0.1f);
|
move_to(85.0f, 1.0f, 0.1f);
|
||||||
break;
|
break;
|
||||||
case 0: // SUN
|
case 0: // SUN
|
||||||
_a = 0;
|
_a = 0;
|
||||||
@ -286,13 +286,13 @@ static void goto_obj(float * mvMat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void draw_object(float * nmv, float * projMat, surface_t * obj,
|
static void draw_object(float * nmv, float * projMat, surface_t * obj,
|
||||||
float ma, float mx, float my, float mz,
|
float ma, float mx, float my,
|
||||||
float tx, float ty, float tz, float s,
|
float tx, float ty, float tz, float s,
|
||||||
float ra, float rx, float ry, float rz) {
|
float ra, float rx, float ry) {
|
||||||
rotate(nmv, ma, mx, my, mz); // orbit movement
|
rotate(nmv, ma, mx, my, 0); // orbit movement
|
||||||
translate(nmv, tx, ty, tz);
|
translate(nmv, tx, ty, tz);
|
||||||
scale(nmv, s, s, s);
|
scale(nmv, s, s, s);
|
||||||
rotate(nmv, ra, rx, ry, rz); // rotation
|
rotate(nmv, ra, rx, ry, 0); // rotation
|
||||||
transform_n_raster(obj, nmv, projMat);
|
transform_n_raster(obj, nmv, projMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,114 +322,114 @@ void draw(void) {
|
|||||||
|
|
||||||
// SUN
|
// SUN
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _sun, _r/24.5f, 0, 1, 0, 0, 1, 0, 2, 0, 0, 0, 0);
|
draw_object(nmv, projMat, _sun, _r/24.5f, 0, 1, 0, 1, 0, 2, 0, 0, 0);
|
||||||
// MERCURY
|
// MERCURY
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[0], _a/87.97f, 0, 1, 0, 4.2f, 1, 0, (1/227.0f)*12, _r/59.0f, 0, 1, 0);
|
draw_object(nmv, projMat, _planet[0], _a/87.97f, 0, 1, 4.2f, 1, 0, (1/227.0f)*12, _r/59.0f, 0, 1);
|
||||||
|
|
||||||
// VENUS
|
// VENUS
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[1], _a/224.7f, 0, 1, 0, 7.9f, 1, 0, (1/113.0f)*12, _r/243.75f, -0.1773f, -1, 0);
|
draw_object(nmv, projMat, _planet[1], _a/224.7f, 0, 1, 7.9f, 1, 0, (1/113.0f)*12, _r/243.75f, -0.1773f, -1);
|
||||||
|
|
||||||
// EARTH
|
// EARTH
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[2], _a/365.2425f, 0, 1, 0, 10.0f, 1, 0, (1/108.0f)*12, _r, -0.234f, 1, 0);
|
draw_object(nmv, projMat, _planet[2], _a/365.2425f, 0, 1, 10.0f, 1, 0, (1/108.0f)*12, _r, -0.234f, 1);
|
||||||
|
|
||||||
// Moon
|
// Moon
|
||||||
draw_object(nmv, projMat, _moon[0], 1, 0, 0, 0, 4.0f, 0, 0, (1/5.0f), 1, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[0], 1, 0, 0, 4.0f, 0, 0, (1/5.0f), 1, 0, 0);
|
||||||
|
|
||||||
// MARS
|
// MARS
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[3], _a/686.98f, 0, 1, 0, 15.2f, 1, 0, (1/208.0f)*12, _r/1.0416f, -0.252f, 1, 0);
|
draw_object(nmv, projMat, _planet[3], _a/686.98f, 0, 1, 15.2f, 1, 0, (1/208.0f)*12, _r/1.0416f, -0.252f, 1);
|
||||||
|
|
||||||
memcpy(cpy, nmv, sizeof cpy);
|
memcpy(cpy, nmv, sizeof cpy);
|
||||||
|
|
||||||
// Phobos
|
// Phobos
|
||||||
draw_object(nmv, projMat, _moon[1], _r*4.3f, 0, 0.1f, 0, 10.0f, 0, 0, (1/5.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[1], _r*4.3f, 0, 0.1f, 10.0f, 0, 0, (1/5.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Deimos
|
// Deimos
|
||||||
draw_object(cpy, projMat, _moon[2], _r/1.5f, 0, 0.1f, 0, 25.0f, 0, 0, (1/6.0f), 0, 0, 0, 0);
|
draw_object(cpy, projMat, _moon[2], _r/1.5f, 0, 0.1f, 25.0f, 0, 0, (1/6.0f), 0, 0, 0);
|
||||||
|
|
||||||
// JUPITER
|
// JUPITER
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[4], _a/(12 * 365.2425f), 0, 1, 0, 30.0f, 1, 0, (1/9.7f)*12, _r/0.416f, -0.031f, 1, 0);
|
draw_object(nmv, projMat, _planet[4], _a/(12 * 365.2425f), 0, 1, 30.0f, 1, 0, (1/9.7f)*12, _r/0.416f, -0.031f, 1);
|
||||||
|
|
||||||
memcpy(cpy, nmv, sizeof cpy);
|
memcpy(cpy, nmv, sizeof cpy);
|
||||||
|
|
||||||
// Io
|
// Io
|
||||||
draw_object(nmv, projMat, _moon[3], _r*3.0f, 0, 0.1f, 0, 3.0f, 0, 2, (1/11.2f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[3], _r*3.0f, 0, 0.1f, 3.0f, 0, 2, (1/11.2f), 0, 0, 0);
|
||||||
|
|
||||||
// Europa
|
// Europa
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[4], _r/2.0f, 0, 0.1f, 0, -4.0f, 0, -1, (1/13.2f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[4], _r/2.0f, 0, 0.1f, -4.0f, 0, -1, (1/13.2f), 0, 0, 0);
|
||||||
|
|
||||||
// Ganymede
|
// Ganymede
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[5], _r/3.0f, 0, 0.1f, 0, -5.0f, 0, -1.5f, (1/9.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[5], _r/3.0f, 0, 0.1f, -5.0f, 0, -1.5f, (1/9.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Callisto
|
// Callisto
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[6], _r/5.0f, 0, 0.1f, 0, 6.0f, 0, -2.5f, (1/10.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[6], _r/5.0f, 0, 0.1f, 6.0f, 0, -2.5f, (1/10.0f), 0, 0, 0);
|
||||||
|
|
||||||
// SATURN
|
// SATURN
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[5], _a/(30 * 365.2425f), 0, 1, 0, 50.4f, 1, 0, (1/11.4f)*12, _r/0.4583f, -0.267f, 1, 0);
|
draw_object(nmv, projMat, _planet[5], _a/(30 * 365.2425f), 0, 1, 50.4f, 1, 0, (1/11.4f)*12, _r/0.4583f, -0.267f, 1);
|
||||||
|
|
||||||
memcpy(cpy, nmv, sizeof cpy);
|
memcpy(cpy, nmv, sizeof cpy);
|
||||||
|
|
||||||
// Enceladus
|
// Enceladus
|
||||||
draw_object(nmv, projMat, _moon[7], _r*5.0f, 0, 0.1f, 0, 2.0f, 0, -2.0f, (1/20.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[7], _r*5.0f, 0, 0.1f, 2.0f, 0, -2.0f, (1/20.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Dione
|
// Dione
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[8], _r*4.1f, 0, 0.1f, 0, -3.0f, 0, -0.5f, (1/18.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[8], _r*4.1f, 0, 0.1f, -3.0f, 0, -0.5f, (1/18.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Rhea
|
// Rhea
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[9], _r*3.2f, 0, 0.1f, 0, 4.0f, 0, -2.5f, (1/15.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[9], _r*3.2f, 0, 0.1f, 4.0f, 0, -2.5f, (1/15.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Titan
|
// Titan
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[10], _r/4.3f, 0, 0.1f, 0, -6.0f, 0, -5.2f, (1/10.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[10], _r/4.3f, 0, 0.1f, -6.0f, 0, -5.2f, (1/10.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Iapetus
|
// Iapetus
|
||||||
memcpy(nmv, cpy, sizeof nmv);
|
memcpy(nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[11], _r/6.3f, 0, 0.1f, 0, 7.0f, 0, -3.2f, (1/14.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[11], _r/6.3f, 0, 0.1f, 7.0f, 0, -3.2f, (1/14.0f), 0, 0, 0);
|
||||||
|
|
||||||
// URANUS
|
// URANUS
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[6], _a/(84 * 365.2425f), 0, 1, 0, 65.0f, 1, 0, (1/26.8f)*12, _r/0.7083f, -0.978f, 0, 0);
|
draw_object(nmv, projMat, _planet[6], _a/(84 * 365.2425f), 0, 1, 65.0f, 1, 0, (1/26.8f)*12, _r/0.7083f, -0.978f, 0);
|
||||||
|
|
||||||
memcpy(cpy, nmv, sizeof cpy);
|
memcpy(cpy, nmv, sizeof cpy);
|
||||||
|
|
||||||
// Ariel
|
// Ariel
|
||||||
draw_object(nmv, projMat, _moon[12], _r, 0.01f, 0, 0, 0, 3.0f, -2.2f, (1/20.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[12], _r, 0.01f, 0, 0, 3.0f, -2.2f, (1/20.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Umbriel
|
// Umbriel
|
||||||
memcpy (nmv, cpy, sizeof nmv);
|
memcpy (nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[13], _r/2.0f, 0.01f, 0, 0, 0, -4.0f, -1.2f, (1/20.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[13], _r/2.0f, 0.01f, 0, 0, -4.0f, -1.2f, (1/20.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Titania
|
// Titania
|
||||||
memcpy (nmv, cpy, sizeof nmv);
|
memcpy (nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[14], _r/5.0f, 0.01f, 0, 0, 0, 5.0f, 0, (1/17.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[14], _r/5.0f, 0.01f, 0, 0, 5.0f, 0, (1/17.0f), 0, 0, 0);
|
||||||
|
|
||||||
// Oberon
|
// Oberon
|
||||||
memcpy (nmv, cpy, sizeof nmv);
|
memcpy (nmv, cpy, sizeof nmv);
|
||||||
draw_object(nmv, projMat, _moon[15], _r/7.0f, 0.01f, 0, 0, 0, 6.0f, -4.4f, (1/17.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[15], _r/7.0f, 0.01f, 0, 0, 6.0f, -4.4f, (1/17.0f), 0, 0, 0);
|
||||||
|
|
||||||
// NEPTUNE
|
// NEPTUNE
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[7], _a/(165 * 365.2425f), 0, 1, 0, 75.0f, 1, 0, (1/27.7f)*12, _r/0.6f, -0.283f, 1.0f, 0);
|
draw_object(nmv, projMat, _planet[7], _a/(165 * 365.2425f), 0, 1, 75.0f, 1, 0, (1/27.7f)*12, _r/0.6f, -0.283f, 1.0f);
|
||||||
|
|
||||||
// Triton
|
// Triton
|
||||||
draw_object(nmv, projMat, _moon[16], _r/5.0f, 0, 0.01f, 0, 3.0f, 0.0f, 0.0f, (1/10.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[16], _r/5.0f, 0, 0.01f, 3.0f, 0.0f, 0.0f, (1/10.0f), 0, 0, 0);
|
||||||
|
|
||||||
// PLUTO
|
// PLUTO
|
||||||
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
memcpy(nmv, mvMat, sizeof nmv); /* copie mvMat dans nmv */
|
||||||
draw_object(nmv, projMat, _planet[8], _a/(248 * 365.2425f), 0, 1, 0, 85.0f, 1, 0, (1/500.7f)*12, _r/6.4f, -0.119f, 1.0f, 0);
|
draw_object(nmv, projMat, _planet[8], _a/(248 * 365.2425f), 0, 1, 85.0f, 1, 0, (1/500.7f)*12, _r/6.4f, -0.119f, 1.0f);
|
||||||
|
|
||||||
// Charon
|
// Charon
|
||||||
draw_object(nmv, projMat, _moon[17], _r/5.0f, 0, 0.01f, 0, 3.0f, 0.0f, 0.0f, (1/13.0f), 0, 0, 0, 0);
|
draw_object(nmv, projMat, _moon[17], _r/5.0f, 0, 0.01f, 3.0f, 0.0f, 0.0f, (1/13.0f), 0, 0, 0);
|
||||||
|
|
||||||
/* déclarer qu'on a changé (en bas niveau) des pixels du screen */
|
/* déclarer qu'on a changé (en bas niveau) des pixels du screen */
|
||||||
gl4dpScreenHasChanged();
|
gl4dpScreenHasChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user