more tidying up

This commit is contained in:
greerdv
2021-05-25 14:56:08 +01:00
parent 6fe8b972a4
commit ccccfb2c5b
8 changed files with 53 additions and 52 deletions
@@ -488,17 +488,18 @@ void TransformCompressor::Marshal(WriteBuffer& wb, const AZ::Transform& value) c
{
AZ::u8 flags = 0;
auto flagsMarker = wb.InsertMarker(flags);
float scale = value.GetUniformScale();
AZ::Quaternion rot = value.GetRotation();
AZ::Matrix3x3 m33 = AZ::Matrix3x3::CreateFromTransform(value);
AZ::Vector3 scale = m33.ExtractScale();
AZ::Quaternion rot = AZ::Quaternion::CreateFromMatrix3x3(m33.GetOrthogonalized());
if (!rot.IsIdentity())
{
flags |= HAS_ROT;
wb.Write(rot, QuatCompMarshaler());
}
if (!AZ::IsClose(scale, 1.0f))
if (!scale.IsClose(AZ::Vector3::CreateOne()))
{
flags |= HAS_SCALE;
wb.Write(scale, HalfMarshaler());
wb.Write(scale, Vec3CompMarshaler());
}
AZ::Vector3 pos = value.GetTranslation();
if (!pos.IsZero())
@@ -526,9 +527,9 @@ void TransformCompressor::Unmarshal(AZ::Transform& value, ReadBuffer& rb) const
}
if (flags & HAS_SCALE)
{
float scale;
rb.Read(scale, HalfMarshaler());
xform.MultiplyByUniformScale(scale);
AZ::Vector3 scale;
rb.Read(scale, Vec3CompMarshaler());
xform.MultiplyByScale(scale);
}
if (flags & HAS_POS)
{