Is OK. Avant restructuration. (découpage de graphics.c en "control_graphics.c" + space_2D.c + _3D.c + etc)
This commit is contained in:
parent
4dada5b292
commit
1c5f45d505
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gem-graph-model version="0.2.1">
|
||||
|
||||
<identity>
|
||||
<name>Test 21-03-2023</name>
|
||||
|
||||
<owner>J</owner>
|
||||
|
||||
<owner_id>J</owner_id>
|
||||
|
||||
<date>time_stamp</date>
|
||||
|
||||
<version>1.0</version>
|
||||
|
||||
<g_ref id="Cause" date="time_stamp" author="J" lang="en">Ref</g_ref>
|
||||
</identity>
|
||||
|
||||
<parameters id="texte" date="0" author="J">
|
||||
<simulation>
|
||||
<max_thread>0</max_thread>
|
||||
<max_cycles>9</max_cycles>
|
||||
|
||||
</simulation>
|
||||
|
||||
<space-param>
|
||||
<!-- loop_on_zero="true" anything moved before zero reenters at the end of space-->
|
||||
<!-- loop_on_zero="false" anything moved before zero is lost-->
|
||||
<!-- loop_on_max="true" anything moved beyond max reenters at the zero of space-->
|
||||
<!-- loop_on_max="false" anything moved beyond max is lost-->
|
||||
|
||||
<dimension x="22" y="4" z="8"/>
|
||||
|
||||
<!-- Site_multiplicity = number of sites in a space unit. -->
|
||||
<!-- Each site points towards a neighbouring space unit. -->
|
||||
<!-- Several arrows can be stacked in the same site. -->
|
||||
|
||||
<site_multiplicity>3</site_multiplicity>
|
||||
|
||||
</space-param>
|
||||
|
||||
</parameters>
|
||||
|
||||
<!-- Model objects definition -->
|
||||
|
||||
<objects id="only dimers in this model" date="time_stamp" author="J">
|
||||
<object id="a dimer" date="time_stamp" author="J">
|
||||
<arrow site="1" weight="1" x="0"/>
|
||||
<arrow site="2" weight="1" x="1"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
|
||||
|
||||
<!-- Saved space description (initial space is sequence 0) -->
|
||||
|
||||
<savedstates id="texte" date="time_stamp" author="J">
|
||||
<state id="initial" date="time_stamp" author="J">
|
||||
<arrow site="1" weight="1" x="0"/>
|
||||
<arrow site="2" weight="1" x="1"/>
|
||||
<arrow site="1" weight="1" x="10"/>
|
||||
<arrow site="2" weight="1" x="11"/>
|
||||
<arrow site="1" weight="1" x="20"/>
|
||||
<arrow site="2" weight="1" x="21"/>
|
||||
|
||||
<!-- Three dimers 1-1 are drawn in the global space
|
||||
at locations (0,1) (10,11) and (20,21) -->
|
||||
|
||||
</state>
|
||||
|
||||
</savedstates>
|
||||
|
||||
<!-- Model transitions definition (rules) -->
|
||||
<!-- In this version : <xs:sequence minOccurs="0" maxOccurs="unbounded">-->
|
||||
<!-- Transitions should be edited by hand and written in a 'human-readable' format -->
|
||||
|
||||
<conditions_tree>
|
||||
<condition_anonym site="1" weight="1" x="0">
|
||||
<condition_anonym site="2" weight="1" x="1">
|
||||
<condition_anonym site="1" weight="0" x="2">
|
||||
<transition_anonym id="move_a_dimer_to_east"
|
||||
date="time_stamp"
|
||||
author="J"
|
||||
probability="0.5"/>
|
||||
<arrow site="1" weight="0" x="0"/>
|
||||
<arrow site="2" weight="0" x="1"/>
|
||||
<arrow site="1" weight="1" x="1"/>
|
||||
<arrow site="2" weight="1" x="2"/>
|
||||
</condition_anonym>
|
||||
<condition_anonym site="2" weight="0" x="-1">
|
||||
<transition_anonym id="move_a_dimer_to_west"
|
||||
date="time_stamp"
|
||||
author="J"
|
||||
probability="0.5"/>
|
||||
<arrow site="1" weight="0" x="0"/>
|
||||
<arrow site="2" weight="0" x="1"/>
|
||||
<arrow site="2" weight="1" x="0"/>
|
||||
<arrow site="1" weight="1" x="1"/>
|
||||
</condition_anonym>
|
||||
</condition_anonym>
|
||||
</condition_anonym>
|
||||
</conditions_tree>
|
||||
|
||||
<conditionslist id="random walk of dimers" date="time_stamp" author="J">
|
||||
|
||||
<condition site="1" weight="1" node_id="1" parent="0" x="0"/>
|
||||
<condition site="2" weight="1" node_id="2" parent="1" x="1"/>
|
||||
<!-- as soon as conditions 1 and 2 are satisfied, a dimer is identified at atation (0,1). -->
|
||||
|
||||
<condition site="1" weight="0" node_id="3" parent="2" x="2"/>
|
||||
<!-- as soon as condition 3 is satisfied,
|
||||
the neighbouring space unit to East of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to East. -->
|
||||
|
||||
<condition site="2" weight="0" node_id="4" parent="2" x="-1"/>
|
||||
<!-- as soon as condition 4 is satisfied,
|
||||
the neighbouring space unit to West of the dimer is empty
|
||||
and the dimer identified by conditions (1,2) can be moved to West. -->
|
||||
|
||||
</conditionslist>
|
||||
|
||||
<transitionslist>
|
||||
|
||||
<transition id="move_a_dimer_to_east" date="time_stamp" author="J"
|
||||
parent="3" probability="1">
|
||||
|
||||
<arrow site="1" weight="0" x="0"/>
|
||||
<arrow site="2" weight="0" x="1"/>
|
||||
<arrow site="1" weight="1" x="1"/>
|
||||
<arrow site="2" weight="1" x="2"/>
|
||||
|
||||
</transition>
|
||||
|
||||
<transition id="move_a_dimer_to_west" date="time_stamp" author="J"
|
||||
parent="4" probability="1">
|
||||
|
||||
<arrow site="1" weight="0" x="0"/>
|
||||
<arrow site="2" weight="0" x="1"/>
|
||||
<arrow site="2" weight="1" x="0"/>
|
||||
<arrow site="1" weight="1" x="1"/>
|
||||
|
||||
</transition>
|
||||
|
||||
</transitionslist>
|
||||
|
||||
</gem-graph-model>
|
|
@ -0,0 +1,235 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- https://www.freeformatter.com/xml-validator-xsd.html -->
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
<xs:attribute name="node_id" type="xs:integer"/>
|
||||
<xs:attribute name="parent" type="xs:integer"/>
|
||||
<xs:attribute name="date" type="xs:integer"/>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="lang" type="xs:string"/>
|
||||
<xs:attribute name="owner" type="xs:string"/>
|
||||
<xs:attribute name="owner_id" type="xs:integer"/>
|
||||
<xs:attribute name="author" type="xs:string"/>
|
||||
<xs:attribute name="version" type="xs:float"/>
|
||||
<xs:attribute name="probability" type="xs:integer"/>
|
||||
<xs:attribute name="site" type="xs:integer" default="0"/>
|
||||
<xs:attribute name="weight" type="xs:integer" default="0"/>
|
||||
<xs:attribute name="u" type="xs:integer"/>
|
||||
<xs:attribute name="v" type="xs:integer"/>
|
||||
<xs:attribute name="w" type="xs:integer"/>
|
||||
<xs:attribute name="x" type="xs:integer"/>
|
||||
<xs:attribute name="y" type="xs:integer"/>
|
||||
<xs:attribute name="z" type="xs:integer"/>
|
||||
<xs:attribute name="t" type="xs:integer"/>
|
||||
|
||||
|
||||
<xs:attributeGroup name="id_date_author">
|
||||
<xs:attribute ref="id"/>
|
||||
<xs:attribute ref="date"/>
|
||||
<xs:attribute ref="author"/>
|
||||
</xs:attributeGroup>
|
||||
|
||||
<xs:element name="g_ref">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="lang" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="quote" substitutionGroup="g_ref"/>
|
||||
|
||||
<xs:element name="dimension">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="optional"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="arrow">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="site" use="required"/>
|
||||
<xs:attribute ref="weight" use="required"/>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="required"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="condition">
|
||||
<xs:complexType>
|
||||
<xs:attribute ref="site" use="required"/>
|
||||
<xs:attribute ref="weight" use="required"/>
|
||||
<xs:attribute ref="node_id" use="required"/>
|
||||
<xs:attribute ref="parent" use="required"/>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="required"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="condition_anonym">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="condition_anonym"/>
|
||||
</xs:sequence>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute ref="site" use="required"/>
|
||||
<xs:attribute ref="weight" use="required"/>
|
||||
<xs:attribute ref="u" use="optional"/>
|
||||
<xs:attribute ref="v" use="optional"/>
|
||||
<xs:attribute ref="w" use="optional"/>
|
||||
<xs:attribute ref="x" use="required"/>
|
||||
<xs:attribute ref="y" use="optional"/>
|
||||
<xs:attribute ref="z" use="optional"/>
|
||||
<xs:attribute ref="t" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="state">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="object" substitutionGroup="state"/>
|
||||
|
||||
<xs:element name="transition">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element minOccurs="0" ref="quote"/>
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="parent" use="required"/>
|
||||
<xs:attribute ref="probability" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="transition_anonym">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
<xs:attribute ref="probability" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="gem-graph-model">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="identity">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="owner" type="xs:string"/>
|
||||
<xs:element name="owner_id" type="xs:integer"/>
|
||||
<xs:element name="date" type="xs:integer"/>
|
||||
<xs:element name="version" type="xs:float"/>
|
||||
<xs:element ref="g_ref" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="parameters">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
|
||||
<xs:element name="simulation">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element name="max_thread" type="xs:integer"/>
|
||||
<xs:element name="max_cycles" type="xs:integer"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="space-param">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="1">
|
||||
<xs:element ref="dimension"/>
|
||||
<xs:element name="site_multiplicity" type="xs:integer"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="objects">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element ref="object"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="savedstates">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="state"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="conditionslist">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element minOccurs="0" ref="quote"/>
|
||||
<xs:element ref="condition"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="id_date_author"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="transitionslist">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="transition"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="conditionstree">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="condition_anonym"/>
|
||||
</xs:sequence>
|
||||
<xs:sequence minOccurs="0" maxOccurs="1">
|
||||
<xs:element ref="transition_anonym"/>
|
||||
</xs:sequence>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="arrow"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
<xs:attribute ref="version" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -40,7 +40,8 @@ struct gl_area_entry {
|
|||
GLuint m;
|
||||
GLuint v;
|
||||
GLuint p;
|
||||
GLuint indices_nb;
|
||||
GLuint line_indices_nb;
|
||||
GLuint plan_indices_nb;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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 <stdbool.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
// bool compute_space_2D(struct gl_area_entry *entry, int state_size);
|
|
@ -38,6 +38,7 @@
|
|||
#include "../../include/base.h"
|
||||
#include "../../include/ui.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/space_2D.h"
|
||||
|
||||
#define VERTEX_SHADER_FILE "src/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/shaders/shader.frag"
|
||||
|
@ -45,12 +46,14 @@
|
|||
|
||||
GLfloat *vertex_base = NULL;
|
||||
GLfloat *color_base = NULL;
|
||||
GLubyte *indices = NULL;
|
||||
GLubyte *line_ndx = NULL;
|
||||
GLubyte *plan_ndx = NULL;
|
||||
int dim = 0;
|
||||
int state_size = 0;
|
||||
int vertex_nb = 0;
|
||||
int colors_nb = 0;
|
||||
int segments_nb = 0;
|
||||
int lines_nb = 0;
|
||||
int plans_nb = 0;
|
||||
int arrows_nb = 0;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -320,7 +323,8 @@ bool graphics_shutdown(const void *gl_area)
|
|||
|
||||
g_free(vertex_base);
|
||||
g_free(color_base);
|
||||
g_free(indices);
|
||||
g_free(line_ndx);
|
||||
g_free(plan_ndx);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -568,15 +572,23 @@ static bool compute_arrow_2D(struct gl_area_entry *entry, int state_size, int vg
|
|||
if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\
|
||||
x, site, center, tip, base); // vgap=%d igap=%d
|
||||
|
||||
assert(igap < entry->indices_nb);
|
||||
assert(igap + 5 < entry->indices_nb);
|
||||
assert(igap < entry->line_indices_nb);
|
||||
assert(igap + 5 < entry->line_indices_nb);
|
||||
|
||||
*(indices + igap + 0) = vgap / 3 + 0;
|
||||
*(indices + igap + 1) = vgap / 3 + 1;
|
||||
*(indices + igap + 2) = vgap / 3 + 0;
|
||||
*(indices + igap + 3) = vgap / 3 + 2;
|
||||
*(indices + igap + 4) = vgap / 3 + 1;
|
||||
*(indices + igap + 5) = vgap / 3 + 2;
|
||||
*(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;
|
||||
}
|
||||
|
@ -616,32 +628,32 @@ static bool compute_arrow_3D(struct gl_area_entry *entry, int state_size, int vg
|
|||
if (A) printf("x = %d site = %d center = %f tip = %f base = %f\n",\
|
||||
x, site, center, tip, base); // vgap=%d igap=%d
|
||||
|
||||
assert(igap < entry->indices_nb);
|
||||
assert(igap + 5 < entry->indices_nb);
|
||||
assert(igap < entry->line_indices_nb);
|
||||
assert(igap + 5 < entry->line_indices_nb);
|
||||
|
||||
*(indices + igap + 0) = vgap / 3 + 0;
|
||||
*(indices + igap + 1) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 0) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 1) = vgap / 3 + 1;
|
||||
|
||||
*(indices + igap + 2) = vgap / 3 + 0;
|
||||
*(indices + igap + 3) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 2) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 3) = vgap / 3 + 2;
|
||||
|
||||
*(indices + igap + 4) = vgap / 3 + 0;
|
||||
*(indices + igap + 5) = vgap / 3 + 3;
|
||||
*(line_ndx + igap + 4) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 5) = vgap / 3 + 3;
|
||||
|
||||
*(indices + igap + 6) = vgap / 3 + 0;
|
||||
*(indices + igap + 7) = vgap / 3 + 4;
|
||||
*(line_ndx + igap + 6) = vgap / 3 + 0;
|
||||
*(line_ndx + igap + 7) = vgap / 3 + 4;
|
||||
|
||||
*(indices + igap + 8) = vgap / 3 + 1;
|
||||
*(indices + igap + 9) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 8) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 9) = vgap / 3 + 2;
|
||||
|
||||
*(indices + igap + 10) = vgap / 3 + 2;
|
||||
*(indices + igap + 11) = vgap / 3 + 3;
|
||||
*(line_ndx + igap + 10) = vgap / 3 + 2;
|
||||
*(line_ndx + igap + 11) = vgap / 3 + 3;
|
||||
|
||||
*(indices + igap + 12) = vgap / 3 + 3;
|
||||
*(indices + igap + 13) = vgap / 3 + 4;
|
||||
*(line_ndx + igap + 12) = vgap / 3 + 3;
|
||||
*(line_ndx + igap + 13) = vgap / 3 + 4;
|
||||
|
||||
*(indices + igap + 14) = vgap / 3 + 4;
|
||||
*(indices + igap + 15) = vgap / 3 + 1;
|
||||
*(line_ndx + igap + 14) = vgap / 3 + 4;
|
||||
*(line_ndx + igap + 15) = vgap / 3 + 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -678,28 +690,28 @@ static bool compute_space_2D(struct gl_area_entry *entry, int state_size){
|
|||
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
*(indices + 0) = 0;
|
||||
*(indices + 1) = state_size * 2 - 2; // barre horizontale du bas
|
||||
*(line_ndx + 0) = 0;
|
||||
*(line_ndx + 1) = state_size * 2 - 2; // barre horizontale du bas
|
||||
|
||||
*(indices + 2) = 1;
|
||||
*(indices + 3) = state_size * 2 - 1; // barre horizontale du haut
|
||||
*(line_ndx + 2) = 1;
|
||||
*(line_ndx + 3) = state_size * 2 - 1; // barre horizontale du haut
|
||||
|
||||
for (int k = 0; k < state_size * 2; k++){
|
||||
|
||||
assert(k < entry->indices_nb);
|
||||
assert(k + 4 < entry->indices_nb);
|
||||
assert(k < entry->line_indices_nb);
|
||||
assert(k + 4 < entry->line_indices_nb);
|
||||
|
||||
*(indices + k + 4) = k;
|
||||
*(line_ndx + k + 4) = k;
|
||||
}
|
||||
|
||||
/* *(indices + state_size * 2 + 6 + 4) = 0; // diagonales pour marquer la case zéro */
|
||||
/* *(indices + state_size * 2 + 6 + 5) = 3; */
|
||||
/* *(indices + state_size * 2 + 6 + 6) = 1; */
|
||||
/* *(indices + state_size * 2 + 6 + 7) = 2; */
|
||||
/* *(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; */
|
||||
|
||||
if (I) printf("indices (%d - state_size(0)) x (%d - state_size(1)) ", 0, 1);
|
||||
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) ", *(indices + v), *(indices + v + 1));
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
}
|
||||
|
||||
if (I) printf(" n = 4 + (%d x 2)\n", state_size + 2);
|
||||
|
@ -743,20 +755,20 @@ static bool compute_space_3D(struct gl_area_entry *entry, int state_size){
|
|||
*(vertex_base + k * 12 + 10) = - 1.0f / state_size;
|
||||
*(vertex_base + k * 12 + 11) = 1.0f / state_size;
|
||||
|
||||
*(color_base + k * 12 + 0) = 0.8f; // rouge
|
||||
*(color_base + k * 12 + 1) = 0.2f;
|
||||
*(color_base + k * 12 + 2) = 0.2f;
|
||||
*(color_base + k * 12 + 0) = 0.8f;
|
||||
*(color_base + k * 12 + 1) = 0.8f;
|
||||
*(color_base + k * 12 + 2) = 0.8f;
|
||||
|
||||
*(color_base + k * 12 + 3) = 0.8f; // jaune
|
||||
*(color_base + k * 12 + 3) = 0.8f;
|
||||
*(color_base + k * 12 + 4) = 0.8f;
|
||||
*(color_base + k * 12 + 5) = 0.2f;
|
||||
*(color_base + k * 12 + 5) = 0.8f;
|
||||
|
||||
*(color_base + k * 12 + 6) = 0.2f; // vert
|
||||
*(color_base + k * 12 + 6) = 0.8f;
|
||||
*(color_base + k * 12 + 7) = 0.8f;
|
||||
*(color_base + k * 12 + 8) = 0.2f;
|
||||
*(color_base + k * 12 + 8) = 0.8f;
|
||||
|
||||
*(color_base + k * 12 + 9) = 0.8f; // magenta
|
||||
*(color_base + k * 12 + 10) = 0.2f;
|
||||
*(color_base + k * 12 + 9) = 0.8f;
|
||||
*(color_base + k * 12 + 10) = 0.8f;
|
||||
*(color_base + k * 12 + 11) = 0.8f;
|
||||
|
||||
/* 0.8, 0.8, 0.8, // blanc */
|
||||
|
@ -772,48 +784,58 @@ static bool compute_space_3D(struct gl_area_entry *entry, int state_size){
|
|||
|
||||
if (V) printf(" n = %d x 2 côté = [%1.1f]\n", state_size + 1, 2.0f / state_size);
|
||||
|
||||
*(indices + 4) = 0;
|
||||
*(indices + 5) = state_size * 4 - 4; // barre horizontale du bas arr
|
||||
*(line_ndx + 4) = 0;
|
||||
*(line_ndx + 5) = state_size * 4 - 4; // barre horizontale du bas arr
|
||||
|
||||
*(indices + 6) = 1;
|
||||
*(indices + 7) = state_size * 4 - 3; // barre horizontale du haut arr
|
||||
*(line_ndx + 6) = 1;
|
||||
*(line_ndx + 7) = state_size * 4 - 3; // barre horizontale du haut arr
|
||||
|
||||
*(indices + 0) = 2;
|
||||
*(indices + 1) = state_size * 4 - 2; // barre horizontale du bas av
|
||||
*(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;
|
||||
|
||||
*(indices + 2) = 3;
|
||||
*(indices + 3) = state_size * 4 - 1; // barre horizontale du haut av
|
||||
|
||||
for (int k = 8; k <= state_size * 8; k += 8){ // for (int k = 8; k < state_size * 8; k += 8){
|
||||
|
||||
|
||||
assert(k < entry->indices_nb);
|
||||
assert(k + 8 < entry->indices_nb);
|
||||
assert(k < entry->line_indices_nb);
|
||||
assert(k + 8 < entry->line_indices_nb);
|
||||
|
||||
*(indices + k + 0) = k / 2 - 4; // + 0;
|
||||
*(indices + k + 1) = k / 2 - 2; // + 2;
|
||||
*(line_ndx + k + 0) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 1) = k / 2 - 2; // + 2;
|
||||
|
||||
*(indices + k + 2) = k / 2 - 3; // + 1;
|
||||
*(indices + k + 3) = k / 2 - 1; // + 3;
|
||||
*(line_ndx + k + 2) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 3) = k / 2 - 1; // + 3;
|
||||
|
||||
*(indices + k + 4) = k / 2 - 4; // + 0;
|
||||
*(indices + k + 5) = k / 2 - 1; // + 3;
|
||||
*(line_ndx + k + 4) = k / 2 - 4; // + 0;
|
||||
*(line_ndx + k + 5) = k / 2 - 1; // + 3;
|
||||
|
||||
*(indices + k + 6) = k / 2 - 3; // + 1;
|
||||
*(indices + k + 7) = k / 2 - 2; // + 2;
|
||||
*(line_ndx + k + 6) = k / 2 - 3; // + 1;
|
||||
*(line_ndx + k + 7) = k / 2 - 2; // + 2;
|
||||
}
|
||||
|
||||
|
||||
*(indices + entry->indices_nb - 4) = 0 + 0; // diagonales pour marquer la case zéro
|
||||
*(indices + entry->indices_nb - 3) = 0 + 1;
|
||||
*(line_ndx + entry->line_indices_nb - 4) = 0 + 0; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + entry->line_indices_nb - 3) = 0 + 1;
|
||||
|
||||
*(indices + entry->indices_nb - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
||||
*(indices + entry->indices_nb - 1) = 0 + 3;
|
||||
*(line_ndx + entry->line_indices_nb - 2) = 0 + 2; // diagonales pour marquer la case zéro
|
||||
*(line_ndx + entry->line_indices_nb - 1) = 0 + 3;
|
||||
|
||||
|
||||
if (I) printf("indices (%d - state_size(0)) x (%d - state_size(1)) ", 0, 1);
|
||||
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) ", *(indices + v), *(indices + v + 1));
|
||||
if (I) printf("(%d-%d) ", *(line_ndx + v), *(line_ndx + v + 1));
|
||||
}
|
||||
|
||||
if (I) printf(" n = 4 + (%d x 2)\n", state_size + 2);
|
||||
|
@ -823,7 +845,7 @@ static bool compute_space_3D(struct gl_area_entry *entry, int state_size){
|
|||
|
||||
/* Initializes the buffer of a gl_area
|
||||
* @param gl_area, ptr to the gl_area widget
|
||||
* Note : indices[] is defined in graphics_cube.h
|
||||
* Note : line_ndx[] is defined in graphics_cube.h
|
||||
* @return void
|
||||
*/
|
||||
|
||||
|
@ -836,7 +858,7 @@ void graphics_init_buffers(const void *gl_area)
|
|||
|
||||
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};
|
||||
// {1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21};
|
||||
dim = 1;
|
||||
state_size = 13; // 2 < state_size < 32
|
||||
arrows_nb = 4;
|
||||
|
@ -844,36 +866,39 @@ void graphics_init_buffers(const void *gl_area)
|
|||
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
|
||||
segments_nb = (2 + state_size) + (arrows_nb * 3);
|
||||
segments_nb = (4 + state_size * 4) + (arrows_nb * 8) + 2; // + 2; pour les 2 diagonales
|
||||
lines_nb = (2 + state_size) + (arrows_nb * 3);
|
||||
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
|
||||
|
||||
entry->indices_nb = segments_nb * 2;
|
||||
entry->line_indices_nb = lines_nb * 2;
|
||||
entry->plan_indices_nb = plans_nb * 3;
|
||||
|
||||
printf("Initialization of buffers with %u indices, %u vertices and %u colors & state_size = %d\n",
|
||||
entry->indices_nb, vertex_nb, colors_nb, state_size);
|
||||
printf("Initialization of buffers with %u line_ndx, %u vertices and %u colors & state_size = %d\n",
|
||||
entry->line_indices_nb, vertex_nb, colors_nb, state_size);
|
||||
|
||||
//XXX g_malloc
|
||||
// g_malloc
|
||||
vertex_base = g_malloc0(vertex_nb * sizeof(GLfloat) * 2);
|
||||
color_base = g_malloc0(colors_nb * sizeof(GLfloat) * 2);
|
||||
indices = g_malloc0(segments_nb * 2 * sizeof(GLubyte) * 2);
|
||||
line_ndx = g_malloc0(lines_nb * 2 * sizeof(GLubyte) * 2);
|
||||
plan_ndx = g_malloc0(plans_nb * 3 * sizeof(GLubyte) * 2);
|
||||
|
||||
// compute_space_2D(entry, state_size); vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
compute_space_2D(entry, state_size); vgap += (6 * state_size); igap += state_size * 2 + 4; cgap += (6 * state_size);
|
||||
|
||||
compute_space_3D(entry, state_size); vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
// compute_space_3D(entry, state_size); vgap += (12 * state_size); igap += state_size * 8 + 8; cgap += (12 * state_size);
|
||||
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, 2, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, 0, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 0, 3, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
compute_arrow_2D(entry, state_size, vgap, igap, 1, 0, 0, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb;
|
||||
compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, 2, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb;
|
||||
compute_arrow_2D(entry, state_size, vgap, igap, 1, 0, 3, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb;
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, 3, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 0, state_size - 2, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, state_size - 2, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb; */
|
||||
compute_arrow_2D(entry, state_size, vgap, igap, 1, 1, state_size - 2, 0, 0); vgap += 9; igap += 6; cgap += 15; ++arrows_nb;
|
||||
|
||||
compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, 0, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
//compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
//compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, state_size - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, state_size - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb;
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, 0, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, 3, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 0, state_size - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
/* compute_arrow_3D(entry, state_size, vgap, igap, 1, 1, state_size - 2, 0, 0); vgap += 15; igap += 16; cgap += 15; ++arrows_nb; */
|
||||
|
||||
// We only use one VAO, so we always keep it bound
|
||||
glGenVertexArrays(1, &vao);
|
||||
|
@ -931,7 +956,7 @@ void graphics_draw(const void *gl_area)
|
|||
compute_i(m);
|
||||
compute_i(v);
|
||||
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClearColor(0.3f, 0, 0, 0.8f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* Use our shaders */
|
||||
|
@ -954,7 +979,8 @@ void graphics_draw(const void *gl_area)
|
|||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glDrawElements(GL_LINES, entry->indices_nb, GL_UNSIGNED_BYTE, indices);
|
||||
glDrawElements(GL_LINES, entry->line_indices_nb, GL_UNSIGNED_BYTE, line_ndx);
|
||||
glDrawElements(GL_TRIANGLES, entry->plan_indices_nb, GL_UNSIGNED_BYTE, plan_ndx);
|
||||
|
||||
/* We finished using the buffers and program */
|
||||
glDisableVertexAttribArray(0);
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Gem-graph OpenGL experiments
|
||||
*
|
||||
* Desc: GL functions
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
#define VERTEX_SHADER_FILE "src/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/shaders/shader.frag"
|
||||
#define K 0
|
||||
|
||||
/* GLfloat *vertex_base = NULL; */
|
||||
/* GLfloat *color_base = NULL; */
|
||||
/* GLubyte *line_ndx = NULL; */
|
||||
/* GLubyte *plan_ndx = NULL; */
|
||||
/* int dim = 0; */
|
||||
/* int state_size = 0; */
|
||||
/* int vertex_nb = 0; */
|
||||
/* int colors_nb = 0; */
|
||||
/* int lines_nb = 0; */
|
||||
/* int plans_nb = 0; */
|
||||
/* int arrows_nb = 0; */
|
||||
|
||||
/* #define V 1 */
|
||||
/* #define I 0 */
|
||||
/* #define EDGE 0.999999 */
|
||||
/* bool compute_space_2D(struct gl_area_entry *entry, int state_size){ */
|
||||
|
||||
/* 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); */
|
||||
|
||||
/* assert(k * 6 < vertex_nb); */
|
||||
/* assert(k * 6 + 5 < vertex_nb); */
|
||||
|
||||
/* *(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; */
|
||||
/* } */
|
||||
|
||||
/* 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++){ */
|
||||
|
||||
/* assert(k < entry->line_indices_nb); */
|
||||
/* assert(k + 4 < entry->line_indices_nb); */
|
||||
|
||||
/* *(line_ndx + k + 4) = k; */
|
||||
/* } */
|
||||
|
||||
/* *(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; */
|
||||
|
||||
/* 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)); */
|
||||
/* } */
|
||||
|
||||
/* if (I) printf(" n = 4 + (%d x 2)\n", state_size + 2); */
|
||||
|
||||
/* return 1; */
|
||||
/* } */
|
||||
|
|
@ -12,5 +12,5 @@ out vec4 color;
|
|||
void main(void)
|
||||
{
|
||||
gl_Position = projection_matrix * view_matrix * model_matrix * vec4(in_position, 1);
|
||||
color = vec4(1 * in_color.rgb, 1);
|
||||
color = vec4(1 * in_color.rgb, 0.2f);
|
||||
}
|
Loading…
Reference in New Issue