VFXExpressionSampleTexture3D.cs 984 B

123456789101112131415161718192021222324252627
  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. class VFXExpressionSampleTexture3D : VFXExpression
  9. {
  10. public VFXExpressionSampleTexture3D() : this(VFXTexture3DValue.Default, VFXValue<Vector3>.Default, VFXValue<float>.Default)
  11. {
  12. }
  13. public VFXExpressionSampleTexture3D(VFXExpression texture, VFXExpression uv, VFXExpression mipLevel)
  14. : base(Flags.InvalidOnCPU, new VFXExpression[3] { texture, uv, mipLevel })
  15. { }
  16. sealed public override VFXExpressionOperation operation { get { return VFXExpressionOperation.None; } }
  17. sealed public override VFXValueType valueType { get { return VFXValueType.Float4; } }
  18. public sealed override string GetCodeString(string[] parents)
  19. {
  20. return string.Format("SampleTexture(VFX_SAMPLER({0}),{1},{2})", parents[0], parents[1], parents[2]);
  21. }
  22. }
  23. }