summaryrefslogtreecommitdiffstats
path: root/src/RendererSection.hpp
blob: 57d04d50f112ddfb4048ac8146b2af8f6925e5b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#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 "AssetManager.hpp"
#include "Section.hpp"
#include "World.hpp"
#include "Vector.hpp"
#include "Renderer.hpp"

class RendererSection : Renderer {
	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;

	

	bool isEnabled = false;

	size_t hash = 0;
public:
	RendererSection(World *world, Vector position);
	RendererSection(const RendererSection &other);
	~RendererSection() override;

	void Render(RenderState &renderState) override;

	void PrepareResources() override;

	void PrepareRender() override;

	void SetEnabled(bool isEnabled);

	Section *GetSection();

	bool IsNeedResourcesPrepare() override;

    size_t numOfFaces = 0;
};