Math: Add serialization specialization for all types

Former-commit-id: 7e45c50d3b4eabfc581736f290fc208592d3d46c
This commit is contained in:
Lynix
2016-03-06 01:54:13 +01:00
parent d6a436100c
commit e9d126b3a4
28 changed files with 699 additions and 80 deletions

View File

@@ -674,6 +674,56 @@ namespace Nz
return sphere;
}
/*!
* \brief Serializes a Sphere
* \return true if successfully serialized
*
* \param context Serialization context
* \param sphere Input Sphere
*/
template<typename T>
bool Serialize(SerializationContext& context, const Sphere<T>& sphere)
{
if (!Serialize(context, sphere.x))
return false;
if (!Serialize(context, sphere.y))
return false;
if (!Serialize(context, sphere.z))
return false;
if (!Serialize(context, sphere.radius))
return false;
return true;
}
/*!
* \brief Unserializes a Sphere
* \return true if successfully unserialized
*
* \param context Serialization context
* \param sphere Output Sphere
*/
template<typename T>
bool Unserialize(SerializationContext& context, Sphere<T>* sphere)
{
if (!Unserialize(context, &sphere->x))
return false;
if (!Unserialize(context, &sphere->y))
return false;
if (!Unserialize(context, &sphere->z))
return false;
if (!Unserialize(context, &sphere->radius))
return false;
return true;
}
}
/*!