added additional methods

This commit is contained in:
2024-08-18 15:46:10 +03:00
parent a612832518
commit 6df8530ab5
3 changed files with 10 additions and 2 deletions

View File

@@ -6,6 +6,7 @@
#include <optional>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
namespace omath::pathfinding

View File

@@ -4,7 +4,7 @@
#include "omath/pathfinding/NavigationMesh.h"
#include <stdexcept>
#include <algorithm>
namespace omath::pathfinding
{
std::expected<Vector3, std::string> NavigationMesh::GetClossestVertex(const Vector3 &point) const
@@ -26,6 +26,11 @@ namespace omath::pathfinding
return m_verTextMap.at(vertex);
}
bool NavigationMesh::Empty() const
{
return m_verTextMap.empty();
}
std::vector<uint8_t> NavigationMesh::Serialize() const
{
auto dumpToVector =[]<typename T>(const T& t, std::vector<uint8_t>& vec){
@@ -58,7 +63,7 @@ namespace omath::pathfinding
{
throw std::runtime_error("Deserialize: Invalid input data size.");
}
std::memcpy(&value, vec.data() + offset, sizeof(value));
std::copy_n(vec.data() + offset, sizeof(value), (uint8_t*)&value);
offset += sizeof(value);
};