LensDistortion.cs 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. [Serializable, VolumeComponentMenu("Post-processing/Lens Distortion")]
  5. public sealed class LensDistortion : VolumeComponent, IPostProcessComponent
  6. {
  7. [Tooltip("Total distortion amount.")]
  8. public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, -1f, 1f);
  9. [Tooltip("Intensity multiplier on X axis. Set it to 0 to disable distortion on this axis.")]
  10. public ClampedFloatParameter xMultiplier = new ClampedFloatParameter(1f, 0f, 1f);
  11. [Tooltip("Intensity multiplier on Y axis. Set it to 0 to disable distortion on this axis.")]
  12. public ClampedFloatParameter yMultiplier = new ClampedFloatParameter(1f, 0f, 1f);
  13. [Tooltip("Distortion center point.")]
  14. public Vector2Parameter center = new Vector2Parameter(new Vector2(0.5f, 0.5f));
  15. [Tooltip("Global screen scaling.")]
  16. public ClampedFloatParameter scale = new ClampedFloatParameter(1f, 0.01f, 5f);
  17. public bool IsActive()
  18. {
  19. return !Mathf.Approximately(intensity.value, 0f)
  20. && (xMultiplier.value > 0f || yMultiplier.value > 0f);
  21. }
  22. public bool IsTileCompatible() => false;
  23. }
  24. }