From 9e56348975dbdaf1cce9dd688129208a61fd4eb5 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 21 Jul 2017 19:49:56 +0500 Subject: 2017-07-21 --- include/Core.hpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'include/Core.hpp') diff --git a/include/Core.hpp b/include/Core.hpp index 64fab4e..8d60ff6 100644 --- a/include/Core.hpp +++ b/include/Core.hpp @@ -15,6 +15,14 @@ #include #include +struct MyMutex { + std::mutex mtx; + std::string str; + MyMutex(std::string name); + void lock(); + void unlock(); +}; + class Core { GameState *gameState; NetworkClient *client; @@ -56,24 +64,27 @@ class Core { void UpdateGameState(); + void UpdateSections(); + std::thread gameStateLoopThread; + std::thread sectionUpdateLoopThread; Shader *shader; //Cube verticies, Cube VAO, Cube UVs, TextureIndexes UboTextureIndexes, TextureData UboTextureIndexes, TextureData2 UboTextureIndexes, Blocks VBO, Models VBO, Line VAO, Lines VBO - //GLuint VBO, VAO, VBO2, UboTextureIndexes, UboTextureData, VBO3, VBO4, VAO2, VBO5; - GLuint UboTextureIndexes, UboTextureData; - //std::vector toRender; + bool isRendersShouldBeCreated=false; + std::condition_variable waitRendersCreated; + std::vector renders; + std::mutex toRenderMutex; std::vector toRender; std::map availableChunks; + std::mutex availableChunksMutex; - int ChunkDistance = 2; + int ChunkDistance = 1; RenderState renderState; - /*std::map> toRenderModels; - std::map> toRenderBlocks;*/ - double tickRate = 0; + double sectionRate = 0; public: Core(); -- cgit v1.2.3