From bdf73a67ffd964c37db5a9694424380bfd685c95 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Wed, 23 Aug 2017 20:23:22 +0500 Subject: 2017-08-23 --- src/RendererWorld.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/RendererWorld.cpp') 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 ptr):gs(ptr) { - MaxRenderingDistance = 10; + MaxRenderingDistance = 4; numOfWorkers = 4; PrepareRender(); @@ -176,6 +176,15 @@ RendererWorld::RendererWorld(std::shared_ptr ptr):gs(ptr) { UpdateAllSections(pos); }); + listener.RegisterHandler(EventType::ChunkDeleted, [this](EventData eventData) { + auto pos = std::get(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); -- cgit v1.2.3