RymlConverters update + tests
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/UUID.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
#include "Math/AABB.hpp"
|
||||
#include "Math/Pose.hpp"
|
||||
@@ -56,7 +57,7 @@ namespace c4
|
||||
|
||||
template<class T>
|
||||
size_t to_chars(ryml::substr buf, const OpenVulkano::Math::Pose<T>& pose)
|
||||
{ return ryml::format(buf, "({},{},{}),({},{},{},{})", pose.m_position.x, pose.m_position.y, pose.m_position.z, pose.m_orientation.x, pose.m_orientation.y, pose.m_orientation.z, pose.m_orientation.w); }
|
||||
{ return ryml::format(buf, "({},{},{}),({},{},{},{})", pose.GetPosition().x, pose.GetPosition().y, pose.GetPosition().z, pose.GetOrientation().x, pose.GetOrientation().y, pose.GetOrientation().z, pose.GetOrientation().w); }
|
||||
|
||||
template<class T>
|
||||
bool from_chars(ryml::csubstr buf, OpenVulkano::Math::Vector2<T>* v)
|
||||
@@ -127,7 +128,18 @@ namespace c4
|
||||
template<class T>
|
||||
bool from_chars(ryml::csubstr buf, OpenVulkano::Math::Pose<T>* pose)
|
||||
{
|
||||
size_t ret = ryml::unformat(buf, "({},{},{}),({},{},{},{})", pose->m_position.x, pose->m_position.y, pose->m_position.z, pose->m_orientation.x, pose->m_orientation.y, pose->m_orientation.z, pose->m_orientation.w);
|
||||
size_t ret = ryml::unformat(buf, "({},{},{}),({},{},{},{})", pose->GetPosition().x, pose->GetPosition().y, pose->GetPosition().z, pose->GetOrientation().x, pose->GetOrientation().y, pose->GetOrientation().z, pose->GetOrientation().w);
|
||||
return ret != ryml::yml::npos;
|
||||
}
|
||||
|
||||
inline size_t to_chars(ryml::substr buf, const OpenVulkano::UUID& uuid)
|
||||
{
|
||||
return ryml::format(buf, "{}", uuid.string());
|
||||
}
|
||||
|
||||
inline bool from_chars(ryml::csubstr buf, OpenVulkano::UUID* uuid)
|
||||
{
|
||||
uuid->assign(buf.str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user