Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TransparentSettingsPass.cs 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using UnityEngine.Rendering.Universal.Internal;
  3. namespace UnityEngine.Rendering.Universal
  4. {
  5. /// <summary>
  6. /// Applies relevant settings before rendering transparent objects
  7. /// </summary>
  8. internal class TransparentSettingsPass : ScriptableRenderPass
  9. {
  10. bool m_shouldReceiveShadows;
  11. const string m_ProfilerTag = "Transparent Settings Pass";
  12. private static readonly ProfilingSampler m_ProfilingSampler = new ProfilingSampler(m_ProfilerTag);
  13. public TransparentSettingsPass(RenderPassEvent evt, bool shadowReceiveSupported)
  14. {
  15. base.profilingSampler = new ProfilingSampler(nameof(TransparentSettingsPass));
  16. renderPassEvent = evt;
  17. m_shouldReceiveShadows = shadowReceiveSupported;
  18. }
  19. public bool Setup()
  20. {
  21. // Currently we only need to enqueue this pass when the user
  22. // doesn't want transparent objects to receive shadows
  23. return !m_shouldReceiveShadows;
  24. }
  25. [Obsolete(DeprecationMessage.CompatibilityScriptingAPIObsolete, false)]
  26. public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
  27. {
  28. // Get a command buffer...
  29. var cmd = renderingData.commandBuffer;
  30. ExecutePass(CommandBufferHelpers.GetRasterCommandBuffer(cmd), m_shouldReceiveShadows);
  31. }
  32. public static void ExecutePass(RasterCommandBuffer cmd, bool shouldReceiveShadows)
  33. {
  34. using (new ProfilingScope(cmd, m_ProfilingSampler))
  35. {
  36. // This pass is only used when transparent objects should not
  37. // receive shadows using the setting on the URP Renderer.
  38. MainLightShadowCasterPass.SetEmptyMainLightShadowParams(cmd);
  39. AdditionalLightsShadowCasterPass.SetEmptyAdditionalLightShadowParams(cmd, AdditionalLightsShadowCasterPass.s_EmptyAdditionalLightIndexToShadowParams);
  40. }
  41. }
  42. }
  43. }