diff --git a/include/klein/klein.h b/include/klein/klein.h index 6265adf..663c8f1 100644 --- a/include/klein/klein.h +++ b/include/klein/klein.h @@ -39,8 +39,8 @@ int klein_export_file(struct klein klein, const char * filename) fwrite("\0", 1, 1, file); fwrite(&klein.dim, 1, 1, file); fwrite(&klein.vertex_size, 8, 1, file); - fwrite(klein.vertex, 16, klein.vertex_size * klein.dim, file); - fwrite(klein.normals, 16, klein.vertex_size * klein.dim, file); + fwrite(klein.vertex, 4, klein.vertex_size * klein.dim, file); + fwrite(klein.normals, 4, klein.vertex_size * klein.dim, file); fclose(file); return 0; diff --git a/src/klein.c b/src/klein.c index 8add64b..7c01494 100644 --- a/src/klein.c +++ b/src/klein.c @@ -7,7 +7,7 @@ 5 bytes with KLEIN 1 byte empty for scaling 1 byte with the dimention of the surface - 8 bytes interprated as a long with the number of vertex + 8 bytes interprated as an int with the number of vertex n bytes with the vertex data of the surface n bytes with the normal data of the surface @@ -35,10 +35,10 @@ int create_surface_klein(unsigned char *path, struct surface *surface) size = surface->dim * surface->vertex; - surface->data = malloc(16 * size); - fread(surface->data, 16, size, file); + surface->data = malloc(4 * size); + fread(surface->data, 4, size, file); - surface->norm = malloc(16 * size); - fread(surface->norm, 16, size, file); + surface->norm = malloc(4 * size); + fread(surface->norm, 4, size, file); return 0; } diff --git a/src/main.h b/src/main.h index 6ae5ebd..6f40d61 100644 --- a/src/main.h +++ b/src/main.h @@ -4,7 +4,9 @@ error of the shaders. */ +#include #define DEBUG +#define GLFW_INCLUDE_NONE typedef const void *window_t; typedef unsigned int id_t; @@ -40,8 +42,8 @@ struct projection struct surface { float *data, *norm; - unsigned long vertex; - unsigned char dim; + uint64_t vertex; + uint8_t dim; }; /*