Change projection w/keyboard

This commit is contained in:
PedroEdiaz
2024-10-22 23:07:30 -06:00
parent 6727c5fa9a
commit 2a5a101080
7 changed files with 140 additions and 48 deletions

View File

@@ -5,10 +5,12 @@
#include <stdlib.h>
#include <stdio.h>
#define WIDTH 512
#define HEIGHT 512
float * generate_data_surface(unsigned int, unsigned char *);
float * generate_normals_surface(float *, unsigned char);
unsigned char palette[] =
{
0xEB,0xD3,0xF8,0xff,
@@ -17,12 +19,15 @@ unsigned char palette[] =
0x7A,0x1C,0xAC,0xff,
};
unsigned char coordanate[4] = {0,1,2,3};
const char * wname = "manigraph: manifold grapher";
float * generate_data_surface(unsigned int, unsigned char *);
float * generate_normals_surface(float *, unsigned char);
struct projection projection =
{
.x=0,
.y=1,
.z=2,
.w=3,
};
void mlog( char * msg )
{
@@ -94,18 +99,25 @@ int main( void )
float * n_surface, *d_surface;
d_surface = generate_data_surface(16,&m);
n_surface = generate_normals_surface(d_surface, m);
if( !(m_surface = create_mesh(d_surface, n_surface, coordanate, m)))
projection.m=m;
if( !(m_surface = create_mesh(d_surface, n_surface, m)))
{
mlog("[MESH] Error al inicializar...\n");
goto error_mesh_surface;
}
projection.mesh=m_surface;
free(n_surface);
free(d_surface);
}
mlog("[MESH] Inicializando...\n");
{
if(!(m_axis = create_mesh(d_axis, NULL, coordanate, 3)))
if(!(m_axis = create_mesh(d_axis, NULL, 3)))
{
mlog("[MESH] Error al inicializar...\n");
goto error_mesh_axis;