Switchin computers again

This commit is contained in:
Ben Kyd
2019-10-11 17:32:41 +01:00
parent 33921d774b
commit dc1b7ab83f
3 changed files with 32 additions and 10 deletions

View File

@@ -85,14 +85,14 @@ void Game::Setup(int w, int h) {
m_world = std::make_unique<World>();
m_world->Voxels.push_back(std::make_shared<Voxel>(0, 0, 0));
//m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, 0));
//m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, 0));
//m_world->Voxels.push_back(std::make_shared<Voxel>(0, 0, 1));
//m_world->Voxels.push_back(std::make_shared<Voxel>(0, 0, -1));
//m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, -1));
//m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, 1));
//m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, 1));
//m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, -1));
m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, 0));
m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, 0));
m_world->Voxels.push_back(std::make_shared<Voxel>(0, 0, 1));
m_world->Voxels.push_back(std::make_shared<Voxel>(0, 0, -1));
m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, -1));
m_world->Voxels.push_back(std::make_shared<Voxel>(-1, 0, 1));
m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, 1));
m_world->Voxels.push_back(std::make_shared<Voxel>(1, 0, -1));
m_world->Shaders["Basic"] = std::make_shared<Shader>();
m_world->Shaders["Basic"]->Load(GameConfig.ResourceBase + "shaders/simple");

View File

@@ -5,10 +5,30 @@
#include "face.hpp"
Voxel::Voxel(int x, int y, int z) {
m_model = glm::translate(glm::mat4(1.0f), { (float)x, (float)y, (float)z });
// Texture winding order - top, bottom, left, right, front, back
m_faces.push_back(Face((FaceDirection)0, 2));
m_faces.push_back(Face((FaceDirection)1, 0));
m_faces.push_back(Face((FaceDirection)2, 1));
m_faces.push_back(Face((FaceDirection)3, 1));
m_faces.push_back(Face((FaceDirection)4, 1));
m_faces.push_back(Face((FaceDirection)5, 1));
for (auto& face : m_faces) {
std::vector<glm::vec3> Vert;
std::vector<glm::vec3> UVs;
face.GetMesh(Vert, UVs);
m_vertices.insert(m_vertices.end(), Vert.begin(), Vert.end());
m_uvs.insert(m_uvs.end(), UVs.begin(), UVs.end());
}
Face top((FaceDirection)0, 2);
std::vector<glm::vec3> topVert;
std::vector<glm::vec3> topUVs;

View File

@@ -3,11 +3,11 @@
#include "../common.hpp"
#include "face.hpp"
class Camera;
class Shader;
class Face;
class Voxel {
public:
Voxel(int x, int y, int z);
@@ -16,6 +16,8 @@ public:
private:
std::vector<Face> m_faces;
GLuint m_vao = 0;
GLuint m_vbo = 0;