move striker gen to animations.c

This commit is contained in:
Mylloon 2023-05-23 12:38:21 +02:00
parent 1f4d8c3789
commit bf0d6f7a05
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 25 additions and 17 deletions

View file

@ -23,4 +23,14 @@ void transitions_init(void);
// Transition zoom // Transition zoom
void zoom_in(void (*)(int), void (*)(int), Uint32, Uint32, int); void zoom_in(void (*)(int), void (*)(int), Uint32, Uint32, int);
// Personnage
struct manifestant {
GLuint corps, tete, jambe_g, jambe_d, bras_g, bras_d;
// Offsets
GLfloat ox, oz;
};
// Génère un manifestant
void genManifestant(struct manifestant *);
#endif #endif

View file

@ -109,3 +109,17 @@ static void zoomin_deinit(void) {
_zoomin_tex[0] = _zoomin_tex[1] = 0; _zoomin_tex[0] = _zoomin_tex[1] = 0;
} }
} }
void genManifestant(struct manifestant *hero) {
// Head and body
hero->tete = gl4dgGenSpheref(7, 7);
hero->corps = gl4dgGenCubef();
// Arms
hero->bras_d = gl4dgGenCubef();
hero->bras_g = gl4dgGenCubef();
// Legs
hero->jambe_g = gl4dgGenCubef();
hero->jambe_d = gl4dgGenCubef();
}

View file

@ -3,12 +3,6 @@
static GLuint _pId = 0; static GLuint _pId = 0;
static GLuint _planId = 0; static GLuint _planId = 0;
struct manifestant {
GLuint corps, tete, jambe_g, jambe_d, bras_g, bras_d;
// Offsets
GLfloat ox, oz;
};
#define HEROS_NUMBER 30 // should change in fragment shader too #define HEROS_NUMBER 30 // should change in fragment shader too
static struct manifestant _herosId[HEROS_NUMBER]; static struct manifestant _herosId[HEROS_NUMBER];
@ -39,17 +33,7 @@ static void init(void) {
// Last Offset X and Z // Last Offset X and Z
for (int i = 0; i < HEROS_NUMBER; ++i) { for (int i = 0; i < HEROS_NUMBER; ++i) {
// Head and body genManifestant(&_herosId[i]);
_herosId[i].tete = gl4dgGenSpheref(7, 7);
_herosId[i].corps = gl4dgGenCubef();
// Arms
_herosId[i].bras_d = gl4dgGenCubef();
_herosId[i].bras_g = gl4dgGenCubef();
// Legs
_herosId[i].jambe_g = gl4dgGenCubef();
_herosId[i].jambe_d = gl4dgGenCubef();
// Coordinates // Coordinates
_herosId[i].ox = ((GLfloat)rand() / (GLfloat)RAND_MAX) * -50; _herosId[i].ox = ((GLfloat)rand() / (GLfloat)RAND_MAX) * -50;