Forme quasi stable
This commit is contained in:
parent
6698c51c6d
commit
551c5a5df2
|
@ -0,0 +1,77 @@
|
||||||
|
The program is not being run.
|
||||||
|
Temporary breakpoint 1 at 0x404740: file src/main.c, line 42.
|
||||||
|
Starting program: /home/jean/Gem-Graph/gem-graph-client/bin/gem-graph-client
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libthread_db.so.1".
|
||||||
|
|
||||||
|
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffce58) at src/main.c:42
|
||||||
|
42 app = gem_graph_client_application_new("org.alec.gemgraph",
|
||||||
|
Continuing.
|
||||||
|
[New Thread 0x7fffef5ff640 (LWP 21368)]
|
||||||
|
[New Thread 0x7fffee2f5640 (LWP 21369)]
|
||||||
|
[New Thread 0x7fffecfeb640 (LWP 21370)]
|
||||||
|
[Thread 0x7fffecfeb640 (LWP 21370) exited]
|
||||||
|
[New Thread 0x7fffecfeb640 (LWP 21371)]
|
||||||
|
[New Thread 0x7fffe49b5640 (LWP 21372)]
|
||||||
|
[New Thread 0x7fffe41b4640 (LWP 21373)]
|
||||||
|
[New Thread 0x7fffe2eaa640 (LWP 21374)]
|
||||||
|
[New Thread 0x7fffe1ba0640 (LWP 21375)]
|
||||||
|
[New Thread 0x7fffe0896640 (LWP 21376)]
|
||||||
|
[New Thread 0x7fffdf58c640 (LWP 21377)]
|
||||||
|
[New Thread 0x7fffde282640 (LWP 21378)]
|
||||||
|
[New Thread 0x7fffdcf78640 (LWP 21379)]
|
||||||
|
[New Thread 0x7fffdbc6e640 (LWP 21380)]
|
||||||
|
[Thread 0x7fffe49b5640 (LWP 21372) exited]
|
||||||
|
[Thread 0x7fffde282640 (LWP 21378) exited]
|
||||||
|
[Thread 0x7fffdf58c640 (LWP 21377) exited]
|
||||||
|
[Thread 0x7fffe0896640 (LWP 21376) exited]
|
||||||
|
[Thread 0x7fffe1ba0640 (LWP 21375) exited]
|
||||||
|
[Thread 0x7fffe41b4640 (LWP 21373) exited]
|
||||||
|
[Thread 0x7fffdbc6e640 (LWP 21380) exited]
|
||||||
|
[Thread 0x7fffdcf78640 (LWP 21379) exited]
|
||||||
|
[Thread 0x7fffe2eaa640 (LWP 21374) exited]
|
||||||
|
[Thread 0x7fffecfeb640 (LWP 21371) exited]
|
||||||
|
[New Thread 0x7fffecfeb640 (LWP 21381)]
|
||||||
|
[New Thread 0x7fffdbc6e640 (LWP 21382)]
|
||||||
|
[New Thread 0x7fffdcf78640 (LWP 21383)]
|
||||||
|
[New Thread 0x7fffde282640 (LWP 21384)]
|
||||||
|
[New Thread 0x7fffe33ff640 (LWP 21385)]
|
||||||
|
[New Thread 0x7fffe20f5640 (LWP 21386)]
|
||||||
|
[New Thread 0x7fffe0deb640 (LWP 21387)]
|
||||||
|
[New Thread 0x7fffe05ea640 (LWP 21388)]
|
||||||
|
[New Thread 0x7fffdda81640 (LWP 21389)]
|
||||||
|
[New Thread 0x7fffdb46d640 (LWP 21390)]
|
||||||
|
[New Thread 0x7fffd965a640 (LWP 21391)]
|
||||||
|
[New Thread 0x7fffd8350640 (LWP 21392)]
|
||||||
|
[New Thread 0x7fffd7046640 (LWP 21393)]
|
||||||
|
[New Thread 0x7fffd5d3c640 (LWP 21394)]
|
||||||
|
[New Thread 0x7fffd4a32640 (LWP 21395)]
|
||||||
|
[New Thread 0x7fffd3728640 (LWP 21396)]
|
||||||
|
[New Thread 0x7fffd241e640 (LWP 21397)]
|
||||||
|
[New Thread 0x7fffd1c1d640 (LWP 21398)]
|
||||||
|
[Thread 0x7fffd241e640 (LWP 21397) exited]
|
||||||
|
[Thread 0x7fffd1c1d640 (LWP 21398) exited]
|
||||||
|
[New Thread 0x7fffd1c1d640 (LWP 21399)]
|
||||||
|
[New Thread 0x7fffd241e640 (LWP 21400)]
|
||||||
|
[Thread 0x7fffd1c1d640 (LWP 21399) exited]
|
||||||
|
[Thread 0x7fffd241e640 (LWP 21400) exited]
|
||||||
|
[New Thread 0x7fffd241e640 (LWP 21401)]
|
||||||
|
[New Thread 0x7fffd1c1d640 (LWP 21402)]
|
||||||
|
[Thread 0x7fffd7046640 (LWP 21393) exited]
|
||||||
|
|
||||||
|
Thread 1 "gem-graph-clien" received signal SIGINT, Interrupt.
|
||||||
|
0x00007ffff5ab4d4b in __memmove_sse2_unaligned_erms () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
|
||||||
|
Breakpoint 2 at 0x4088a5: file src/graphics/graphics.c, line 697.
|
||||||
|
Continuing.
|
||||||
|
[Thread 0x7fffd5d3c640 (LWP 21394) exited]
|
||||||
|
|
||||||
|
Thread 1 "gem-graph-clien" received signal SIGINT, Interrupt.
|
||||||
|
0x00007ffff5b77dca in __memset_avx2_unaligned_erms () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
|
||||||
|
Breakpoint 3 at 0x408320: file src/graphics/graphics.c, line 873.
|
||||||
|
Continuing.
|
||||||
|
|
||||||
|
Thread 1 "gem-graph-clien" received signal SIGINT, Interrupt.
|
||||||
|
0x00007ffff5ab4e3e in __memmove_sse2_unaligned_erms () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
|
||||||
|
Quit
|
||||||
|
|
||||||
|
quit
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Gem-graph OpenGL experiments
|
||||||
|
*
|
||||||
|
* Desc: GL functions
|
||||||
|
*
|
||||||
|
* 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 <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the arrows[] array
|
||||||
|
*
|
||||||
|
* For each arrow the following parameters are displayed :
|
||||||
|
* - rank in the array
|
||||||
|
* - weight (or load)
|
||||||
|
* - coordinates in space (site, x, y, z)
|
||||||
|
*/
|
||||||
|
void show_arrows_array_head(int one_batch_size, long nb_batches_specified, int verbose);
|
||||||
|
void show_one_arrow_in_array(struct arrow_t *arrows, int i);
|
||||||
|
void show_empty_arrows_array();
|
||||||
|
void show_arrows_array (struct arrow_t *arrows, int arrows_nb, int x, int y, int z);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the initial user choices :
|
||||||
|
* - space dimension size and appearance (grids)
|
||||||
|
* - arrows[] array
|
||||||
|
* NB The space may be empty or saturated with arrows or any value in between
|
||||||
|
* To assert : Only one arrow per possible coordinates with a load max equal to ?
|
||||||
|
*/
|
||||||
|
void show_user_choices(long copy_nb_arrows_specified,
|
||||||
|
int space_size_x, int space_size_y, int space_size_z,
|
||||||
|
int prefer, int arbitrary, int one_batch_size);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the result of the function set_arrow()
|
||||||
|
* and indicates the reasons of the choice (call) this function makes (see this function)
|
||||||
|
*/
|
||||||
|
void show_user_action(struct arrow_t *arrows, int arrows_nb, int address, int requested_weight,
|
||||||
|
int current_weight, int site, int x, int y, int z);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints vertex and lines buffers_states (sizes) at major one_batch_sizes and at the end of a session.
|
||||||
|
* Major one_batch_sizes are creation of grids and creation of arrows
|
||||||
|
* Arithmetic verification is provided at each one_batch_size
|
||||||
|
*/
|
||||||
|
void show_buffers_states(int space_X, int space_Y, int space_Z,
|
||||||
|
long nb_batches_specified, int one_batch_size,
|
||||||
|
int offset_after_grids, int buffer_vertex_size,
|
||||||
|
int buffer_lines_size_after_cubes, int buffer_lines_size);
|
|
@ -27,6 +27,10 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
|
||||||
|
void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z);
|
||||||
|
|
||||||
|
void write_space_faces_grids (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes grid lines intersections to vertex and color buffers
|
* Writes grid lines intersections to vertex and color buffers
|
||||||
*
|
*
|
||||||
|
@ -45,6 +49,15 @@ void grid_write_intersections (long x, long y, long z);
|
||||||
*/
|
*/
|
||||||
void grid_write_ridges (long x, long y, long z);
|
void grid_write_ridges (long x, long y, long z);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes marks (each space unit) along space ridges
|
||||||
|
*
|
||||||
|
* @param coords long (x,y,z) // , step_x, step_y, step_z
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void grid_write_marks (long x, long y, long z);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes grid lines for x axis to vertex and color buffers
|
* Writes grid lines for x axis to vertex and color buffers
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* 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 "base.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <epoxy/gl.h>
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#include <GL/glext.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 void *gl_area);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Created and compile a shader
|
||||||
|
*
|
||||||
|
* @param type, shader type
|
||||||
|
* src, source code of shader
|
||||||
|
*
|
||||||
|
* @return shader id
|
||||||
|
*/
|
||||||
|
static inline GLuint create_shader(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find the gl_area_entry size
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
*
|
||||||
|
* @return size of array
|
||||||
|
*/
|
||||||
|
// extern struct gl_area_entry **gl_area_array;
|
||||||
|
// static inline short gl_area_size(void)
|
||||||
|
// {
|
||||||
|
// struct gl_area_entry **cur;
|
||||||
|
// short size;
|
||||||
|
|
||||||
|
// Check uninitialized and quit
|
||||||
|
// if (gl_area_array == NULL) return 0;
|
||||||
|
|
||||||
|
// cur = gl_area_array;
|
||||||
|
// while(*cur) {
|
||||||
|
// cur++;
|
||||||
|
// size++;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return size;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/*** TEST ***/
|
||||||
|
|
||||||
|
// void main_test_graphics (void);
|
|
@ -0,0 +1,156 @@
|
||||||
|
/*
|
||||||
|
* Gem-graph OpenGL experiments
|
||||||
|
*
|
||||||
|
* Desc: GL functions
|
||||||
|
*
|
||||||
|
* 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 <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "../../include/graphics.h"
|
||||||
|
#include "../../include/arrows.h"
|
||||||
|
#include "../../include/displays.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the arrows[] array
|
||||||
|
*
|
||||||
|
* For each arrow the following parameters are displayed :
|
||||||
|
* - rank in the array
|
||||||
|
* - weight (or load)
|
||||||
|
* - coordinates in space (site, x, y, z)
|
||||||
|
*/
|
||||||
|
void show_arrows_array_head(int one_batch_size, long nb_batches_specified, int verbose) {
|
||||||
|
printf("\n [rank] load | site x y z");
|
||||||
|
if (verbose) printf(" one batch size = %d nb_batches_specified = %ld",\
|
||||||
|
one_batch_size, nb_batches_specified);
|
||||||
|
}
|
||||||
|
void show_one_arrow_in_array(struct arrow_t *arrows, int i) {
|
||||||
|
printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d",\
|
||||||
|
i, arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z);
|
||||||
|
}
|
||||||
|
void show_empty_arrows_array() {printf("\n [NULL] ---- | ---- --- --- ---");}
|
||||||
|
|
||||||
|
void show_arrows_array (struct arrow_t *arrows, int arrows_nb, int x, int y, int z)
|
||||||
|
{
|
||||||
|
show_arrows_array_head (0,0,0);
|
||||||
|
for (int i = 0; i < arrows_nb; i++)
|
||||||
|
show_one_arrow_in_array(arrows, i);
|
||||||
|
if (arrows_nb == 0) show_empty_arrows_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the initial user choices :
|
||||||
|
* - space dimension size and appearance (grids)
|
||||||
|
* - arrows[] array
|
||||||
|
* NB The space may be empty or saturated with arrows or any value in between
|
||||||
|
* To assert : Only one arrow per possible coordinates with a load max equal to ?
|
||||||
|
*/
|
||||||
|
void show_user_choices(long copy_nb_arrows_specified,
|
||||||
|
int space_size_x, int space_size_y, int space_size_z,
|
||||||
|
int prefer, int arbitrary, int one_batch_size)
|
||||||
|
{
|
||||||
|
printf("\nnb arrows specified = %ld", copy_nb_arrows_specified);
|
||||||
|
printf(" space size (x,y,z) = (%d,%d,%d)", space_size_x, space_size_y, space_size_z);
|
||||||
|
printf(" arbitrary = %d one_batch_size = %d", arbitrary, one_batch_size);
|
||||||
|
if (prefer == 0) printf(" prefer = %d <> show all grids", prefer);
|
||||||
|
if (prefer == 1) printf(" prefer = %d <> show no grid", prefer);
|
||||||
|
if (prefer > 1) printf(" show grids according rule (%d)", prefer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints the result of the function set_arrow()
|
||||||
|
* and indicates the reasons of the choice (call) this function makes (see this function)
|
||||||
|
*/
|
||||||
|
#define TEST 0
|
||||||
|
void show_user_action(struct arrow_t *arrows, int arrows_nb, int address, int requested_weight,
|
||||||
|
int current_weight, int site, int x, int y, int z)
|
||||||
|
{
|
||||||
|
if (address == -1 && requested_weight > 0) { // *(arrows + i * 5 + 0)
|
||||||
|
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); //arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||||
|
if (! TEST) printf("\n "); else printf(" ");
|
||||||
|
printf("=> CREATE"); return;}
|
||||||
|
|
||||||
|
if (address >= 0 && requested_weight == 0) {
|
||||||
|
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||||
|
if (! TEST) printf("\n "); else printf(" ");
|
||||||
|
printf("=> ERASE"); return;}
|
||||||
|
|
||||||
|
if (address >= 0 && current_weight != requested_weight) {
|
||||||
|
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||||
|
if (! TEST) printf("\n "); else printf(" ");
|
||||||
|
printf("=> MODIFY"); return;}
|
||||||
|
|
||||||
|
if (address >= 0 && current_weight == requested_weight){
|
||||||
|
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d;", site, x, y, z, address); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5);
|
||||||
|
if (! TEST) printf("\n "); else printf(" ");
|
||||||
|
printf("requested_weight == current_weight => END"); return;}
|
||||||
|
|
||||||
|
if (address == -1 && requested_weight == 0) {
|
||||||
|
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||||
|
if (! TEST) printf("\n "); else printf(" ");
|
||||||
|
printf("=> END"); return;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prints vertex and lines buffers_states (sizes) at major one_batch_sizes and at the end of a session.
|
||||||
|
* Major one_batch_sizes are creation of grids and creation of arrows
|
||||||
|
* Arithmetic verification is provided at each one_batch_size
|
||||||
|
*/
|
||||||
|
void show_buffers_states(int space_X, int space_Y, int space_Z,
|
||||||
|
long nb_batches_specified, int one_batch_size,
|
||||||
|
int offset_after_grids, int buffer_vertex_size,
|
||||||
|
int buffer_lines_size_after_cubes, int buffer_lines_size)
|
||||||
|
{
|
||||||
|
int offset_after_arrows = buffer_vertex_size / 3, difference = offset_after_arrows - offset_after_grids;
|
||||||
|
|
||||||
|
printf("\n - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
|
||||||
|
|
||||||
|
printf("\n buffer_vertex_offset_after grids = %9d\t%9d = (x+1)*(y+1)*(z+1); <--> (x,y,z = %d,%d,%d)",\
|
||||||
|
offset_after_grids, (space_X + 1)*(space_Y + 1)*(space_Z + 1), space_X, space_Y, space_Z);
|
||||||
|
|
||||||
|
printf("\n buffer_vertex_offset_after arrows = %9d\t%9d = %d + %d; <--> %d = 12 x %d (%d cubes)",\
|
||||||
|
offset_after_arrows, offset_after_arrows, offset_after_grids,\
|
||||||
|
difference, difference, difference / 12, difference / 12);
|
||||||
|
|
||||||
|
printf("\n buffer_lines_offset after cubes = %9d\t%9d = 2 * (%dx%d + %dx%d + %dx%d); <--> 2 * (x*y + x*z + y*z)",\
|
||||||
|
buffer_lines_size_after_cubes, ((space_X+1) * (space_Y+1) + (space_X+1) * (space_Z+1) + (space_Y+1) * (space_Z+1)) * 2,
|
||||||
|
space_X+1, space_Y+1, space_X+1, space_Z+1, space_Y+1, space_Z+1);
|
||||||
|
|
||||||
|
printf("\n buffer_lines_offset after arrows = %9d\t%9d = %d + %d; <--> %d = 14 x %d (%d arrows drawned)",\
|
||||||
|
buffer_lines_size, buffer_lines_size, buffer_lines_size_after_cubes,\
|
||||||
|
buffer_lines_size - buffer_lines_size_after_cubes,\
|
||||||
|
buffer_lines_size - buffer_lines_size_after_cubes, (buffer_lines_size - buffer_lines_size_after_cubes) / 14,\
|
||||||
|
(buffer_lines_size - buffer_lines_size_after_cubes) / 14);
|
||||||
|
|
||||||
|
if (nb_batches_specified * one_batch_size == 0) printf("\n");
|
||||||
|
else printf("\n WARNING Arrows of the same address, whatever their weight, are drawn in superimposition. Check their list.");
|
||||||
|
|
||||||
|
printf("\n It happens that NOT all the specified arrows (%ld) = (%ld x %d) are drawned (%d) ! WHY ? (d = %ld)\n",\
|
||||||
|
nb_batches_specified * one_batch_size, nb_batches_specified, one_batch_size, (buffer_lines_size - buffer_lines_size_after_cubes) / 14,\
|
||||||
|
nb_batches_specified * one_batch_size - (buffer_lines_size - buffer_lines_size_after_cubes) / 14);
|
||||||
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ static volatile int buffer_lines_size = 0;
|
||||||
static volatile int buffer_colors_size = 0;
|
static volatile int buffer_colors_size = 0;
|
||||||
static volatile int buffer_plans_size = 0;
|
static volatile int buffer_plans_size = 0;
|
||||||
|
|
||||||
#define TEST 1
|
#define TEST 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||||
|
@ -113,15 +113,6 @@ static void graphics_debug_callback(GLenum source, GLenum type, GLuint id,
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO ?
|
|
||||||
* Should a function "graphics_erase_line (GLuint a, GLuint b)" be used ?
|
|
||||||
* symetric with graphics_write_line (GLuint a, GLuint b)
|
|
||||||
*
|
|
||||||
* NB in this version lines only can be erased,
|
|
||||||
* and similar functions for vertex and plans have not to be considered.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe a line from a to b into the line buffer
|
* Writes values to describe a line from a to b into the line buffer
|
||||||
*
|
*
|
||||||
|
@ -278,7 +269,6 @@ bool graphics_init_shaders(const void *gl_area)
|
||||||
return false;
|
return false;
|
||||||
vertex = create_shader(GL_VERTEX_SHADER, vertex_shader);
|
vertex = create_shader(GL_VERTEX_SHADER, vertex_shader);
|
||||||
|
|
||||||
// ! WARNING ! l'instruction suivante (ou un autre 'free') a pu provoquer un 'double free' (Abandon)
|
|
||||||
if(vertex == 0) {
|
if(vertex == 0) {
|
||||||
entry->program = 0;
|
entry->program = 0;
|
||||||
g_free(vertex_shader);
|
g_free(vertex_shader);
|
||||||
|
@ -601,9 +591,11 @@ static void show_user_choices(struct arrow_t *arrows, int arrows_nb,
|
||||||
{
|
{
|
||||||
if (show_array) printf("\n");
|
if (show_array) printf("\n");
|
||||||
printf("model + user constraints :\tspace size x,y,z = %d,%d,%d\t", space_size_x, space_size_y, space_size_z);
|
printf("model + user constraints :\tspace size x,y,z = %d,%d,%d\t", space_size_x, space_size_y, space_size_z);
|
||||||
if (prefer == 0) printf("prefer = %d <> show all grids", prefer);
|
if (show_all && prefer == 0) printf("prefer = %d <> show all grids", prefer);
|
||||||
if (prefer == 1) printf("prefer = %d <> show no grid", prefer);
|
if (show_all && prefer == 1) printf("prefer = %d <> show no grid", prefer);
|
||||||
if (prefer > 1) printf("show grids according rule (%d)", prefer);
|
if (show_all && prefer > 1) printf("show grids according rule (%d)", prefer);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
if (show_all) printf("\n\
|
if (show_all) printf("\n\
|
||||||
initial arrows data with arrows_nb = %d", arrows_nb);
|
initial arrows data with arrows_nb = %d", arrows_nb);
|
||||||
if (show_array) show_arrows_array (arrows, arrows_nb, space_size_x, space_size_y, space_size_z);
|
if (show_array) show_arrows_array (arrows, arrows_nb, space_size_x, space_size_y, space_size_z);
|
||||||
|
@ -645,6 +637,7 @@ static void show_buffers_states(int space_X, int space_Y, int space_Z, int arrow
|
||||||
|
|
||||||
if (arrows_nb > 1)
|
if (arrows_nb > 1)
|
||||||
printf("\n WARNING In this test, it may happens that some arrows (whatever their weights) are drawn superimposed (check the list).\n");
|
printf("\n WARNING In this test, it may happens that some arrows (whatever their weights) are drawn superimposed (check the list).\n");
|
||||||
|
else printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -762,9 +755,9 @@ static inline int set_arrow (struct arrow_t *arrows, int arrows_nb, int requeste
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n[%d]set_arrow() invoked with requested weight = %2d + ", arrows_nb, requested_weight);
|
//printf("\n[%d]set_arrow() invoked with requested weight = %2d + ", arrows_nb, requested_weight);
|
||||||
|
|
||||||
show_user_action(arrows, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
if (TEST) show_user_action(arrows, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
||||||
|
|
||||||
if (address == -1 && requested_weight > 0)
|
if (address == -1 && requested_weight > 0)
|
||||||
return create_arrow (arrows_nb, requested_weight, site, x, y, z);
|
return create_arrow (arrows_nb, requested_weight, site, x, y, z);
|
||||||
|
@ -775,9 +768,9 @@ static inline int set_arrow (struct arrow_t *arrows, int arrows_nb, int requeste
|
||||||
if (address >= 0 && current_weight != requested_weight)
|
if (address >= 0 && current_weight != requested_weight)
|
||||||
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z);
|
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z);
|
||||||
|
|
||||||
if (! TEST && address >= 0 && current_weight == requested_weight) show_arrows_array(arrows, arrows_nb, x, y, z);
|
// if (! TEST && address >= 0 && current_weight == requested_weight) show_arrows_array(arrows, arrows_nb, x, y, z);
|
||||||
|
|
||||||
if (! TEST && address == -1 && requested_weight == 0) show_arrows_array(arrows, arrows_nb, x, y, z);
|
// if (! TEST && address == -1 && requested_weight == 0) show_arrows_array(arrows, arrows_nb, x, y, z);
|
||||||
|
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
|
@ -867,7 +860,7 @@ static void show_user_action(struct arrow_t *arrows, int arrows_nb, int address,
|
||||||
*
|
*
|
||||||
* Draws space and arrows
|
* Draws space and arrows
|
||||||
*/
|
*/
|
||||||
void main_test_graphics (void)
|
void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
{
|
{
|
||||||
// assert : space dimensions (x,y,z) > 0 TODO NOT checked before init
|
// assert : space dimensions (x,y,z) > 0 TODO NOT checked before init
|
||||||
// assert : arrows localization within space and sites TODO NOT checked when invoking set_arrow()
|
// assert : arrows localization within space and sites TODO NOT checked when invoking set_arrow()
|
||||||
|
@ -879,88 +872,74 @@ void main_test_graphics (void)
|
||||||
int rand(void);
|
int rand(void);
|
||||||
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
||||||
|
|
||||||
int arbitrary = 500;
|
int arbitrary = 20;
|
||||||
int space_X = 1 + rand() % arbitrary,
|
int space_X = 1 + rand() % arbitrary,
|
||||||
space_Y = 1 + rand() % arbitrary,
|
space_Y = 1 + rand() % arbitrary,
|
||||||
space_Z = 1 + rand() % arbitrary;
|
space_Z = 1 + rand() % arbitrary;
|
||||||
int density_max = space_X * space_Y * space_Z;
|
int density_max = space_X * space_Y * space_Z;
|
||||||
int arrows_nb = 0;
|
int arrows_nb = 0;//rand() % density_max;
|
||||||
int pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
int pref_show_grids = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
||||||
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
||||||
|
int weight = 0, site = 0,
|
||||||
/* arrows = g_malloc0(arrows_nb * sizeof(struct arrow_t)); */
|
stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;
|
||||||
|
|
||||||
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 0);
|
|
||||||
|
|
||||||
// WARNING arrows with same address will be drawn superimposed
|
|
||||||
/* if (arrows_nb > 0) */
|
|
||||||
/* for (int i = 0; i < arrows_nb; i ++) { */
|
|
||||||
/* arrows[i].load = 1 + rand() % arbitrary; */
|
|
||||||
/* arrows[i].site = rand() % 6; */
|
|
||||||
/* arrows[i].x = rand() % space_X; */
|
|
||||||
/* arrows[i].y = rand() % space_Y; */
|
|
||||||
/* arrows[i].z = rand() % space_Z; */
|
|
||||||
/* }; */
|
|
||||||
|
|
||||||
// forget the next two lines during the random tests
|
|
||||||
// arrows[] = {... some values ...}
|
|
||||||
// int arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5;
|
|
||||||
|
|
||||||
/* GRID */
|
|
||||||
grid_write_intersections (space_X, space_Y, space_Z);
|
|
||||||
if (pref_show_grids % 2 == 0) grid_write_x (space_X, space_Y, space_Z);
|
|
||||||
if (pref_show_grids % 3 == 0) grid_write_y (space_X, space_Y, space_Z);
|
|
||||||
if (pref_show_grids % 5 == 0) grid_write_z (space_X, space_Y, space_Z);
|
|
||||||
if (pref_show_grids > 0) grid_write_ridges (space_X, space_Y, space_Z);
|
|
||||||
int offset_after_grids = buffer_vertex_size / 3;
|
int offset_after_grids = buffer_vertex_size / 3;
|
||||||
int buffer_lines_size_after_cubes = buffer_lines_size;
|
int buffer_lines_size_after_cubes = buffer_lines_size;
|
||||||
int offset_up_to_this_cube_coords = 0, x, y, z;
|
int offset_up_to_this_cube_coords = 0, x, y, z;
|
||||||
|
|
||||||
|
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0);
|
||||||
|
|
||||||
|
long offset_vertex = 0, offset_colors = 0, offset_lines = 0;
|
||||||
|
write_space_ridges (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
|
||||||
|
|
||||||
|
offset_vertex = 8, offset_colors = 8, offset_lines = 12;
|
||||||
|
write_space_faces_grids (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, 0);
|
||||||
|
|
||||||
/* ARROWS */
|
/* ARROWS */
|
||||||
/* NB The 12 vertices required to draw 6 arrows in each cube
|
/* NB The 12 vertices required to draw 6 arrows in each cube
|
||||||
* are always defined (whether arrows are drawn or not). */
|
* are always defined (whether arrows are drawn or not). */
|
||||||
/* Therefore: if (arrows_nb > 0) is not required (next line) */
|
/* Therefore: if (arrows_nb > 0) is not required (next line) */
|
||||||
arrows_write_terminations (space_X, space_Y, space_Z);
|
/* arrows_write_terminations (space_X, space_Y, space_Z); */
|
||||||
|
|
||||||
for (int k = 0; k < arbitrary; k++)
|
/* volatile int remaining = arbitrary; */
|
||||||
arrows_nb = set_arrow (arrows, arrows_nb,
|
/* while (remaining) { */
|
||||||
rand() % arbitrary, // load / weight
|
/* for (int l = 0; l < 10; l++) { */
|
||||||
rand() % 6, // site,
|
/* arrows_nb = set_arrow (arrows, arrows_nb, */
|
||||||
rand() % space_X, // x
|
/* rand() % arbitrary, // load / weight */
|
||||||
rand() % space_Y, // y
|
/* rand() % 6, // site, */
|
||||||
rand() % space_Z); // z
|
/* rand() % space_X, // x */
|
||||||
|
/* rand() % space_Y, // y */
|
||||||
|
/* rand() % space_Z); // z */
|
||||||
|
/* } */
|
||||||
|
/* remaining -= 10; */
|
||||||
|
|
||||||
// ligne suivante inutile: < ce sont les sous-fonctions de set_arrow() qui appellent
|
/* for (int i = 0; i < arrows_nb; i++) { */
|
||||||
// show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 1);
|
/* weight = arrows[i].load; */
|
||||||
|
/* site = arrows[i].site; */
|
||||||
|
/* x = arrows[i].x; */
|
||||||
|
/* y = arrows[i].y; */
|
||||||
|
/* z = arrows[i].z; */
|
||||||
|
|
||||||
int weight = 0, site = 0,
|
/* offset_up_to_this_cube_coords = 12 * (stx * x + sty * y + stz * z); */
|
||||||
stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;
|
/* arrow_offset = offset_after_grids + offset_up_to_this_cube_coords; */
|
||||||
|
|
||||||
if (arrows_nb > 0)
|
/* arrows_write_basis (arrow_offset); */
|
||||||
for (int i = 0; i < arrows_nb; i++) {
|
|
||||||
weight = arrows[i].load;
|
|
||||||
site = arrows[i].site;
|
|
||||||
x = arrows[i].x;
|
|
||||||
y = arrows[i].y;
|
|
||||||
z = arrows[i].z;
|
|
||||||
|
|
||||||
offset_up_to_this_cube_coords = 12 * (stx * x + sty * y + stz * z);
|
/* switch(site){ */
|
||||||
arrow_offset = offset_after_grids + offset_up_to_this_cube_coords;
|
/* case EAST: case WEST: write_arrow_lines_east_west (arrow_offset, weight, site); break; */
|
||||||
|
/* case ZENITH: case NADIR: write_arrow_lines_zenith_nadir (arrow_offset, weight, site); break; */
|
||||||
|
/* case SOUTH: case NORTH: write_arrow_lines_south_north (arrow_offset, weight, site); break; */
|
||||||
|
/* default: break; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
|
||||||
arrows_write_basis (arrow_offset);
|
/* free(arrows); */
|
||||||
|
/* arrows = NULL; */
|
||||||
|
/* arrows_nb = 0; */
|
||||||
|
/* if (TEST) printf("\nCreated %d arrows", arbitrary - remaining); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
switch(site){
|
/* show_buffers_states(space_X, space_Y, space_Z, arrows_nb, */
|
||||||
case EAST: case WEST: write_arrow_lines_east_west (arrow_offset, weight, site); break;
|
/* offset_after_grids, buffer_vertex_size, */
|
||||||
case ZENITH: case NADIR: write_arrow_lines_zenith_nadir (arrow_offset, weight, site); break;
|
/* buffer_lines_size_after_cubes, buffer_lines_size); */
|
||||||
case SOUTH: case NORTH: write_arrow_lines_south_north (arrow_offset, weight, site); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(arrows);
|
|
||||||
|
|
||||||
show_buffers_states(space_X, space_Y, space_Z, arrows_nb,
|
|
||||||
offset_after_grids, buffer_vertex_size,
|
|
||||||
buffer_lines_size_after_cubes, buffer_lines_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,136 @@
|
||||||
|
|
||||||
#include "../../include/base.h"
|
#include "../../include/base.h"
|
||||||
#include "../../include/graphics.h"
|
#include "../../include/graphics.h"
|
||||||
|
|
||||||
|
void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z)
|
||||||
|
{
|
||||||
|
float max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
|
graphics_write_vertex (- x / max, - y / max, - z / max);
|
||||||
|
|
||||||
|
graphics_write_vertex (+ x / max, - y / max, - z / max);
|
||||||
|
graphics_write_vertex (- x / max, + y / max, - z / max);
|
||||||
|
graphics_write_vertex (- x / max, - y / max, + z / max);
|
||||||
|
|
||||||
|
graphics_write_vertex (+ x / max, + y / max, - z / max);
|
||||||
|
graphics_write_vertex (+ x / max, - y / max, + z / max);
|
||||||
|
graphics_write_vertex (- x / max, + y / max, + z / max);
|
||||||
|
|
||||||
|
graphics_write_vertex (+ x / max, + y / max, + z / max);
|
||||||
|
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
graphics_write_color (0.9f, 0.4f, 0.2f);
|
||||||
|
|
||||||
|
graphics_write_line ( 0, 1); graphics_write_line ( 7, 4);
|
||||||
|
graphics_write_line ( 0, 2); graphics_write_line ( 7, 5);
|
||||||
|
graphics_write_line ( 0, 3); graphics_write_line ( 7, 6);
|
||||||
|
|
||||||
|
graphics_write_line ( 1, 4); graphics_write_line ( 2, 4);
|
||||||
|
graphics_write_line ( 1, 5); graphics_write_line ( 3, 5);
|
||||||
|
graphics_write_line ( 2, 6); graphics_write_line ( 3, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_space_faces_grids (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
|
||||||
|
{
|
||||||
|
float i, max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
|
if (style) for (i = 1; i < x; i++) {
|
||||||
|
|
||||||
|
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, - z / max);
|
||||||
|
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, z / max);
|
||||||
|
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, z / max);
|
||||||
|
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, - z / max);
|
||||||
|
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (style) for (i = 0; i < x; i ++) {
|
||||||
|
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (style) offset_vertex += (x - 1) * 4;
|
||||||
|
if (style) offset_colors += (x - 1) * 4;
|
||||||
|
|
||||||
|
for (i = 1; i < y; i++) {
|
||||||
|
|
||||||
|
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, - z / max);
|
||||||
|
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, z / max);
|
||||||
|
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, z / max);
|
||||||
|
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, - z / max);
|
||||||
|
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < y - 1; i ++) {
|
||||||
|
|
||||||
|
if (style)
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
offset_vertex += (y - 1) * 4;
|
||||||
|
offset_colors += (y - 1) * 4;
|
||||||
|
|
||||||
|
for (i = 1; i < z; i++) {
|
||||||
|
|
||||||
|
graphics_write_vertex (- x / max, - y / max, (2 * i / z - 1) * z / max);
|
||||||
|
graphics_write_vertex (- x / max, y / max, (2 * i / z - 1) * z / max);
|
||||||
|
graphics_write_vertex ( x / max, y / max, (2 * i / z - 1) * z / max);
|
||||||
|
graphics_write_vertex ( x / max, - y / max, (2 * i / z - 1) * z / max);
|
||||||
|
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= z; i ++) {
|
||||||
|
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
|
if (style)
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes grid lines intersections to vertex and color buffers
|
* Writes grid lines intersections to vertex and color buffers
|
||||||
|
@ -47,7 +177,7 @@ void grid_write_intersections (long x, long y, long z)
|
||||||
vz = (2 * k / z - 1) * z / max;
|
vz = (2 * k / z - 1) * z / max;
|
||||||
|
|
||||||
graphics_write_vertex (vx, vy, vz);
|
graphics_write_vertex (vx, vy, vz);
|
||||||
graphics_write_color (0.64f,0.64f,0.64f);
|
// graphics_write_color (0.64f,0.64f,0.64f);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +188,20 @@ void grid_write_intersections (long x, long y, long z)
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void grid_write_ridges (long x,
|
void grid_write_marks (long x, long y, long z)
|
||||||
long y,
|
{
|
||||||
long z)
|
long step_x = (z + 1) * (y + 1), step_y = z + 1, step_z = 1;
|
||||||
|
int delta = 1.0f;
|
||||||
|
for (int i=1; i < z; i ++) {
|
||||||
|
// graphics_write_vertex (delta, delta, i); graphics_write_vertex (delta, - delta, i);
|
||||||
|
// graphics_write_color (0.3f,0.3f,0.3f); graphics_write_color (0.3f,0.3f,0.3f);
|
||||||
|
// graphics_write_line (0, step_z * z + step_y * y + step_x * x);
|
||||||
|
graphics_write_line ( i * step_z, i * step_z + x);
|
||||||
|
// graphics_write_line ( i * step_z, i * step_z + y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void grid_write_ridges (long x, long y, long z)
|
||||||
{
|
{
|
||||||
long step_x = (z + 1) * (y + 1),
|
long step_x = (z + 1) * (y + 1),
|
||||||
step_y = z + 1,
|
step_y = z + 1,
|
||||||
|
|
Loading…
Reference in New Issue