summaryrefslogtreecommitdiffstats
path: root/src/graphics/RenderSection.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-24 16:52:24 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-24 16:52:24 +0200
commit6a00886804c53883d919f008f6ec47a574d86607 (patch)
tree2dbe9fdb0a0d5f068770d49a3c960d36958f27d5 /src/graphics/RenderSection.hpp
parent2017-07-21 (diff)
downloadAltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.gz
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.bz2
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.lz
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.xz
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.tar.zst
AltCraft-6a00886804c53883d919f008f6ec47a574d86607.zip
Diffstat (limited to 'src/graphics/RenderSection.hpp')
-rw-r--r--src/graphics/RenderSection.hpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/graphics/RenderSection.hpp b/src/graphics/RenderSection.hpp
new file mode 100644
index 0000000..5973909
--- /dev/null
+++ b/src/graphics/RenderSection.hpp
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <GL/glew.h>
+#include <glm/detail/type_mat.hpp>
+#include <glm/vec2.hpp>
+#include <glm/detail/type_mat4x4.hpp>
+#include <glm/gtx/transform.hpp>
+#include <easylogging++.h>
+
+#include <core/AssetManager.hpp>
+#include <world/Section.hpp>
+#include <world/World.hpp>
+
+class RenderState {
+ GLuint ActiveVao;
+ GLuint ActiveShader;
+public:
+ void SetActiveVao(GLuint Vao);
+ void SetActiveShader(GLuint Shader);
+};
+
+class RenderSection {
+ Vector sectionPosition;
+ World *world;
+ GLuint Vao, VboTextures, VboModels, VboColors;
+ std::vector<glm::mat4> models;
+ std::vector<glm::vec4> textures;
+ std::vector<glm::vec3> colors;
+
+ static GLuint VboVertices, VboUvs;
+ static std::map<GLuint, int> refCounterVbo;
+ static std::map<GLuint, int> refCounterVao;
+
+ size_t numOfFaces = 0;
+
+ bool isEnabled = true;
+
+ size_t hash = 0;
+public:
+ RenderSection(World *world, Vector position);
+ RenderSection(const RenderSection &other);
+ ~RenderSection();
+
+ void UpdateState(const std::map<BlockTextureId, glm::vec4> &textureAtlas);
+ void Render(RenderState &state);
+
+ void SetEnabled(bool isEnabled);
+
+ Section *GetSection();
+
+ bool IsNeedUpdate();
+}; \ No newline at end of file