diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-21 16:49:56 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-07-21 16:49:56 +0200 |
commit | 9e56348975dbdaf1cce9dd688129208a61fd4eb5 (patch) | |
tree | 5a44a37cf0243c1ced14c222f35983eaaaa0185b /include/Core.hpp | |
parent | 2017-06-21 (diff) | |
download | AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.gz AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.bz2 AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.lz AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.xz AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.zst AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.zip |
Diffstat (limited to 'include/Core.hpp')
-rw-r--r-- | include/Core.hpp | 25 |
1 files changed, 18 insertions, 7 deletions
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 <graphics/RenderSection.hpp> #include <network/NetworkClient.hpp> +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<Vector> toRender; + bool isRendersShouldBeCreated=false; + std::condition_variable waitRendersCreated; + std::vector<Vector> renders; + std::mutex toRenderMutex; std::vector<Vector> toRender; std::map<Vector, RenderSection> availableChunks; + std::mutex availableChunksMutex; - int ChunkDistance = 2; + int ChunkDistance = 1; RenderState renderState; - /*std::map<Vector, std::vector<glm::mat4>> toRenderModels; - std::map<Vector, std::vector<glm::vec2>> toRenderBlocks;*/ - double tickRate = 0; + double sectionRate = 0; public: Core(); |