deserialize every

This commit is contained in:
vis2k 2022-10-19 10:37:12 +02:00
parent 2b5fbcf05a
commit e408c44ff3

View File

@ -316,10 +316,28 @@ void SerializeEverything(NetworkWriter writer)
writer.WriteLong(sZ);
}
// deserialize full data after delta compression
void DeserializeEverything(NetworkReader reader, out Vector3 position, out Quaternion rotation, out Vector3 scale)
{
// position
long pX = reader.ReadLong();
long pY = reader.ReadLong();
long pZ = reader.ReadLong();
position = Compression.ScaleToFloat(pX, pY, pZ, positionPrecision);
// rotation
rotation = reader.ReadQuaternion();
// scale
long sX = reader.ReadLong();
long sY = reader.ReadLong();
long sZ = reader.ReadLong();
scale = Compression.ScaleToFloat(sX, sY, sZ, scalePrecision);
}
// last serialization for delta compression
public override void OnSerialize(NetworkWriter writer, bool initialState)
{
// TODO ClientToServer support.
// - initial is still only called on server
// - not initial could just send directly