Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Universal2DResourceData.cs 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using UnityEngine.Rendering.RenderGraphModule;
  3. namespace UnityEngine.Rendering.Universal
  4. {
  5. /// <summary>
  6. /// Class that holds settings related to texture resources.
  7. /// </summary>
  8. internal class Universal2DResourceData : UniversalResourceDataBase
  9. {
  10. TextureHandle[][] CheckAndGetTextureHandle(ref TextureHandle[][] handle)
  11. {
  12. if (!CheckAndWarnAboutAccessibility())
  13. return new TextureHandle[][] { new TextureHandle[] { TextureHandle.nullHandle } };
  14. return handle;
  15. }
  16. void CheckAndSetTextureHandle(ref TextureHandle[][] handle, TextureHandle[][] newHandle)
  17. {
  18. if (!CheckAndWarnAboutAccessibility())
  19. return;
  20. if (handle == null || handle.Length != newHandle.Length)
  21. handle = new TextureHandle[newHandle.Length][];
  22. for (int i = 0; i < newHandle.Length; i++)
  23. handle[i] = newHandle[i];
  24. }
  25. internal TextureHandle intermediateDepth
  26. {
  27. get => CheckAndGetTextureHandle(ref _intermediateDepth);
  28. set => CheckAndSetTextureHandle(ref _intermediateDepth, value);
  29. }
  30. private TextureHandle _intermediateDepth;
  31. internal TextureHandle[][] lightTextures
  32. {
  33. get => CheckAndGetTextureHandle(ref _lightTextures);
  34. set => CheckAndSetTextureHandle(ref _lightTextures, value);
  35. }
  36. private TextureHandle[][] _lightTextures = new TextureHandle[0][];
  37. internal TextureHandle[] normalsTexture
  38. {
  39. get => CheckAndGetTextureHandle(ref _cameraNormalsTexture);
  40. set => CheckAndSetTextureHandle(ref _cameraNormalsTexture, value);
  41. }
  42. private TextureHandle[] _cameraNormalsTexture = new TextureHandle[0];
  43. internal TextureHandle shadowsTexture
  44. {
  45. get => CheckAndGetTextureHandle(ref _shadowsTexture);
  46. set => CheckAndSetTextureHandle(ref _shadowsTexture, value);
  47. }
  48. private TextureHandle _shadowsTexture;
  49. internal TextureHandle shadowsDepth
  50. {
  51. get => CheckAndGetTextureHandle(ref _shadowsDepth);
  52. set => CheckAndSetTextureHandle(ref _shadowsDepth, value);
  53. }
  54. private TextureHandle _shadowsDepth;
  55. internal TextureHandle upscaleTexture
  56. {
  57. get => CheckAndGetTextureHandle(ref _upscaleTexture);
  58. set => CheckAndSetTextureHandle(ref _upscaleTexture, value);
  59. }
  60. private TextureHandle _upscaleTexture;
  61. internal TextureHandle cameraSortingLayerTexture
  62. {
  63. get => CheckAndGetTextureHandle(ref _cameraSortingLayerTexture);
  64. set => CheckAndSetTextureHandle(ref _cameraSortingLayerTexture, value);
  65. }
  66. private TextureHandle _cameraSortingLayerTexture;
  67. /// <inheritdoc />
  68. public override void Reset()
  69. {
  70. _intermediateDepth = TextureHandle.nullHandle;
  71. _shadowsTexture = TextureHandle.nullHandle;
  72. _shadowsDepth = TextureHandle.nullHandle;
  73. _upscaleTexture = TextureHandle.nullHandle;
  74. _cameraSortingLayerTexture = TextureHandle.nullHandle;
  75. for (int i = 0; i < _cameraNormalsTexture.Length; i++)
  76. _cameraNormalsTexture[i] = TextureHandle.nullHandle;
  77. for (int i = 0; i < _lightTextures.Length; i++)
  78. for (int j = 0; j < _lightTextures[i].Length; j++)
  79. _lightTextures[i][j] = TextureHandle.nullHandle;
  80. }
  81. }
  82. }