diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-23 17:23:22 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-23 17:23:22 +0200 |
commit | bdf73a67ffd964c37db5a9694424380bfd685c95 (patch) | |
tree | 3d313b318623eb7e7c46aed80c10e7fe896a5587 /src/RendererWorld.cpp | |
parent | 2017-08-20 (diff) | |
download | AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar.gz AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar.bz2 AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar.lz AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar.xz AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.tar.zst AltCraft-bdf73a67ffd964c37db5a9694424380bfd685c95.zip |
Diffstat (limited to '')
-rw-r--r-- | src/RendererWorld.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index 9bd2ccf..dd5fdb4 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -84,7 +84,7 @@ void RendererWorld::UpdateAllSections(VectorF playerPos) } RendererWorld::RendererWorld(std::shared_ptr<GameState> ptr):gs(ptr) { - MaxRenderingDistance = 10; + MaxRenderingDistance = 4; numOfWorkers = 4; PrepareRender(); @@ -176,6 +176,15 @@ RendererWorld::RendererWorld(std::shared_ptr<GameState> ptr):gs(ptr) { UpdateAllSections(pos); }); + listener.RegisterHandler(EventType::ChunkDeleted, [this](EventData eventData) { + auto pos = std::get<ChunkDeletedData>(eventData).pos; + sectionsMutex.lock(); + auto it = sections.find(pos); + if (it != sections.end()) + sections.erase(it); + sectionsMutex.unlock(); + }); + for (int i = 0; i < numOfWorkers; i++) workers.push_back(std::thread(&RendererWorld::WorkerFunction, this, i)); @@ -251,6 +260,7 @@ void RendererWorld::Render(RenderState & renderState) { sectionsMutex.unlock(); glCheckError(); + glLineWidth(3.0); renderState.SetActiveShader(entityShader->Program); glCheckError(); projectionLoc = glGetUniformLocation(entityShader->Program, "projection"); @@ -265,6 +275,7 @@ void RendererWorld::Render(RenderState & renderState) { it.colorLoc = colorLoc; it.Render(renderState); } + glLineWidth(1.0); |