VignetteEffectSerializer.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class VignetteEffectSerializer : Serializer<VignetteEffectManager>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(VignetteEffectManager manager, BinaryWriter writer)
  8. {
  9. writer.Write(VignetteEffectManager.header);
  10. writer.WriteVersion(version);
  11. writer.Write(manager.Active);
  12. writer.Write(manager.Intensity);
  13. writer.Write(manager.Blur);
  14. writer.Write(manager.BlurSpread);
  15. writer.Write(manager.ChromaticAberration);
  16. }
  17. public override void Deserialize(VignetteEffectManager manager, BinaryReader reader, SceneMetadata metadata)
  18. {
  19. _ = reader.ReadVersion();
  20. var active = reader.ReadBoolean();
  21. manager.Intensity = reader.ReadSingle();
  22. manager.Blur = reader.ReadSingle();
  23. manager.BlurSpread = reader.ReadSingle();
  24. manager.ChromaticAberration = reader.ReadSingle();
  25. manager.SetEffectActive(active);
  26. }
  27. }
  28. }