diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-11-06 14:01:19 +0100 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-01-13 03:39:33 +0100 |
commit | 95c85382030af78854a42d457fbb259e6078402b (patch) | |
tree | 9ed941e9ee88cc77ece824c3c7bb872a37ec7d9b /src/RendererSection.hpp | |
parent | Minor shader optimization (diff) | |
download | AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar.gz AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar.bz2 AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar.lz AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar.xz AltCraft-95c85382030af78854a42d457fbb259e6078402b.tar.zst AltCraft-95c85382030af78854a42d457fbb259e6078402b.zip |
Diffstat (limited to 'src/RendererSection.hpp')
-rw-r--r-- | src/RendererSection.hpp | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/src/RendererSection.hpp b/src/RendererSection.hpp index 26068e4..c9137ce 100644 --- a/src/RendererSection.hpp +++ b/src/RendererSection.hpp @@ -1,49 +1,12 @@ #pragma once -#include <vector> -#include <array> - #include <glm/mat4x4.hpp> #include <GL/glew.h> #include "Vector.hpp" -#include "Block.hpp" -class BlockModel; -class AssetManager; -class World; class RenderState; - -struct RendererSectionData { - std::vector<glm::mat4> models; - std::vector<glm::vec4> textures; - std::vector<glm::vec3> colors; - std::vector<glm::vec2> lights; - size_t hash; - Vector sectionPos; - - RendererSectionData(World *world, Vector sectionPosition); -private: - - void AddFacesByBlockModel(const std::vector<Vector> §ionsList, World *world, Vector blockPos, const BlockModel &model, glm::mat4 transform, unsigned char light, unsigned char skyLight, const std::array<unsigned char, 16 * 16 * 16>& visibility); - - std::array<unsigned char, 16 * 16 * 16> GetBlockVisibilityData(World *world); - - std::vector<std::pair<BlockId, const BlockModel *>> idModels; - const BlockModel* GetInternalBlockModel(const BlockId& id); - - std::array<BlockId, 4096> 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 RendererSectionData; class RendererSection { enum Vbos { @@ -63,7 +26,7 @@ class RendererSection { RendererSection(const RendererSection &other) = delete; public: - RendererSection(RendererSectionData data); + RendererSection(const RendererSectionData &data); RendererSection(RendererSection &&other); |