fixed cube + doc
This commit is contained in:
parent
b568b16322
commit
a42bed2390
3 changed files with 68 additions and 5 deletions
|
|
@ -19,19 +19,21 @@ int main(void) {
|
|||
uni->num_verts = uni->num_faces = uni->num_objects = 0;
|
||||
|
||||
/* --- Ajout des objets : géométrie locale en (0,0,0) --- */
|
||||
/*
|
||||
sph = add_sphere(uni, 0, 0, 0, int_to_f(30), 8, COLOR4, 0);
|
||||
if (!sph) { free(uni); return 1; }
|
||||
set_object_pos(sph,int_to_f(60),0,0);
|
||||
set_object_pos(sph,int_to_f(70),0,0);
|
||||
//set_object_color(COLOR4);
|
||||
|
||||
cyl = add_cylinder(uni, 0, 0, 0, int_to_f(20), int_to_f(60), 12, COLOR2, 0);
|
||||
if (!cyl) { free(uni); return 1; }
|
||||
set_object_pos(cyl,int_to_f(-60),0,0);
|
||||
set_object_pos(cyl,int_to_f(-70),0,0);
|
||||
//set_object_color(COLOR2);
|
||||
*/
|
||||
|
||||
tmp_obj = add_math_surface(uni, 0, 0, 0, int_to_f(120), int_to_f(120), 30, 30, COLOR2, 0);
|
||||
tmp_obj = add_box(uni, 0, 0, 0, int_to_f(45), int_to_f(60), int_to_f(70), COLOR1, 0);
|
||||
|
||||
|
||||
|
||||
// tmp_obj = add_math_surface(uni, 0, 0, 0, int_to_f(120), int_to_f(120), 30, 30, COLOR2, 0);
|
||||
// set_object_pos(tmp_obj, 0, int_to_f(-40), 0);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue