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 move_to(float posx, float posy , float posz);
|
||||
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 ra, float rx, float ry, float rz);
|
||||
float ra, float rx, float ry);
|
||||
static int get_sign(float x, float y);
|
||||
|
||||
/*!\brief un identifiant pour l'écran (de dessin) */
|
||||
@ -274,8 +274,8 @@ static void goto_obj(float * mvMat) {
|
||||
break;
|
||||
case 9: // PLUTO
|
||||
_a = 0;
|
||||
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 85.4f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
move_to(85.4f, 1.0f, 0.1f);
|
||||
lookAt(mvMat, _cam.x, _cam.y, _cam.z, 85.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
move_to(85.0f, 1.0f, 0.1f);
|
||||
break;
|
||||
case 0: // SUN
|
||||
_a = 0;
|
||||
@ -286,13 +286,13 @@ static void goto_obj(float * mvMat) {
|
||||
}
|
||||
|
||||
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 ra, float rx, float ry, float rz) {
|
||||
rotate(nmv, ma, mx, my, mz); // orbit movement
|
||||
float ra, float rx, float ry) {
|
||||
rotate(nmv, ma, mx, my, 0); // orbit movement
|
||||
translate(nmv, tx, ty, tz);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -322,114 +322,114 @@ void draw(void) {
|
||||
|
||||
// SUN
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
// 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
|
||||
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
|
||||
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);
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 */
|
||||
gl4dpScreenHasChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user