VFXExpressionAbstractUintOperation.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Linq;
  3. using System.Runtime.CompilerServices;
  4. using UnityEngine;
  5. using UnityEngine.VFX;
  6. namespace UnityEditor.VFX
  7. {
  8. abstract class VFXExpressionUnaryUIntOperation : VFXExpressionUnaryNumericOperation
  9. {
  10. public VFXExpressionUnaryUIntOperation(VFXExpression parent, VFXExpressionOperation operation) : base(parent, operation)
  11. {
  12. if (!IsUIntValueType(parent.valueType))
  13. {
  14. throw new ArgumentException("Incorrect VFXExpressionUnaryUIntOperation");
  15. }
  16. }
  17. sealed protected override int ProcessUnaryOperation(int input)
  18. {
  19. throw new NotImplementedException();
  20. }
  21. sealed protected override float ProcessUnaryOperation(float input)
  22. {
  23. throw new NotImplementedException();
  24. }
  25. sealed protected override bool ProcessUnaryOperation(bool input)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. sealed protected override string GetUnaryOperationCode(string x, VFXValueType type)
  30. {
  31. if (!IsUIntValueType(type))
  32. throw new InvalidOperationException("VFXExpressionUnaryUIntOperation : Unexpected type");
  33. return GetUnaryOperationCode(x);
  34. }
  35. abstract protected string GetUnaryOperationCode(string x);
  36. }
  37. abstract class VFXExpressionBinaryUIntOperation : VFXExpressionBinaryNumericOperation
  38. {
  39. protected VFXExpressionBinaryUIntOperation(VFXExpression parentLeft, VFXExpression parentRight, VFXExpressionOperation operation)
  40. : base(parentLeft, parentRight, operation)
  41. {
  42. if (!IsUIntValueType(parentLeft.valueType) || !IsUIntValueType(parentRight.valueType))
  43. {
  44. throw new ArgumentException("Incorrect VFXExpressionBinaryUIntOperation");
  45. }
  46. }
  47. sealed protected override int ProcessBinaryOperation(int x, int y)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. sealed protected override float ProcessBinaryOperation(float x, float y)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. sealed protected override bool ProcessBinaryOperation(bool x, bool y)
  56. {
  57. throw new NotImplementedException();
  58. }
  59. sealed protected override string GetBinaryOperationCode(string x, string y, VFXValueType type)
  60. {
  61. if (!IsUIntValueType(type))
  62. {
  63. throw new InvalidOperationException("Invalid VFXExpressionBinaryUIntOperation");
  64. }
  65. return GetBinaryOperationCode(x, y);
  66. }
  67. protected abstract string GetBinaryOperationCode(string x, string y);
  68. }
  69. }