c bon envie de gerber

This commit is contained in:
Mylloon 2023-05-21 08:26:20 +02:00
parent 1b0b3fed8e
commit 996e3e5067
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 7 additions and 6 deletions

View file

@ -5,7 +5,7 @@ in vec3 vec_normal;
out vec4 fragColor;
const int max = 20; // should change in cpu too
const int max = 3; // should change in cpu too
uniform vec4 couleur;
uniform vec4 lumPos[max];

View file

@ -100,8 +100,9 @@ static void draw(void) {
for (int i = 0; i < HEROS_NUMBER; ++i) {
// Torchs
// Position
float offset = 2; // we make sure that lights never eats the ground
GLfloat lumpos_i[] = {(_herosId[i].ox / 10) + (deplacement / 10), 1,
((_herosId[i].oz / 20) - 1)};
((_herosId[i].oz / 20) - 1) - offset};
rotate_vec(lumpos_i, ((float)sin(deplacement) + 1));
memcpy(lumpos[i], lumpos_i, sizeof(lumpos_i));
@ -170,10 +171,10 @@ static void draw(void) {
gl4dgDraw(_herosId[i].bras_d);
}
/* On devrait donner HEROS_NUMBER mais pour éviter de ne plus rien voir avec
* les lumières, on en donne que 20 */
glUniform4fv(glGetUniformLocation(_pId, "lumPos"), 20, (float *)lumpos);
glUniform4fv(glGetUniformLocation(_pId, "lumColor"), 20, (float *)lumcolor);
int max_gpu = 3; // HEROS_NUMBER;
glUniform4fv(glGetUniformLocation(_pId, "lumPos"), max_gpu, (float *)lumpos);
glUniform4fv(glGetUniformLocation(_pId, "lumColor"), max_gpu,
(float *)lumcolor);
deplacement += (float)(0.4 * M_PI * dt);
glUseProgram(0);