WIP: Calcul de la taille des buffers semble OK

This commit is contained in:
Jean Sirmai 2023-07-06 17:04:40 +02:00
parent dd03152a5d
commit a017c91699
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 42 additions and 9 deletions

View File

@ -201,6 +201,19 @@ static int compute_arrow_2D(int space_size_x,
float base = center + (2 * site - 1) * (0.1f / space_size_x); float base = center + (2 * site - 1) * (0.1f / space_size_x);
float lat = 0.4f / space_size_x; float lat = 0.4f / space_size_x;
/* for (int i = 0; i < space_size_x; i++) */
/* for (int j = 0; j < space_size_y; j++) */
/* for (int k = 0; k < space_size_z; k++) */
/* { */
/* x = - ((space_size_x % 2) * (space_size_x / 2 - i) */
/* - (space_size_x % 2 - 1) * (i + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
/* y = - ((space_size_x % 2) * (space_size_x / 2 - j) */
/* - (space_size_x % 2 - 1) * (j + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
/* z = - ((space_size_x % 2) * (space_size_x / 2 - k) */
/* - (space_size_x % 2 - 1) * (k + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
/* } */
*(vertex_origin + vertex_ndx + 0) = tip; *(vertex_origin + vertex_ndx + 0) = tip;
*(vertex_origin + vertex_ndx + 1) = zero; *(vertex_origin + vertex_ndx + 1) = zero;
*(vertex_origin + vertex_ndx + 2) = zero; *(vertex_origin + vertex_ndx + 2) = zero;

View File

@ -539,9 +539,9 @@ GLubyte arrows[] = {
static void get_model_data_and_user_preferences(){ static void get_model_data_and_user_preferences(){
model_space_size_x = 3; // 2 < model_space_size_x < 32 model_space_size_x = 3; // 1 < model_space_size_x
model_space_size_y = 1; // 2 < model_space_size_y < 32 model_space_size_y = 0; // 1 < model_space_size_y
model_space_size_z = 0; // 2 < model_space_size_z < 32 model_space_size_z = 0; // 1 < model_space_size_z
model_arrows_nb = 2; // assert : l'emplacement des flèches est contraint model_arrows_nb = 2; // assert : l'emplacement des flèches est contraint
// par model_space_size_x, y, z et le nombre de sites // par model_space_size_x, y, z et le nombre de sites
@ -584,25 +584,45 @@ static void compute_buffers_sizes(int model_space_size_x,
int pref_style_lines_planes, int pref_style_lines_planes,
int pref_style_mix_colors) int pref_style_mix_colors)
{ {
int four_ladder_amounts = 8; // 4 parallels to connect the orthogonal squares
buffer_vertex_size = (model_space_size_x + 1) buffer_vertex_size = (model_space_size_x + 1)
* (model_space_size_y + 1) * (model_space_size_y + 1)
* (model_space_size_z + 1); * (model_space_size_z + 1)
* 3
+ model_space_size_x * 3
+ model_space_size_y * 3
+ model_space_size_z * 3
- 3;
buffer_colors_size = (model_space_size_x + 1) buffer_colors_size = (model_space_size_x + 1)
* (model_space_size_y + 1) * (model_space_size_y + 1)
* (model_space_size_z + 1); * (model_space_size_z + 1)
* 3
+ model_space_size_x * 3
+ model_space_size_y * 3
+ model_space_size_z * 3
- 3;
buffer_plans_size = 0; buffer_plans_size = 0;
buffer_lines_size = (model_space_size_x + 1) * 2 buffer_lines_size = (model_space_size_x + 1) * 2
+ (model_space_size_y + 1) * 2 + (model_space_size_y + 1) * 2
+ (model_space_size_z + 1) * 2; + (model_space_size_z + 1) * 2;
buffer_lines_size = (model_space_size_x + 1)
* (model_space_size_y + 1)
* (model_space_size_z + 1)
* 3
- model_space_size_x
- model_space_size_y
- model_space_size_z
+ 2; // je suis en 2D
// pourquoi est-ce possible ?
buffer_lines_size += 8 * pref_mark_unit_space; // 8 because 4 diagonal lines buffer_lines_size += 8 * pref_mark_unit_space; // 8 because 4 diagonal lines
buffer_vertex_size += model_arrows_nb * 15; // - 2, + 3 ou -8 == Ad Hoc ! buffer_vertex_size += model_arrows_nb * 9; // je suis en 2D
// buffer_vertex_size += model_arrows_nb * 15 - 3; // - 2, + 3 ou -8 == Ad Hoc !
buffer_colors_size += model_arrows_nb * 15; buffer_colors_size += model_arrows_nb * 15;
buffer_plans_size += 0; buffer_plans_size += 0;
buffer_lines_size += model_arrows_nb * 16; buffer_lines_size += model_arrows_nb * 6; // je suis en 2D
// buffer_lines_size += model_arrows_nb * 16;
if (S) printf("allocated buffers sizes :%4d/3 = %3d vertices, %4d/3 = %3d colors,\ if (S) printf("allocated buffers sizes :%4d/3 = %3d vertices, %4d/3 = %3d colors,\
%4d/2 = %3d lines, %4d/3 = %3d plans. (space size = %d x %d x %d)\n",\ %4d/2 = %3d lines, %4d/3 = %3d plans. (space size = %d x %d x %d)\n",\