WIP: cleaning (widgets, graphics, shaders)
This commit is contained in:
parent
0487a15b65
commit
6209ad9a09
14
(notes)
14
(notes)
|
@ -15,14 +15,14 @@ pour éditer : sed
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
contain.c: (136) gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
|
contain.c: (136) gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
|
||||||
|
|
||||||
graph_area.h: (177) static inline GLuint create_shader(const int stack_id, int type, const char *src) {...}
|
graphics.h: (177) static inline GLuint create_shader(const int stack_id, int type, const char *src) {...}
|
||||||
|
|
||||||
graph_area.c: (153) graphics_draw (stack_index[i].stack_id);
|
graphics.c: (153) graphics_draw (stack_index[i].stack_id);
|
||||||
|
|
||||||
graph_area.c: (233) g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label);
|
graphics.c: (233) g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label);
|
||||||
graph_area.c: (289) g_signal_connect(GTK_GL_AREA(gl_area), "render", G_CALLBACK(on_glarea_render), NULL);
|
graphics.c: (289) g_signal_connect(GTK_GL_AREA(gl_area), "render", G_CALLBACK(on_glarea_render), NULL);
|
||||||
graph_area.c: g_signal_connect(gl_area, "realize", G_CALLBACK(on_glarea_realize), NULL);
|
graphics.c: g_signal_connect(gl_area, "realize", G_CALLBACK(on_glarea_realize), NULL);
|
||||||
graph_area.c: g_signal_connect(gl_area, "unrealize", G_CALLBACK(on_glarea_unrealize), NULL);
|
graphics.c: g_signal_connect(gl_area, "unrealize", G_CALLBACK(on_glarea_unrealize), NULL);
|
||||||
|
|
||||||
graph_stack.c: (149) if (!graphics_init_shaders(cur_id)) return -1;
|
graph_stack.c: (149) if (!graphics_init_shaders(cur_id)) return -1;
|
||||||
graph_stack.c: (153) graphics_init_buffers(cur_id);
|
graph_stack.c: (153) graphics_init_buffers(cur_id);
|
||||||
|
@ -36,7 +36,7 @@ graph_stack.c: (316) stack->arrows_nb = set_arrow (stack_id, stack->arrows_nb
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
contain is called (#included) in : callback, display, tree, graph_stack, graph_area, init,
|
contain is called (#included) in : callback, display, tree, graph_stack, graphics, init,
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ int get_STATE_RULES_DATA ();
|
||||||
/* S P A C E S T R U C T U R E S */
|
/* S P A C E S T R U C T U R E S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // < used by graph_area.h
|
enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // < used by graphics.h
|
||||||
|
|
||||||
struct arrow_t { uint load; uint site; uint x; uint y; uint z; };
|
struct arrow_t { uint load; uint site; uint x; uint y; uint z; };
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window);
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/******************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* E coli by David S. Goodsell (2009) */
|
|
||||||
/* --- */
|
|
||||||
/* Let this freeze frame guide us towards the model */
|
|
||||||
/* that alone can account for the phenomenon ! */
|
|
||||||
/* */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
GtkWidget *get_text_view();
|
|
||||||
GtkFrame *get_frame_with_label();
|
|
||||||
GtkWidget *get_rules_page_new();
|
|
||||||
GtkBox *get_rules_user_tree_new();
|
|
||||||
|
|
||||||
GtkWidget *get_image_ALL_SPACE();
|
|
||||||
GtkWidget *get_image_GLUTAMATE();
|
|
||||||
GtkWidget *get_image_GLUTAMINE();
|
|
||||||
GtkWidget *get_image_HISTIDINE();
|
|
||||||
GtkWidget *get_image_HISTAMINE();
|
|
||||||
GtkWidget *get_image_PHENYLALANINE();
|
|
||||||
GtkWidget *get_image_DOPAMINE();
|
|
||||||
GtkWidget *get_image_ATP();
|
|
||||||
GtkWidget *get_image_AMP();
|
|
||||||
GtkWidget *get_rules_tree_hpaned_new();
|
|
||||||
|
|
||||||
GtkProgressBar *get_ELAPSED_TIME_ProgressBar();
|
|
||||||
GtkBox *get_RUN_STOP_box();
|
|
||||||
GtkBox *get_ZOOM_box();
|
|
||||||
GtkBox *get_edit_TOOL_box();
|
|
||||||
GtkBox *get_XYZ_box();
|
|
||||||
GtkWidget *get_OBJECTS_and_SITUATIONS();
|
|
||||||
GtkBox *get_ELAPSED_TIME_box();
|
|
||||||
|
|
||||||
GtkButton *get_btt_run_xor_edit();
|
|
||||||
|
|
||||||
void window_bar(GtkWindow *window, char *title);
|
|
||||||
|
|
||||||
|
|
|
@ -1,328 +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>
|
|
||||||
* 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 <gtk-4.0/gtk/gtk.h>
|
|
||||||
#include <glib-2.0/glib.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <epoxy/gl.h>
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#include <cglm/cglm.h>
|
|
||||||
|
|
||||||
#include "base.h"
|
|
||||||
//#include "draw.c"
|
|
||||||
|
|
||||||
// #define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
|
||||||
// #define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
|
||||||
#define VERTEX_SHADER_FILE "shader.vert"
|
|
||||||
#define FRAG_SHADER_FILE "shader.frag"
|
|
||||||
#define GL_TARGET_MAJOR_VERSION 0
|
|
||||||
#define GL_TARGET_MINOR_VERSION 4
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Structure describing a gl_area and its parameters, used to create a table
|
|
||||||
* of Gem-graph client current gl_areas
|
|
||||||
*/
|
|
||||||
struct graphic_stack_t {
|
|
||||||
|
|
||||||
int id;
|
|
||||||
int mode;
|
|
||||||
|
|
||||||
float rotation_angles[N_AXIS]; // Rotation angles on each axis
|
|
||||||
|
|
||||||
GLuint vao; // init_buffers
|
|
||||||
GLuint position_buffer; // shutdown, draw
|
|
||||||
GLuint color_buffer; // shutdown, draw
|
|
||||||
GLuint program; // shutdown, init_shaders, draw
|
|
||||||
GLuint m; // init_shaders, draw
|
|
||||||
GLuint v; // init_shaders, draw
|
|
||||||
GLuint p; // init_shaders, draw
|
|
||||||
|
|
||||||
struct arrow_t *arrows_ptr;
|
|
||||||
long arrows_nb;
|
|
||||||
|
|
||||||
GLfloat *buffer_vertex_origin;
|
|
||||||
GLfloat *buffer_colors_origin;
|
|
||||||
GLuint *buffer_lines_origin;
|
|
||||||
GLuint *buffer_plans_origin;
|
|
||||||
|
|
||||||
long buffer_vertex_size;
|
|
||||||
long buffer_colors_size;
|
|
||||||
long buffer_lines_size;
|
|
||||||
long buffer_plans_size;
|
|
||||||
|
|
||||||
long buffer_vertex_0_arrow;
|
|
||||||
long buffer_colors_0_arrow;
|
|
||||||
long buffer_lines_0_arrow;
|
|
||||||
long buffer_plans_0_arrow;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool ui_render_stack(GtkWidget *container_widget);
|
|
||||||
|
|
||||||
bool ui_setup_glarea(int target_mode, GtkWidget *target_widget);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
|
||||||
*/
|
|
||||||
extern struct graphic_stack_t *graphic_stack;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initializes a gl_area
|
|
||||||
*
|
|
||||||
* @param gl_area, ptr to the gl_area widget
|
|
||||||
*
|
|
||||||
* @return true if initialized
|
|
||||||
*/
|
|
||||||
int graphics_init(void *error_buffer);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draws the current buffer to a gl_area
|
|
||||||
*
|
|
||||||
* @param gl_area, ptr to the gl_area widget
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_draw(const int stack_id);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Shutdowns a gl_area
|
|
||||||
*
|
|
||||||
* @param gl_area, ptr to the gl_area widget
|
|
||||||
*
|
|
||||||
* @return true if success
|
|
||||||
*/
|
|
||||||
bool graphics_shutdown(const int stack_id, void *error_buffer);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initializes the shaders of a gl_area and link them to a program
|
|
||||||
*
|
|
||||||
* @param gl_area, ptr to the gl_area widget
|
|
||||||
*
|
|
||||||
* @return true if initialized
|
|
||||||
*/
|
|
||||||
bool graphics_init_shaders(const int stack_id);
|
|
||||||
|
|
||||||
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer);
|
|
||||||
bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer);
|
|
||||||
bool ui_update_axis_stack(GtkWidget *container_widget, int axis, int value);
|
|
||||||
|
|
||||||
/* Initializes the buffer of a gl_area
|
|
||||||
* Calls according to the user preferences
|
|
||||||
* @param gl_area, ptr to the gl_area widget
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_init_buffers(const int stack_id);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draws a vertex (x, y, z)
|
|
||||||
* if (console) prints (x, y, z) values to console
|
|
||||||
*
|
|
||||||
* @param GLfloat x, GLfloat y, GLfloat z
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_draw_vertex (const int stack_id,
|
|
||||||
GLfloat x,
|
|
||||||
GLfloat y,
|
|
||||||
GLfloat z);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draws the color (r, g, b) associated to a vertex
|
|
||||||
* if (console) prints (r, g, b) values to console
|
|
||||||
*
|
|
||||||
* @param GLfloat r, GLfloat g, GLfloat b
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_draw_color (const int stack_id, GLfloat r, GLfloat g, GLfloat b);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Writes values to describe a line from a to b into the line buffer
|
|
||||||
*
|
|
||||||
* @param coords GLuint (a,b)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_draw_line (const int stack_id, GLuint a, GLuint b);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
|
||||||
*
|
|
||||||
* @param coords GLuint (a,b,c)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_draw_plan (const int stack_id, GLuint a, GLuint b, GLuint c);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Created and compile a shader
|
|
||||||
*
|
|
||||||
* @param type, shader type
|
|
||||||
* src, source code of shader
|
|
||||||
*
|
|
||||||
* @return shader id
|
|
||||||
*/
|
|
||||||
static inline GLuint create_shader(const int stack_id, int type, const char *src)
|
|
||||||
{
|
|
||||||
GLuint shader;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
shader = glCreateShader(type);
|
|
||||||
glShaderSource(shader, 1, &src, NULL);
|
|
||||||
glCompileShader(shader);
|
|
||||||
|
|
||||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
|
||||||
if(status == GL_FALSE) {
|
|
||||||
int log_len;
|
|
||||||
char *buffer;
|
|
||||||
|
|
||||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len);
|
|
||||||
|
|
||||||
buffer = g_malloc(log_len + 1);
|
|
||||||
assert (buffer);
|
|
||||||
glGetShaderInfoLog(shader, log_len, NULL, buffer);
|
|
||||||
|
|
||||||
g_warning("Compile failure in %s shader:\n%s",
|
|
||||||
type == GL_VERTEX_SHADER ? "vertex" : "fragment",
|
|
||||||
buffer);
|
|
||||||
|
|
||||||
g_free(buffer);
|
|
||||||
|
|
||||||
glDeleteShader(shader);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return shader;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void print_stack(int stack_id)
|
|
||||||
{
|
|
||||||
static int n = 0;
|
|
||||||
|
|
||||||
printf("\n[n=%d]***************", n);
|
|
||||||
|
|
||||||
printf("id = %d\tmode = %d\n",
|
|
||||||
graphic_stack[stack_id].id,
|
|
||||||
graphic_stack[stack_id].mode);
|
|
||||||
|
|
||||||
printf("rotation_angles = ");
|
|
||||||
for (int i = 0; i < N_AXIS; i++) {
|
|
||||||
printf("%f\t", graphic_stack[stack_id].rotation_angles[i]); // Rotation angles on each axis
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
printf("vao = %d\n", graphic_stack[stack_id].vao);
|
|
||||||
printf("position_buffer = %d\n", graphic_stack[stack_id].position_buffer);
|
|
||||||
printf("color_buffer = %d\n", graphic_stack[stack_id].color_buffer);
|
|
||||||
printf("program = %d\n", graphic_stack[stack_id].program);
|
|
||||||
printf("m = %d\n", graphic_stack[stack_id].m);
|
|
||||||
printf("v = %d\n", graphic_stack[stack_id].v);
|
|
||||||
printf("p = %d\n", graphic_stack[stack_id].p);
|
|
||||||
|
|
||||||
printf("arrows_ptr = %p\n", graphic_stack[stack_id].arrows_ptr);
|
|
||||||
printf("arrows_nb = %ld\n", graphic_stack[stack_id].arrows_nb);
|
|
||||||
|
|
||||||
printf("buffer_vertex_origin = %p\n", graphic_stack[stack_id].buffer_vertex_origin);
|
|
||||||
printf("buffer_colors_origin = %p\n", graphic_stack[stack_id].buffer_colors_origin);
|
|
||||||
printf("buffer_lines_origin = %p\n", graphic_stack[stack_id].buffer_lines_origin);
|
|
||||||
printf("buffer_plans_origin = %p\n", graphic_stack[stack_id].buffer_plans_origin);
|
|
||||||
|
|
||||||
printf("buffer_vertex_size = %ld\n", graphic_stack[stack_id].buffer_vertex_size);
|
|
||||||
printf("buffer_colors_size = %ld\n", graphic_stack[stack_id].buffer_colors_size);
|
|
||||||
printf("buffer_lines_size = %ld\n", graphic_stack[stack_id].buffer_lines_size);
|
|
||||||
printf("buffer_plans_size = %ld\n", graphic_stack[stack_id].buffer_plans_size);
|
|
||||||
|
|
||||||
printf("buffer_vertex_0_arrow = %ld\n", graphic_stack[stack_id].buffer_vertex_0_arrow);
|
|
||||||
printf("buffer_colors_0_arrow = %ld\n", graphic_stack[stack_id].buffer_colors_0_arrow);
|
|
||||||
printf("buffer_lines_0_arrow = %ld\n", graphic_stack[stack_id].buffer_lines_0_arrow);
|
|
||||||
printf("buffer_plans_0_arrow = %ld\n", graphic_stack[stack_id].buffer_plans_0_arrow);
|
|
||||||
|
|
||||||
printf("********************\n");
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void graphics_model_setup (const int stack_id);
|
|
||||||
|
|
||||||
int draw_one_arrow_vertex (const int stack_id,
|
|
||||||
int space_X,
|
|
||||||
int space_Y,
|
|
||||||
int space_Z,
|
|
||||||
int weight,
|
|
||||||
int site,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int z);
|
|
||||||
|
|
||||||
int draw_one_arrow_line(const int stack_id,
|
|
||||||
int offset_vertex);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Writes grid ridges to vertex and color buffers
|
|
||||||
*
|
|
||||||
* @param coords long (x,y,z), step_x, step_y, step_z
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
int draw_space_ridges_vertex (const int stack_id,
|
|
||||||
long offset_vertex,
|
|
||||||
long x,
|
|
||||||
long y,
|
|
||||||
long z);
|
|
||||||
|
|
||||||
int draw_space_ridges_lines (const int stack_id);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Writes grid lines on space faces
|
|
||||||
*
|
|
||||||
* @param coords long (x,y,z)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
long draw_grids_on_space_faces_vertex (const int stack_id,
|
|
||||||
long x,
|
|
||||||
long y,
|
|
||||||
long z);
|
|
||||||
|
|
||||||
long draw_grids_on_space_faces_lines (const int stack_id,
|
|
||||||
long offset_vertex,
|
|
||||||
long x,
|
|
||||||
long y,
|
|
||||||
long z);
|
|
||||||
|
|
||||||
int set_arrow (int stack_id,
|
|
||||||
int arrows_nb,
|
|
||||||
int space_X,
|
|
||||||
int space_Y,
|
|
||||||
int space_Z,
|
|
||||||
int requested_weight,
|
|
||||||
int site,
|
|
||||||
int arrow_x,
|
|
||||||
int arrow_y,
|
|
||||||
int arrow_z);
|
|
||||||
|
|
|
@ -32,11 +32,12 @@
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#include <cglm/cglm.h>
|
#include <cglm/cglm.h>
|
||||||
|
|
||||||
#define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
#define VERTEX_SHADER_FILE "src/shader.vert"
|
||||||
#define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
#define FRAG_SHADER_FILE "src/shader.frag"
|
||||||
#define GL_TARGET_MAJOR_VERSION 0
|
#define GL_TARGET_MAJOR_VERSION 0
|
||||||
#define GL_TARGET_MINOR_VERSION 4
|
#define GL_TARGET_MINOR_VERSION 4
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure describing a gl_area and its parameters, used to create a table
|
* Structure describing a gl_area and its parameters, used to create a table
|
||||||
* of Gem-graph client current gl_areas
|
* of Gem-graph client current gl_areas
|
||||||
|
@ -80,6 +81,14 @@ struct graphic_stack_t {
|
||||||
*/
|
*/
|
||||||
extern struct graphic_stack_t *graphic_stack;
|
extern struct graphic_stack_t *graphic_stack;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure describing a gl_area and its parameters, used to create a table
|
||||||
|
* of Gem-graph client current gl_areas
|
||||||
|
*/
|
||||||
|
bool ui_render_stack(GtkWidget *container_widget);
|
||||||
|
|
||||||
|
bool ui_setup_glarea(int target_mode, GtkWidget *target_widget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes a gl_area
|
* Initializes a gl_area
|
||||||
*
|
*
|
||||||
|
@ -96,7 +105,7 @@ int graphics_init(void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
//void graphics_draw(const int stack_id);
|
void graphics_draw(const int stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdowns a gl_area
|
* Shutdowns a gl_area
|
||||||
|
@ -116,6 +125,10 @@ bool graphics_shutdown(const int stack_id, void *error_buffer);
|
||||||
*/
|
*/
|
||||||
bool graphics_init_shaders(const int stack_id);
|
bool graphics_init_shaders(const int stack_id);
|
||||||
|
|
||||||
|
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer);
|
||||||
|
bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer);
|
||||||
|
bool ui_update_axis_stack(GtkWidget *container_widget, int axis, int value);
|
||||||
|
|
||||||
/* Initializes the buffer of a gl_area
|
/* Initializes the buffer of a gl_area
|
||||||
* Calls according to the user preferences
|
* Calls according to the user preferences
|
||||||
* @param gl_area, ptr to the gl_area widget
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
@ -253,6 +266,148 @@ static inline void print_stack(int stack_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void graphics_model_setup (const int stack_id);
|
||||||
|
|
||||||
|
int draw_one_arrow_vertex (const int stack_id,
|
||||||
|
int space_X,
|
||||||
|
int space_Y,
|
||||||
|
int space_Z,
|
||||||
|
int weight,
|
||||||
|
int site,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z);
|
||||||
|
|
||||||
|
int draw_one_arrow_line(const int stack_id,
|
||||||
|
int offset_vertex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes grid ridges to vertex and color buffers
|
||||||
|
*
|
||||||
|
* @param coords long (x,y,z), step_x, step_y, step_z
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
int draw_space_ridges_vertex (const int stack_id,
|
||||||
|
long offset_vertex,
|
||||||
|
long x,
|
||||||
|
long y,
|
||||||
|
long z);
|
||||||
|
|
||||||
|
int draw_space_ridges_lines (const int stack_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes grid lines on space faces
|
||||||
|
*
|
||||||
|
* @param coords long (x,y,z)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
long draw_grids_on_space_faces_vertex (const int stack_id,
|
||||||
|
long x,
|
||||||
|
long y,
|
||||||
|
long z);
|
||||||
|
|
||||||
|
long draw_grids_on_space_faces_lines (const int stack_id,
|
||||||
|
long offset_vertex,
|
||||||
|
long x,
|
||||||
|
long y,
|
||||||
|
long z);
|
||||||
|
|
||||||
|
int set_arrow (int stack_id,
|
||||||
|
int arrows_nb,
|
||||||
|
int space_X,
|
||||||
|
int space_Y,
|
||||||
|
int space_Z,
|
||||||
|
int requested_weight,
|
||||||
|
int site,
|
||||||
|
int arrow_x,
|
||||||
|
int arrow_y,
|
||||||
|
int arrow_z);
|
||||||
|
/*
|
||||||
|
* Initializes a gl_area
|
||||||
|
*
|
||||||
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
*
|
||||||
|
* @return true if initialized
|
||||||
|
*/
|
||||||
|
int graphics_init(void *error_buffer);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws the current buffer to a gl_area
|
||||||
|
*
|
||||||
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
//void graphics_draw(const int stack_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shutdowns a gl_area
|
||||||
|
*
|
||||||
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
*
|
||||||
|
* @return true if success
|
||||||
|
*/
|
||||||
|
bool graphics_shutdown(const int stack_id, void *error_buffer);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initializes the shaders of a gl_area and link them to a program
|
||||||
|
*
|
||||||
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
*
|
||||||
|
* @return true if initialized
|
||||||
|
*/
|
||||||
|
bool graphics_init_shaders(const int stack_id);
|
||||||
|
|
||||||
|
/* Initializes the buffer of a gl_area
|
||||||
|
* Calls according to the user preferences
|
||||||
|
* @param gl_area, ptr to the gl_area widget
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_init_buffers(const int stack_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws a vertex (x, y, z)
|
||||||
|
* if (console) prints (x, y, z) values to console
|
||||||
|
*
|
||||||
|
* @param GLfloat x, GLfloat y, GLfloat z
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_draw_vertex (const int stack_id,
|
||||||
|
GLfloat x,
|
||||||
|
GLfloat y,
|
||||||
|
GLfloat z);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws the color (r, g, b) associated to a vertex
|
||||||
|
* if (console) prints (r, g, b) values to console
|
||||||
|
*
|
||||||
|
* @param GLfloat r, GLfloat g, GLfloat b
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_draw_color (const int stack_id, GLfloat r, GLfloat g, GLfloat b);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes values to describe a line from a to b into the line buffer
|
||||||
|
*
|
||||||
|
* @param coords GLuint (a,b)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_draw_line (const int stack_id, GLuint a, GLuint b);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
||||||
|
*
|
||||||
|
* @param coords GLuint (a,b,c)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_draw_plan (const int stack_id, GLuint a, GLuint b, GLuint c);
|
||||||
|
|
||||||
void graphics_model_setup (const int stack_id);
|
void graphics_model_setup (const int stack_id);
|
||||||
|
|
||||||
int draw_one_arrow_vertex (const int stack_id,
|
int draw_one_arrow_vertex (const int stack_id,
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/******************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* E coli by David S. Goodsell (2009) */
|
|
||||||
/* --- */
|
|
||||||
/* Let this freeze frame guide us towards the model */
|
|
||||||
/* that alone can account for the phenomenon ! */
|
|
||||||
/* */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
#pragma once // < WTF !?
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <glib-2.0/glib.h>
|
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
|
||||||
|
|
||||||
//#include "cold.h"
|
|
||||||
#include "display.h"
|
|
||||||
#include "contain.h"
|
|
||||||
|
|
||||||
|
|
||||||
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
|
||||||
|
|
||||||
GtkScrolledWindow *get_user_rules_tree ();
|
|
||||||
void set_run_edit_mode(int prescribed_mode);
|
|
||||||
int get_run_edit_mode();
|
|
||||||
GListModel* get_user_tree_model (GObject *item, gpointer root);
|
|
||||||
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
|
|
||||||
GObject* object, gpointer user_data);
|
|
||||||
|
|
|
@ -37,8 +37,7 @@
|
||||||
#define H_IMAGE_LOCAL H / 16
|
#define H_IMAGE_LOCAL H / 16
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window);
|
void main_window_design (GtkWindow *main_window);
|
||||||
void set_check_button_active (GtkButton *button, int active);
|
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window);
|
||||||
void two_notebooks_in_two_panes (GtkWindow *window);
|
|
||||||
|
|
||||||
GtkFrame *get_frame_with_label();
|
GtkFrame *get_frame_with_label();
|
||||||
GtkWidget *get_selected_rules_vpaned_new();
|
GtkWidget *get_selected_rules_vpaned_new();
|
||||||
|
@ -48,3 +47,42 @@ GtkButton *get_GtkButton (char *btt_name);
|
||||||
GtkWidget *get_window_child_STATE();
|
GtkWidget *get_window_child_STATE();
|
||||||
GtkWidget *get_window_child_RULES();
|
GtkWidget *get_window_child_RULES();
|
||||||
GtkWidget *get_window_child_DATA();
|
GtkWidget *get_window_child_DATA();
|
||||||
|
|
||||||
|
GtkWidget *get_text_view();
|
||||||
|
GtkFrame *get_frame_with_label();
|
||||||
|
GtkWidget *get_rules_page_new();
|
||||||
|
GtkBox *get_rules_user_tree_new();
|
||||||
|
|
||||||
|
GtkWidget *get_image_ALL_SPACE();
|
||||||
|
GtkWidget *get_image_GLUTAMATE();
|
||||||
|
GtkWidget *get_image_GLUTAMINE();
|
||||||
|
GtkWidget *get_image_HISTIDINE();
|
||||||
|
GtkWidget *get_image_HISTAMINE();
|
||||||
|
GtkWidget *get_image_PHENYLALANINE();
|
||||||
|
GtkWidget *get_image_DOPAMINE();
|
||||||
|
GtkWidget *get_image_ATP();
|
||||||
|
GtkWidget *get_image_AMP();
|
||||||
|
GtkWidget *get_rules_tree_hpaned_new();
|
||||||
|
|
||||||
|
GtkProgressBar *get_ELAPSED_TIME_ProgressBar();
|
||||||
|
GtkBox *get_RUN_STOP_box();
|
||||||
|
GtkBox *get_ZOOM_box();
|
||||||
|
GtkBox *get_edit_TOOL_box();
|
||||||
|
GtkBox *get_XYZ_box();
|
||||||
|
GtkWidget *get_OBJECTS_and_SITUATIONS();
|
||||||
|
GtkBox *get_ELAPSED_TIME_box();
|
||||||
|
|
||||||
|
GtkButton *get_btt_run_xor_edit();
|
||||||
|
|
||||||
|
void window_bar(GtkWindow *window, char *title);
|
||||||
|
|
||||||
|
|
||||||
|
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
||||||
|
|
||||||
|
GtkScrolledWindow *get_user_rules_tree ();
|
||||||
|
void set_run_edit_mode(int prescribed_mode);
|
||||||
|
int get_run_edit_mode();
|
||||||
|
GListModel* get_user_tree_model (GObject *item, gpointer root);
|
||||||
|
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
|
||||||
|
GObject* object, gpointer user_data);
|
||||||
|
|
|
@ -26,15 +26,12 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
#include "../include/callback.h"
|
|
||||||
#include "../include/contain.h"
|
|
||||||
#include "../include/tree.h"
|
|
||||||
#include "../include/contain.h"
|
|
||||||
#include "../include/dialog.h"
|
|
||||||
#include "../include/texts.h"
|
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
|
#include "../include/callback.h"
|
||||||
|
#include "../include/widgets.h"
|
||||||
|
#include "../include/texts.h"
|
||||||
#include "../include/parsing.h"
|
#include "../include/parsing.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graphics.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <cglm/cglm.h>
|
#include <cglm/cglm.h>
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
//#include "../include/ui.h"
|
//#include "../include/ui.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graphics.h"
|
||||||
|
|
||||||
void graphics_draw_vertex (const int stack_id,
|
void graphics_draw_vertex (const int stack_id,
|
||||||
GLfloat x,
|
GLfloat x,
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
#include <glib-2.0/glib.h>
|
#include <glib-2.0/glib.h>
|
||||||
|
|
||||||
#include "../include/contain.h"
|
#include "../include/widgets.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graphics.h"
|
||||||
#include "../include/callback.h"
|
#include "../include/callback.h"
|
||||||
|
|
||||||
struct stack_index_t {
|
struct stack_index_t {
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../include/contain.h"
|
#include "../include/widgets.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graphics.h"
|
||||||
#include "../include/parsing.h"
|
#include "../include/parsing.h"
|
||||||
|
|
||||||
#define TEST 0
|
#define TEST 0
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
#include "../include/contain.h" // instead of "ui.h"
|
#include "../include/widgets.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graphics.h"
|
||||||
|
|
||||||
/* Initializes the buffer of a gl_area
|
/* Initializes the buffer of a gl_area
|
||||||
* Calls according to the user preferences
|
* Calls according to the user preferences
|
||||||
|
|
|
@ -40,7 +40,7 @@ int main (int argc, char **argv)
|
||||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
g_object_unref (app);
|
g_object_unref (app);
|
||||||
|
|
||||||
printf("\nTODO (2024-06-30) OpenGL see : contain.get_SPACE_VIEW_box()\
|
printf("\nTODO (2024-06-30) OpenGL see : widgets.get_SPACE_VIEW_box()\
|
||||||
\nline 138 > ui_setup_glarea (0, GTK_WIDGET (middle_box));\n\n");
|
\nline 138 > ui_setup_glarea (0, GTK_WIDGET (middle_box));\n\n");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "../include/contain.h"
|
#include "../include/widgets.h"
|
||||||
#include "../include/texts.h"
|
#include "../include/texts.h"
|
||||||
#include "../include/callback.h"
|
#include "../include/callback.h"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
#include "../include/graph_area.h"
|
|
||||||
#include "../include/callback.h"
|
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
#include "../include/display.h"
|
#include "../include/graphics.h"
|
||||||
#include "../include/tree.h"
|
#include "../include/callback.h"
|
||||||
|
#include "../include/widgets.h"
|
||||||
#include "../include/texts.h"
|
#include "../include/texts.h"
|
||||||
|
|
||||||
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
||||||
|
@ -230,7 +229,7 @@ void main_window_design (GtkWindow *main_window){
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *get_window_child_STATE() {
|
GtkWidget *get_window_child_STATE() {
|
||||||
if (0) printf("contain.get_window_child_STATE (line 235)\n");
|
if (0) printf("widgets.get_window_child_STATE (line 235)\n");
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
@ -242,7 +241,7 @@ GtkWidget *get_window_child_STATE() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_window_child_RULES(){
|
GtkWidget *get_window_child_RULES(){
|
||||||
if (0) printf("contain.get_window_child_RULES (line 246)\n");
|
if (0) printf("widgets.get_window_child_RULES (line 246)\n");
|
||||||
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
||||||
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
|
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
|
||||||
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");
|
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");
|
||||||
|
@ -254,7 +253,7 @@ GtkWidget *get_window_child_RULES(){
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_window_child_DATA (){
|
GtkWidget *get_window_child_DATA (){
|
||||||
if (0) printf("contain.get_window_child_DATA (line 259)\n");
|
if (0) printf("widgets.get_window_child_DATA (line 259)\n");
|
||||||
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32));
|
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32));
|
||||||
|
|
||||||
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------");
|
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------");
|
|
@ -1,8 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
#include "../include/contain.h"
|
#include "../include/widgets.h"
|
||||||
#include "../include/tree.h"
|
|
||||||
#include "../include/texts.h"
|
#include "../include/texts.h"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
Loading…
Reference in New Issue