From 996e3e5067f266d925b18cfd0cff18458383eb65 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 21 May 2023 08:26:20 +0200 Subject: [PATCH] c bon envie de gerber --- shaders/manif.fs | 2 +- src/manif.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/shaders/manif.fs b/shaders/manif.fs index 6ad4824..e956008 100644 --- a/shaders/manif.fs +++ b/shaders/manif.fs @@ -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]; diff --git a/src/manif.c b/src/manif.c index ffa33d5..fe5a873 100644 --- a/src/manif.c +++ b/src/manif.c @@ -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);