summaryrefslogtreecommitdiffstats
path: root/src/RendererSection.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-09-23 17:55:08 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:32 +0100
commit437cf879808fb68a79e7f8325615737f86f434be (patch)
treedb9dcb8c02606dc8bfc7478e058291b6cec076cf /src/RendererSection.hpp
parent2017-09-20 (diff)
downloadAltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.gz
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.bz2
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.lz
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.xz
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.zst
AltCraft-437cf879808fb68a79e7f8325615737f86f434be.zip
Diffstat (limited to 'src/RendererSection.hpp')
-rw-r--r--src/RendererSection.hpp36
1 files changed, 27 insertions, 9 deletions
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<Vector> &sectionsList, World *world, Vector blockPos);
- void AddFacesByBlockModel(const std::vector<Vector> &sectionsList, World *world, Vector blockPos, const BlockModel &model, glm::mat4 transform, unsigned char light, unsigned char skyLight);
+ void AddFacesByBlockModel(const std::vector<Vector> &sectionsList, 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);
+
+ AssetManager& am = AssetManager::Instance();
+
+ 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 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