blob: e7bd51279e7e7ca5a34dd13cfb89a6402914479e (
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
52
53
54
|
#pragma once
#include "RendererSection.hpp"
#include "RendererEntity.hpp"
#include "RendererSky.hpp"
#include "GameState.hpp"
#include "Shader.hpp"
#include <glm/gtc/type_ptr.hpp>
class Frustum;
class RendererWorld {
//General
GameState *gs;
EventListener listener;
size_t numOfWorkers;
size_t currentWorker = 0;
std::vector<std::thread> workers;
void WorkerFunction(size_t WorkerId);
bool isRunning = true;
std::mutex isParsingMutex;
std::map<Vector, bool> isParsing;
//Blocks
std::mutex renderDataMutex;
std::queue<RendererSectionData> renderData;
std::vector<Vector> renderList;
std::mutex sectionsMutex;
std::map<Vector, RendererSection> sections;
Shader *blockShader;
void UpdateAllSections(VectorF playerPos);
std::unique_ptr<Frustum> frustum;
//Entities
Shader *entityShader;
std::vector<RendererEntity> entities;
//Sky
Texture *skyTexture;
Shader *skyShader;
RendererSky rendererSky;
public:
RendererWorld(GameState* ptr);
~RendererWorld();
void Render(RenderState& renderState);
void PrepareRender();
double MaxRenderingDistance;
void Update(double timeToUpdate);
GameState *GameStatePtr();
int culledSections = 0;
};
|