Started adding vertices for icosohedron
This commit is contained in:
parent
ef44b24798
commit
9a710c4687
BIN
PlanetMiner
BIN
PlanetMiner
Binary file not shown.
BIN
bin/main.o
BIN
bin/main.o
Binary file not shown.
BIN
bin/worldgen.o
Normal file
BIN
bin/worldgen.o
Normal file
Binary file not shown.
68
src/main.c
68
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);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "worldgen.h"
|
||||
#include <cglm/struct.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
#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)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <cglm/struct.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct worldMesh {
|
||||
long int count;
|
||||
|
Loading…
Reference in New Issue
Block a user