moving bodies

This commit is contained in:
Mylloon 2023-05-19 11:21:58 +02:00
parent be76a975de
commit fbcb4dd4c3
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -103,13 +103,15 @@ static void draw(void) {
// Position
GLfloat lumpos_i[] = {(_herosId[i].ox / 10) + (deplacement / 10), 1,
((_herosId[i].oz / 20) - 1)};
rotate_vec(lumpos_i, 2 * ((float)sin(deplacement) + 1) / 2);
rotate_vec(lumpos_i, ((float)sin(deplacement) + 1));
memcpy(lumpos[i], lumpos_i, sizeof(lumpos_i));
// Color
const GLfloat lumcolor_red[] = {1, 0, 0, 1};
memcpy(lumcolor[i], lumcolor_red, sizeof(lumcolor_red));
GLfloat oscillation = ((float)sin(2 * deplacement) + 1);
// Draw corps
bindAndLoadf(matrix_model);
gl4duScalef(0.1f, 0.5f, 0.2f);
@ -133,6 +135,7 @@ static void draw(void) {
gl4duScalef(0.1f, 1, 0.05f);
gl4duTranslatef(0, 0, -1);
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
gl4duRotatef(-oscillation * 90, 0, 0, 1);
gl4duSendMatrices();
gl4dgDraw(_herosId[i].jambe_g);
@ -142,6 +145,7 @@ static void draw(void) {
gl4duScalef(0.1f, 1, 0.05f);
gl4duTranslatef(0, 0, -7);
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
gl4duRotatef(oscillation * 90, 0, 0, 1);
gl4duSendMatrices();
gl4dgDraw(_herosId[i].jambe_d);
@ -151,6 +155,7 @@ static void draw(void) {
gl4duScalef(0.1f, 0.4f, 0.05f);
gl4duTranslatef(0, 4, 1);
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
gl4duRotatef(oscillation * 90, 0, 0, 1);
gl4duSendMatrices();
gl4dgDraw(_herosId[i].bras_g);
@ -160,6 +165,7 @@ static void draw(void) {
gl4duScalef(0.1f, 0.4f, 0.05f);
gl4duTranslatef(0, 4, -8);
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
gl4duRotatef(-oscillation * 90, 0, 0, 1);
gl4duSendMatrices();
gl4dgDraw(_herosId[i].bras_d);