PostProcessingContext.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. namespace UnityEngine.PostProcessing
  2. {
  3. public class PostProcessingContext
  4. {
  5. public PostProcessingProfile profile;
  6. public Camera camera;
  7. public MaterialFactory materialFactory;
  8. public RenderTextureFactory renderTextureFactory;
  9. public bool interrupted { get; private set; }
  10. public void Interrupt()
  11. {
  12. interrupted = true;
  13. }
  14. public PostProcessingContext Reset()
  15. {
  16. profile = null;
  17. camera = null;
  18. materialFactory = null;
  19. renderTextureFactory = null;
  20. interrupted = false;
  21. return this;
  22. }
  23. #region Helpers
  24. public bool isGBufferAvailable
  25. {
  26. get { return camera.actualRenderingPath == RenderingPath.DeferredShading; }
  27. }
  28. public bool isHdr
  29. {
  30. // No UNITY_5_6_OR_NEWER defined in early betas of 5.6
  31. #if UNITY_5_6 || UNITY_5_6_OR_NEWER
  32. get { return camera.allowHDR; }
  33. #else
  34. get { return camera.hdr; }
  35. #endif
  36. }
  37. public int width
  38. {
  39. get { return camera.pixelWidth; }
  40. }
  41. public int height
  42. {
  43. get { return camera.pixelHeight; }
  44. }
  45. public Rect viewport
  46. {
  47. get { return camera.rect; } // Normalized coordinates
  48. }
  49. #endregion
  50. }
  51. }