VFXExpressionAbstractBoolOperation.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 VFXExpressionUnaryBoolOperation : VFXExpressionUnaryNumericOperation
  9. {
  10. public VFXExpressionUnaryBoolOperation(VFXExpression parent, VFXExpressionOperation operation) : base(parent, operation)
  11. {
  12. if (!IsBoolValueType(parent.valueType))
  13. {
  14. throw new ArgumentException("Incorrect VFXExpressionUnaryBoolOperation");
  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 uint ProcessUnaryOperation(uint input)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. sealed protected override string GetUnaryOperationCode(string x, VFXValueType type)
  30. {
  31. if (!IsBoolValueType(type))
  32. throw new InvalidOperationException("VFXExpressionUnaryBoolOperation : Unexpected type");
  33. return GetUnaryOperationCode(x);
  34. }
  35. abstract protected string GetUnaryOperationCode(string x);
  36. }
  37. abstract class VFXExpressionBinaryBoolOperation : VFXExpressionBinaryNumericOperation
  38. {
  39. protected VFXExpressionBinaryBoolOperation(VFXExpression parentLeft, VFXExpression parentRight, VFXExpressionOperation operation)
  40. : base(parentLeft, parentRight, operation)
  41. {
  42. if (!IsBoolValueType(parentLeft.valueType) || !IsBoolValueType(parentRight.valueType))
  43. {
  44. throw new ArgumentException("Incorrect VFXExpressionBinaryBoolOperation");
  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 uint ProcessBinaryOperation(uint x, uint y)
  56. {
  57. throw new NotImplementedException();
  58. }
  59. sealed protected override string GetBinaryOperationCode(string x, string y, VFXValueType type)
  60. {
  61. if (!IsBoolValueType(type))
  62. {
  63. throw new InvalidOperationException("Invalid VFXExpressionBinaryBoolOperation");
  64. }
  65. return GetBinaryOperationCode(x, y);
  66. }
  67. protected abstract string GetBinaryOperationCode(string x, string y);
  68. }
  69. }