fixed cube + doc

This commit is contained in:
Frater 2026-05-11 16:15:01 +02:00
commit a42bed2390
3 changed files with 68 additions and 5 deletions

View file

@ -54,9 +54,39 @@ Object3D *add_box(Universe *uni, fixed x, fixed y, fixed z, fixed dx, fixed dy,
fixed nz[6] = {int_to_f(1), -int_to_f(1), 0, 0, 0, 0};
/* Configuration des sommets pour respecter le "face culling" (sens trigo) */
/*
int sx[24] = {-1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1};
int sy[24] = {-1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1};
int sz[24] = { 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1};
*/
/* Ordre CCW rigoureux pour que le "back-face culling" affiche les 6 faces */
int sx[24] = {
-1, 1, 1, -1, /* Face +Z (Avant) */
1, -1, -1, 1, /* Face -Z (Arrière) */
-1, 1, 1, -1, /* Face +Y (Haut) */
-1, 1, 1, -1, /* Face -Y (Bas) */
1, 1, 1, 1, /* Face +X (Droite) */
-1, -1, -1, -1 /* Face -X (Gauche) */
};
int sy[24] = {
-1, -1, 1, 1, /* Face +Z */
-1, -1, 1, 1, /* Face -Z */
1, 1, 1, 1, /* Face +Y */
-1, -1, -1, -1, /* Face -Y */
-1, -1, 1, 1, /* Face +X */
-1, -1, 1, 1 /* Face -X */
};
int sz[24] = {
1, 1, 1, 1, /* Face +Z */
-1, -1, -1, -1, /* Face -Z */
1, 1, -1, -1, /* Face +Y */
-1, -1, 1, 1, /* Face -Y */
1, -1, -1, 1, /* Face +X */
-1, 1, 1, -1 /* Face -X */
};
if (uni->num_objects >= MAX_OBJECTS) return NULL;
if (uni->num_verts + 24 > MAX_VERTEX) return NULL;