WIP: des couleurs, certes...

This commit is contained in:
Jean Sirmai 2023-06-23 23:48:14 +02:00
parent a6927dbaa5
commit ecd3ed98fc
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 16 additions and 13 deletions

View File

@ -562,9 +562,9 @@ static void get_model_data_and_user_preferences(){
state_size = 8; // 2 < state_size < 32 state_size = 8; // 2 < state_size < 32
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
pref_3D_xor_2D_space = 0; // default view == 0 == 3D pref_3D_xor_2D_space = 0; // default == 0 == 3D
pref_3D_xor_2D_arrows = 1; // default view == 0 == 3D pref_3D_xor_2D_arrows = 1; // default == 0 == 3D
pref_mark_unit_space_zero = 0; // default == 0 == no mark pref_mark_unit_space_zero = 1; // default == 0 == no mark
} }
static void compute_vertex_colors_lines_plans_nb(int dim, static void compute_vertex_colors_lines_plans_nb(int dim,
@ -635,6 +635,7 @@ void graphics_init_buffers(const void *gl_area)
vertex_base, color_base, vertex_base, color_base,
line_ndx, line_ndx,
pref_mark_unit_space_zero, dgap); pref_mark_unit_space_zero, dgap);
else compute_space_3D(state_size, else compute_space_3D(state_size,
vertex_base, color_base, vertex_base, color_base,
line_ndx, line_ndx,
@ -722,7 +723,7 @@ void graphics_draw(const void *gl_area)
/* Use our shaders */ /* Use our shaders */
glUseProgram(entry->program); glUseProgram(entry->program);
glClearColor(0.3f, 0, 0, 0.8f); glClearColor(0, 0, 0, 0.2f); // glClearColor(0.3f, 0, 0, 0.8f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* Update the "mvp" matrix we use in the shader */ /* Update the "mvp" matrix we use in the shader */

View File

@ -62,21 +62,23 @@ bool compute_space_3D(int state_size,
*(vertex_base + k * 12 + 10) = - 1.0f / state_size; *(vertex_base + k * 12 + 10) = - 1.0f / state_size;
*(vertex_base + k * 12 + 11) = 1.0f / state_size; *(vertex_base + k * 12 + 11) = 1.0f / state_size;
*(color_base + k * 12 + 0) = 0.8f; *(color_base + k * 12 + 0) = 1 - (k / state_size);
*(color_base + k * 12 + 1) = 0.8f; *(color_base + k * 12 + 1) = 0.2f;
*(color_base + k * 12 + 2) = 0.8f; *(color_base + k * 12 + 2) = (k / state_size);
*(color_base + k * 12 + 3) = 0.8f; *(color_base + k * 12 + 3) = 0.8f;
*(color_base + k * 12 + 4) = 0.8f; *(color_base + k * 12 + 4) = 0.8f;
*(color_base + k * 12 + 5) = 0.8f; *(color_base + k * 12 + 5) = 0.2f;
*(color_base + k * 12 + 6) = 0.8f; *(color_base + k * 12 + 6) = 0.8f;
*(color_base + k * 12 + 7) = 0.8f; *(color_base + k * 12 + 7) = (k / state_size);
*(color_base + k * 12 + 8) = 0.8f; *(color_base + k * 12 + 8) = 0.2f;
*(color_base + k * 12 + 9) = 0.8f; *(color_base + k * 12 + 9) = 1 - (k / state_size);
*(color_base + k * 12 + 10) = 0.8f; *(color_base + k * 12 + 10) = 0.2f;
*(color_base + k * 12 + 11) = 0.8f; *(color_base + k * 12 + 11) = 0.9f;
// if (k == 0) for (int j = 0; j < 12; j++) *(color_base + j) = 0.2f;
/* 0.8, 0.8, 0.8, // blanc */ /* 0.8, 0.8, 0.8, // blanc */
/* 0.8, 0.8, 0.2, // jaune */ /* 0.8, 0.8, 0.2, // jaune */