From 6a00886804c53883d919f008f6ec47a574d86607 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Mon, 24 Jul 2017 19:52:24 +0500 Subject: 2017-07-24 --- src/graphics/RenderSection.hpp | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/graphics/RenderSection.hpp (limited to 'src/graphics/RenderSection.hpp') 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 +#include +#include +#include +#include +#include + +#include +#include +#include + +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 models; + std::vector textures; + std::vector colors; + + static GLuint VboVertices, VboUvs; + static std::map refCounterVbo; + static std::map 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 &textureAtlas); + void Render(RenderState &state); + + void SetEnabled(bool isEnabled); + + Section *GetSection(); + + bool IsNeedUpdate(); +}; \ No newline at end of file -- cgit v1.2.3