CameraInfoSerializer.cs 837 B

1234567891011121314151617181920212223242526272829
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class CameraInfoSerializer : Serializer<CameraInfo>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(CameraInfo info, BinaryWriter writer)
  8. {
  9. writer.WriteVersion(version);
  10. writer.Write(info.TargetPos);
  11. writer.Write(info.Angle);
  12. writer.Write(info.Distance);
  13. writer.Write(info.FOV);
  14. }
  15. public override void Deserialize(CameraInfo info, BinaryReader reader, SceneMetadata metadata)
  16. {
  17. _ = reader.ReadVersion();
  18. info.TargetPos = reader.ReadVector3();
  19. info.Angle = reader.ReadQuaternion();
  20. info.Distance = reader.ReadSingle();
  21. info.FOV = reader.ReadSingle();
  22. }
  23. }
  24. }