public static Quaternion GetQuaternion(this INetBuffer reader, bool delta = false) { if (reader.CompressionSchema.DeltaZeroCompression && delta) { bool changed = reader.GetBool(); if (!changed) { return(Quaternion.identity); } } bool deltaZero = reader.CompressionSchema.DeltaZeroDeep && delta; if (reader.CompressionSchema.SmallestThree) { return(SmallestThree.DecodeQuaternion(reader, delta)); } float x = reader.GetFloat(deltaZero); float y = reader.GetFloat(deltaZero); float z = reader.GetFloat(deltaZero); float w = reader.GetFloat(deltaZero); return(new Quaternion(x, y, z, w)); }
public static Vector3 GetVector3(this INetBuffer reader, bool delta = false) { if (reader.CompressionSchema.DeltaZeroCompression && delta) { bool changed = reader.GetBool(); if (!changed) { return(Vector3.zero); } } if (reader.CompressionSchema.DeltaZeroDeep && delta) { return(new Vector3(reader.GetFloat(true), reader.GetFloat(true), reader.GetFloat(true))); } return(new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat())); }