moving bodies
This commit is contained in:
parent
be76a975de
commit
fbcb4dd4c3
1 changed files with 7 additions and 1 deletions
|
@ -103,13 +103,15 @@ static void draw(void) {
|
||||||
// Position
|
// Position
|
||||||
GLfloat lumpos_i[] = {(_herosId[i].ox / 10) + (deplacement / 10), 1,
|
GLfloat lumpos_i[] = {(_herosId[i].ox / 10) + (deplacement / 10), 1,
|
||||||
((_herosId[i].oz / 20) - 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));
|
memcpy(lumpos[i], lumpos_i, sizeof(lumpos_i));
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
const GLfloat lumcolor_red[] = {1, 0, 0, 1};
|
const GLfloat lumcolor_red[] = {1, 0, 0, 1};
|
||||||
memcpy(lumcolor[i], lumcolor_red, sizeof(lumcolor_red));
|
memcpy(lumcolor[i], lumcolor_red, sizeof(lumcolor_red));
|
||||||
|
|
||||||
|
GLfloat oscillation = ((float)sin(2 * deplacement) + 1);
|
||||||
|
|
||||||
// Draw corps
|
// Draw corps
|
||||||
bindAndLoadf(matrix_model);
|
bindAndLoadf(matrix_model);
|
||||||
gl4duScalef(0.1f, 0.5f, 0.2f);
|
gl4duScalef(0.1f, 0.5f, 0.2f);
|
||||||
|
@ -133,6 +135,7 @@ static void draw(void) {
|
||||||
gl4duScalef(0.1f, 1, 0.05f);
|
gl4duScalef(0.1f, 1, 0.05f);
|
||||||
gl4duTranslatef(0, 0, -1);
|
gl4duTranslatef(0, 0, -1);
|
||||||
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
||||||
|
gl4duRotatef(-oscillation * 90, 0, 0, 1);
|
||||||
|
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
gl4dgDraw(_herosId[i].jambe_g);
|
gl4dgDraw(_herosId[i].jambe_g);
|
||||||
|
@ -142,6 +145,7 @@ static void draw(void) {
|
||||||
gl4duScalef(0.1f, 1, 0.05f);
|
gl4duScalef(0.1f, 1, 0.05f);
|
||||||
gl4duTranslatef(0, 0, -7);
|
gl4duTranslatef(0, 0, -7);
|
||||||
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
||||||
|
gl4duRotatef(oscillation * 90, 0, 0, 1);
|
||||||
|
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
gl4dgDraw(_herosId[i].jambe_d);
|
gl4dgDraw(_herosId[i].jambe_d);
|
||||||
|
@ -151,6 +155,7 @@ static void draw(void) {
|
||||||
gl4duScalef(0.1f, 0.4f, 0.05f);
|
gl4duScalef(0.1f, 0.4f, 0.05f);
|
||||||
gl4duTranslatef(0, 4, 1);
|
gl4duTranslatef(0, 4, 1);
|
||||||
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
||||||
|
gl4duRotatef(oscillation * 90, 0, 0, 1);
|
||||||
|
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
gl4dgDraw(_herosId[i].bras_g);
|
gl4dgDraw(_herosId[i].bras_g);
|
||||||
|
@ -160,6 +165,7 @@ static void draw(void) {
|
||||||
gl4duScalef(0.1f, 0.4f, 0.05f);
|
gl4duScalef(0.1f, 0.4f, 0.05f);
|
||||||
gl4duTranslatef(0, 4, -8);
|
gl4duTranslatef(0, 4, -8);
|
||||||
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
move(_herosId[i].ox + deplacement, 0, _herosId[i].oz * part_mult);
|
||||||
|
gl4duRotatef(-oscillation * 90, 0, 0, 1);
|
||||||
|
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
gl4dgDraw(_herosId[i].bras_d);
|
gl4dgDraw(_herosId[i].bras_d);
|
||||||
|
|
Reference in a new issue