diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-26 20:57:53 -0400 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-26 20:57:53 -0400 |
commit | 5a08c9c8e230fd952311f29bc02b22c7635d0178 (patch) | |
tree | 09bb647986461478ba8cc0671550d8488a6c434f /src/chunk.hpp | |
parent | texture arrays (diff) | |
download | minecraftvulkan-5a08c9c8e230fd952311f29bc02b22c7635d0178.tar.gz minecraftvulkan-5a08c9c8e230fd952311f29bc02b22c7635d0178.tar.bz2 minecraftvulkan-5a08c9c8e230fd952311f29bc02b22c7635d0178.zip |
vertex buffer is not a byte vector, multi texture loading
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r-- | src/chunk.hpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index d10adc9..e2cfab5 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -1,6 +1,9 @@ #pragma once #include "xe_model.hpp" +#include "xe_engine.hpp" +#include "xe_image.hpp" + #include "PerlinNoise.hpp" #include <glm/common.hpp> @@ -11,19 +14,30 @@ #include <string> #include <map> -#define INVALID 0 -#define AIR 1 -#define DIRT 2 -#define GRASS 3 +#define INVALID -1 +#define AIR 0 +#define DIRT 1 +#define GRASS 2 + +#define DIRT_TEXTURE "res/image/dirt.png" +#define GRASS_TEXTURE "res/image/grass.png" +#define GRASS_TOP_TEXTURE "res/image/grass_top.png" namespace app { +struct Block { + uint32_t textures[6]; +}; + class Chunk { public: + static void load(); + static void unload(); + static std::vector<xe::Image*>& getTextures(); + static Chunk* newChunk(int32_t gridX, int32_t gridZ, uint32_t world_seed); - static void reset(); Chunk(int32_t gridX, int32_t gridZ, uint32_t world_seed); ~Chunk() {}; @@ -43,16 +57,16 @@ class Chunk { private: void generate(); - void addVerticies(uint8_t side, int32_t x, int32_t y, int32_t z); + void addVerticies(uint8_t side, int32_t x, int32_t y, int32_t z, uint8_t block); bool reloadRequired{false}; bool working{false}; std::shared_ptr<xe::Model> chunkMesh; - std::vector<float> vertexData; - std::vector<uint8_t> blocks; + xe::Model::Data vertexData; + std::vector<uint8_t> cubes; std::thread worker; - + }; const float px[36][3] = { |