From 437cf879808fb68a79e7f8325615737f86f434be Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 23 Sep 2017 20:55:08 +0500 Subject: 2017-09-23 --- src/RendererSection.hpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/RendererSection.hpp') diff --git a/src/RendererSection.hpp b/src/RendererSection.hpp index fa4a389..6745987 100644 --- a/src/RendererSection.hpp +++ b/src/RendererSection.hpp @@ -23,11 +23,31 @@ struct RendererSectionData { RendererSectionData(World *world, Vector sectionPosition); private: - bool TestBlockExists(const std::vector §ionsList, World *world, Vector blockPos); - void AddFacesByBlockModel(const std::vector §ionsList, World *world, Vector blockPos, const BlockModel &model, glm::mat4 transform, unsigned char light, unsigned char skyLight); + void AddFacesByBlockModel(const std::vector §ionsList, World *world, Vector blockPos, const BlockModel &model, glm::mat4 transform, unsigned char light, unsigned char skyLight, const std::array& visibility); + + std::array GetBlockVisibilityData(World *world); + + AssetManager& am = AssetManager::Instance(); + + std::vector> idModels; + const BlockModel* GetInternalBlockModel(const BlockId& id); + + std::array blockIdData; + void SetBlockIdData(World *world); + + inline const BlockId& GetBlockId(const Vector& pos) { + return blockIdData[pos.y * 256 + pos.z * 16 + pos.x]; + } + + inline const BlockId& GetBlockId(int x, int y, int z) { + return blockIdData[y * 256 +z * 16 + x]; + } + + }; + class RendererSection { enum Vbos { MODELS = 0, @@ -36,9 +56,9 @@ class RendererSection { LIGHTS, VBOCOUNT, }; - - static GLuint Vao; - static GLuint Vbo[VBOCOUNT]; + GLuint Vao = { 0 }; + GLuint Vbo[VBOCOUNT] = { 0 }; + static GLuint VboVertices, VboUvs; size_t hash; @@ -52,15 +72,13 @@ public: ~RendererSection(); + void Render(RenderState &renderState); + Vector GetPosition(); size_t GetHash(); size_t numOfFaces; - size_t offset; - - static GLuint GetVao(); - friend void swap(RendererSection &lhs, RendererSection &rhs); }; \ No newline at end of file -- cgit v1.2.3