From 6e42ac9e8b331b2cb6efaa8aa8893d7657e8c91e Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 2 Mar 2021 17:42:24 +0000 Subject: [PATCH] voxel meshes perhaps --- src/Rendering/mesh.hpp | 4 +++- src/Rendering/renderable.hpp | 2 -- src/Rendering/rendermaster.hpp | 1 + src/Rendering/voxelmesh.hpp | 23 +++++++++++++++++++++++ src/main.cpp | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/Rendering/voxelmesh.hpp diff --git a/src/Rendering/mesh.hpp b/src/Rendering/mesh.hpp index 644fb1d..7aea96a 100644 --- a/src/Rendering/mesh.hpp +++ b/src/Rendering/mesh.hpp @@ -15,8 +15,10 @@ public: Mesh(); - +private: + GLuint mVAO; + GLuint mVBO; }; diff --git a/src/Rendering/renderable.hpp b/src/Rendering/renderable.hpp index 0b81cf3..7441d8c 100644 --- a/src/Rendering/renderable.hpp +++ b/src/Rendering/renderable.hpp @@ -35,8 +35,6 @@ private: std::vector mMeshs; Mesh* mActiveMesh; - GLuint mActiveVAO; - GLuint mActiveVBO; // Meshes have uniform uniforms GLuint mUBO; diff --git a/src/Rendering/rendermaster.hpp b/src/Rendering/rendermaster.hpp index 8696466..9965d23 100644 --- a/src/Rendering/rendermaster.hpp +++ b/src/Rendering/rendermaster.hpp @@ -5,6 +5,7 @@ * Renderer Structure * * Mesh -> Renderable + * Mesh -> VoxelMesh * Renderable -> Model * Renderable -> World (static(?)) * Renderable -> Entity (dynamic) diff --git a/src/Rendering/voxelmesh.hpp b/src/Rendering/voxelmesh.hpp new file mode 100644 index 0000000..bb94ecf --- /dev/null +++ b/src/Rendering/voxelmesh.hpp @@ -0,0 +1,23 @@ +#ifndef MINECRAFT_RENDERER_VOXELMESH_H_ +#define MINECRAFT_RENDERER_VOXELMESH_H_ + +#include "mesh.hpp" + +class VoxelMesh : public Mesh +{ +public: + + VoxelMesh(); + + + + int Width; + int Height; + int Depth; + + // Size is w*h*d + std::vector Voxels; + +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index d4683a1..63e1cc7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,7 @@ void version() { std::stringstream version; - auto& container = []( std::string s ) { std::string r = ""; for ( auto& c : s ) { r += "-"; } return r; }; + const auto& container = []( std::string s ) { std::string r = ""; for ( auto& c : s ) { r += "-"; } return r; }; version << "Minecraft "; version << VERSION_MAJOR << "." << VERSION_MINOR << "." << VERSION_PATCH;