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/world | |
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/world')
-rw-r--r-- | include/world/Section.hpp | 3 | ||||
-rw-r--r-- | include/world/World.hpp | 21 |
2 files changed, 15 insertions, 9 deletions
diff --git a/include/world/Section.hpp b/include/world/Section.hpp index 139b5b5..2df0cfe 100644 --- a/include/world/Section.hpp +++ b/include/world/Section.hpp @@ -3,6 +3,7 @@ #include <vector> #include <map> #include <condition_variable> +#include <functional> #include <easylogging++.h> @@ -45,4 +46,6 @@ public: Section(const Section &other); Vector GetPosition(); + + size_t GetHash(); };
\ No newline at end of file diff --git a/include/world/World.hpp b/include/world/World.hpp index 6e5eedb..6b09f1f 100644 --- a/include/world/World.hpp +++ b/include/world/World.hpp @@ -11,17 +11,14 @@ #include <world/Collision.hpp> class World { - //utility vars - World(const World &other); - - World &operator=(const World &other); - - //game vars + std::map<Vector, Section> sections; + std::map<Vector, std::mutex> sectionMutexes; int dimension = 0; - //game methods Section ParseSection(StreamInput *data, Vector position); + World(const World &other); + World &operator=(const World &other); public: World(); @@ -29,7 +26,13 @@ public: void ParseChunkData(std::shared_ptr<PacketChunkData> packet); - std::map<Vector, Section> sections; - bool isPlayerCollides(double X, double Y, double Z); + + Block &GetBlock(Vector pos); + + std::vector<Vector> GetSectionsList(); + + Section &GetSection(Vector sectionPos); + + glm::vec3 Raycast(glm::vec3 position, glm::vec3 direction, float maxLength = 1000.0f, float minPrecision = 0.01f); };
\ No newline at end of file |