FallbackVector4.cs 869 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using UnityEngine;
  5. namespace AmplifyShaderEditor
  6. {
  7. [Serializable]
  8. public class FallbackVector4 : IFallbackVars
  9. {
  10. [SerializeField]
  11. private Vector4 m_current;
  12. [SerializeField]
  13. private Vector4 m_previous;
  14. public FallbackVector4()
  15. {
  16. m_current = new Vector4( 0, 0, 0, 0 );
  17. m_previous = new Vector4( 0, 0, 0, 0 );
  18. }
  19. public FallbackVector4( Vector4 data )
  20. {
  21. m_current = data;
  22. m_previous = data;
  23. }
  24. public void Revert()
  25. {
  26. Vector4 aux = m_current;
  27. m_current = m_previous;
  28. m_previous = aux;
  29. }
  30. public Vector4 Current
  31. {
  32. get { return m_current; }
  33. set
  34. {
  35. m_previous = m_current;
  36. m_current = value;
  37. }
  38. }
  39. public override string ToString() { return m_current.ToString(); }
  40. }
  41. }