Compare commits
27
Commits
klein
...
crisel-nuklear
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b83f0f07e3
|
||
|
|
52aa9d4ac2
|
||
|
|
bc537cf9f2 | ||
|
|
533109fbcd
|
||
|
|
3997613d16
|
||
|
|
f21121b88d
|
||
|
|
86480fe9b1
|
||
|
|
e9bd748dd8
|
||
|
|
ad4f5cb077
|
||
|
|
a08b17e975
|
||
|
|
d97a35b898
|
||
|
|
b2f6707efc
|
||
|
|
7344c6bfcb
|
||
|
|
b928dcd82d
|
||
|
|
f687117fed
|
||
|
|
81eb79662e | ||
|
|
d2e2c6eef7 | ||
|
|
57091d3408 | ||
|
|
6d1223d79e | ||
|
|
3e3c6e676e | ||
|
|
f33b8f67b5 | ||
|
|
eb59f5346a
|
||
|
|
ee144f2286
|
||
|
|
56339e9e10 | ||
|
|
03796fdaff
|
||
|
|
46869cbcde
|
||
|
|
25df66b5f8 |
No files matched your search
@@ -9,29 +9,24 @@ OBJ = \
|
|||||||
src/input.o \
|
src/input.o \
|
||||||
src/load.o \
|
src/load.o \
|
||||||
src/mesh.o \
|
src/mesh.o \
|
||||||
|
src/gui.o \
|
||||||
src/main.o
|
src/main.o
|
||||||
|
|
||||||
EXAMPLES = \
|
EXAMPLES = \
|
||||||
example/basic.o
|
example/basic \
|
||||||
|
example/riemman \
|
||||||
|
example/n-cube \
|
||||||
|
example/n-hilbert-cube \
|
||||||
|
example/lens
|
||||||
|
|
||||||
CFLAGS = \
|
CFLAGS = \
|
||||||
-I./ext/cglm/include \
|
-I./ext/cglm/include \
|
||||||
-I./ext/glfw/include \
|
-I./ext/glfw/include \
|
||||||
-I./ext/glad \
|
-I./ext/glad \
|
||||||
|
-I./ext/nuklear \
|
||||||
-I./include \
|
-I./include \
|
||||||
-Wall -Wno-unused-function -std=c99 -D_GNU_SOURCE \
|
-Wall -Wno-unused-function -std=c99 -D_GNU_SOURCE \
|
||||||
|
|
||||||
WAYLAND-LIB = \
|
|
||||||
xdg-shell \
|
|
||||||
relative-pointer-unstable-v1 \
|
|
||||||
xdg-decoration-unstable-v1 \
|
|
||||||
pointer-constraints-unstable-v1 \
|
|
||||||
viewporter \
|
|
||||||
idle-inhibit-unstable-v1 \
|
|
||||||
fractional-scale-v1 \
|
|
||||||
xdg-activation-v1 \
|
|
||||||
wayland
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage:"
|
@echo "Usage:"
|
||||||
@echo " $(MAKE) windows"
|
@echo " $(MAKE) windows"
|
||||||
@@ -39,6 +34,8 @@ help:
|
|||||||
@echo " $(MAKE) linux-wayland"
|
@echo " $(MAKE) linux-wayland"
|
||||||
@echo " $(MAKE) cocoa"
|
@echo " $(MAKE) cocoa"
|
||||||
@echo " $(MAKE) CC=emcc wasm"
|
@echo " $(MAKE) CC=emcc wasm"
|
||||||
|
@echo "Examples"
|
||||||
|
@echo " $(MAKE) examples"
|
||||||
@echo "Clean"
|
@echo "Clean"
|
||||||
@echo " $(MAKE) clean"
|
@echo " $(MAKE) clean"
|
||||||
|
|
||||||
@@ -54,11 +51,11 @@ glfw.dll:
|
|||||||
# LINUX
|
# LINUX
|
||||||
linux-wayland: $(OBJ)
|
linux-wayland: $(OBJ)
|
||||||
cd ext; $(MAKE) -f glfw.mk linux-wayland; cd -
|
cd ext; $(MAKE) -f glfw.mk linux-wayland; cd -
|
||||||
$(CC) -o $(BIN) $(OBJ) ext/libglfw.a -lGL -lm
|
$(CC) -o $(BIN) $(OBJ) ext/libglfw.a -lm
|
||||||
|
|
||||||
linux-x11: $(OBJ)
|
linux-x11: $(OBJ)
|
||||||
cd ext; $(MAKE) -f glfw.mk linux-x11; cd -
|
cd ext; $(MAKE) -f glfw.mk linux-x11; cd -
|
||||||
$(CC) -o $(BIN) $(OBJ) ext/libglfw.a -lGL -lm
|
$(CC) -o $(BIN) $(OBJ) ext/libglfw.a -lm
|
||||||
|
|
||||||
cocoa: $(OBJ)
|
cocoa: $(OBJ)
|
||||||
cd ext; $(MAKE) -f glfw.mk cocoa; cd -
|
cd ext; $(MAKE) -f glfw.mk cocoa; cd -
|
||||||
@@ -68,11 +65,8 @@ wasm: $(OBJ)
|
|||||||
$(CC) -sUSE_WEBGL2=1 -sUSE_GLFW=3 -o $(BIN).html $(OBJ)
|
$(CC) -sUSE_WEBGL2=1 -sUSE_GLFW=3 -o $(BIN).html $(OBJ)
|
||||||
chmod -x $(BIN).wasm
|
chmod -x $(BIN).wasm
|
||||||
|
|
||||||
libglfw.so:
|
|
||||||
$(CC) -fPIC -shared $(DFLAGS) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(OBJ) $(BIN)
|
rm $(OBJ) $(BIN) $(EXAMPLES)
|
||||||
cd ext; $(MAKE) -f glfw.mk clean; cd -
|
cd ext; $(MAKE) -f glfw.mk clean; cd -
|
||||||
|
|
||||||
|
|
||||||
@@ -82,3 +76,6 @@ examples: $(EXAMPLES)
|
|||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -Wno-implicit-function-declaration $(CFLAGS) -c -o $@ $<
|
$(CC) -Wno-implicit-function-declaration $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
.c:
|
||||||
|
$(CC) -I include -o $@ $< -lm
|
||||||
@@ -1,92 +1,62 @@
|
|||||||
# Manigraph: Graficadora de variedades
|
# Manigraph
|
||||||
Diaz Camacho Pedro Emilio
|
Manigraph is a cutting-edge tool for multidimentional surface visualization,
|
||||||
|
capable of handling over a hundred dimensions. It allows users to interactively
|
||||||
|
explore each dimension in an intuitive and dynamic way.
|
||||||
|
Import your .klein files, which represents multidimentional surface.
|
||||||
|
|
||||||
# Resumen
|
# Building
|
||||||
manigraph es un graficador interactiva de variedades que lee archivos binarios, con la información de
|
Manigraph is written in C99, and uses OpenGL 2.0 for the rendering. So you just
|
||||||
una variedad multidimensional y grafica esta variedad en una proyección tridimensional.
|
need a C compiler to build this project.
|
||||||
|
|
||||||
# Dependencias
|
## Source code
|
||||||
Para poder compilar el proyecto hace falta lo siguiente.
|
|
||||||
## Programas
|
|
||||||
- `cc`: Cualquier compilador de C.
|
|
||||||
- `git`: Gestor de dependencias. (Opcional)
|
|
||||||
- `make`: Herramienta para compilar automáticamente. (Opcional)
|
|
||||||
|
|
||||||
## Librerías
|
|
||||||
- `openGL`: A cross-platform API for rendering 2D and 3D graphics. (no incluida)
|
|
||||||
- `glew`: The OpenGL Extension Wrangler Library (no incluida)
|
|
||||||
- `glfw`: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input.
|
|
||||||
- `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C.
|
|
||||||
### Linux
|
|
||||||
Para compilar `glfw` en linux hacen falta las siguientes librerías. (no incluidas)
|
|
||||||
- `x11`: libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
|
||||||
- `wayland`: libwayland-dev libxkbcommon-dev wayland-protocols
|
|
||||||
|
|
||||||
# Descargas
|
|
||||||
- [git](https://git-scm.com/downloads/win)
|
|
||||||
- [MinGW](https://github.com/niXman/mingw-builds-binaries/releases)
|
|
||||||
- [glew](https://glew.sourceforge.net/)
|
|
||||||
|
|
||||||
# Clonar el código fuente
|
|
||||||
```
|
```
|
||||||
git clone https://gitea.adles.top/software/manigraph.git
|
git clone https://gitea.axiolutions.top/software/manigraph.git
|
||||||
cd manigraph
|
cd manigraph
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
# Compilación
|
## Dependecies
|
||||||
Para compilar manualmente el proyecto se puede usar `make` o ejecutar los comandos manualmente
|
You may need system specific dependecies to build *Manigraph*.
|
||||||
en el código fuente de `manigraph`.
|
[Reference](https://www.glfw.org/docs/3.3/compile.html#compile_deps)
|
||||||
|
|
||||||
## Make
|
### Linux
|
||||||
Los siguientes comandos sirven para compilar `manigraph` deacuerdo al sistema operativo.
|
- `x11`: libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||||
|
- `wayland`: libwayland-dev libxkbcommon-dev wayland-protocols
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
A C compiler is needed for building *Manigraph*. and any of those commands
|
||||||
|
|
||||||
```
|
```
|
||||||
make windows
|
make windows
|
||||||
|
./compile.bat
|
||||||
make linux-x11
|
make linux-x11
|
||||||
make linux-wayland
|
make linux-wayland
|
||||||
make cocoa
|
make cocoa
|
||||||
|
make CC=emcc wasm
|
||||||
```
|
```
|
||||||
|
|
||||||
## Manualmente
|
# Flow of Manigraph
|
||||||
se pueden compilar el proyecto manualmente sin necesidad del programa `make`.
|

|
||||||
|
|
||||||
### GLFW
|
# Design
|
||||||
Si tienes problemas compilando `GLFW` puedes checar su página web oficial
|
Manigraph is a program designed with sustainability in mind. It is built to be
|
||||||
explicando el tema: [Compiling GLFW](https://www.glfw.org/docs/3.3/compile.html).
|
portable, resource-efficient, and easy to maintain and scale. The program
|
||||||
|
follows a Data-Oriented Programming (DOP) paradigm, where each file is
|
||||||
|
responsible for a specific data type and manages its own dependencies. Each
|
||||||
|
function is named after the file it resides in, ensuring a clear organization
|
||||||
|
and structure.
|
||||||
|
|
||||||
#### Windows
|
The independence of data types allows for efficient scaling and maintenance.
|
||||||
```
|
The main file is a special case in this design: it is responsible for combining
|
||||||
cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll -lgdi32
|
all the data types in a comprehensive manner, actng as the workflow of the program.
|
||||||
```
|
|
||||||
|
|
||||||
#### Linux
|
# Contributing
|
||||||
```
|
Before commiting use `clang-format`, for coding style consistency. Your
|
||||||
cc -fPIC -shared -D_GLFW_X11 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
contribution must be whitin the design principles and the concept of Manigraph.
|
||||||
cc -fPIC -shared -D_GLFW_WAYLAND -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Mac
|
The following diagram illustrates the relationships between files, showing how
|
||||||
```
|
they are connected through dependencies. It also highlights the scenarios where
|
||||||
cc -fPIC -shared -D_GLFW_COCOA -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
files are not independent of one another,
|
||||||
```
|
|
||||||
|
|
||||||
### Manigraph
|

|
||||||
#### Windows
|
|
||||||
```
|
|
||||||
cc -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lopengl32 -lglew32
|
|
||||||
```
|
|
||||||
#### Linux
|
|
||||||
```
|
|
||||||
cc -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lGL -lGLEW
|
|
||||||
```
|
|
||||||
#### Mac
|
|
||||||
```
|
|
||||||
cc -framework GL -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lGLEW
|
|
||||||
```
|
|
||||||
|
|
||||||
# Ejecutar
|
|
||||||
En linux se puede ejecutar el programa sin instalar la libreria de glfw usando:
|
|
||||||
```
|
|
||||||
LD_LIBRARY_PATH=. ./manigraph
|
|
||||||
```
|
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
:: git submodule update --init --recursive
|
:: git submodule update --init --recursive
|
||||||
:: gcc -fPIC -shared -Iext/glfw/deps/MinGW -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll -lgdi32
|
:: gcc -fPIC -shared -Iext/glfw/deps/MinGW -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll -lgdi32
|
||||||
gcc -I ext/cglm/include -I ext/glfw/include src/*.c -o manigraph -L . -lglfw -lopengl32 -lglew32
|
gcc -I ext/glad -I ext/cglm/include -I ext/nuklear -I ext/glfw/include src/*.c ext/glad/glad.c -o manigraph -L . -lglfw -lopengl32
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
# Estructura de archivos
|
|
||||||
Díaz Camacho Pedro Emilio
|
|
||||||
|
|
||||||
# Headers
|
|
||||||
## main.h
|
|
||||||
Este archivo incluye los prototipos internos, que va a usar el programa
|
|
||||||
funge como api interna para los desarrolladores y debe estar bien documentada.
|
|
||||||
|
|
||||||
# codigo fuente
|
|
||||||
|
|
||||||
## main.c
|
|
||||||
Este archivo debe configurar el programa antes de iniciarse, avisar de los problemas
|
|
||||||
que eviten que el programa se ejecute correctamente, iniciar y terminar los objetos que use el
|
|
||||||
programa, así como ejecutar la función principal
|
|
||||||
### Depende de
|
|
||||||
- <GL/gl.h>
|
|
||||||
|
|
||||||
## context.c
|
|
||||||
En este archivo se escoge un color para limpiar la pantalla y tiene una función para limpiar
|
|
||||||
tanto lo dibujado en pantalla, como distintos buffers gráficos.
|
|
||||||
### Depende de
|
|
||||||
- <GL/gl.h>
|
|
||||||
|
|
||||||
## input.c
|
|
||||||
Incluye la función `poll_input`, que se ejecuta en cada ciclo del programa y devuelve un
|
|
||||||
cuaternion de tipo `float *` que representa la rotación total del cubo, después de interactuar
|
|
||||||
con el programa.
|
|
||||||
### Depende de
|
|
||||||
- <GLFW/glfw3.h>
|
|
||||||
- <cglm/quat.h>
|
|
||||||
|
|
||||||
## matrix.c
|
|
||||||
Incluye las funciónes para configurar y cargar en la GPU las 3 matrices principales.
|
|
||||||
- `fix_matrix` esta matriz no cambia y se usa para configurar la perspectiva y la vista que
|
|
||||||
va a usar el programa en todo momento.
|
|
||||||
- `mdl_matrix` esta matriz depende de cada mesh y describe la rotación única de cada objeto,
|
|
||||||
se usa para rotar los ejes ortogonamente con un indice.
|
|
||||||
- `rot_matrix` esta matriz describe la rotación total de todos los objetos y se configura con
|
|
||||||
un cuaternio
|
|
||||||
### Depende de
|
|
||||||
- <cglm/mat4.h>
|
|
||||||
- <cglm/cam.h>
|
|
||||||
- <cglm/quat.h>
|
|
||||||
|
|
||||||
## mesh.c
|
|
||||||
Este archivo se usa para crear, destruir y dibujar objetos de tipo `mesh`, un `mesh` es una
|
|
||||||
colección de triángulos que describen un objeto multidimensional.
|
|
||||||
### Depende de
|
|
||||||
- <GL/gl.h>
|
|
||||||
- <stdlib.h>
|
|
||||||
|
|
||||||
## shader.c
|
|
||||||
Debe crear, destruir y usar los shaders, estos shaders son programas para la gpu escritos en glsl para
|
|
||||||
además aquí se carga memoria en gpu con las funciónes `gload_`
|
|
||||||
### Depende de
|
|
||||||
- <GL/gl.h>
|
|
||||||
|
|
||||||
## texture.c
|
|
||||||
Debe cargar, usar y destruir las texturas, que va a usar la gpu, también crea una textura
|
|
||||||
para una paleta de colores definida, esto para manipular fácilmente los colores que usará el programa.
|
|
||||||
### Depende de
|
|
||||||
- <GL/gl.h>
|
|
||||||
|
|
||||||
## window.c
|
|
||||||
Crea, usa, limpie y cierra una ventana, una ventana tiene un contexto de OpenGL asociado para poder
|
|
||||||
dibujar objetos en ella, tiene una función especial para avisar si la ventana está abierta para
|
|
||||||
dibujar.
|
|
||||||
### Depende de
|
|
||||||
- <GLFW/glfw3.h>
|
|
||||||
|
|
||||||
# Datos
|
|
||||||
## data/cube.h
|
|
||||||
Aquí esta la información del mesh de un cubo, este se va a borrar cuando podamos
|
|
||||||
importar meshes para graficarlos.
|
|
||||||
|
|
||||||
## data/axis.h
|
|
||||||
Aquí está el mesh de un solo eje, este se va a rotar para hacer los otros 2 ejes.
|
|
||||||
|
|
||||||
## data/shaders.h
|
|
||||||
Aquí estan los shaders en glsl para dibujar en pantalla
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# Tipos de datos del proyecto
|
|
||||||
Díaz Camacho Pedro Emilio
|
|
||||||
|
|
||||||
# Introducción
|
|
||||||
En este archivo vamos a detallar los tipos de datos únicos del programa, estos
|
|
||||||
tipos de datos son estructuras que representan objetos computacionales y son
|
|
||||||
necesarios para integrar las distintas partes del programa.
|
|
||||||
|
|
||||||
## window_t
|
|
||||||
En `window.c` tenemos una estructura que es la ventana y esta se representa por `window_t`,
|
|
||||||
este tipo de dato es un pointer que es manejado por `glfw`.
|
|
||||||
|
|
||||||
## id_t
|
|
||||||
`id_t` es un tipo de dato que representa objetos de `OpenGL`, estos datos
|
|
||||||
normalmente vienen enumerados, y en `manigraph` se usan para representar `shaders`,
|
|
||||||
`programs` y `texture`.
|
|
||||||
|
|
||||||
## mesh_t
|
|
||||||
Este es un tipo de dato usado para interactuar con `mesh.c`, este representa la triangulación de un
|
|
||||||
objeto gráfico y funciona ocultando las variables que `OpenGL` necesita en un `void *`.
|
|
||||||
|
|
||||||
## mat4_t
|
|
||||||
`mat4_t` se usará para representar las matrices, se usará este tipo de dato exclusivamente
|
|
||||||
en `matrix.c` y funcionará con el tipo de dato `mat4` de `cglm`.
|
|
||||||
|
|
||||||
## quat_t
|
|
||||||
Este tipo de dato sirve para representar un quaternio, este quaternio representa la rotación
|
|
||||||
del objeto gráficado en la proyección tridimensional, y se usará para crear una matriz que
|
|
||||||
pueda entender `glsl`.
|
|
||||||
|
|
||||||
## narray
|
|
||||||
`narray` es un tipo de dato que funciona como un `array` enumerado, esto significa que el primer
|
|
||||||
elemento del `array` dice cuantos elementos tiene este, sin contar el primer elemento, y los demas elementos
|
|
||||||
funcionan como un `array` normal.
|
|
||||||
|
|
||||||
esta estructura nos ayuda a trabajar con arrays de tamaños arbitrario de forma óptima y sin tener que marcar el
|
|
||||||
último elemento de forma especial.
|
|
||||||
|
|
||||||
### narray_u8_t
|
|
||||||
es un `narray` para `char` y `unsigned char`.
|
|
||||||
### narray_float_t
|
|
||||||
es un `narray` para `float`.
|
|
||||||
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# Manual de Diseño
|
|
||||||
Diaz Camacho Pedro Emilio
|
|
||||||
|
|
||||||
# Objetivos
|
|
||||||
## Prioridad alta
|
|
||||||
- [ ] El programa debe actualizarse cuando interactuan con el.
|
|
||||||
- [ ] El usuario quiere:
|
|
||||||
- [X] Ver 3 ejes en todo momento.
|
|
||||||
- [ ] Ver que ejes esta viendo.
|
|
||||||
- [ ] Ver cuantos ejes hay.
|
|
||||||
- [X] El usuario quiere:
|
|
||||||
- [X] Rotar estos ejes,
|
|
||||||
- [X] Ver donde quedan los ejes despues de la rotados.
|
|
||||||
- [ ] El usuario experimentado quiere ejecutar el programa y pasar la variedad:
|
|
||||||
- [ ] Como argumento del programa.
|
|
||||||
- [ ] Desde la entrada estandar del programa.
|
|
||||||
|
|
||||||
## Prioridad media
|
|
||||||
|
|
||||||
- [ ] El usuario quiere:
|
|
||||||
- [ ] Cambiar los ejes que se ven por pares.
|
|
||||||
- [ ] Cambiar los ejes donde esta la informacion de los ejes.
|
|
||||||
- [ ] El usuario quiere interactuar con el programa:
|
|
||||||
- [ ] Usando solo el mouse.
|
|
||||||
- [ ] Usando solo el teclado.
|
|
||||||
|
|
||||||
## Prioridad baja
|
|
||||||
- [ ] El usuario quiere guardar las transformaciones como un archivo GIF.
|
|
||||||
|
|
||||||
# Camino
|
|
||||||
|
|
||||||
0. Graficadora de un cubo.
|
|
||||||
1. Se hace un programa que muestre un cubo.
|
|
||||||
1. Se muestran los 3 ejes del cubo
|
|
||||||
1. Se rota el cubo en sus 3 ejes usando el teclado.
|
|
||||||
1. Se rota el cubo en sus 3 ejes usando el mouse.
|
|
||||||
1. Se muestran la etiqueta de los ejes.
|
|
||||||
1. Se hace el formato de objetos multidimensionales.
|
|
||||||
0. Programa ejemplo
|
|
||||||
1. Se hace un programa que divida un cuadrado en triangulos.
|
|
||||||
1. Se mapea cada vertice del triangulo en un punto de la cinta de
|
|
||||||
mobius usando una parametrizacion
|
|
||||||
1. Se mapea cada vertice del triangulo en un punto de la botella de
|
|
||||||
klein usando una parametrizacion
|
|
||||||
1. Se divide cada lado de un cubo de n dimensiones, en triangulos.
|
|
||||||
|
|
||||||
0. Graficadora de variedades
|
|
||||||
1. Se generaliza el programa para usar este formato.
|
|
||||||
1. Se muestran la informacion de los ejes mostrados y cuantos hay.
|
|
||||||
1. Se pueden cambiar los ejes por pares
|
|
||||||
1. Usando el mouse.
|
|
||||||
1. Usando el teclado.
|
|
||||||
0. Detalles.
|
|
||||||
1. Se anima el cambio de eje.
|
|
||||||
1. Se hace el generador de GIF.
|
|
||||||
1. Se puede cambiar el shader
|
|
||||||
1. Documentacion
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Problemas esperados al desarrollar
|
|
||||||
Diaz Camacho Pedro Emilio
|
|
||||||
|
|
||||||
## OpenGL esperan objetos tridimensionales, no de n dimensiones.
|
|
||||||
|
|
||||||
Usando glVertexAttribPointer podemos pasar las coordenadas que
|
|
||||||
queramos de los puntos de las variedades, y con ello usar objetos 3D en
|
|
||||||
el shader.
|
|
||||||
|
|
||||||
## Rotar ejes por pares en una animacion continua.
|
|
||||||
- Con glVertexAttribPointer podemos pasar las coordenadas del eje
|
|
||||||
seleccionado, al shader.
|
|
||||||
- Con la funcion mix del shader y bloqueando el input, podemos hacer
|
|
||||||
una animacion pasando una variable con la cpu.
|
|
||||||
- Cuando la animacion termine intercambiar los indices del layout,
|
|
||||||
usando glVertexAttribPointer otra vez.
|
|
||||||
|
|
||||||
## Volumen de la variedad.
|
|
||||||
Dado que la funcion parametrizadora es continua, mandamos la frontera
|
|
||||||
de un n-cubo a la frontera de una variedad, por lo que solo basta
|
|
||||||
graficar la frontera de la variedad.
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Manual de usario para Manigraph
|
|
||||||
Manigraph es un graficador interactivo de variedades que lee archivos
|
|
||||||
binarios de una variedad multidimensional y los proyecta a 3 dimensiones.
|
|
||||||
|
|
||||||
# Glosario
|
|
||||||
Llamaremos a los 3 ejes de la proyección tridimensional `X`, `Y` y `Z`,
|
|
||||||
este sistema de coordenadas es derecho con el eje `Z` apuntando afuera de la pantalla
|
|
||||||
|
|
||||||
# Controles
|
|
||||||
## Teclado
|
|
||||||
- `Q` Rota el eje `X` de forma horaria.
|
|
||||||
- `W` Rota el eje `X` de forma antihoraria.
|
|
||||||
- `A` Rota el eje `Y` de forma horaria.
|
|
||||||
- `S` Rota el eje `Y` de forma antihoraria.
|
|
||||||
- `Z` Rota el eje `Z` de forma horaria.
|
|
||||||
- `X` Rota el eje `Z` de forma antihoraria.
|
|
||||||
## Mouse
|
|
||||||
- Hacer `click` en un eje lo selecciona.
|
|
||||||
- El `scroll` del mouse hace girar al eje seleccionado.
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024.1997862712624 780.4323630001875" width="2048.3995725425248" height="1560.864726000375" filter="invert(93%) hue-rotate(180deg)">
|
||||||
|
<!-- svg-source:excalidraw -->
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<style class="style-fonts">
|
||||||
|
@font-face { font-family: Excalifont; src: url(data:font/woff2;base64,d09GMgABAAAAABpsAA4AAAAALpAAABoXAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbiygcgSwGYACBBBEICsYgs3ELUgABNgIkA4EgBCAFgxgHIBseJCMDdYvSKkb2lwfcofLFNUBDpYNih53Ilwl1K/MjFI3wbLCLBb91s1eJhEeHi0FWw5OG5+fW+7H/V/U36DWMGKNHL5oag5EijExBMPJIE7HrSvsiMbkosNEL9MKzC/5hLvb2N0u3hcNQ7FdERDwwGaqhRj1c26gvDVU5CaURSWmS0eGBawIJxHE8njb9+BjF8F4C08Ak4+3+T6cltZr2/xlBwpIMC+hNFoANB5Xv3pVbVIdpk1YyYECyOcnbmLIAdJLmf3VW9m6XtLTEuT2mCjGTa+/1V/RyK7X/69tW4iQTQ2g4MMCLJEv/u9+v/mE+ksaPRAvNLBISpezh9wwxr6JpiFezEDlUERl4FE0iEhKxUKmVXCit4udwfhX2/VGS3MQIvVCxze+LFQIQAOgAADYIyoxCBIDce0OlpoVul7Qc4HXrbmsAXo+2ynrgdbhnNAEvKACAeGR63duaALkWBNLh9RlshcgZZPC8yPyc0H1RAUEITCmQ2PJgeZs5GMEi1TxjcWPAZYEIDnExDgnU3K9eKJUm9q13cF8I7RQHhlOU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w/LFtvxsDyHbxcEYg+Z//ngrDAnuLGbocH+4uqqe8QqiV8gsZE/WdjbRcYJxJNTeYFW1xdRFYefzeVxSUKmNXvIIHaCTlHXZYOyDdIMj6SlpBHNZc+koXSWuyUKLHodd2kFE6LCb6Bd5SZV4iNrZOtRDZPMLLG9BX9cAWEcDXRsDYLp0apP915WLUtx4BPAN4g9ajT9v6/aReF+J6JIHMyzjUrw09uITc8jUVSLifBGHiH0XB7I/D7UBLUCvlxJc9S7RjMfgICLJJZgSK1+4AxLdMQplsbtfziTS1WOzcNf7p6LRGS8Lv35vWLOlwebB7/gipHosCYNV7l2p/NwZhLrL/1UMZ9JKSk6B0L1Hv/Eo/qgP3TZ9CPYygqXfFPhGc6xtj4YP0LJeXByQ5wXFd5gHG05qCn9TR5CBZyTj+O0ZNvqYD3WtC1pt7Bds4NPoN7CILyoq9rH3S3mOc9PznnXseLI11GR4yZ8GLYKaWw7xvwR4LUvqh0EQXOa1gQlzh071ySEa9P6/6sh0jo1EzuFt/H4P9hRrEenbLx2rUKtAnuql2HBNXdCyBRjAGiixJ3DsM71rK1FbtEpfqPOpbhdhcCcbhW+ITS+a5gfM/S4T/tarxsBhA+jcMVNNzpLiMQ512p37z0yF6zMcUbomn2GAOLHVCI9pdnV7dmUtSPUANvFD8ue9FeePwIccrc6jRzESp+NVYTXVDFOF5JMWymkISNOEjoAjcb9703a9MIj6Fcz+LJfZaZZqPy+5Yvlr/Erpmes6/wrOUpZspvnu7G3UquQIrtmFk7LC7XnlvUVNPrgx5itIlwwVonqercmuoGR/BbbT+VNodmPLkvACsoGMF7hKIq+TtEYF5RO2ZYz4f/+x4ZMHer22y2PWrlv/CykldnRnuPxwM2oW7jYIjr2txKtbqpQhyHQfI+sQ9dCI4dTP1TETznnopQ5hprfcKf1soRU9727Vwv4OjF3RgZEykBzLine truncated
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
<rect x="0" y="0" width="1024.1997862712624" height="780.4323630001875" fill="#ffffff"></rect><g stroke-linecap="round" transform="translate(851.1997862712624 354.71618150009374) rotate(0 81.5 35.5)"><path d="M17.75 0 C49.51 1.43, 85.67 -0.41, 145.25 0 C159.08 0.81, 160.78 5.85, 163 17.75 C162.63 23.54, 166.27 34.26, 163 53.25 C166.58 66.67, 153.59 67.99, 145.25 71 C107.15 67.76, 73.81 70.82, 17.75 71 C8.55 72.47, -2.15 63.47, 0 53.25 C1.24 39.07, -0.05 22.89, 0 17.75 C2.11 2.57, 3.08 3.01, 17.75 0" stroke="none" stroke-width="0" fill="#ffffff"></path><path d="M17.75 0 C49.22 1.7, 83.5 -0.37, 145.25 0 M17.75 0 C54.18 0.04, 91.42 -0.76, 145.25 0 M145.25 0 C157.12 0.2, 161.01 5.48, 163 17.75 M145.25 0 C156.48 0.96, 164.2 6.91, 163 17.75 M163 17.75 C164 29.04, 163.85 36.77, 163 53.25 M163 17.75 C163.54 26, 162.8 35.19, 163 53.25 M163 53.25 C162.69 65.27, 155.39 71, 145.25 71 M163 53.25 C163.03 66.53, 158.99 70.56, 145.25 71 M145.25 71 C116.76 70.51, 85.82 68.97, 17.75 71 M145.25 71 C101.35 71.52, 56.26 70.4, 17.75 71 M17.75 71 C6.29 70.71, -0.25 64.65, 0 53.25 M17.75 71 C8.13 72.54, 2.15 66.81, 0 53.25 M0 53.25 C-1.01 42.76, -0.36 35.76, 0 17.75 M0 53.25 C0.37 40.1, -0.06 27, 0 17.75 M0 17.75 C0.89 5.79, 5.76 -0.31, 17.75 0 M0 17.75 C-0.77 6.86, 4.23 -1.64, 17.75 0" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(896.0997862712625 377.71618150009374) rotate(0 36.60000000000002 12.5)"><text x="36.6" y="17.619999999999997" font-family="Excalifont, Xiaolai, Segoe UI Emoji" font-size="20px" fill="#1e1e1e" text-anchor="middle" style="white-space: pre;" direction="ltr" dominant-baseline="alphabetic">example</text></g><g stroke-linecap="round" transform="translate(481.08350232307953 354.71618150009374) rotate(0 81.5 35.5)"><path d="M17.75 0 C56.58 2.76, 97.59 1.04, 145.25 0 C153.95 0.88, 163.61 5.02, 163 17.75 C160.41 28.34, 164.42 32.48, 163 53.25 C159.99 63.69, 155.86 70.32, 145.25 71 C114.79 71.92, 92.44 70.77, 17.75 71 C3.41 72.84, -2.11 63.25, 0 53.25 C1.88 43.01, -1.31 34.17, 0 17.75 C-1.62 6.74, 7.44 -0.85, 17.75 0" stroke="none" stroke-width="0" fill="#ffffff"></path><path d="M17.75 0 C46.23 0.38, 71.83 -0.86, 145.25 0 M17.75 0 C62.89 0.55, 108 0.12, 145.25 0 M145.25 0 C158.02 1.95, 162.01 6.82, 163 17.75 M145.25 0 C159.22 0.93, 161.15 5.65, 163 17.75 M163 17.75 C163.16 28.37, 163.55 38.32, 163 53.25 M163 17.75 C163.32 31.15, 162.83 46.58, 163 53.25 M163 53.25 C161.99 64.94, 155.64 72.94, 145.25 71 M163 53.25 C164.28 66.34, 157.55 70.54, 145.25 71 M145.25 71 C114.62 69.8, 87.29 72.13, 17.75 71 M145.25 71 C101.71 70.18, 59.13 68.95, 17.75 71 M17.75 71 C7.76 72.64, -1.95 65.56, 0 53.25 M17.75 71 C4.1 71.64, -0.58 63.2, 0 53.25 M0 53.25 C2.09 43.15, -0.39 32.18, 0 17.75 M0 53.25 C-0.91 45.47, 0.17 37.32, 0 17.75 M0 17.75 C-0.21 4.5, 4.03 -1.53, 17.75 0 M0 17.75 C-1.49 8.05, 4.66 1.61, 17.75 0" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(534.2501689897463 377.71618150009374) rotate(0 28.33333333333337 12.5)"><text x="28.333333333333332" y="17.619999999999997" font-family="Excalifont, Xiaolai, Segoe UI Emoji" font-size="20px" fill="#1e1e1e" text-anchor="middle" style="white-space: pre;" direction="ltr" dominant-baseline="alphabetic">main.c</text></g><g mask="url(#mask-rhsh--Nqw0UhZ4cChM8e3)" stroke-linecap="round"><g transform="translate(848.5039775457833 393.07535597041465) rotate(0 -98.92848442705531 -2.8591744703209088)"><path d="M-1.06 0.86 C-33.93 -0.09, -165.18 -3.82, -198.12 -4.97 M0.58 0.26 C-32.38 -1.08, -166.4 -5.84, -199.21 -6.7" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(848.5039775457833 393.07535597041465) rotate(0 -98.92848442705531 -2.8591744703209088)"><path d="M-175.46 -14.5 C-179.26 -13.42, -184.73 -12.64, -199.21 -6.7 M-175.46 -14.5 C-181.5 -12.75, -188.18 -9.51, -199.21 -6.7" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(848.5039775457833 393.07535597041465) rotate(0 -98.92848442705531 -2.8591744703209088)"><path d="M-176 2.59 C-179.78 -0.12, -185.13 -3.14, -199.21 -6.7 M-176 2.59 C-182.06 -0.32, -188.6 -1.76, -199.21 -6.7" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g></g><mask id="mask-rhsh--Nqw0UhZ4cChM8e3"><rect x="0" y="0" fill="#fff" width="1146.360946399894" height="498.79370491105647"></rect><rect x="698.242159785395" y="377.7161815000936" fill="#000" width="102.66666666666667" height="25" opacity="1"></rect></mask><g transform="translate(698.2421597853945 377.71618150009374) rotate(0 50.948908750995315 12.438354021268879)"><text x="51.333333333333336" y="17.619999999999997" font-family="Excalifont, Xiaolai, Segoe UI Emoji" font-size="20px" fill="#1e1e1e" text-anchor="middle" style="white-space: pre;" direction="ltr" dominant-baseline="alphabetic">figure.klein</text></g><g stroke-opacity="0.3" fill-opacity="0.3" stroke-linecap="round" transform="translate(10 10) rotate(0 221.5 117.92569168297996)"><path d="M1.26 1.69 L442.36 1.8 L4Line truncated
|
||||||
|
After Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,10 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1898.4758660507769 1129.0324109769003" width="1898.4758660507769" height="1129.0324109769003" filter="invert(93%) hue-rotate(180deg)">
|
||||||
|
<!-- svg-source:excalidraw -->
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<style class="style-fonts">
|
||||||
|
@font-face { font-family: Excalifont; src: url(data:font/woff2;base64,d09GMgABAAAAACFEAA4AAAAAPEwAACDsAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGigbjyocghgGYACBNBEICttkw1ULbAABNgIkA4FUBCAFgxgHIBvgLqOitFNuQPaXB9xh8ck1oKSDzZRBwbAM2lh2DDHwtR5eHI4HHSXNW83+16F91F+XYoQks0M0Z83uJps4MQPiEMSSQPCIY0kgiAezIoWK05ZSR2oOlev1Wj9RKvY9g7YntHdf86sKPW8LN//tXo2uUBjVIAweQwghNKAQFmEdvf4HCFepsgPXCyQQVY3j8bVp4/A/6fS1fje7ZcMHogJxHJdoLQ/Lab1bHwgcOSAwhQ0h+Agn6ce53tQm9kHaDvijnJJAaizkJv/Zng21d/zTAxySQp7KqUlf7dxvd2VJhoDAduwkBUPrAoCg8Mr1ffTmfHNfmxO2OU4zjRK5ALzaPXjd/O//ljmbn9YnCaDbFUmERSEMEQZjdubtm3f/Jq1sodX0voXSipAIWXtqVbmoPegOJ8DovCgsLlJj0QqhBP7ukdSmZxT9NTLfmenyj/Nj77Sd6asLo4xcDEkO+WtdAAGADC0ADAOBWHo8PohQFFHTMBEkfk5cD3N7Ts8Bgrcp7U1A8NFe3QgEd9/EFiCAAQBgEuXrvf2JeCEw4A1fDkLB9K69AhF89Iq2QJ+OY/hEKxdbgVLGkzP+BjBitSWCLrgZApZlgK0gN5tGB6kCFxoA5FPHVJ7mq+Ur+m/7MAibix0XsUkYqApNUNtiA0aIVegQmDwmECqKbLieFFzZIgxuMtsXFtrwt6kC+/Qv8JMleSdI+nRkxloRgMVXxotMMVsYuy3fHF8AmYUFK12M4eeDgIiEzA8NAxMLBxcPn5C/AIGkZOSCBFMJFyEyHhCYWifiPrgEIOQIBEnEDoEcIUSs3QsPxYPDx+T9fBQUfjUBFQuDHzYaOs5XXR4IUag2WamKgaWVKBw8p14XAAo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LHIKBtxgYqJApaRGyaEs/25uRQhWB2ZqonhAtXBbdbwZqQlL2pBMjNnyqTRjU1b1lxHtkOdwq/qdt0wcQRIuXJfyafP6H2bRLyRJahNmPq3fZSM0DxrXSn3vyESsPTXDJeJpky82UMl2ZyYFXxzzdybcyvDjaVNY64s5oQNoX72ytad1aEKTfOiswiUfzCe1Ca48Z2jGItQtXIzSgQJfQhtmAtAuSOwj8FVyEfVWolt0mnWk+tfT0e8Otf3zSo51qH7soJw2rID9etqIrWbL47Mmfau+VRwfTa3evzqrgYnYF2QTcp2okfbEFZhWMKKCVRNkA+yQW+MTHENbiAWhLAqpRpf3oubj+r3QBlco7DfeyR1K/Jyn6eOajQN+34MReWzvBsjQBnn/VjMCfMS3d2b6sXpVjdPRt2wg30oXaJiRbTAL/ePl4xWqiGhjw5FL1upZ7vBOgNrcmfef5uIJDY2GMj9HroaF9Jtw7Dd/nIC3CuyOSKqulbK1ebs0cy9Jme5+s8zb9Ao95g3VUnnLd/mhpPYsEqNpc6emshAAS7U2AgKWP3jb2goCpasF46a253lYbbdrCZm1TW8sWZzihmxNoSAe2suuRvsHleFsixxXELpSOspU3gH7+dSzY1gBjHMgbxjawv0CcXgHJ9mplB1RhuywWMMFJRLine truncated
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
<rect x="0" y="0" width="1898.4758660507769" height="1129.0324109769003" fill="#ffffff"></rect><g stroke-linecap="round"><g transform="translate(134.6093715002511 107.77351992160297) rotate(0 0 20.53139395856948)"><path d="M-0.03 0.27 C0.12 7.13, 0.43 34.86, 0.4 41.61 M-0.71 -0.07 C-0.55 6.89, 0.17 34.05, 0.18 40.93" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(134.6093715002511 107.77351992160297) rotate(0 0 20.53139395856948)"><path d="M-7.14 21.74 C-5.07 26.42, -3.05 29.24, 0.18 40.93 M-7.14 21.74 C-5.09 26.83, -3.72 31.32, 0.18 40.93" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(134.6093715002511 107.77351992160297) rotate(0 0 20.53139395856948)"><path d="M6.9 21.53 C6.09 26.25, 5.21 29.1, 0.18 40.93 M6.9 21.53 C5.56 26.71, 3.54 31.25, 0.18 40.93" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g></g><mask></mask><g stroke-linecap="round" transform="translate(10 10) rotate(0 111.7041731117875 50.71428571428572)"><path d="M94.57 1.05 C108.74 -0.54, 127.47 0.09, 142.03 1.74 C156.6 3.38, 170.26 6.55, 181.96 10.93 C193.65 15.31, 205.46 21.69, 212.2 28.03 C218.95 34.38, 221.77 42.07, 222.43 49 C223.09 55.92, 221.5 63.3, 216.18 69.59 C210.85 75.87, 201.36 82.01, 190.46 86.72 C179.57 91.43, 164.94 95.26, 150.82 97.85 C136.71 100.43, 120.76 102.54, 105.77 102.24 C90.78 101.94, 74.39 99.22, 60.88 96.05 C47.36 92.87, 34.4 88.55, 24.68 83.18 C14.96 77.82, 6.51 70.56, 2.54 63.86 C-1.42 57.16, -1.66 49.9, 0.88 42.97 C3.42 36.04, 9.22 28.01, 17.76 22.26 C26.3 16.51, 36.78 12.02, 52.11 8.45 C67.43 4.89, 97.69 1.96, 109.7 0.86 C121.7 -0.23, 124.22 1.3, 124.13 1.87 M89.3 -0.05 C102.73 -2.44, 118.6 -1.14, 133.29 0.37 C147.98 1.88, 164.89 4.63, 177.44 8.99 C189.98 13.36, 201.23 20.63, 208.58 26.55 C215.92 32.48, 219.93 38.04, 221.49 44.53 C223.04 51.01, 222.13 58.81, 217.9 65.47 C213.67 72.13, 206.1 79.1, 196.1 84.48 C186.09 89.86, 171.89 94.84, 157.87 97.74 C143.84 100.64, 126.92 102.13, 111.97 101.89 C97.01 101.66, 82.15 99.11, 68.12 96.32 C54.09 93.52, 38.32 90.03, 27.78 85.13 C17.25 80.23, 9.22 73.57, 4.91 66.93 C0.61 60.3, 0.56 52.44, 1.96 45.32 C3.36 38.2, 6.26 30.25, 13.3 24.22 C20.34 18.18, 31.69 12.76, 44.2 9.12 C56.71 5.48, 81.22 3.44, 88.35 2.37 C95.48 1.29, 86.8 1.94, 86.98 2.67" stroke="#1e1e1e" stroke-width="2" fill="none"></path></g><g transform="translate(94.25072764231356 48.35387038268223) rotate(0 27.46666717529297 12.5)"><text x="27.46666717529297" y="17.619999999999997" font-family="Excalifont, Xiaolai, Segoe UI Emoji" font-size="20px" fill="#1e1e1e" text-anchor="middle" style="white-space: pre;" direction="ltr" dominant-baseline="alphabetic">Start</text></g><g mask="url(#mask-DGfGDIEhGbM9VZLGxmU2x)" stroke-linecap="round"><g transform="translate(134.84314553266427 962.6293772541449) rotate(0 0 26.5107599192919)"><path d="M-1.19 0.39 C-0.97 9.52, 0.7 44.88, 0.73 53.73 M0.39 -0.45 C0.57 8.43, 0 43.34, 0.16 51.98" stroke="#1971c2" stroke-width="2" fill="none"></path></g><g transform="translate(134.84314553266427 962.6293772541449) rotate(0 0 26.5107599192919)"><path d="M-8.37 28.48 C-5.8 35.64, -3.14 38.61, 0.16 51.98 M-8.37 28.48 C-5.7 36.93, -1.61 43.92, 0.16 51.98" stroke="#1971c2" stroke-width="2" fill="none"></path></g><g transform="translate(134.84314553266427 962.6293772541449) rotate(0 0 26.5107599192919)"><path d="M8.73 28.49 C7.04 35.48, 5.43 38.45, 0.16 51.98 M8.73 28.49 C5.61 37, 3.89 43.99, 0.16 51.98" stroke="#1971c2" stroke-width="2" fill="none"></path></g></g><mask id="mask-DGfGDIEhGbM9VZLGxmU2x"><rect x="0" y="0" fill="#fff" width="234.84314553266427" height="1115.6508970927287"></rect><rect x="123.08481219933105" y="976.6401371734369" fill="#000" width="23.516666666666666" height="25" opacity="1"></rect></mask><g transform="translate(123.08481219933094 976.6401371734369) rotate(0 11.528343253334356 12.628268248881113)"><text x="11.758333333333333" y="17.619999999999997" font-family="Excalifont, Xiaolai, Segoe UI Emoji" font-size="20px" fill="#1971c2" text-anchor="middle" style="white-space: pre;" direction="ltr" dominant-baseline="alphabetic">no</text></g><g stroke-linecap="round" transform="translate(11.271716961235711 856.5863096653122) rotate(0 123.57142857142861 60.80888546829817)"><path d="M155 15.25 C178.01 26.81, 199.99 37.31, 216.14 45.75 M155 15.25 C177.66 26.24, 198.53 36.57, 216.14 45.75 M216.14 45.75 C247.48 62.03, 248.09 61.93, 216.14 76.25 M216.14 45.75 C249.22 61.31, 246.25 61.77, 216.14 76.25 M216.14 76.25 C197.3 84.9, 180.84 92.47, 155 106.37 M216.14 76.25 C197.75 85.2, 180.38 93.91, 155 106.37 M155 106.37 C125.11 121.61, 122.24 123.5, 93 106.37 M155 106.37 C125.91 121.02, 125.35 120.1, 93 106.37 M93 106.37 C69.08 94.76, 44.5 82.99, 31 76.25 M93 106.37 C79.25 99.51, 65.79 94.69, 31 76.25 M31 76.25 C-1.88 59.65, -1.57 62.64, 31 45.75 M31 76.25 C-1.26 61.03, 0.39 59.25, 31 45.75 M31 45.75 C48.24 37.32, 60.78 30.54, 93 15.25 M31 45.75 C55.54 34.5, 77.85 22.63, 93 15.25 M93 15.25 C122.69 -0.0Line truncated
|
||||||
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,54 @@
|
|||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define KLEIN_IMPLEMENT
|
||||||
|
#include <klein/klein.h>
|
||||||
|
#include <klein/norm.h>
|
||||||
|
#include <klein/parm.h>
|
||||||
|
|
||||||
|
int p = 37;
|
||||||
|
int q = 7;
|
||||||
|
|
||||||
|
void lens(float *d_surface, int *coord, unsigned char * grid)
|
||||||
|
{
|
||||||
|
|
||||||
|
float norm = 0;
|
||||||
|
float sphere[4];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
sphere[i] = ((float)coord[i] / grid[i]) - 0.5;
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
norm += sphere[i] * sphere[i];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
sphere[i] = sphere[i] / sqrt(norm);
|
||||||
|
|
||||||
|
d_surface[0] = (sphere[0] * cos(2 * M_PI / p)) - (sphere[1] * sin(2 * M_PI / p));
|
||||||
|
d_surface[1] = (sphere[0] * sin(2 * M_PI / p)) + (sphere[1] * cos(2 * M_PI / p));
|
||||||
|
d_surface[2] = (sphere[2] * cos(2 * M_PI * q / p)) - (sphere[3] * sin(2 * M_PI * q / p));
|
||||||
|
d_surface[3] = (sphere[2] * sin(2 * M_PI * q / p)) + (sphere[3] * cos(2 * M_PI * q / p));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char file_name[0xff];
|
||||||
|
struct klein klein;
|
||||||
|
struct parm parametrization = {
|
||||||
|
.grid = (unsigned char[]){8, 8,8,8},
|
||||||
|
.m = 4,
|
||||||
|
.n = 4,
|
||||||
|
.f = lens,
|
||||||
|
};
|
||||||
|
|
||||||
|
snprintf(file_name, 0xff, "lens-%03d-%03d.klein", p, q);
|
||||||
|
printf("writing %s\n", file_name);
|
||||||
|
|
||||||
|
klein_parametrize(&klein, parametrization);
|
||||||
|
klein_normalize(&klein);
|
||||||
|
klein_export_file(klein, file_name);
|
||||||
|
|
||||||
|
free(klein.vertex);
|
||||||
|
free(klein.normals);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+3
-3
@@ -10,7 +10,7 @@
|
|||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char dim = 4;
|
unsigned char dim = 10;
|
||||||
|
|
||||||
void cube(float *d_surface, int *coord, unsigned char *grid)
|
void cube(float *d_surface, int *coord, unsigned char *grid)
|
||||||
{
|
{
|
||||||
@@ -37,9 +37,9 @@ int main(void)
|
|||||||
parametrization.grid = malloc(dim);
|
parametrization.grid = malloc(dim);
|
||||||
|
|
||||||
for (i = 0; i < dim; ++i)
|
for (i = 0; i < dim; ++i)
|
||||||
parametrization.grid[i] = 1 << i;
|
parametrization.grid[i] = 1 + i;
|
||||||
|
|
||||||
snprintf(file_name, 0xff, "%03d-cube.klein", dim);
|
snprintf(file_name, 0xff, "cube-%03d.klein", dim);
|
||||||
printf("writing %s\n", file_name);
|
printf("writing %s\n", file_name);
|
||||||
|
|
||||||
klein_parametrize(&klein, parametrization);
|
klein_parametrize(&klein, parametrization);
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ int klein_export_file(struct klein klein, const char * filename)
|
|||||||
fwrite("\0", 1, 1, file);
|
fwrite("\0", 1, 1, file);
|
||||||
fwrite(&klein.dim, 1, 1, file);
|
fwrite(&klein.dim, 1, 1, file);
|
||||||
fwrite(&klein.vertex_size, 8, 1, file);
|
fwrite(&klein.vertex_size, 8, 1, file);
|
||||||
fwrite(klein.vertex, 16, klein.vertex_size * klein.dim, file);
|
fwrite(klein.vertex, 4, klein.vertex_size * klein.dim, file);
|
||||||
fwrite(klein.normals, 16, klein.vertex_size * klein.dim, file);
|
fwrite(klein.normals, 4, klein.vertex_size * klein.dim, file);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
#ifdef KLEIN_NORM_H
|
||||||
|
#error file included twice
|
||||||
|
#endif
|
||||||
|
#define KLEIN_NORM_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef KLEIN_H
|
||||||
|
#warning Please include klein/klein.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void klein_normalize(struct klein * klein);
|
||||||
|
|
||||||
|
#ifdef KLEIN_IMPLEMENT
|
||||||
static inline
|
static inline
|
||||||
void __calculate_normal( float *p1, float *p2, float *p3, float *normal, unsigned char n)
|
void __calculate_normal( float *p1, float *p2, float *p3, float *normal, unsigned char n)
|
||||||
{ unsigned char i;
|
{ unsigned char i;
|
||||||
@@ -116,3 +129,4 @@ void klein_normalize(struct klein * klein)
|
|||||||
|
|
||||||
free(norm_vec);
|
free(norm_vec);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
+8
-2
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
void set_clean_color_context(unsigned char r, unsigned char g, unsigned char b)
|
void set_clean_color_context(unsigned char r, unsigned char g, unsigned char b)
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glClearColor((float)r / 0xff, (float)g / 0xff, (float)b / 0xff, 1.0);
|
glClearColor((float)r / 0xff, (float)g / 0xff, (float)b / 0xff, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,4 +21,11 @@ int init_context(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_context(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }
|
void clean_context(void)
|
||||||
|
{
|
||||||
|
/* This is important cos, Nuklear Disable DEPTH TEST */
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT );
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#define A -1,-1,-1,
|
||||||
|
#define B -1,-1, 1,
|
||||||
|
#define C -1, 1,-1,
|
||||||
|
#define D -1, 1, 1,
|
||||||
|
#define E 1,-1,-1,
|
||||||
|
#define F 1,-1, 1,
|
||||||
|
#define G 1, 1,-1,
|
||||||
|
#define H 1, 1, 1,
|
||||||
|
|
||||||
|
narray_float_t d_cube =
|
||||||
|
{
|
||||||
|
3*3*2*6,
|
||||||
|
|
||||||
|
A C E
|
||||||
|
C E G
|
||||||
|
|
||||||
|
E G F
|
||||||
|
G F H
|
||||||
|
|
||||||
|
F H B
|
||||||
|
H B D
|
||||||
|
|
||||||
|
B D A
|
||||||
|
D A C
|
||||||
|
|
||||||
|
C D G
|
||||||
|
D G H
|
||||||
|
|
||||||
|
A B E
|
||||||
|
B E F
|
||||||
|
|
||||||
|
};
|
||||||
+2
-2
@@ -61,7 +61,7 @@ const char *fs_plain =
|
|||||||
|
|
||||||
"void main()"
|
"void main()"
|
||||||
"{"
|
"{"
|
||||||
" FragColor = vec4(pow(vec3(Color),vec3(1.0/2.2)),Color.a);"
|
" FragColor = vec4(pow(vec3(Color),vec3(1.0/1.0)),Color.a);"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char *fs =
|
const char *fs =
|
||||||
@@ -92,7 +92,7 @@ const char *fs =
|
|||||||
" float specular = pow(abs(dot(normalize(Normal), halfwayDir)), 32.0);\n"
|
" float specular = pow(abs(dot(normalize(Normal), halfwayDir)), 32.0);\n"
|
||||||
" float diffuse = abs(dot(normalize(Normal), lightDir));\n"
|
" float diffuse = abs(dot(normalize(Normal), lightDir));\n"
|
||||||
|
|
||||||
" vec3 result = pow((0.5 + 0.5*diffuse + 1.5*specular) * Color.rgb, "
|
" vec3 result = pow((0.5 + 0.5*diffuse + 1*specular) * Color.rgb, "
|
||||||
"vec3(1.0/2.2));\n"
|
"vec3(1.0/2.2));\n"
|
||||||
" FragColor = vec4(result, Color.a);\n"
|
" FragColor = vec4(result, Color.a);\n"
|
||||||
"}";
|
"}";
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#include <glad.h>
|
||||||
|
#include "main.h"
|
||||||
|
#define MAX_VERTEX_BUFFER 512 * 1024
|
||||||
|
#define MAX_ELEMENT_BUFFER 128 * 1024
|
||||||
|
#define NK_INCLUDE_FIXED_TYPES
|
||||||
|
#define NK_INCLUDE_STANDARD_IO
|
||||||
|
#define NK_INCLUDE_STANDARD_VARARGS
|
||||||
|
#define NK_INCLUDE_DEFAULT_ALLOCATOR
|
||||||
|
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
||||||
|
#define NK_INCLUDE_FONT_BAKING
|
||||||
|
#define NK_INCLUDE_DEFAULT_FONT
|
||||||
|
#define NK_IMPLEMENTATION
|
||||||
|
#define NK_GLFW_GL3_IMPLEMENTATION
|
||||||
|
#include <nuklear.h>
|
||||||
|
#include <demo/glfw_opengl3/nuklear_glfw_gl3.h>
|
||||||
|
|
||||||
|
struct gui gui =
|
||||||
|
{
|
||||||
|
.file_name = {0},
|
||||||
|
.projection = (struct projection){ .mesh=NULL, .x =0, .y=1, .z=2 },
|
||||||
|
};
|
||||||
|
|
||||||
|
float surface_color[4] = {(float)0x2F/0xFF, (float)0x3C/0xFF, (float)0x7E/0xFF, (float)0xff/0xFF};
|
||||||
|
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void restore_surface_color( void )
|
||||||
|
{
|
||||||
|
gui.picked_color[0] = surface_color[0];
|
||||||
|
gui.picked_color[1] = surface_color[1];
|
||||||
|
gui.picked_color[2] = surface_color[2];
|
||||||
|
gui.picked_color[3] = surface_color[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct nk_glfw glfw ={0};
|
||||||
|
struct nk_context * context;
|
||||||
|
|
||||||
|
void draw_gui( void )
|
||||||
|
{
|
||||||
|
nk_glfw3_new_frame(&glfw);
|
||||||
|
|
||||||
|
if (nk_begin(context, "MANIGRAPH", nk_rect(10, 10, 256, 256),
|
||||||
|
NK_WINDOW_BORDER |NK_WINDOW_SCALABLE | NK_WINDOW_MOVABLE | NK_WINDOW_MINIMIZABLE) )
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Color picker para personalización */
|
||||||
|
{
|
||||||
|
struct nk_colorf * p = (void*)&gui.picked_color;
|
||||||
|
nk_layout_row_dynamic(context, 120, 1);
|
||||||
|
*p = nk_color_picker(context, *p, NK_RGBA);
|
||||||
|
}
|
||||||
|
|
||||||
|
nk_layout_row_dynamic(context, 20, 1);
|
||||||
|
if (nk_button_label(context, "Restablecer"))
|
||||||
|
restore_surface_color();
|
||||||
|
|
||||||
|
|
||||||
|
nk_layout_row_dynamic(context, 12, 1);
|
||||||
|
nk_label(context, (char*)gui.file_name, NK_TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
|
nk_label_colored(context, "Atajos de teclado:", NK_TEXT_ALIGN_LEFT, nk_rgb(255, 255, 255)); // Encabezado
|
||||||
|
nk_label(context, " - W/S: Rotar eje X", NK_TEXT_ALIGN_LEFT);
|
||||||
|
nk_label(context, " - A/D: Rotar eje Y", NK_TEXT_ALIGN_LEFT);
|
||||||
|
nk_label(context, " - Z/X: Rotar eje Z", NK_TEXT_ALIGN_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
nk_end(context);
|
||||||
|
nk_glfw3_render(&glfw, NK_ANTI_ALIASING_ON, MAX_VERTEX_BUFFER, MAX_ELEMENT_BUFFER);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void init_gui( window_t window )
|
||||||
|
{
|
||||||
|
struct nk_font_atlas * atlas;
|
||||||
|
|
||||||
|
restore_surface_color();
|
||||||
|
|
||||||
|
{
|
||||||
|
context = nk_glfw3_init(&glfw,(GLFWwindow*) window, NK_GLFW3_DEFAULT );
|
||||||
|
nk_glfw3_font_stash_begin(&glfw, &atlas);
|
||||||
|
nk_glfw3_font_stash_end(&glfw);
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-30
@@ -1,15 +1,18 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include <glad.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <cglm/quat.h>
|
#include <cglm/quat.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define ANGLE ((float)0x01 / 0xff * 2 * GLM_PI)
|
#define ANGLE ((float)0x01 / 0xff * 2 * GLM_PI)
|
||||||
|
|
||||||
unsigned char selected_axis = 0;
|
unsigned char selected_axis = 0;
|
||||||
int window_width;
|
int window_width = 512;
|
||||||
int window_height;
|
int window_height = 512;
|
||||||
|
|
||||||
unsigned char animate_index = 0;
|
unsigned char animate_index = 0;
|
||||||
|
extern struct gui gui;
|
||||||
|
|
||||||
versor q = GLM_QUAT_IDENTITY_INIT;
|
versor q = GLM_QUAT_IDENTITY_INIT;
|
||||||
|
|
||||||
@@ -19,7 +22,13 @@ vec3 axis[3] = {
|
|||||||
{0, 0, 1},
|
{0, 0, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct projection projection;
|
|
||||||
|
void __error_callback_input(int x, const char * msg )
|
||||||
|
{
|
||||||
|
mlog("[GLFW] ");
|
||||||
|
mlog(msg);
|
||||||
|
mlog("\n");
|
||||||
|
}
|
||||||
|
|
||||||
void __key_callback_input(
|
void __key_callback_input(
|
||||||
GLFWwindow *window, int key, int scancode, int action, int mods)
|
GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||||
@@ -33,41 +42,41 @@ void __key_callback_input(
|
|||||||
|
|
||||||
selected_coord = key - GLFW_KEY_0 - 1;
|
selected_coord = key - GLFW_KEY_0 - 1;
|
||||||
|
|
||||||
if (selected_coord >= projection.m)
|
if (selected_coord >= gui.projection.m)
|
||||||
return;
|
return;
|
||||||
if (selected_coord == projection.x)
|
if (selected_coord == gui.projection.x)
|
||||||
return;
|
return;
|
||||||
if (selected_coord == projection.y)
|
if (selected_coord == gui.projection.y)
|
||||||
return;
|
return;
|
||||||
if (selected_coord == projection.z)
|
if (selected_coord == gui.projection.z)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selected_coord = projection.w;
|
selected_coord = gui.projection.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projection.w >= projection.m)
|
if (gui.projection.w >= gui.projection.m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
case GLFW_KEY_I:
|
case GLFW_KEY_I:
|
||||||
tmp = projection.w;
|
tmp = gui.projection.w;
|
||||||
projection.w = projection.x;
|
gui.projection.w = gui.projection.x;
|
||||||
projection.x = tmp;
|
gui.projection.x = tmp;
|
||||||
|
|
||||||
animate_index = 1;
|
animate_index = 1;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_O:
|
case GLFW_KEY_O:
|
||||||
tmp = projection.w;
|
tmp = gui.projection.w;
|
||||||
projection.w = projection.y;
|
gui.projection.w = gui.projection.y;
|
||||||
projection.y = tmp;
|
gui.projection.y = tmp;
|
||||||
animate_index = 2;
|
animate_index = 2;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_P:
|
case GLFW_KEY_P:
|
||||||
tmp = projection.w;
|
tmp = gui.projection.w;
|
||||||
projection.w = projection.z;
|
gui.projection.w = gui.projection.z;
|
||||||
projection.z = tmp;
|
gui.projection.z = tmp;
|
||||||
animate_index = 3;
|
animate_index = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -128,18 +137,20 @@ void __scroll_callback_input(GLFWwindow *window, double xoffset, double yoffset)
|
|||||||
glm_quat_rotatev(r, axis[2], axis[2]);
|
glm_quat_rotatev(r, axis[2], axis[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __drop_callback_input(GLFWwindow *window, int count, char **path)
|
void __drop_callback_input(GLFWwindow *window, int count, unsigned char **path)
|
||||||
{
|
{
|
||||||
struct surface surface;
|
struct surface surface;
|
||||||
|
|
||||||
if (create_surface_klein(*path, &surface))
|
if (create_surface_klein(*path, &surface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(projection.mesh = create_mesh(surface)))
|
if (!(gui.projection.mesh = create_mesh(surface)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
projection.m = surface.dim;
|
strcpy(gui.file_name, *path);
|
||||||
set_projection_mesh(projection);
|
|
||||||
|
gui.projection.m = surface.dim;
|
||||||
|
set_projection_mesh(gui.projection);
|
||||||
|
|
||||||
free(surface.norm);
|
free(surface.norm);
|
||||||
free(surface.data);
|
free(surface.data);
|
||||||
@@ -187,13 +198,5 @@ end:
|
|||||||
glm_quat_rotatev(p, axis[2], axis[2]);
|
glm_quat_rotatev(p, axis[2], axis[2]);
|
||||||
glm_quat_normalize(q);
|
glm_quat_normalize(q);
|
||||||
|
|
||||||
// LOG INFO
|
|
||||||
if (0)
|
|
||||||
{
|
|
||||||
printf("QUAT: %2.5f %2.5f %2.5f %2.5f\n", q[0], q[1], q[2], q[3]);
|
|
||||||
printf("PROY: %3d %3d %3d (%3d)\n", projection.x, projection.y,
|
|
||||||
projection.z, projection.w);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
+4
-4
@@ -35,10 +35,10 @@ int create_surface_klein(unsigned char *path, struct surface *surface)
|
|||||||
|
|
||||||
size = surface->dim * surface->vertex;
|
size = surface->dim * surface->vertex;
|
||||||
|
|
||||||
surface->data = malloc(16 * size);
|
surface->data = malloc(4 * size);
|
||||||
fread(surface->data, 16, size, file);
|
fread(surface->data, 4, size, file);
|
||||||
|
|
||||||
surface->norm = malloc(16 * size);
|
surface->norm = malloc(4 * size);
|
||||||
fread(surface->norm, 16, size, file);
|
fread(surface->norm, 4, size, file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
+1
-7
@@ -22,13 +22,7 @@ void rot_matrix_load(id_t shader, quat_t q)
|
|||||||
load_mat4_to_shader(shader, "rot", (mat4_t)m);
|
load_mat4_to_shader(shader, "rot", (mat4_t)m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void color_load(id_t shader, unsigned char color[4])
|
void color_load(id_t shader, float res[4])
|
||||||
{
|
{
|
||||||
float res[4];
|
|
||||||
|
|
||||||
res[0] = (float)color[0] / 0xff;
|
|
||||||
res[1] = (float)color[1] / 0xff;
|
|
||||||
res[2] = (float)color[2] / 0xff;
|
|
||||||
res[3] = (float)color[3] / 0xff;
|
|
||||||
load_float4_to_shader(shader, "color", res);
|
load_float4_to_shader(shader, "color", res);
|
||||||
}
|
}
|
||||||
+35
-19
@@ -7,6 +7,11 @@
|
|||||||
#define WIDTH 512
|
#define WIDTH 512
|
||||||
#define HEIGHT 512
|
#define HEIGHT 512
|
||||||
|
|
||||||
|
#include <glad.h>
|
||||||
|
|
||||||
|
float *generate_data_surface(unsigned int, unsigned char *);
|
||||||
|
float *generate_normals_surface(float *, unsigned char);
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -15,11 +20,13 @@
|
|||||||
#define M_PI 3.14159
|
#define M_PI 3.14159
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct projection projection = {.x = 0, .y = 1, .z = 2, .w = 3, .mesh = NULL};
|
window_t window;
|
||||||
|
id_t shader, shader_plain;
|
||||||
|
|
||||||
const char *wname = "manigraph: manifold grapher";
|
const char *wname = "manigraph: manifold grapher";
|
||||||
|
|
||||||
unsigned char color[4] = {0x2F, 0x3C, 0x7E, 0xff};
|
extern volatile unsigned char animate_index;
|
||||||
|
extern struct gui gui;
|
||||||
|
|
||||||
void mlog(char *msg)
|
void mlog(char *msg)
|
||||||
{
|
{
|
||||||
@@ -28,11 +35,6 @@ void mlog(char *msg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
window_t window;
|
|
||||||
id_t shader, shader_plain;
|
|
||||||
|
|
||||||
extern volatile unsigned char animate_index;
|
|
||||||
|
|
||||||
#ifndef EMSCRIPTEN
|
#ifndef EMSCRIPTEN
|
||||||
static inline
|
static inline
|
||||||
#endif
|
#endif
|
||||||
@@ -44,10 +46,16 @@ static inline
|
|||||||
|
|
||||||
q = poll_input(window);
|
q = poll_input(window);
|
||||||
|
|
||||||
|
gui.quat[0] = q[0];
|
||||||
|
gui.quat[1] = q[1];
|
||||||
|
gui.quat[2] = q[2];
|
||||||
|
gui.quat[3] = q[3];
|
||||||
|
|
||||||
|
|
||||||
rot_matrix_load(shader, q);
|
rot_matrix_load(shader, q);
|
||||||
rot_matrix_load(shader_plain, q);
|
rot_matrix_load(shader_plain, q);
|
||||||
color_load(shader, color);
|
color_load(shader, gui.picked_color);
|
||||||
color_load(shader_plain, color);
|
color_load(shader_plain, gui.picked_color);
|
||||||
|
|
||||||
{
|
{
|
||||||
static float angle = 0;
|
static float angle = 0;
|
||||||
@@ -59,7 +67,7 @@ static inline
|
|||||||
|
|
||||||
load_float_to_shader(shader, "angle", angle);
|
load_float_to_shader(shader, "angle", angle);
|
||||||
load_float_to_shader(shader_plain, "angle", angle);
|
load_float_to_shader(shader_plain, "angle", angle);
|
||||||
set_projection_mesh(projection);
|
set_projection_mesh(gui.projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animate_index)
|
if (animate_index)
|
||||||
@@ -74,16 +82,19 @@ static inline
|
|||||||
}
|
}
|
||||||
clean_context();
|
clean_context();
|
||||||
|
|
||||||
if (!projection.mesh)
|
|
||||||
return;
|
|
||||||
|
|
||||||
draw_mesh(shader, projection.mesh);
|
if (gui.projection.mesh)
|
||||||
draw_mesh_lines(shader_plain, projection.mesh);
|
{
|
||||||
|
draw_mesh(shader, gui.projection.mesh);
|
||||||
|
draw_mesh_lines(shader_plain, gui.projection.mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_gui();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
mlog("[VENTANA] Inicializando...\n");
|
mlog("[VENTANA] Inicializando...\n");
|
||||||
{
|
{
|
||||||
if (!(window = init_window(WIDTH, HEIGHT, wname)))
|
if (!(window = init_window(WIDTH, HEIGHT, wname)))
|
||||||
@@ -129,6 +140,11 @@ int main(void)
|
|||||||
fix_matrix_load(shader_plain, (float)WIDTH / HEIGHT);
|
fix_matrix_load(shader_plain, (float)WIDTH / HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mlog("[GUI] Inicializando...\n");
|
||||||
|
{
|
||||||
|
init_gui(window);
|
||||||
|
}
|
||||||
|
|
||||||
mlog("[MAIN LOOP] Inicializando...\n");
|
mlog("[MAIN LOOP] Inicializando...\n");
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
emscripten_set_main_loop(&main_loop, 60, 1);
|
emscripten_set_main_loop(&main_loop, 60, 1);
|
||||||
@@ -140,7 +156,7 @@ int main(void)
|
|||||||
mlog("[MAIN LOOP] Terminando...\n");
|
mlog("[MAIN LOOP] Terminando...\n");
|
||||||
|
|
||||||
mlog("[MESH] Destruyendo...\n");
|
mlog("[MESH] Destruyendo...\n");
|
||||||
destroy_mesh(projection.mesh);
|
destroy_mesh(gui.projection.mesh);
|
||||||
mlog("[SHADER] Destruyendo...\n");
|
mlog("[SHADER] Destruyendo...\n");
|
||||||
destroy_shader(shader_plain);
|
destroy_shader(shader_plain);
|
||||||
mlog("[SHADER] Destruyendo...\n");
|
mlog("[SHADER] Destruyendo...\n");
|
||||||
@@ -150,12 +166,12 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_context:
|
error_context:
|
||||||
mlog("[SHADER] Destruyendo...\n");
|
|
||||||
destroy_shader(shader_plain);
|
|
||||||
error_shader_plain:
|
|
||||||
mlog("[SHADER] Destruyendo...\n");
|
mlog("[SHADER] Destruyendo...\n");
|
||||||
destroy_shader(shader);
|
destroy_shader(shader);
|
||||||
error_shader:
|
error_shader:
|
||||||
|
mlog("[SHADER] Destruyendo...\n");
|
||||||
|
destroy_shader(shader_plain);
|
||||||
|
error_shader_plain:
|
||||||
mlog("[WINDOW] Destruyendo...\n");
|
mlog("[WINDOW] Destruyendo...\n");
|
||||||
close_window(window);
|
close_window(window);
|
||||||
error_window:
|
error_window:
|
||||||
|
|||||||
+13
-2
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
#define GLFW_INCLUDE_NONE
|
||||||
|
|
||||||
typedef const void *window_t;
|
typedef const void *window_t;
|
||||||
typedef unsigned int id_t;
|
typedef unsigned int id_t;
|
||||||
@@ -22,12 +23,19 @@ typedef float *mat4_t;
|
|||||||
w: the coordanate of the w axis.
|
w: the coordanate of the w axis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct projection
|
struct gui
|
||||||
{
|
{
|
||||||
|
float quat[4];
|
||||||
|
float picked_color[4];
|
||||||
|
char file_name[0xff];
|
||||||
|
struct projection
|
||||||
|
{
|
||||||
mesh_t mesh;
|
mesh_t mesh;
|
||||||
unsigned char m, x, y, z, w;
|
unsigned char m, x, y, z, w;
|
||||||
|
} projection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this structure has all the information to generate
|
this structure has all the information to generate
|
||||||
a mesh, where:
|
a mesh, where:
|
||||||
@@ -163,7 +171,7 @@ void rot_matrix_load(id_t shader, quat_t q);
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void color_load(id_t shader, unsigned char color[4]);
|
void color_load(id_t shader, float* color);
|
||||||
|
|
||||||
id_t config_texture(unsigned short type);
|
id_t config_texture(unsigned short type);
|
||||||
|
|
||||||
@@ -179,3 +187,6 @@ void destroy_texture(id_t texture);
|
|||||||
id_t create_palette_texture(const unsigned char colors[][4], unsigned char n);
|
id_t create_palette_texture(const unsigned char colors[][4], unsigned char n);
|
||||||
|
|
||||||
quat_t poll_input(window_t window);
|
quat_t poll_input(window_t window);
|
||||||
|
|
||||||
|
void draw_gui( void );
|
||||||
|
void init_gui( window_t window );
|
||||||
@@ -111,6 +111,7 @@ void draw_mesh_lines(id_t shader, mesh_t p)
|
|||||||
#ifndef EMSCRIPTEN
|
#ifndef EMSCRIPTEN
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, obj->vertex);
|
glDrawArrays(GL_TRIANGLES, 0, obj->vertex);
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
#else
|
#else
|
||||||
glDrawArrays(GL_LINES, 0, obj->vertex);
|
glDrawArrays(GL_LINES, 0, obj->vertex);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+8
-2
@@ -8,6 +8,7 @@ void __mouse_callback_input(GLFWwindow *, int, int, int);
|
|||||||
void __scroll_callback_input(GLFWwindow *, double, double);
|
void __scroll_callback_input(GLFWwindow *, double, double);
|
||||||
void __key_callback_input(GLFWwindow *, int, int, int, int);
|
void __key_callback_input(GLFWwindow *, int, int, int, int);
|
||||||
void __drop_callback_input(GLFWwindow *, int, const char **);
|
void __drop_callback_input(GLFWwindow *, int, const char **);
|
||||||
|
void __error_callback_input(int, const char *);
|
||||||
|
|
||||||
window_t init_window(unsigned int w, unsigned int h, const char *name);
|
window_t init_window(unsigned int w, unsigned int h, const char *name);
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ static void __limit_fps_window(int max_fps)
|
|||||||
window_t init_window(unsigned int width, unsigned int height, const char *title)
|
window_t init_window(unsigned int width, unsigned int height, const char *title)
|
||||||
{
|
{
|
||||||
window_t window;
|
window_t window;
|
||||||
|
glfwSetErrorCallback(__error_callback_input);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -51,6 +53,7 @@ window_t init_window(unsigned int width, unsigned int height, const char *title)
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, 1);
|
||||||
|
|
||||||
window = (window_t)glfwCreateWindow(width, height, title, NULL, NULL);
|
window = (window_t)glfwCreateWindow(width, height, title, NULL, NULL);
|
||||||
if (!(window))
|
if (!(window))
|
||||||
@@ -67,15 +70,18 @@ window_t init_window(unsigned int width, unsigned int height, const char *title)
|
|||||||
glfwSetKeyCallback((GLFWwindow *)window, __key_callback_input);
|
glfwSetKeyCallback((GLFWwindow *)window, __key_callback_input);
|
||||||
glfwSetDropCallback((GLFWwindow *)window, __drop_callback_input);
|
glfwSetDropCallback((GLFWwindow *)window, __drop_callback_input);
|
||||||
|
|
||||||
__window_callback_input((GLFWwindow *)window, width, height);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void use_window(window_t window) { glfwMakeContextCurrent((void *)window); }
|
void use_window(window_t window) { glfwMakeContextCurrent((void *)window); }
|
||||||
|
|
||||||
|
extern int window_width, window_height;
|
||||||
|
|
||||||
int is_open_window(window_t window)
|
int is_open_window(window_t window)
|
||||||
{
|
{
|
||||||
|
/* Restore window proportions if Nuklear breaks it */
|
||||||
|
__window_callback_input((GLFWwindow *)window, window_width, window_height);
|
||||||
|
|
||||||
glfwSwapBuffers((void *)window);
|
glfwSwapBuffers((void *)window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user