WIP: mieux ! reste encore qq. réglages 3D mais la 2D est Ok.
This commit is contained in:
parent
1104459617
commit
fbbefa687a
|
@ -4,7 +4,9 @@
|
||||||
* Desc: OpenGL utils header
|
* Desc: OpenGL utils header
|
||||||
*
|
*
|
||||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||||
* Copyleft (something) ( ;- )) Isn't that fun ?! ----------------,cbF@^@ââ63-OPM,FJ&_(_((T^RQJn||lpv)=à)o -----------------------------------------------------
|
* Copyleft (something) ( ;- )) Isn't that fun ?! -------|cbF@^@ââ63-OPM,FJ&_(_((T^RQ491486Jn||lpv)=à)o!
|
||||||
|
* []xgey('"auU~|~`RIO7y89+1/CHR+-/+à&Ç-_'(-_çéy&#
|
||||||
|
* "tà(utgey(91JI2aFIgB[|[~&Ç(=À'7hu0eiCHR+-/+à&Ç-)
|
||||||
*
|
*
|
||||||
* This file is part of Gem-graph.
|
* This file is part of Gem-graph.
|
||||||
*
|
*
|
||||||
|
@ -49,9 +51,15 @@ int plans_ndx = 0;
|
||||||
|
|
||||||
#define EDGE 0.999999
|
#define EDGE 0.999999
|
||||||
|
|
||||||
#define S2 0
|
#define S 0
|
||||||
|
#define S3 0
|
||||||
|
#define SA 1
|
||||||
|
|
||||||
#define L 0
|
#define L 0
|
||||||
#define V 1
|
#define V 1
|
||||||
|
#define C 0
|
||||||
|
#define P 0
|
||||||
|
|
||||||
static bool compute_space_2D(int space_size_x,
|
static bool compute_space_2D(int space_size_x,
|
||||||
int space_size_y,
|
int space_size_y,
|
||||||
int space_size_z,
|
int space_size_z,
|
||||||
|
@ -71,13 +79,13 @@ static bool compute_space_2D(int space_size_x,
|
||||||
// car on passe du nombre de cases = (n)
|
// car on passe du nombre de cases = (n)
|
||||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||||
|
|
||||||
if (S2) printf("space_2D vertex ");
|
if (S) printf("space_2D vertex ");
|
||||||
for (int k = 0; k < space_size_x; k++){ // barres verticales
|
for (int k = 0; k < space_size_x; k++){ // barres verticales
|
||||||
//
|
//
|
||||||
x = ((space_size_x % 2) * (space_size_x / 2 - k)
|
x = ((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;
|
+ (space_size_x % 2 - 1) * (k + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE;
|
||||||
|
|
||||||
if (S2) printf("[%1.1f] ", x);
|
if (S) printf("[%1.1f] ", x);
|
||||||
|
|
||||||
*(vertex_origin + k * 6 + 0) = - x;
|
*(vertex_origin + k * 6 + 0) = - x;
|
||||||
*(vertex_origin + k * 6 + 1) = 1.0f / space_size_x;
|
*(vertex_origin + k * 6 + 1) = 1.0f / space_size_x;
|
||||||
|
@ -87,8 +95,9 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(vertex_origin + k * 6 + 4) = - 1.0f / space_size_x;
|
*(vertex_origin + k * 6 + 4) = - 1.0f / space_size_x;
|
||||||
*(vertex_origin + k * 6 + 5) = 0.0f;
|
*(vertex_origin + k * 6 + 5) = 0.0f;
|
||||||
|
|
||||||
vertex_ndx += 6;
|
// fun > if (k == space_size_x - 1) *(vertex_origin + k * 6 + 5) = 0.1f;
|
||||||
if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
|
||||||
|
vertex_ndx += 6; if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
||||||
|
|
||||||
*(color_origin + k * 6 + 0) = 1;
|
*(color_origin + k * 6 + 0) = 1;
|
||||||
*(color_origin + k * 6 + 1) = 0;
|
*(color_origin + k * 6 + 1) = 0;
|
||||||
|
@ -103,8 +112,7 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(line_origin + k * 2 + 0) = k * 2 + 0;
|
*(line_origin + k * 2 + 0) = k * 2 + 0;
|
||||||
*(line_origin + k * 2 + 1) = k * 2 + 1;
|
*(line_origin + k * 2 + 1) = k * 2 + 1;
|
||||||
|
|
||||||
lines_ndx += 2;
|
lines_ndx += 2; if (L) printf(" => lines_ndx = %d\n", lines_ndx);
|
||||||
if (L) printf(" => lines_ndx = %d\n", lines_ndx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*(color_origin + 0) = 0;
|
*(color_origin + 0) = 0;
|
||||||
|
@ -123,7 +131,7 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 4) = 0;
|
*(color_origin + (space_size_x - 1) * 6 + 4) = 0;
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 5) = 0;
|
*(color_origin + (space_size_x - 1) * 6 + 5) = 0;
|
||||||
|
|
||||||
colors_ndx += 12;
|
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
||||||
|
|
||||||
*(line_origin + lines_ndx + 0) = 0;
|
*(line_origin + lines_ndx + 0) = 0;
|
||||||
*(line_origin + lines_ndx + 1) = space_size_x * 2 - 2; // barre horizontale du bas
|
*(line_origin + lines_ndx + 1) = space_size_x * 2 - 2; // barre horizontale du bas
|
||||||
|
@ -131,8 +139,7 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(line_origin + lines_ndx + 2) = 1;
|
*(line_origin + lines_ndx + 2) = 1;
|
||||||
*(line_origin + lines_ndx + 3) = space_size_x * 2 - 1; // barre horizontale du haut
|
*(line_origin + lines_ndx + 3) = space_size_x * 2 - 1; // barre horizontale du haut
|
||||||
|
|
||||||
lines_ndx += 4;
|
lines_ndx += 4; if (L) printf("H=> lines_ndx = %d\n", lines_ndx);
|
||||||
if (L) printf("H=> lines_ndx = %d\n", lines_ndx);
|
|
||||||
|
|
||||||
if (pref_mark_unit_space == 1 || pref_mark_unit_space == 3) // diagonales to mark first space unit
|
if (pref_mark_unit_space == 1 || pref_mark_unit_space == 3) // diagonales to mark first space unit
|
||||||
{
|
{
|
||||||
|
@ -142,8 +149,7 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(line_origin + lines_ndx + 2) = 1;
|
*(line_origin + lines_ndx + 2) = 1;
|
||||||
*(line_origin + lines_ndx + 3) = 2;
|
*(line_origin + lines_ndx + 3) = 2;
|
||||||
|
|
||||||
lines_ndx += 4;
|
lines_ndx += 4; if (L) printf("X=> lines_ndx = %d\n", lines_ndx);
|
||||||
if (L) printf("X=> lines_ndx = %d\n", lines_ndx);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,16 +161,15 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(line_origin + lines_ndx + 2) = (space_size_x - 2) * 2 + 1;
|
*(line_origin + lines_ndx + 2) = (space_size_x - 2) * 2 + 1;
|
||||||
*(line_origin + lines_ndx + 3) = (space_size_x - 2) * 2 + 2;
|
*(line_origin + lines_ndx + 3) = (space_size_x - 2) * 2 + 2;
|
||||||
|
|
||||||
lines_ndx +=4;
|
lines_ndx +=4; if (L) printf("X=> lines_ndx = %d\n", lines_ndx);
|
||||||
if (L) printf("X=> lines_ndx = %d\n", lines_ndx);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S2) printf(" n = %d x 2 côté = [%1.1f]\n", space_size_x + 1, 2.0f / space_size_x);
|
if (S) printf(" n = %d x 2 côté = [%1.1f]\n", space_size_x + 1, 2.0f / space_size_x);
|
||||||
if (S2) printf("space_2D line_origin (%d - space_size_x(0)) x (%d - space_size_x(1)) ", 0, 1);
|
if (S) printf("space_2D line_origin (%d - space_size_x(0)) x (%d - space_size_x(1)) ", 0, 1);
|
||||||
for (int v = 0; v < space_size_x + 2; v++)
|
for (int v = 0; v < space_size_x + 2; v++)
|
||||||
if (S2) printf("(%d-%d) ", *(line_origin + v), *(line_origin + v + 1));
|
if (S) printf("(%d-%d) ", *(line_origin + v), *(line_origin + v + 1));
|
||||||
if (S2) printf(" n = 4 + (%d x 2)\n", space_size_x + 2);
|
if (S) printf(" n = 4 + (%d x 2)\n", space_size_x + 2);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -196,24 +201,23 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
printf("compute_arrow_2D load = %d site = %d x = %d\n", weight, site, x);
|
printf("compute_arrow_2D load = %d site = %d x = %d\n", weight, site, x);
|
||||||
float zero = 0.0f;
|
float zero = 0.0f;
|
||||||
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
||||||
float tip = center + (2 * site - 1) * (1.0f / space_size_x);
|
float tip = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
||||||
tip = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
|
||||||
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;
|
||||||
|
|
||||||
*(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;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 3) = base;
|
*(vertex_origin + vertex_ndx + 3) = base;
|
||||||
*(vertex_origin + vertex_ndx + 4) = 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 4) = lat;
|
||||||
*(vertex_origin + vertex_ndx + 5) = zero;
|
*(vertex_origin + vertex_ndx + 5) = zero;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 6) = base;
|
*(vertex_origin + vertex_ndx + 6) = base;
|
||||||
*(vertex_origin + vertex_ndx + 7) = - 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 7) = - lat;
|
||||||
*(vertex_origin + vertex_ndx + 8) = zero;
|
*(vertex_origin + vertex_ndx + 8) = zero;
|
||||||
|
|
||||||
vertex_ndx += 9;
|
vertex_ndx += 9; if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
||||||
if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
|
||||||
|
|
||||||
if (pref_style_lines_planes == 0) {
|
if (pref_style_lines_planes == 0) {
|
||||||
|
|
||||||
|
@ -228,8 +232,7 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
*(line_origin + lines_ndx + 4) = vertex_ndx / 3 - 2;
|
*(line_origin + lines_ndx + 4) = vertex_ndx / 3 - 2;
|
||||||
*(line_origin + lines_ndx + 5) = vertex_ndx / 3 - 1;
|
*(line_origin + lines_ndx + 5) = vertex_ndx / 3 - 1;
|
||||||
|
|
||||||
lines_ndx += 6;
|
lines_ndx += 6; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
if (V) printf("|=> lines_ndx = %d\n", lines_ndx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,12 +245,11 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
*(plan_origin + plans_ndx + 4) = vertex_ndx / 3 + 1;
|
*(plan_origin + plans_ndx + 4) = vertex_ndx / 3 + 1;
|
||||||
*(plan_origin + plans_ndx + 5) = vertex_ndx / 3 + 2;
|
*(plan_origin + plans_ndx + 5) = vertex_ndx / 3 + 2;
|
||||||
|
|
||||||
plans_ndx += 6;
|
plans_ndx += 6; if (P) printf("|=> plans_ndx = %d\n", plans_ndx);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define S3 0
|
|
||||||
static bool compute_space_3D (int space_size_x,
|
static bool compute_space_3D (int space_size_x,
|
||||||
int space_size_y,
|
int space_size_y,
|
||||||
int space_size_z,
|
int space_size_z,
|
||||||
|
@ -291,8 +293,7 @@ static bool compute_space_3D (int space_size_x,
|
||||||
*(vertex_origin + k * 12 + 10) = - 1.0f / space_size_x;
|
*(vertex_origin + k * 12 + 10) = - 1.0f / space_size_x;
|
||||||
*(vertex_origin + k * 12 + 11) = 1.0f / space_size_x;
|
*(vertex_origin + k * 12 + 11) = 1.0f / space_size_x;
|
||||||
|
|
||||||
vertex_ndx += 12;
|
vertex_ndx += 12; if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
||||||
if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
|
||||||
|
|
||||||
*(color_origin + k * 12 + 0) = 1; // 1 - (k / space_size_x);
|
*(color_origin + k * 12 + 0) = 1; // 1 - (k / space_size_x);
|
||||||
*(color_origin + k * 12 + 1) = 0;
|
*(color_origin + k * 12 + 1) = 0;
|
||||||
|
@ -309,6 +310,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
*(color_origin + k * 12 + 9) = 0;
|
*(color_origin + k * 12 + 9) = 0;
|
||||||
*(color_origin + k * 12 + 10) = 0;
|
*(color_origin + k * 12 + 10) = 0;
|
||||||
*(color_origin + k * 12 + 11) = 1;
|
*(color_origin + k * 12 + 11) = 1;
|
||||||
|
|
||||||
|
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
*(color_origin + 0) = 0;
|
*(color_origin + 0) = 0;
|
||||||
|
@ -327,6 +330,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
*(color_origin + 10) = 1;
|
*(color_origin + 10) = 1;
|
||||||
*(color_origin + 11) = 1;
|
*(color_origin + 11) = 1;
|
||||||
|
|
||||||
|
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
||||||
|
|
||||||
*(color_origin + (space_size_x - 1) * 12 + 0) = 1;
|
*(color_origin + (space_size_x - 1) * 12 + 0) = 1;
|
||||||
*(color_origin + (space_size_x - 1) * 12 + 1) = 1;
|
*(color_origin + (space_size_x - 1) * 12 + 1) = 1;
|
||||||
*(color_origin + (space_size_x - 1) * 12 + 2) = 1;
|
*(color_origin + (space_size_x - 1) * 12 + 2) = 1;
|
||||||
|
@ -343,6 +348,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
*(color_origin + (space_size_x - 1) * 12 + 10) = 1;
|
*(color_origin + (space_size_x - 1) * 12 + 10) = 1;
|
||||||
*(color_origin + (space_size_x - 1) * 12 + 11) = 1;
|
*(color_origin + (space_size_x - 1) * 12 + 11) = 1;
|
||||||
|
|
||||||
|
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
||||||
|
|
||||||
if (S3) printf(" n = %d x 2 côté = [%1.1f]\n", space_size_x + 1, 2.0f / space_size_x);
|
if (S3) printf(" n = %d x 2 côté = [%1.1f]\n", space_size_x + 1, 2.0f / space_size_x);
|
||||||
|
|
||||||
*(line_origin + 4) = 0;
|
*(line_origin + 4) = 0;
|
||||||
|
@ -357,6 +364,7 @@ static bool compute_space_3D (int space_size_x,
|
||||||
*(line_origin + 2) = 3;
|
*(line_origin + 2) = 3;
|
||||||
*(line_origin + 3) = space_size_x * 4 - 1; // barre horizontale du haut av
|
*(line_origin + 3) = space_size_x * 4 - 1; // barre horizontale du haut av
|
||||||
|
|
||||||
|
lines_ndx += 8; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
|
|
||||||
/* *(plan_origin + 0) = 0; */
|
/* *(plan_origin + 0) = 0; */
|
||||||
/* *(plan_origin + 1) = 1; */
|
/* *(plan_origin + 1) = 1; */
|
||||||
|
@ -365,6 +373,7 @@ static bool compute_space_3D (int space_size_x,
|
||||||
/* *(plan_origin + 3) = 0; */
|
/* *(plan_origin + 3) = 0; */
|
||||||
/* *(plan_origin + 4) = 1; */
|
/* *(plan_origin + 4) = 1; */
|
||||||
/* *(plan_origin + 5) = 3; */
|
/* *(plan_origin + 5) = 3; */
|
||||||
|
// plans_ndx += 6; if (P) printf("|=> plans_ndx = %d\n", plans_ndx);
|
||||||
|
|
||||||
|
|
||||||
for (int k = 8; k <= space_size_x * 8; k += 8){ // for (int k = 8; k < space_size_x * 8; k += 8){
|
for (int k = 8; k <= space_size_x * 8; k += 8){ // for (int k = 8; k < space_size_x * 8; k += 8){
|
||||||
|
@ -381,6 +390,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
*(line_origin + k + 6) = k / 2 - 3; // + 1;
|
*(line_origin + k + 6) = k / 2 - 3; // + 1;
|
||||||
*(line_origin + k + 7) = k / 2 - 2; // + 2;
|
*(line_origin + k + 7) = k / 2 - 2; // + 2;
|
||||||
|
|
||||||
|
lines_ndx += 8; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref_mark_unit_space == 1 || pref_mark_unit_space == 3) {
|
if (pref_mark_unit_space == 1 || pref_mark_unit_space == 3) {
|
||||||
|
@ -390,6 +401,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
*(line_origin + (2 + space_size_x) * 8 - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
*(line_origin + (2 + space_size_x) * 8 - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
||||||
*(line_origin + (2 + space_size_x) * 8 - 1) = 0 + 3;
|
*(line_origin + (2 + space_size_x) * 8 - 1) = 0 + 3;
|
||||||
|
|
||||||
|
lines_ndx += 4; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref_mark_unit_space == 2 || pref_mark_unit_space == 3) {
|
if (pref_mark_unit_space == 2 || pref_mark_unit_space == 3) {
|
||||||
|
@ -399,6 +412,8 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
*(line_origin + (2 + space_size_x) * 8 - 6) = (space_size_x - 1) * 4 + 2; // diagonales pour marquer la case finale
|
*(line_origin + (2 + space_size_x) * 8 - 6) = (space_size_x - 1) * 4 + 2; // diagonales pour marquer la case finale
|
||||||
*(line_origin + (2 + space_size_x) * 8 - 5) = (space_size_x - 1) * 4 + 3;
|
*(line_origin + (2 + space_size_x) * 8 - 5) = (space_size_x - 1) * 4 + 3;
|
||||||
|
|
||||||
|
lines_ndx += 4; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S3) printf("space 3D buffer_lines (from-to) ");
|
if (S3) printf("space 3D buffer_lines (from-to) ");
|
||||||
|
@ -434,99 +449,90 @@ static bool compute_arrow_3D(int space_size_x,
|
||||||
int buffer_lines_size,
|
int buffer_lines_size,
|
||||||
int buffer_plans_size)
|
int buffer_plans_size)
|
||||||
|
|
||||||
|
|
||||||
/* static bool compute_arrow_3D(int space_size_x, */
|
|
||||||
/* GLfloat *vertex_origin, GLfloat *color_origin, */
|
|
||||||
/* GLubyte *line_origin, GLubyte *plan_origin, */
|
|
||||||
/* bool pref_style_lines_planes, */
|
|
||||||
/* int vgap, int cgap, int lgap, int pgap, */
|
|
||||||
/* int weight, int site, int x, int y, int z) */
|
|
||||||
|
|
||||||
/* 1 flèche 3D > vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
{
|
{
|
||||||
float zero = 0.0f;
|
float zero = 0.0f;
|
||||||
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
||||||
float tip = center + (2 * site - 1) * (1.0f / space_size_x);
|
float tip = center + (2 * site - 1) * (1.0f / 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);
|
||||||
|
|
||||||
int vgap = space_size_x * 12;
|
if (A3) printf("arrow_3D (vertices %d to %d) ",\
|
||||||
|
(buffer_vertex_size + space_size_x * 12 - 15), (buffer_vertex_size + space_size_x * 12));
|
||||||
|
|
||||||
if (A3) printf("arrow_3D (vertices %d to %d) ", (buffer_vertex_size + vgap - 15), (buffer_vertex_size + vgap));
|
*(vertex_origin + space_size_x * 12 + 0) = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
||||||
|
*(vertex_origin + space_size_x * 12 + 1) = zero;
|
||||||
|
*(vertex_origin + space_size_x * 12 + 2) = zero;
|
||||||
|
|
||||||
*(vertex_origin + vgap + 0) = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
*(vertex_origin + space_size_x * 12 + 3) = base;
|
||||||
*(vertex_origin + vgap + 1) = zero;
|
*(vertex_origin + space_size_x * 12 + 4) = 0.4f / space_size_x;
|
||||||
*(vertex_origin + vgap + 2) = zero;
|
*(vertex_origin + space_size_x * 12 + 5) = 0.4f / space_size_x;
|
||||||
|
|
||||||
*(vertex_origin + vgap + 3) = base;
|
*(vertex_origin + space_size_x * 12 + 6) = base;
|
||||||
*(vertex_origin + vgap + 4) = 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 7) = 0.4f / space_size_x;
|
||||||
*(vertex_origin + vgap + 5) = 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 8) = - 0.4f / space_size_x;
|
||||||
|
|
||||||
*(vertex_origin + vgap + 6) = base;
|
*(vertex_origin + space_size_x * 12 + 9) = base;
|
||||||
*(vertex_origin + vgap + 7) = 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 10) = - 0.4f / space_size_x;
|
||||||
*(vertex_origin + vgap + 8) = - 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 11) = - 0.4f / space_size_x;
|
||||||
|
|
||||||
*(vertex_origin + vgap + 9) = base;
|
*(vertex_origin + space_size_x * 12 + 12) = base;
|
||||||
*(vertex_origin + vgap + 10) = - 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 13) = - 0.4f / space_size_x;
|
||||||
*(vertex_origin + vgap + 11) = - 0.4f / space_size_x;
|
*(vertex_origin + space_size_x * 12 + 14) = 0.4f / space_size_x;
|
||||||
|
|
||||||
*(vertex_origin + vgap + 12) = base;
|
vertex_ndx += 15; if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
||||||
*(vertex_origin + vgap + 13) = - 0.4f / space_size_x;
|
|
||||||
*(vertex_origin + vgap + 14) = 0.4f / space_size_x;
|
|
||||||
|
|
||||||
vertex_ndx += 15;
|
|
||||||
if (V) printf(" => vertex_ndx = %d\n", vertex_ndx);
|
|
||||||
|
|
||||||
if (A3) printf("center = %f tip = %f base = %f\n",\
|
if (A3) printf("center = %f tip = %f base = %f\n",\
|
||||||
center, tip, base); // vgap=%d igap=%d
|
center, tip, base); // space_size_x * 12=%d igap=%d
|
||||||
|
|
||||||
if (pref_style_lines_planes == 0) {
|
if (pref_style_lines_planes == 0) {
|
||||||
|
|
||||||
int lgap = space_size_x * 12;
|
*(line_origin + space_size_x * 12 + 0) = space_size_x * 12 / 3 + 0;
|
||||||
|
*(line_origin + space_size_x * 12 + 1) = space_size_x * 12 / 3 + 1;
|
||||||
|
|
||||||
*(line_origin + lgap + 0) = vgap / 3 + 0;
|
*(line_origin + space_size_x * 12 + 2) = space_size_x * 12 / 3 + 0;
|
||||||
*(line_origin + lgap + 1) = vgap / 3 + 1;
|
*(line_origin + space_size_x * 12 + 3) = space_size_x * 12 / 3 + 2;
|
||||||
|
|
||||||
*(line_origin + lgap + 2) = vgap / 3 + 0;
|
*(line_origin + space_size_x * 12 + 4) = space_size_x * 12 / 3 + 0;
|
||||||
*(line_origin + lgap + 3) = vgap / 3 + 2;
|
*(line_origin + space_size_x * 12 + 5) = space_size_x * 12 / 3 + 3;
|
||||||
|
|
||||||
*(line_origin + lgap + 4) = vgap / 3 + 0;
|
*(line_origin + space_size_x * 12 + 6) = space_size_x * 12 / 3 + 0;
|
||||||
*(line_origin + lgap + 5) = vgap / 3 + 3;
|
*(line_origin + space_size_x * 12 + 7) = space_size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
*(line_origin + lgap + 6) = vgap / 3 + 0;
|
*(line_origin + space_size_x * 12 + 8) = space_size_x * 12 / 3 + 1;
|
||||||
*(line_origin + lgap + 7) = vgap / 3 + 4;
|
*(line_origin + space_size_x * 12 + 9) = space_size_x * 12 / 3 + 2;
|
||||||
|
|
||||||
*(line_origin + lgap + 8) = vgap / 3 + 1;
|
*(line_origin + space_size_x * 12 + 10) = space_size_x * 12 / 3 + 2;
|
||||||
*(line_origin + lgap + 9) = vgap / 3 + 2;
|
*(line_origin + space_size_x * 12 + 11) = space_size_x * 12 / 3 + 3;
|
||||||
|
|
||||||
*(line_origin + lgap + 10) = vgap / 3 + 2;
|
*(line_origin + space_size_x * 12 + 12) = space_size_x * 12 / 3 + 3;
|
||||||
*(line_origin + lgap + 11) = vgap / 3 + 3;
|
*(line_origin + space_size_x * 12 + 13) = space_size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
*(line_origin + lgap + 12) = vgap / 3 + 3;
|
*(line_origin + space_size_x * 12 + 14) = space_size_x * 12 / 3 + 4;
|
||||||
*(line_origin + lgap + 13) = vgap / 3 + 4;
|
*(line_origin + space_size_x * 12 + 15) = space_size_x * 12 / 3 + 1;
|
||||||
|
|
||||||
*(line_origin + lgap + 14) = vgap / 3 + 4;
|
lines_ndx += 16; if (L) printf("|=> lines_ndx = %d\n", lines_ndx);
|
||||||
*(line_origin + lgap + 15) = vgap / 3 + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref_style_lines_planes == 1) {
|
if (pref_style_lines_planes == 1) {
|
||||||
|
|
||||||
int pgap = 0;
|
int pgap = 0; // ?? TODO (REMOVE)
|
||||||
|
|
||||||
*(plan_origin + pgap + 0) = vgap / 3 + 0;
|
*(plan_origin + pgap + 0) = space_size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + pgap + 1) = vgap / 3 + 1;
|
*(plan_origin + pgap + 1) = space_size_x * 12 / 3 + 1;
|
||||||
*(plan_origin + pgap + 2) = vgap / 3 + 2;
|
*(plan_origin + pgap + 2) = space_size_x * 12 / 3 + 2;
|
||||||
|
|
||||||
*(plan_origin + pgap + 3) = vgap / 3 + 0;
|
*(plan_origin + pgap + 3) = space_size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + pgap + 4) = vgap / 3 + 3;
|
*(plan_origin + pgap + 4) = space_size_x * 12 / 3 + 3;
|
||||||
*(plan_origin + pgap + 5) = vgap / 3 + 4;
|
*(plan_origin + pgap + 5) = space_size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
*(plan_origin + pgap + 0) = vgap / 3 + 0;
|
*(plan_origin + pgap + 0) = space_size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + pgap + 1) = vgap / 3 + 1;
|
*(plan_origin + pgap + 1) = space_size_x * 12 / 3 + 1;
|
||||||
*(plan_origin + pgap + 2) = vgap / 3 + 3;
|
*(plan_origin + pgap + 2) = space_size_x * 12 / 3 + 3;
|
||||||
|
|
||||||
*(plan_origin + pgap + 3) = vgap / 3 + 0;
|
*(plan_origin + pgap + 3) = space_size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + pgap + 4) = vgap / 3 + 2;
|
*(plan_origin + pgap + 4) = space_size_x * 12 / 3 + 2;
|
||||||
*(plan_origin + pgap + 5) = vgap / 3 + 4;
|
*(plan_origin + pgap + 5) = space_size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
|
plans_ndx += 12; if (P) printf("|=> plans_ndx = %d\n", plans_ndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -571,7 +577,6 @@ static void show_user_choices(int model_space_size_x,
|
||||||
buffer_lines_size, buffer_lines_size / 2, buffer_plans_size, buffer_plans_size / 3);
|
buffer_lines_size, buffer_lines_size / 2, buffer_plans_size, buffer_plans_size / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SA 1
|
|
||||||
bool compute_space_and_arrows(int model_space_size_x,
|
bool compute_space_and_arrows(int model_space_size_x,
|
||||||
int model_space_size_y,
|
int model_space_size_y,
|
||||||
int model_space_size_z,
|
int model_space_size_z,
|
||||||
|
@ -692,20 +697,6 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
buffer_lines_size,
|
buffer_lines_size,
|
||||||
buffer_plans_size);
|
buffer_plans_size);
|
||||||
|
|
||||||
|
|
||||||
/* compute_arrow_3D(model_space_size_x, */
|
|
||||||
/* vertex_origin, color_origin, */
|
|
||||||
/* line_origin, plan_origin, */
|
|
||||||
/* vgap, igap, cgap, */
|
|
||||||
/* 1, 0, 0, 0, 0); */
|
|
||||||
/* vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
/* compute_arrow_3D(entry, model_space_size_x, vgap, igap, 1, 1, 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
/* compute_arrow_3D(entry, model_space_size_x, vgap, igap, 1, 0, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
/* compute_arrow_3D(entry, model_space_size_x, vgap, igap, 1, 1, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
/* compute_arrow_3D(entry, model_space_size_x, vgap, igap, 1, 0, model_space_size_x - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
/* compute_arrow_3D(entry, model_space_size_x, vgap, igap, 1, 1, model_space_size_x - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++model_arrows_nb; */
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,6 @@ GLfloat *buffer_vertex_origin = NULL;
|
||||||
GLfloat *buffer_colors_origin = NULL;
|
GLfloat *buffer_colors_origin = NULL;
|
||||||
GLubyte *buffer_lines_origin = NULL;
|
GLubyte *buffer_lines_origin = NULL;
|
||||||
GLubyte *buffer_plans_origin = NULL;
|
GLubyte *buffer_plans_origin = NULL;
|
||||||
GLubyte arrows[] = { 1, 1, 0, 1, 2, 1, 1, 1, 4, 1, 2, 5, 1, 1, 8, 1, 2, 9 };
|
|
||||||
// arrows[] = { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 };
|
|
||||||
|
|
||||||
int pref_3D_xor_2D_space = 0; // default view == 0 == 3D
|
int pref_3D_xor_2D_space = 0; // default view == 0 == 3D
|
||||||
int pref_3D_xor_2D_arrows = 0; // default view == 0 == 3D
|
int pref_3D_xor_2D_arrows = 0; // default view == 0 == 3D
|
||||||
|
@ -522,15 +520,18 @@ bool graphics_init_shaders(const void *gl_area)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GLubyte arrows[] = { 1, 1, 0, 1, 0, 1, 1, 1, 4, 1, 0, 5, 1, 1, 8, 1, 0, 9 };
|
||||||
|
// arrows[] = { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 };
|
||||||
|
|
||||||
static void get_model_data_and_user_preferences(){
|
static void get_model_data_and_user_preferences(){
|
||||||
|
|
||||||
model_space_size_x = 8; // 2 < model_space_size_x < 32
|
model_space_size_x = 11; // 2 < model_space_size_x < 32
|
||||||
model_arrows_nb = 6; // assert : l'emplacement des flèches est contraint
|
model_arrows_nb = 6; // 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
|
||||||
pref_3D_xor_2D_space = 1; // 0 = 3D 1 = 2D
|
pref_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D
|
||||||
pref_3D_xor_2D_arrows = 1; // 0 = 3D 1 = 2D
|
pref_3D_xor_2D_arrows = 0; // 0 = 3D 1 = 2D
|
||||||
pref_mark_unit_space = 2; // 0 = no marks, 1 = 1st, 2 = last, 3 = both
|
pref_mark_unit_space = 3; // 0 = no marks, 1 = 1st, 2 = last, 3 = both
|
||||||
pref_style_lines_planes = 0; // 0 = arrows as lines, 1 = as planes, 2 = mix
|
pref_style_lines_planes = 0; // 0 = arrows as lines, 1 = as planes, 2 = mix
|
||||||
pref_style_mix_colors = 0; // TODO
|
pref_style_mix_colors = 0; // TODO
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue