WIP: Espace (2D, 3D) Ok. Maintenant, les flèches !
This commit is contained in:
parent
5d5998c5d6
commit
a874d96105
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: OpenGL utils header
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
bool compute_arrow_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z);
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: OpenGL utils header
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
bool compute_arrow_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z);
|
||||
|
|
@ -26,19 +26,28 @@
|
|||
#include <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
int graphics_compute_lines(int line_indices_nb,
|
||||
bool compute_space_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, int lines_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb);
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last);
|
||||
|
||||
int graphics_compute_plans(int plan_indices_nb,
|
||||
bool compute_arrow_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *plan_ndx, int plans_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb);
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z);
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
bool compute_space_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last);
|
||||
|
||||
bool compute_arrow_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z);
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: OpenGL utils header
|
||||
*
|
||||
* Copyright (C) 2023 Arthur Menges <arthur.menges@a-lec.org>
|
||||
* Copyright (C) 2023 Adrien Bourmault <neox@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// v5----- v4
|
||||
// /| /|
|
||||
// v1------v0|
|
||||
// | | | |
|
||||
// | |v6---|-|v7
|
||||
// |/ |/
|
||||
// v2------v3
|
||||
//
|
||||
// static GLfloat vertex_base[] = {
|
||||
// 0.5, 0.5, 0.5, // v0
|
||||
// -0.5, 0.5, 0.5, // v1
|
||||
// -0.5,-0.5, 0.5, // v2
|
||||
// 0.5,-0.5, 0.5, // v3
|
||||
// 0.5, 0.5,-0.5, // v4
|
||||
// -0.5, 0.5,-0.5, // v5
|
||||
// -0.5,-0.5,-0.5, // v6
|
||||
// 0.5,-0.5,-0.5, // v7
|
||||
// };
|
||||
static GLfloat vertex_base_ignore[] = {
|
||||
0.5, .0f, .0f, // v0
|
||||
-0.5, .0f, .0f, // v1
|
||||
-0.5,-0.5, .0f, // v2
|
||||
0.5,-0.5, .0f, // v3
|
||||
0.5, .0f,-.0f, // v4
|
||||
-0.5, .0f,-.0f, // v5
|
||||
-0.5,-0.5,-.0f, // v6
|
||||
0.5,-0.5,-.0f, // v7
|
||||
};
|
||||
|
||||
static GLubyte indices_ignore[] = {
|
||||
0,1,
|
||||
1,2,
|
||||
2,3,
|
||||
3,0,
|
||||
|
||||
4,5,
|
||||
5,6,
|
||||
6,7,
|
||||
7,4,
|
||||
|
||||
0,4,
|
||||
1,5,
|
||||
2,6,
|
||||
3,7,
|
||||
|
||||
// 2,4,
|
||||
// 3,5,
|
||||
// 0,6,
|
||||
// 1,7,
|
||||
|
||||
};
|
||||
// v5------v4
|
||||
// /| /|
|
||||
// v1------v0|
|
||||
// | | | |
|
||||
// | v6----|-v7
|
||||
// |/ |/
|
||||
// v2------v3
|
||||
//
|
||||
|
||||
|
||||
static GLfloat color_base[] = {
|
||||
0.8, 0.8, 0.8, // blanc
|
||||
0.8, 0.8, 0.2, // jaune
|
||||
0.8, 0.2, 0.2, // rouge
|
||||
0.2, 0.2, 0.2, // noir
|
||||
0.2, 0.2, 0.2, // gris
|
||||
0.2, 0.8, 0.8, // cyan
|
||||
0.2, 0.8, 0.2, // vert
|
||||
0.8, 0.2, 0.8, // magenta
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: OpenGL utils header
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
bool compute_space_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last);
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
bool compute_space_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last);
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <epoxy/gl.h>
|
||||
//#include <GL/glu.h>
|
||||
|
||||
bool compute_arrow_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z){
|
||||
|
||||
float zero = 0.0f;
|
||||
float center = (1.0f / state_size) * (2 * x - state_size + 2);
|
||||
// float tip = center + (2 * site - 1) * (1.0f / state_size);
|
||||
float base = center + (2 * site - 1) * (0.1f / state_size);
|
||||
|
||||
*(vertex_base + vgap + 0) = center + (2 * site - 1) * (1.0f / state_size - 0.01f);
|
||||
*(vertex_base + vgap + 1) = zero;
|
||||
*(vertex_base + vgap + 2) = zero;
|
||||
|
||||
*(vertex_base + vgap + 3) = base;
|
||||
*(vertex_base + vgap + 4) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 5) = zero;
|
||||
|
||||
*(vertex_base + vgap + 6) = base;
|
||||
*(vertex_base + vgap + 7) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 8) = zero;
|
||||
|
||||
|
||||
*(line_ndx + igap + 0) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 1) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 2) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 3) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 4) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 5) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 0) = vgap / 3 + 0;
|
||||
*(plan_ndx + 1) = vgap / 3 + 1;
|
||||
*(plan_ndx + 2) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 3) = vgap / 3 + 0;
|
||||
*(plan_ndx + 4) = vgap / 3 + 1;
|
||||
*(plan_ndx + 5) = vgap / 3 + 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <epoxy/gl.h>
|
||||
//#include <GL/glu.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define A 0
|
||||
bool compute_arrow_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z){
|
||||
|
||||
float zero = 0.0f;
|
||||
float center = (1.0f / state_size) * (2 * x - state_size + 2);
|
||||
float tip = center + (2 * site - 1) * (1.0f / state_size);
|
||||
float base = center + (2 * site - 1) * (0.1f / state_size);
|
||||
|
||||
if (A) printf("compute_arrow_3D vgap = %d\n", vgap);
|
||||
|
||||
*(vertex_base + vgap + 0) = center + (2 * site - 1) * (1.0f / state_size - 0.01f);
|
||||
*(vertex_base + vgap + 1) = zero;
|
||||
*(vertex_base + vgap + 2) = zero;
|
||||
|
||||
*(vertex_base + vgap + 3) = base;
|
||||
*(vertex_base + vgap + 4) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 5) = 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 6) = base;
|
||||
*(vertex_base + vgap + 7) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 8) = - 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 9) = base;
|
||||
*(vertex_base + vgap + 10) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 11) = - 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 12) = base;
|
||||
*(vertex_base + vgap + 13) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 14) = 0.4f / state_size;
|
||||
|
||||
if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\
|
||||
x, site, center, tip, base); // vgap=%d igap=%d
|
||||
|
||||
*(line_ndx + igap + 0) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 1) = vgap / 3 + 1;
|
||||
|
||||
*(line_ndx + igap + 2) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 3) = vgap / 3 + 2;
|
||||
|
||||
*(line_ndx + igap + 4) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 5) = vgap / 3 + 3;
|
||||
|
||||
*(line_ndx + igap + 6) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 7) = vgap / 3 + 4;
|
||||
|
||||
*(line_ndx + igap + 8) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 9) = vgap / 3 + 2;
|
||||
|
||||
*(line_ndx + igap + 10) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 11) = vgap / 3 + 3;
|
||||
|
||||
*(line_ndx + igap + 12) = vgap / 3 + 3;
|
||||
*(line_ndx + igap + 13) = vgap / 3 + 4;
|
||||
|
||||
*(line_ndx + igap + 14) = vgap / 3 + 4;
|
||||
*(line_ndx + igap + 15) = vgap / 3 + 1;
|
||||
|
||||
|
||||
*(plan_ndx + 0) = vgap / 3 + 0;
|
||||
*(plan_ndx + 1) = vgap / 3 + 1;
|
||||
*(plan_ndx + 2) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 3) = vgap / 3 + 0;
|
||||
*(plan_ndx + 4) = vgap / 3 + 1;
|
||||
*(plan_ndx + 5) = vgap / 3 + 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -42,322 +42,370 @@
|
|||
#include "../../include/ui.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/buffers.h"
|
||||
#include "../../include/space_2D.h"
|
||||
#include "../../include/space_3D.h"
|
||||
#include "../../include/arrow_2D.h"
|
||||
#include "../../include/arrow_3D.h"
|
||||
|
||||
#define A 0
|
||||
int graphics_compute_lines(int line_indices_nb,
|
||||
#define V 1
|
||||
#define I 0
|
||||
#define EDGE 0.999999
|
||||
bool compute_space_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, int lines_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb)
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last)
|
||||
{
|
||||
/// struct gl_area_entry *entry;
|
||||
/// GLuint vao, vertex_buffer, color_buffer;
|
||||
int vgap = 0, igap = 0, pgap = 0, cgap = 0;
|
||||
|
||||
/// entry = find_entry_from_ptr(gl_area);
|
||||
float x = 0;
|
||||
// for (int k = 0; k < state_size + 1; k++) <=> + 1
|
||||
// car on passe du nombre de cases = (n)
|
||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21}; < from model.xml
|
||||
dim = 1;
|
||||
state_size = 7; // 2 < state_size < 32
|
||||
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
|
||||
if (V) printf("vertices ");
|
||||
for (int k = 0; k < state_size; k++){ // barres verticales
|
||||
//
|
||||
x = ((state_size % 2) * (state_size / 2 - k)
|
||||
+ (state_size % 2 - 1) * (k + 0.5f - state_size / 2)) / state_size * 2 * EDGE;
|
||||
|
||||
vertex_nb = (state_size + 1) * 6 + arrows_nb * 9;
|
||||
vertex_nb = (state_size + 1) * 12 + arrows_nb * 15;
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
// lines_nb = (2 + state_size) + (arrows_nb * 3); // cas 2D
|
||||
lines_nb = (4 + state_size * 4) + (arrows_nb * 8) + 4; // + 4; pour les 4 diagonales (29/6/2023 pour voir)
|
||||
//// plans_nb = 8; //(4 + state_size * 4) + (arrows_nb * 8) + 2; // bhuingfyunfyuguinlgi svbysbubsyu qvyqytqujtvcttcef
|
||||
if (V) printf("[%1.1f] ", x);
|
||||
|
||||
line_indices_nb = lines_nb * 2;
|
||||
*(vertex_base + k * 6 + 0) = - x;
|
||||
*(vertex_base + k * 6 + 1) = 1.0f / state_size;
|
||||
*(vertex_base + k * 6 + 2) = 0.0f;
|
||||
|
||||
printf("Initialization of buffers with %u line_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
line_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
*(vertex_base + k * 6 + 3) = - x;
|
||||
*(vertex_base + k * 6 + 4) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 6 + 5) = 0.0f;
|
||||
|
||||
// g_malloc
|
||||
// vertex_base = g_malloc0(vertex_nb * sizeof(GLfloat) * 2);
|
||||
// color_base = g_malloc0(colors_nb * sizeof(GLfloat) * 2);
|
||||
// line_ndx = g_malloc0(lines_nb * 2 * sizeof(GLubyte) * 2);
|
||||
//// plan_ndx = g_malloc0(plans_nb * 3 * sizeof(GLubyte) * 2);
|
||||
*(color_base + k * 6 + 0) = 1;
|
||||
*(color_base + k * 6 + 1) = 0;
|
||||
*(color_base + k * 6 + 2) = 0;
|
||||
|
||||
assert(state_size * 6 < vertex_nb); assert(state_size * 6 + 5 < vertex_nb);
|
||||
// compute_space_2D(state_size, vertex_base, line_ndx);
|
||||
// vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
|
||||
*(line_ndx + state_size * 2 + 6 + 4) = 0; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + state_size * 2 + 6 + 5) = 3;
|
||||
*(line_ndx + state_size * 2 + 6 + 6) = 1;
|
||||
*(line_ndx + state_size * 2 + 6 + 7) = 2;
|
||||
|
||||
for (int k = 0; k < state_size; k++){
|
||||
assert(k * 12 < vertex_nb); assert(k * 12 + 11 < vertex_nb);
|
||||
assert(k * 12 < colors_nb); assert(k * 12 + 11 < colors_nb);
|
||||
assert(k + 8 < line_indices_nb); assert(k + 16 < line_indices_nb);
|
||||
*(color_base + k * 6 + 3) = 1;
|
||||
*(color_base + k * 6 + 4) = 1;
|
||||
*(color_base + k * 6 + 5) = 0;
|
||||
}
|
||||
|
||||
compute_space_3D(state_size, vertex_base, color_base, line_ndx,
|
||||
0,0); // patch provisoire
|
||||
// pref_mark_unit_space_zero, dgap){
|
||||
vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
*(color_base + 0) = 0;
|
||||
*(color_base + 1) = 0;
|
||||
*(color_base + 2) = 0;
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 0, 0, 0); */
|
||||
/* // if (A) printf("compute_arrow_2D vgap = %d vertex_nb = %d\n", vgap, vertex_nb); */
|
||||
/* // if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\ */
|
||||
/* // x, site, center, tip, base); // vgap=%d igap=%d */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
*(color_base + 3) = 1;
|
||||
*(color_base + 4) = 1;
|
||||
*(color_base + 5) = 1;
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
*(color_base + (state_size - 1) * 6 + 0) = 1;
|
||||
*(color_base + (state_size - 1) * 6 + 1) = 1;
|
||||
*(color_base + (state_size - 1) * 6 + 2) = 1;
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 3, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
*(color_base + (state_size - 1) * 6 + 3) = 0;
|
||||
*(color_base + (state_size - 1) * 6 + 4) = 0;
|
||||
*(color_base + (state_size - 1) * 6 + 5) = 0;
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb);
|
||||
assert(igap < line_indices_nb); assert(igap + 5 < line_indices_nb);
|
||||
*(line_ndx + 0) = 0;
|
||||
*(line_ndx + 1) = state_size * 2 - 2; // barre horizontale du bas
|
||||
|
||||
*(line_ndx + 2) = 1;
|
||||
*(line_ndx + 3) = state_size * 2 - 1; // barre horizontale du haut
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 0, 0, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
for (int k = 0; k < state_size * 2; k++) *(line_ndx + k + 4) = k;
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 1, 2, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
if (I) printf("line_ndx (%d - state_size(0)) x (%d - state_size(1)) ", 0, 1);
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 0, 3, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
for (int v = 0; v < state_size + 2; v++)
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 1, 3, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
int dgap = 0;
|
||||
|
||||
return line_indices_nb;
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/// glGenBuffers(1, &vertex_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, vertex_nb * sizeof(vertex_base[0]), vertex_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
|
||||
// colors
|
||||
/// glGenBuffers(1, &color_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, colors_nb * sizeof(color_base), color_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// We only use one VAO, so we always keep it bound
|
||||
/// glGenVertexArrays(1, &vao);
|
||||
/// glBindVertexArray(vao);
|
||||
|
||||
/// if(entry != NULL) {
|
||||
/// entry->vao = vao;
|
||||
/// entry->position_buffer = vertex_buffer;
|
||||
/// entry->color_buffer = color_buffer;
|
||||
/// }
|
||||
}
|
||||
|
||||
#define A 0
|
||||
int graphics_compute_plans(int plan_indices_nb,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *plan_ndx, int plans_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb)
|
||||
{
|
||||
/// int line_indices_nb = 0; // AD HOC !
|
||||
/// struct gl_area_entry *entry;
|
||||
/// GLuint vao, vertex_buffer, color_buffer;
|
||||
int vgap = 0, igap = 0, pgap = 0, cgap = 0;
|
||||
|
||||
/// entry = find_entry_from_ptr(gl_area);
|
||||
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21}; < from model.xml
|
||||
dim = 1;
|
||||
state_size = 7; // 2 < state_size < 32
|
||||
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
|
||||
|
||||
vertex_nb = (state_size + 1) * 6 + arrows_nb * 9;
|
||||
vertex_nb = (state_size + 1) * 12 + arrows_nb * 15;
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
// lines_nb = (2 + state_size) + (arrows_nb * 3); // cas 2D
|
||||
//// lines_nb = (4 + state_size * 4) + (arrows_nb * 8) + 2; // + 2; pour les 2 diagonales
|
||||
plans_nb = 8; //(4 + state_size * 4) + (arrows_nb * 8) + 2; // bhuingfyunfyuguinlgi svbysbubsyu qvyqytqujtvcttcef
|
||||
|
||||
//// plan_indices_nb = plans_nb * 3;
|
||||
|
||||
printf("Initialization of buffers with %u plan_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
plan_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
|
||||
// g_malloc
|
||||
//// vertex_base = g_malloc0(vertex_nb * sizeof(GLfloat) * 2);
|
||||
//// color_base = g_malloc0(colors_nb * sizeof(GLfloat) * 2);
|
||||
//// line_ndx = g_malloc0(lines_nb * 2 * sizeof(GLubyte) * 2);
|
||||
plan_ndx = g_malloc0(plans_nb * 3 * sizeof(GLubyte) * 2);
|
||||
|
||||
assert(state_size * 6 < vertex_nb); assert(state_size * 6 + 5 < vertex_nb);
|
||||
// compute_space_2D(state_size, vertex_base, line_ndx);
|
||||
// vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
|
||||
/* *(line_ndx + state_size * 2 + 6 + 4) = 0; // diagonales pour marquer la case zéro */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 5) = 3; */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 6) = 1; */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 7) = 2; */
|
||||
|
||||
for (int k = 0; k < state_size; k++){
|
||||
assert(k * 12 < vertex_nb); assert(k * 12 + 11 < vertex_nb);
|
||||
assert(k * 12 < colors_nb); assert(k * 12 + 11 < colors_nb);
|
||||
// assert(k + 8 < line_indices_nb); assert(k + 16 < line_indices_nb);
|
||||
|
||||
compute_space_3D(state_size, vertex_base, color_base, plan_ndx,
|
||||
0,0); // patch provisoire
|
||||
//pref_mark_unit_space_zero, dgap){
|
||||
|
||||
vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 0, 0, 0); */
|
||||
/* // if (A) printf("compute_arrow_2D vgap = %d vertex_nb = %d\n", vgap, vertex_nb); */
|
||||
/* // if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\ */
|
||||
/* // x, site, center, tip, base); // vgap=%d igap=%d */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 3, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb);
|
||||
// assert(igap < line_indices_nb); assert(igap + 5 < line_indices_nb);
|
||||
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, 0, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, 3, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, 3, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
return plan_indices_nb;
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/// glGenBuffers(1, &vertex_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, vertex_nb * sizeof(vertex_base[0]), vertex_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
|
||||
// colors
|
||||
/// glGenBuffers(1, &color_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, colors_nb * sizeof(color_base), color_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// We only use one VAO, so we always keep it bound
|
||||
/// glGenVertexArrays(1, &vao);
|
||||
/// glBindVertexArray(vao);
|
||||
|
||||
/// if(entry != NULL) {
|
||||
/// entry->vao = vao;
|
||||
/// entry->position_buffer = vertex_buffer;
|
||||
/// entry->color_buffer = color_buffer;
|
||||
/// }
|
||||
if (pref_mark_unit_space_first) { // diagonales to mark first space unit
|
||||
dgap +=4;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 0) = 0;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 1) = 3;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 2) = 1;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 3) = 2;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_last) { // diagonales to mark last space unit
|
||||
dgap +=4;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 0) = (state_size - 2) * 2 + 0;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 1) = (state_size - 2) * 2 + 3;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 2) = (state_size - 2) * 2 + 1;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 3) = (state_size - 2) * 2 + 2;
|
||||
}
|
||||
|
||||
if (I) printf(" n = 4 + (%d x 2)\n", state_size + 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool compute_arrow_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z)
|
||||
{
|
||||
|
||||
float zero = 0.0f;
|
||||
float center = (1.0f / state_size) * (2 * x - state_size + 2);
|
||||
// float tip = center + (2 * site - 1) * (1.0f / state_size);
|
||||
float base = center + (2 * site - 1) * (0.1f / state_size);
|
||||
|
||||
*(vertex_base + vgap + 0) = center + (2 * site - 1) * (1.0f / state_size - 0.01f);
|
||||
*(vertex_base + vgap + 1) = zero;
|
||||
*(vertex_base + vgap + 2) = zero;
|
||||
|
||||
*(vertex_base + vgap + 3) = base;
|
||||
*(vertex_base + vgap + 4) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 5) = zero;
|
||||
|
||||
*(vertex_base + vgap + 6) = base;
|
||||
*(vertex_base + vgap + 7) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 8) = zero;
|
||||
|
||||
|
||||
*(line_ndx + igap + 0) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 1) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 2) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 3) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 4) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 5) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 0) = vgap / 3 + 0;
|
||||
*(plan_ndx + 1) = vgap / 3 + 1;
|
||||
*(plan_ndx + 2) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 3) = vgap / 3 + 0;
|
||||
*(plan_ndx + 4) = vgap / 3 + 1;
|
||||
*(plan_ndx + 5) = vgap / 3 + 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool compute_space_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last)
|
||||
{
|
||||
|
||||
float x = 0;
|
||||
// for (int k = 0; k < state_size + 1; k++) <=> + 1 car
|
||||
// on passe du nombre de cases = (n)
|
||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||
|
||||
if (V) printf("vertices ");
|
||||
for (int k = 0; k < state_size; k++){ // barres verticales
|
||||
//
|
||||
x = ((state_size % 2) * (state_size / 2 - k)
|
||||
+ (state_size % 2 - 1) * (k + 0.5f - state_size / 2)) / state_size * 2 * EDGE;
|
||||
|
||||
if (V) printf("[%1.1f] ", x);
|
||||
|
||||
*(vertex_base + k * 12 + 0) = - x;
|
||||
*(vertex_base + k * 12 + 1) = 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 2) = 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 3) = - x;
|
||||
*(vertex_base + k * 12 + 4) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 5) = - 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 6) = - x;
|
||||
*(vertex_base + k * 12 + 7) = 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 8) = - 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 9) = - x;
|
||||
*(vertex_base + k * 12 + 10) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 11) = 1.0f / state_size;
|
||||
|
||||
*(color_base + k * 12 + 0) = 1; // 1 - (k / state_size);
|
||||
*(color_base + k * 12 + 1) = 0;
|
||||
*(color_base + k * 12 + 2) = 0;
|
||||
|
||||
*(color_base + k * 12 + 3) = 0.2f;
|
||||
*(color_base + k * 12 + 4) = 1;
|
||||
*(color_base + k * 12 + 5) = 0;
|
||||
|
||||
*(color_base + k * 12 + 6) = 1;
|
||||
*(color_base + k * 12 + 7) = 1;
|
||||
*(color_base + k * 12 + 8) = 0;
|
||||
|
||||
*(color_base + k * 12 + 9) = 0;
|
||||
*(color_base + k * 12 + 10) = 0;
|
||||
*(color_base + k * 12 + 11) = 1;
|
||||
}
|
||||
|
||||
*(color_base + 0) = 0;
|
||||
*(color_base + 1) = 0;
|
||||
*(color_base + 2) = 0;
|
||||
|
||||
*(color_base + 3) = 1;
|
||||
*(color_base + 4) = 1;
|
||||
*(color_base + 5) = 1;
|
||||
|
||||
*(color_base + 6) = 0;
|
||||
*(color_base + 7) = 0;
|
||||
*(color_base + 8) = 0;
|
||||
|
||||
*(color_base + 9) = 1;
|
||||
*(color_base + 10) = 1;
|
||||
*(color_base + 11) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 0) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 1) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 2) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 3) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 4) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 5) = 0;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 6) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 7) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 8) = 0;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 9) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 10) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 11) = 1;
|
||||
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
*(line_ndx + 4) = 0;
|
||||
*(line_ndx + 5) = state_size * 4 - 4; // barre horizontale du bas arr
|
||||
|
||||
*(line_ndx + 6) = 1;
|
||||
*(line_ndx + 7) = state_size * 4 - 3; // barre horizontale du haut arr
|
||||
|
||||
*(line_ndx + 0) = 2;
|
||||
*(line_ndx + 1) = state_size * 4 - 2; // barre horizontale du bas av
|
||||
|
||||
*(line_ndx + 2) = 3;
|
||||
*(line_ndx + 3) = state_size * 4 - 1; // barre horizontale du haut av
|
||||
|
||||
|
||||
/* *(plan_ndx + 0) = 0; */
|
||||
/* *(plan_ndx + 1) = 1; */
|
||||
/* *(plan_ndx + 2) = 2; */
|
||||
|
||||
/* *(plan_ndx + 3) = 0; */
|
||||
/* *(plan_ndx + 4) = 1; */
|
||||
/* *(plan_ndx + 5) = 3; */
|
||||
|
||||
|
||||
for (int k = 8; k <= state_size * 8; k += 8){ // for (int k = 8; k < state_size * 8; k += 8){
|
||||
|
||||
|
||||
*(line_ndx + k + 0) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 1) = k / 2 - 2; // + 2;
|
||||
|
||||
*(line_ndx + k + 2) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 3) = k / 2 - 1; // + 3;
|
||||
|
||||
*(line_ndx + k + 4) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 5) = k / 2 - 1; // + 3;
|
||||
|
||||
*(line_ndx + k + 6) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 7) = k / 2 - 2; // + 2;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_first) {
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 4) = 0 + 0; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + (2 + state_size) * 8 - 3) = 0 + 1;
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + (2 + state_size) * 8 - 1) = 0 + 3;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_last) {
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 8) = (state_size - 1) * 4 + 0; // diagonales pour marquer la case finale
|
||||
*(line_ndx + (2 + state_size) * 8 - 7) = (state_size - 1) * 4 + 1;
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 6) = (state_size - 1) * 4 + 2; // diagonales pour marquer la case finale
|
||||
*(line_ndx + (2 + state_size) * 8 - 5) = (state_size - 1) * 4 + 3;
|
||||
}
|
||||
|
||||
if (I) printf("line_ndx ");
|
||||
for (int v = 0; v < state_size + 2; v++) {
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
}
|
||||
|
||||
if (I) printf("pref_mark_unit_space_first = %d ", pref_mark_unit_space_first);
|
||||
if (I) printf("pref_mark_unit_space_last = %d ", pref_mark_unit_space_last);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool compute_arrow_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, GLubyte *plan_ndx,
|
||||
int vgap, int igap, int cgap,
|
||||
int weight, int site, int x, int y, int z)
|
||||
{
|
||||
float zero = 0.0f;
|
||||
float center = (1.0f / state_size) * (2 * x - state_size + 2);
|
||||
float tip = center + (2 * site - 1) * (1.0f / state_size);
|
||||
float base = center + (2 * site - 1) * (0.1f / state_size);
|
||||
|
||||
if (I) printf("compute_arrow_3D vgap = %d\n", vgap);
|
||||
|
||||
*(vertex_base + vgap + 0) = center + (2 * site - 1) * (1.0f / state_size - 0.01f);
|
||||
*(vertex_base + vgap + 1) = zero;
|
||||
*(vertex_base + vgap + 2) = zero;
|
||||
|
||||
*(vertex_base + vgap + 3) = base;
|
||||
*(vertex_base + vgap + 4) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 5) = 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 6) = base;
|
||||
*(vertex_base + vgap + 7) = 0.4f / state_size;
|
||||
*(vertex_base + vgap + 8) = - 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 9) = base;
|
||||
*(vertex_base + vgap + 10) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 11) = - 0.4f / state_size;
|
||||
|
||||
*(vertex_base + vgap + 12) = base;
|
||||
*(vertex_base + vgap + 13) = - 0.4f / state_size;
|
||||
*(vertex_base + vgap + 14) = 0.4f / state_size;
|
||||
|
||||
if (I) printf("x = %d site = %d center = %f tip = %f base = %f\n",\
|
||||
x, site, center, tip, base); // vgap=%d igap=%d
|
||||
|
||||
*(line_ndx + igap + 0) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 1) = vgap / 3 + 1;
|
||||
|
||||
*(line_ndx + igap + 2) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 3) = vgap / 3 + 2;
|
||||
|
||||
*(line_ndx + igap + 4) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 5) = vgap / 3 + 3;
|
||||
|
||||
*(line_ndx + igap + 6) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 7) = vgap / 3 + 4;
|
||||
|
||||
*(line_ndx + igap + 8) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 9) = vgap / 3 + 2;
|
||||
|
||||
*(line_ndx + igap + 10) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 11) = vgap / 3 + 3;
|
||||
|
||||
*(line_ndx + igap + 12) = vgap / 3 + 3;
|
||||
*(line_ndx + igap + 13) = vgap / 3 + 4;
|
||||
|
||||
*(line_ndx + igap + 14) = vgap / 3 + 4;
|
||||
*(line_ndx + igap + 15) = vgap / 3 + 1;
|
||||
|
||||
|
||||
*(plan_ndx + 0) = vgap / 3 + 0;
|
||||
*(plan_ndx + 1) = vgap / 3 + 1;
|
||||
*(plan_ndx + 2) = vgap / 3 + 2;
|
||||
|
||||
*(plan_ndx + 3) = vgap / 3 + 0;
|
||||
*(plan_ndx + 4) = vgap / 3 + 1;
|
||||
*(plan_ndx + 5) = vgap / 3 + 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,362 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: OpenGL utils header
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
* Copyleft (something) ( ;- )) Isn't that fun ?! ----------------,cbF@^@ââ63-OPM,FJ&_(_((T^RQJn||lpv)=à)o -----------------------------------------------------
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//#pragma once
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#include <glib-2.0/glib.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../../include/base.h"
|
||||
#include "../../include/ui.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/buffers.h"
|
||||
#include "../../include/space_2D.h"
|
||||
#include "../../include/space_3D.h"
|
||||
#include "../../include/arrow_2D.h"
|
||||
#include "../../include/arrow_3D.h"
|
||||
|
||||
#define A 0
|
||||
int graphics_compute_lines(int line_indices_nb,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx, int lines_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb)
|
||||
{
|
||||
/// struct gl_area_entry *entry;
|
||||
/// GLuint vao, vertex_buffer, color_buffer;
|
||||
int vgap = 0, igap = 0, pgap = 0, cgap = 0;
|
||||
|
||||
/// entry = find_entry_from_ptr(gl_area);
|
||||
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21}; < from model.xml
|
||||
dim = 1;
|
||||
state_size = 7; // 2 < state_size < 32
|
||||
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
|
||||
|
||||
vertex_nb = (state_size + 1) * 6 + arrows_nb * 9;
|
||||
vertex_nb = (state_size + 1) * 12 + arrows_nb * 15;
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
// lines_nb = (2 + state_size) + (arrows_nb * 3); // cas 2D
|
||||
lines_nb = (4 + state_size * 4) + (arrows_nb * 8) + 4; // + 4; pour les 4 diagonales (29/6/2023 pour voir)
|
||||
//// plans_nb = 8; //(4 + state_size * 4) + (arrows_nb * 8) + 2; // bhuingfyunfyuguinlgi svbysbubsyu qvyqytqujtvcttcef
|
||||
|
||||
line_indices_nb = lines_nb * 2;
|
||||
|
||||
printf("Initialization of buffers with %u line_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
line_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
|
||||
// g_malloc
|
||||
// vertex_base = g_malloc0(vertex_nb * sizeof(GLfloat) * 2);
|
||||
// color_base = g_malloc0(colors_nb * sizeof(GLfloat) * 2);
|
||||
// line_ndx = g_malloc0(lines_nb * 2 * sizeof(GLubyte) * 2);
|
||||
//// plan_ndx = g_malloc0(plans_nb * 3 * sizeof(GLubyte) * 2);
|
||||
|
||||
assert(state_size * 6 < vertex_nb); assert(state_size * 6 + 5 < vertex_nb);
|
||||
// compute_space_2D(state_size, vertex_base, line_ndx);
|
||||
// vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
|
||||
*(line_ndx + state_size * 2 + 6 + 4) = 0; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + state_size * 2 + 6 + 5) = 3;
|
||||
*(line_ndx + state_size * 2 + 6 + 6) = 1;
|
||||
*(line_ndx + state_size * 2 + 6 + 7) = 2;
|
||||
|
||||
for (int k = 0; k < state_size; k++){
|
||||
assert(k * 12 < vertex_nb); assert(k * 12 + 11 < vertex_nb);
|
||||
assert(k * 12 < colors_nb); assert(k * 12 + 11 < colors_nb);
|
||||
assert(k + 8 < line_indices_nb); assert(k + 16 < line_indices_nb);
|
||||
}
|
||||
|
||||
compute_space_3D(state_size, vertex_base, color_base, line_ndx,
|
||||
0,0); // patch provisoire
|
||||
// pref_mark_unit_space_zero, dgap){
|
||||
vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 0, 0, 0); */
|
||||
/* // if (A) printf("compute_arrow_2D vgap = %d vertex_nb = %d\n", vgap, vertex_nb); */
|
||||
/* // if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\ */
|
||||
/* // x, site, center, tip, base); // vgap=%d igap=%d */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 3, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb);
|
||||
assert(igap < line_indices_nb); assert(igap + 5 < line_indices_nb);
|
||||
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 0, 0, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 1, 2, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 0, 3, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
|
||||
compute_arrow_3D(state_size,
|
||||
vertex_base, color_base,
|
||||
line_ndx, 0, // plan_ndx,
|
||||
vgap, igap, cgap,
|
||||
1, 1, 3, 0, 0);
|
||||
vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
|
||||
return line_indices_nb;
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/// glGenBuffers(1, &vertex_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, vertex_nb * sizeof(vertex_base[0]), vertex_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
|
||||
// colors
|
||||
/// glGenBuffers(1, &color_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, colors_nb * sizeof(color_base), color_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// We only use one VAO, so we always keep it bound
|
||||
/// glGenVertexArrays(1, &vao);
|
||||
/// glBindVertexArray(vao);
|
||||
|
||||
/// if(entry != NULL) {
|
||||
/// entry->vao = vao;
|
||||
/// entry->position_buffer = vertex_buffer;
|
||||
/// entry->color_buffer = color_buffer;
|
||||
/// }
|
||||
}
|
||||
|
||||
#define A 0
|
||||
int graphics_compute_plans(int plan_indices_nb,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *plan_ndx, int plans_nb,
|
||||
int dim, int state_size,
|
||||
int vertex_nb,
|
||||
int colors_nb,
|
||||
int arrows_nb)
|
||||
{
|
||||
/// int line_indices_nb = 0; // AD HOC !
|
||||
/// struct gl_area_entry *entry;
|
||||
/// GLuint vao, vertex_buffer, color_buffer;
|
||||
int vgap = 0, igap = 0, pgap = 0, cgap = 0;
|
||||
|
||||
/// entry = find_entry_from_ptr(gl_area);
|
||||
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21}; < from model.xml
|
||||
dim = 1;
|
||||
state_size = 7; // 2 < state_size < 32
|
||||
arrows_nb = 4; // assert : leur emplacement doit être fonction de state_size
|
||||
|
||||
vertex_nb = (state_size + 1) * 6 + arrows_nb * 9;
|
||||
vertex_nb = (state_size + 1) * 12 + arrows_nb * 15;
|
||||
colors_nb = (state_size + 1) * 12 + arrows_nb * 0; // TODO
|
||||
// lines_nb = (2 + state_size) + (arrows_nb * 3); // cas 2D
|
||||
//// lines_nb = (4 + state_size * 4) + (arrows_nb * 8) + 2; // + 2; pour les 2 diagonales
|
||||
plans_nb = 8; //(4 + state_size * 4) + (arrows_nb * 8) + 2; // bhuingfyunfyuguinlgi svbysbubsyu qvyqytqujtvcttcef
|
||||
|
||||
//// plan_indices_nb = plans_nb * 3;
|
||||
|
||||
printf("Initialization of buffers with %u plan_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
plan_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
|
||||
// g_malloc
|
||||
//// vertex_base = g_malloc0(vertex_nb * sizeof(GLfloat) * 2);
|
||||
//// color_base = g_malloc0(colors_nb * sizeof(GLfloat) * 2);
|
||||
//// line_ndx = g_malloc0(lines_nb * 2 * sizeof(GLubyte) * 2);
|
||||
plan_ndx = g_malloc0(plans_nb * 3 * sizeof(GLubyte) * 2);
|
||||
|
||||
assert(state_size * 6 < vertex_nb); assert(state_size * 6 + 5 < vertex_nb);
|
||||
// compute_space_2D(state_size, vertex_base, line_ndx);
|
||||
// vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
|
||||
/* *(line_ndx + state_size * 2 + 6 + 4) = 0; // diagonales pour marquer la case zéro */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 5) = 3; */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 6) = 1; */
|
||||
/* *(line_ndx + state_size * 2 + 6 + 7) = 2; */
|
||||
|
||||
for (int k = 0; k < state_size; k++){
|
||||
assert(k * 12 < vertex_nb); assert(k * 12 + 11 < vertex_nb);
|
||||
assert(k * 12 < colors_nb); assert(k * 12 + 11 < colors_nb);
|
||||
// assert(k + 8 < line_indices_nb); assert(k + 16 < line_indices_nb);
|
||||
|
||||
compute_space_3D(state_size, vertex_base, color_base, plan_ndx,
|
||||
0,0); // patch provisoire
|
||||
//pref_mark_unit_space_zero, dgap){
|
||||
|
||||
vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 0, 0, 0); */
|
||||
/* // if (A) printf("compute_arrow_2D vgap = %d vertex_nb = %d\n", vgap, vertex_nb); */
|
||||
/* // if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\ */
|
||||
/* // x, site, center, tip, base); // vgap=%d igap=%d */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 0, 3, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb); */
|
||||
/* assert(igap < entry->line_indices_nb); assert(igap + 5 < entry->line_indices_nb); */
|
||||
/* compute_arrow_2D(state_size, vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, vgap, igap, cgap, 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
|
||||
assert(vgap < vertex_nb); assert(vgap + 9 < vertex_nb);
|
||||
// assert(igap < line_indices_nb); assert(igap + 5 < line_indices_nb);
|
||||
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, 0, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, 3, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, 0, // plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, 3, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
return plan_indices_nb;
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 0, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/* compute_arrow_3D(state_size, */
|
||||
/* vertex_base, color_base, */
|
||||
/* line_ndx, plan_ndx, */
|
||||
/* vgap, igap, cgap, */
|
||||
/* 1, 1, state_size - 2, 0, 0); */
|
||||
/* vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
/// glGenBuffers(1, &vertex_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, vertex_nb * sizeof(vertex_base[0]), vertex_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
|
||||
// colors
|
||||
/// glGenBuffers(1, &color_buffer);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
||||
/// glBufferData(GL_ARRAY_BUFFER, colors_nb * sizeof(color_base), color_base, GL_STATIC_DRAW);
|
||||
/// glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// We only use one VAO, so we always keep it bound
|
||||
/// glGenVertexArrays(1, &vao);
|
||||
/// glBindVertexArray(vao);
|
||||
|
||||
/// if(entry != NULL) {
|
||||
/// entry->vao = vao;
|
||||
/// entry->position_buffer = vertex_buffer;
|
||||
/// entry->color_buffer = color_buffer;
|
||||
/// }
|
||||
}
|
||||
}
|
|
@ -39,10 +39,11 @@
|
|||
#include "../../include/base.h"
|
||||
#include "../../include/ui.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/space_2D.h"
|
||||
#include "../../include/space_3D.h"
|
||||
#include "../../include/arrow_2D.h"
|
||||
#include "../../include/arrow_3D.h"
|
||||
#include "../../include/buffers.h"
|
||||
//#include "../../include/space_2D.h"
|
||||
//#include "../../include/space_3D.h"
|
||||
//#include "../../include/arrow_2D.h"
|
||||
//#include "../../include/arrow_3D.h"
|
||||
|
||||
#define VERTEX_SHADER_FILE "src/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/shaders/shader.frag"
|
||||
|
@ -502,6 +503,9 @@ bool pref_background_color = 0; // don't know yet...
|
|||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// TODO Tester (presque) toutes les combinaisons possibles de ces variables !!!
|
||||
// NB mark_unit_space_first & last m'auront surtout servi à debuguer (> à oublier)
|
||||
|
||||
static void get_model_data_and_user_preferences(){
|
||||
// The model data (arrows) to use ( from model.xml)
|
||||
// { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 };
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#define V 1
|
||||
#define I 0
|
||||
#define EDGE 0.999999
|
||||
bool compute_space_2D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last)
|
||||
{
|
||||
|
||||
float x = 0;
|
||||
// for (int k = 0; k < state_size + 1; k++) <=> + 1
|
||||
// car on passe du nombre de cases = (n)
|
||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||
|
||||
if (V) printf("vertices ");
|
||||
for (int k = 0; k < state_size; k++){ // barres verticales
|
||||
//
|
||||
x = ((state_size % 2) * (state_size / 2 - k)
|
||||
+ (state_size % 2 - 1) * (k + 0.5f - state_size / 2)) / state_size * 2 * EDGE;
|
||||
|
||||
if (V) printf("[%1.1f] ", x);
|
||||
|
||||
*(vertex_base + k * 6 + 0) = - x;
|
||||
*(vertex_base + k * 6 + 1) = 1.0f / state_size;
|
||||
*(vertex_base + k * 6 + 2) = 0.0f;
|
||||
|
||||
*(vertex_base + k * 6 + 3) = - x;
|
||||
*(vertex_base + k * 6 + 4) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 6 + 5) = 0.0f;
|
||||
|
||||
*(color_base + k * 6 + 0) = 1;
|
||||
*(color_base + k * 6 + 1) = 0;
|
||||
*(color_base + k * 6 + 2) = 0;
|
||||
|
||||
*(color_base + k * 6 + 3) = 1;
|
||||
*(color_base + k * 6 + 4) = 1;
|
||||
*(color_base + k * 6 + 5) = 0;
|
||||
}
|
||||
|
||||
*(color_base + 0) = 0;
|
||||
*(color_base + 1) = 0;
|
||||
*(color_base + 2) = 0;
|
||||
|
||||
*(color_base + 3) = 1;
|
||||
*(color_base + 4) = 1;
|
||||
*(color_base + 5) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 6 + 0) = 1;
|
||||
*(color_base + (state_size - 1) * 6 + 1) = 1;
|
||||
*(color_base + (state_size - 1) * 6 + 2) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 6 + 3) = 0;
|
||||
*(color_base + (state_size - 1) * 6 + 4) = 0;
|
||||
*(color_base + (state_size - 1) * 6 + 5) = 0;
|
||||
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
*(line_ndx + 0) = 0;
|
||||
*(line_ndx + 1) = state_size * 2 - 2; // barre horizontale du bas
|
||||
|
||||
*(line_ndx + 2) = 1;
|
||||
*(line_ndx + 3) = state_size * 2 - 1; // barre horizontale du haut
|
||||
|
||||
for (int k = 0; k < state_size * 2; k++) *(line_ndx + k + 4) = k;
|
||||
|
||||
if (I) printf("line_ndx (%d - state_size(0)) x (%d - state_size(1)) ", 0, 1);
|
||||
|
||||
for (int v = 0; v < state_size + 2; v++)
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
|
||||
int dgap = 0;
|
||||
|
||||
if (pref_mark_unit_space_first) { // diagonales to mark first space unit
|
||||
dgap +=4;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 0) = 0;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 1) = 3;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 2) = 1;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 3) = 2;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_last) { // diagonales to mark last space unit
|
||||
dgap +=4;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 0) = (state_size - 2) * 2 + 0;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 1) = (state_size - 2) * 2 + 3;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 2) = (state_size - 2) * 2 + 1;
|
||||
*(line_ndx + state_size * 2 + 6 + dgap + 3) = (state_size - 2) * 2 + 2;
|
||||
}
|
||||
|
||||
if (I) printf(" n = 4 + (%d x 2)\n", state_size + 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* Copyright (C) 2023 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#define V 1
|
||||
#define I 0
|
||||
#define EDGE 0.999999
|
||||
|
||||
bool compute_space_3D(int state_size,
|
||||
GLfloat *vertex_base, GLfloat *color_base,
|
||||
GLubyte *line_ndx,
|
||||
bool pref_mark_unit_space_first,
|
||||
bool pref_mark_unit_space_last)
|
||||
{
|
||||
|
||||
float x = 0;
|
||||
// for (int k = 0; k < state_size + 1; k++) <=> + 1 car
|
||||
// on passe du nombre de cases = (n)
|
||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||
|
||||
if (V) printf("vertices ");
|
||||
for (int k = 0; k < state_size; k++){ // barres verticales
|
||||
//
|
||||
x = ((state_size % 2) * (state_size / 2 - k)
|
||||
+ (state_size % 2 - 1) * (k + 0.5f - state_size / 2)) / state_size * 2 * EDGE;
|
||||
|
||||
if (V) printf("[%1.1f] ", x);
|
||||
|
||||
*(vertex_base + k * 12 + 0) = - x;
|
||||
*(vertex_base + k * 12 + 1) = 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 2) = 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 3) = - x;
|
||||
*(vertex_base + k * 12 + 4) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 5) = - 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 6) = - x;
|
||||
*(vertex_base + k * 12 + 7) = 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 8) = - 1.0f / state_size;
|
||||
|
||||
*(vertex_base + k * 12 + 9) = - x;
|
||||
*(vertex_base + k * 12 + 10) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 11) = 1.0f / state_size;
|
||||
|
||||
*(color_base + k * 12 + 0) = 1; // 1 - (k / state_size);
|
||||
*(color_base + k * 12 + 1) = 0;
|
||||
*(color_base + k * 12 + 2) = 0;
|
||||
|
||||
*(color_base + k * 12 + 3) = 0.2f;
|
||||
*(color_base + k * 12 + 4) = 1;
|
||||
*(color_base + k * 12 + 5) = 0;
|
||||
|
||||
*(color_base + k * 12 + 6) = 1;
|
||||
*(color_base + k * 12 + 7) = 1;
|
||||
*(color_base + k * 12 + 8) = 0;
|
||||
|
||||
*(color_base + k * 12 + 9) = 0;
|
||||
*(color_base + k * 12 + 10) = 0;
|
||||
*(color_base + k * 12 + 11) = 1;
|
||||
}
|
||||
|
||||
*(color_base + 0) = 0;
|
||||
*(color_base + 1) = 0;
|
||||
*(color_base + 2) = 0;
|
||||
|
||||
*(color_base + 3) = 1;
|
||||
*(color_base + 4) = 1;
|
||||
*(color_base + 5) = 1;
|
||||
|
||||
*(color_base + 6) = 0;
|
||||
*(color_base + 7) = 0;
|
||||
*(color_base + 8) = 0;
|
||||
|
||||
*(color_base + 9) = 1;
|
||||
*(color_base + 10) = 1;
|
||||
*(color_base + 11) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 0) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 1) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 2) = 1;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 3) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 4) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 5) = 0;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 6) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 7) = 0;
|
||||
*(color_base + (state_size - 1) * 12 + 8) = 0;
|
||||
|
||||
*(color_base + (state_size - 1) * 12 + 9) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 10) = 1;
|
||||
*(color_base + (state_size - 1) * 12 + 11) = 1;
|
||||
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
*(line_ndx + 4) = 0;
|
||||
*(line_ndx + 5) = state_size * 4 - 4; // barre horizontale du bas arr
|
||||
|
||||
*(line_ndx + 6) = 1;
|
||||
*(line_ndx + 7) = state_size * 4 - 3; // barre horizontale du haut arr
|
||||
|
||||
*(line_ndx + 0) = 2;
|
||||
*(line_ndx + 1) = state_size * 4 - 2; // barre horizontale du bas av
|
||||
|
||||
*(line_ndx + 2) = 3;
|
||||
*(line_ndx + 3) = state_size * 4 - 1; // barre horizontale du haut av
|
||||
|
||||
|
||||
/* *(plan_ndx + 0) = 0; */
|
||||
/* *(plan_ndx + 1) = 1; */
|
||||
/* *(plan_ndx + 2) = 2; */
|
||||
|
||||
/* *(plan_ndx + 3) = 0; */
|
||||
/* *(plan_ndx + 4) = 1; */
|
||||
/* *(plan_ndx + 5) = 3; */
|
||||
|
||||
|
||||
for (int k = 8; k <= state_size * 8; k += 8){ // for (int k = 8; k < state_size * 8; k += 8){
|
||||
|
||||
|
||||
*(line_ndx + k + 0) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 1) = k / 2 - 2; // + 2;
|
||||
|
||||
*(line_ndx + k + 2) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 3) = k / 2 - 1; // + 3;
|
||||
|
||||
*(line_ndx + k + 4) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 5) = k / 2 - 1; // + 3;
|
||||
|
||||
*(line_ndx + k + 6) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 7) = k / 2 - 2; // + 2;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_first) {
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 4) = 0 + 0; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + (2 + state_size) * 8 - 3) = 0 + 1;
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + (2 + state_size) * 8 - 1) = 0 + 3;
|
||||
}
|
||||
|
||||
if (pref_mark_unit_space_last) {
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 8) = (state_size - 1) * 4 + 0; // diagonales pour marquer la case finale
|
||||
*(line_ndx + (2 + state_size) * 8 - 7) = (state_size - 1) * 4 + 1;
|
||||
|
||||
*(line_ndx + (2 + state_size) * 8 - 6) = (state_size - 1) * 4 + 2; // diagonales pour marquer la case finale
|
||||
*(line_ndx + (2 + state_size) * 8 - 5) = (state_size - 1) * 4 + 3;
|
||||
}
|
||||
|
||||
if (I) printf("line_ndx ");
|
||||
for (int v = 0; v < state_size + 2; v++) {
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
}
|
||||
|
||||
if (I) printf("pref_mark_unit_space_first = %d ", pref_mark_unit_space_first);
|
||||
if (I) printf("pref_mark_unit_space_last = %d ", pref_mark_unit_space_last);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue