Rework Serialization functions

add name and handle more types
This commit is contained in:
SweetId
2024-03-05 17:26:07 -05:00
parent 055634e77c
commit a0f2b128d7
28 changed files with 645 additions and 336 deletions

View File

@@ -421,13 +421,13 @@ namespace Nz
template<typename T>
bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>)
{
if (!Serialize(context, static_cast<UInt8>(boundingVolume.extent)))
if (!Serialize(context, "extent", static_cast<UInt8>(boundingVolume.extent)))
return false;
if (!Serialize(context, boundingVolume.aabb))
if (!Serialize(context, "aabb", boundingVolume.aabb))
return false;
if (!Serialize(context, boundingVolume.obb))
if (!Serialize(context, "obb", boundingVolume.obb))
return false;
return true;
@@ -446,7 +446,7 @@ namespace Nz
bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>)
{
UInt8 extend;
if (!Unserialize(context, &extend))
if (!Unserialize(context, "extent", &extend))
return false;
if (extend > UnderlyingCast(Extent::Max))
@@ -454,10 +454,10 @@ namespace Nz
boundingVolume->extent = static_cast<Extent>(extend);
if (!Unserialize(context, &boundingVolume->aabb))
if (!Unserialize(context, "aabb", &boundingVolume->aabb))
return false;
if (!Unserialize(context, &boundingVolume->obb))
if (!Unserialize(context, "obb", &boundingVolume->obb))
return false;
return true;