LightPropertySerializer.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class LightPropertySerializer : Serializer<LightProperty>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(LightProperty prop, BinaryWriter writer)
  8. {
  9. writer.WriteVersion(version);
  10. writer.Write(prop.Rotation);
  11. writer.Write(prop.Intensity);
  12. writer.Write(prop.Range);
  13. writer.Write(prop.SpotAngle);
  14. writer.Write(prop.ShadowStrength);
  15. writer.Write(prop.LightColour);
  16. }
  17. public override void Deserialize(LightProperty prop, BinaryReader reader, SceneMetadata metadata)
  18. {
  19. _ = reader.ReadVersion();
  20. prop.Rotation = reader.ReadQuaternion();
  21. prop.Intensity = reader.ReadSingle();
  22. prop.Range = reader.ReadSingle();
  23. prop.SpotAngle = reader.ReadSingle();
  24. prop.ShadowStrength = reader.ReadSingle();
  25. prop.LightColour = reader.ReadColour();
  26. }
  27. }
  28. }