diff --git a/PlanetMiner b/PlanetMiner index ae91123..f68fba4 100755 Binary files a/PlanetMiner and b/PlanetMiner differ diff --git a/bin/main.o b/bin/main.o index 79d1912..b10314d 100644 Binary files a/bin/main.o and b/bin/main.o differ diff --git a/bin/worldgen.o b/bin/worldgen.o new file mode 100644 index 0000000..809dbe6 Binary files /dev/null and b/bin/worldgen.o differ diff --git a/src/main.c b/src/main.c index 2afe0a9..7b3348c 100644 --- a/src/main.c +++ b/src/main.c @@ -71,42 +71,31 @@ int main() vec3s up = {0.0f, 1.0f, 0.0f}; static const GLfloat g_vertex_buffer_data[] = { - -1.0f,-1.0f,-1.0f, // triangle 1 : begin - -1.0f,-1.0f, 1.0f, - -1.0f, 1.0f, 1.0f, // triangle 1 : end - 1.0f, 1.0f,-1.0f, // triangle 2 : begin - -1.0f,-1.0f,-1.0f, - -1.0f, 1.0f,-1.0f, // triangle 2 : end - 1.0f,-1.0f, 1.0f, - -1.0f,-1.0f,-1.0f, - 1.0f,-1.0f,-1.0f, - 1.0f, 1.0f,-1.0f, - 1.0f,-1.0f,-1.0f, - -1.0f,-1.0f,-1.0f, - -1.0f,-1.0f,-1.0f, - -1.0f, 1.0f, 1.0f, - -1.0f, 1.0f,-1.0f, - 1.0f,-1.0f, 1.0f, - -1.0f,-1.0f, 1.0f, - -1.0f,-1.0f,-1.0f, - -1.0f, 1.0f, 1.0f, - -1.0f,-1.0f, 1.0f, - 1.0f,-1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 1.0f,-1.0f,-1.0f, - 1.0f, 1.0f,-1.0f, - 1.0f,-1.0f,-1.0f, - 1.0f, 1.0f, 1.0f, - 1.0f,-1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f,-1.0f, - -1.0f, 1.0f,-1.0f, - 1.0f, 1.0f, 1.0f, - -1.0f, 1.0f,-1.0f, - -1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - -1.0f, 1.0f, 1.0f, - 1.0f,-1.0f, 1.0f + 1.0f, 0.0f, 2.0f, + 2.0f, 1.0f, 0.0f, + + BAC + BCH + BHF + BFG + BGA + + AIC + ICD + CDH + DHJ + HJF + JFL + FLG + LGE + GEA + EAI + + KEI + KID + KDJ + KJL + KLE }; GLuint vertexbuffer; @@ -116,10 +105,11 @@ int main() vec3s direction = {0.0f, 0.0f, -5.0f}; + printf("Entering main loop\n"); + do { glClear( GL_COLOR_BUFFER_BIT ); - g if( glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS ) { @@ -175,7 +165,9 @@ int main() glfwSwapBuffers(window); glfwPollEvents(); } - while( glfwGetKey(window, GLFW_KEY_Q) | glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS && !glfwWindowShouldClose(window)); + while( (glfwGetKey(window, GLFW_KEY_Q) != GLFW_PRESS + && glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS) + && !glfwWindowShouldClose(window)); glDeleteBuffers(1, &vertexbuffer); glDeleteProgram(programID); diff --git a/src/worldgen.c b/src/worldgen.c index 6b54831..f46472b 100644 --- a/src/worldgen.c +++ b/src/worldgen.c @@ -1,5 +1,6 @@ #include "worldgen.h" #include +#include #define ORDER 1 #define RSQRT5 0.4472135954999579 @@ -9,10 +10,12 @@ worldMesh generateWorld(vec3s position) { // placeholder struct for world mesh worldMesh mesh; - vertex.count = 20 * ORDER * 3; // Icosahedron has 20 triangular sides + mesh.count = 20 * ORDER * 3; // Icosahedron has 20 triangular sides mesh.vertices = (GLfloat*) malloc(sizeof(GLfloat) * mesh.count); populateIcosphere(mesh, ORDER, 1); + + return mesh; } void populateIcosphere(worldMesh mesh, unsigned char order, float radius) diff --git a/src/worldgen.h b/src/worldgen.h index 08af7bd..0fafaa4 100644 --- a/src/worldgen.h +++ b/src/worldgen.h @@ -1,4 +1,5 @@ #include +#include typedef struct worldMesh { long int count;