diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-03-16 20:04:44 +0100 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-03-17 09:30:25 +0100 |
commit | 47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096 (patch) | |
tree | b6b7c41fa1594a54c3f3907f23d26787a85a056c /src/RendererWorld.hpp | |
parent | Improved RendererSectionData parsing data locality (diff) | |
download | AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar.gz AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar.bz2 AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar.lz AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar.xz AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.tar.zst AltCraft-47bc1c3f81d8f697ddf6a9b84f5cb0b762be9096.zip |
Diffstat (limited to 'src/RendererWorld.hpp')
-rw-r--r-- | src/RendererWorld.hpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/RendererWorld.hpp b/src/RendererWorld.hpp index b9d1113..77a02fd 100644 --- a/src/RendererWorld.hpp +++ b/src/RendererWorld.hpp @@ -10,6 +10,7 @@ #include "RendererSection.hpp" #include "RendererEntity.hpp" #include "RendererSky.hpp" +#include "RendererSectionData.hpp" class Frustum; class GameState; @@ -17,9 +18,14 @@ class Texture; class Shader; class EventListener; class RenderState; -class RendererSectionData; class RendererWorld { + struct SectionParsing { + SectionsData data; + RendererSectionData renderer; + bool parsing = false; + }; + //General GameState *gs; std::unique_ptr<EventListener> listener; @@ -28,13 +34,14 @@ class RendererWorld { std::vector<std::thread> workers; void WorkerFunction(size_t WorkerId); bool isRunning = true; - std::mutex isParsingMutex; - std::map<Vector, bool> isParsing; + const static size_t parsingBufferSize = 64; + SectionParsing parsing[parsingBufferSize]; + std::queue<Vector> parseQueue; + bool parseQueueNeedRemoveUnnecessary = false; + void ParseQueueUpdate(); + void ParseQeueueRemoveUnnecessary(); //Blocks - std::mutex renderDataMutex; - std::queue<std::unique_ptr<RendererSectionData>> renderData; std::vector<Vector> renderList; - std::mutex sectionsMutex; std::map<Vector, RendererSection> sections; Shader *blockShader; void UpdateAllSections(VectorF playerPos); |