BloomEffectSerializer.cs 1.1 KB

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