diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-29 16:55:16 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-29 16:55:16 +0200 |
commit | f942405184c2d6067fb5303b58a225edf7e452b1 (patch) | |
tree | 83e70c7e3019e5b195c9caf41194b2113fa76d7f /old/graphics/RenderSection.hpp | |
parent | 2017-07-26 (diff) | |
download | AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.gz AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.bz2 AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.lz AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.xz AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.zst AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.zip |
Diffstat (limited to 'old/graphics/RenderSection.hpp')
-rw-r--r-- | old/graphics/RenderSection.hpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/old/graphics/RenderSection.hpp b/old/graphics/RenderSection.hpp new file mode 100644 index 0000000..7f97624 --- /dev/null +++ b/old/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 |