XROcclusionMeshPass.cs 926 B

1234567891011121314151617181920212223242526272829303132
  1. #if ENABLE_VR && ENABLE_XR_MODULE
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. /// <summary>
  5. /// Draw the XR occlusion mesh into the current depth buffer when XR is enabled.
  6. /// </summary>
  7. public class XROcclusionMeshPass : ScriptableRenderPass
  8. {
  9. public XROcclusionMeshPass(RenderPassEvent evt)
  10. {
  11. base.profilingSampler = new ProfilingSampler(nameof(XROcclusionMeshPass));
  12. renderPassEvent = evt;
  13. }
  14. /// <inheritdoc/>
  15. public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
  16. {
  17. if (!renderingData.cameraData.xr.enabled)
  18. return;
  19. CommandBuffer cmd = CommandBufferPool.Get();
  20. renderingData.cameraData.xr.RenderOcclusionMesh(cmd);
  21. context.ExecuteCommandBuffer(cmd);
  22. CommandBufferPool.Release(cmd);
  23. }
  24. }
  25. }
  26. #endif