diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h index 1fa9a5b6..968f82da 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h @@ -33,6 +33,7 @@ freely, subject to the following restrictions: #include #include //For abort() #include //For memcpy +#include #include #include #include @@ -284,24 +285,8 @@ namespace PolyVox private: - struct BlockPositionCompare - { - bool operator() (const PolyVox::Vector3DInt32& a, const PolyVox::Vector3DInt32& b) const - { - const uint32_t size = 3; - for(uint32_t ct = 0; ct < size; ++ct) - { - if (a.getElement(ct) < b.getElement(ct)) - return true; - if (b.getElement(ct) < a.getElement(ct)) - return false; - } - return false; - } - }; - - typedef std::map >, BlockPositionCompare> SharedPtrBlockMap; - typedef std::map >, BlockPositionCompare> WeakPtrBlockMap; + typedef std::unordered_map > > SharedPtrBlockMap; + typedef std::unordered_map > > WeakPtrBlockMap; void initialise(); diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.h b/library/PolyVoxCore/include/PolyVoxCore/Vector.h index db3da0f8..7a7ff7ed 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Vector.h @@ -31,6 +31,7 @@ freely, subject to the following restrictions: #include #include +#include #include namespace PolyVox @@ -228,6 +229,19 @@ namespace PolyVox }//namespace PolyVox +namespace std +{ + template <> + struct hash + { + std::size_t operator()(const PolyVox::Vector3DInt32& vec) const + { + return ((vec.getX() & 0xFF)) | ((vec.getY() & 0xFF) << 8) | ((vec.getZ() & 0xFF) << 16); + } + }; +} + + #include "PolyVoxCore/Vector.inl" #endif