Math: Add serialization specialization for all types
Former-commit-id: 7e45c50d3b4eabfc581736f290fc208592d3d46c
This commit is contained in:
@@ -1013,6 +1013,56 @@ namespace Nz
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Serializes a Vector4
|
||||
* \return true if successfully serialized
|
||||
*
|
||||
* \param context Serialization context
|
||||
* \param vector Input Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Serialize(SerializationContext& context, const Vector4<T>& vector)
|
||||
{
|
||||
if (!Serialize(context, vector.x))
|
||||
return false;
|
||||
|
||||
if (!Serialize(context, vector.y))
|
||||
return false;
|
||||
|
||||
if (!Serialize(context, vector.z))
|
||||
return false;
|
||||
|
||||
if (!Serialize(context, vector.w))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unserializes a Vector4
|
||||
* \return true if successfully unserialized
|
||||
*
|
||||
* \param context Serialization context
|
||||
* \param vector Output Vector3
|
||||
*/
|
||||
template<typename T>
|
||||
bool Unserialize(SerializationContext& context, Vector4<T>* vector)
|
||||
{
|
||||
if (!Unserialize(context, &vector->x))
|
||||
return false;
|
||||
|
||||
if (!Unserialize(context, &vector->y))
|
||||
return false;
|
||||
|
||||
if (!Unserialize(context, &vector->z))
|
||||
return false;
|
||||
|
||||
if (!Unserialize(context, &vector->w))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user