diff options
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 |