|
|
|
|
|
|
using System; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.XR; |
|
|
|
|
|
|
|
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
// Init a FrameSettings from renderpipeline settings, frame settings and debug settings (if any)
|
|
|
|
// This will aggregate the various option
|
|
|
|
static public FrameSettings InitializeFrameSettings(Camera camera, RenderPipelineSettings renderPipelineSettings, FrameSettings srcFrameSettings, ref FrameSettings dstFrameSettings) |
|
|
|
public static FrameSettings InitializeFrameSettings(Camera camera, RenderPipelineSettings renderPipelineSettings, FrameSettings srcFrameSettings, ref FrameSettings dstFrameSettings) |
|
|
|
{ |
|
|
|
if (dstFrameSettings == null) |
|
|
|
dstFrameSettings = new FrameSettings(); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dstFrameSettings.enableShadow = srcFrameSettings.enableShadow; |
|
|
|
dstFrameSettings.enableSSR = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableSSR && renderPipelineSettings.supportSSR; |
|
|
|
dstFrameSettings.enableSSR = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableSSR && renderPipelineSettings.supportSSR; |
|
|
|
dstFrameSettings.enableSubsurfaceScattering = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableSubsurfaceScattering && renderPipelineSettings.supportSubsurfaceScattering; |
|
|
|
dstFrameSettings.enableSubsurfaceScattering = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableSubsurfaceScattering && renderPipelineSettings.supportSubsurfaceScattering; |
|
|
|
dstFrameSettings.enableTransmission = srcFrameSettings.enableTransmission; |
|
|
|
|
|
|
|
// We have to fall back to forward-only rendering when scene view is using wireframe rendering mode
|
|
|
|
|
|
|
dstFrameSettings.enableAlphaTestOnlyInDeferredPrepass = srcFrameSettings.enableAlphaTestOnlyInDeferredPrepass; |
|
|
|
|
|
|
|
dstFrameSettings.enableTransparentPrepass = srcFrameSettings.enableTransparentPrepass; |
|
|
|
dstFrameSettings.enableMotionVectors = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableMotionVectors; |
|
|
|
dstFrameSettings.enableObjectMotionVectors = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableObjectMotionVectors; |
|
|
|
dstFrameSettings.enableMotionVectors = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableMotionVectors; |
|
|
|
dstFrameSettings.enableObjectMotionVectors = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableObjectMotionVectors; |
|
|
|
dstFrameSettings.enableDistortion = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableDistortion; |
|
|
|
dstFrameSettings.enableDistortion = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableDistortion; |
|
|
|
dstFrameSettings.enablePostprocess = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enablePostprocess; |
|
|
|
dstFrameSettings.enablePostprocess = camera.cameraType != CameraType.Reflection && srcFrameSettings.enablePostprocess; |
|
|
|
dstFrameSettings.enableStereo = camera.cameraType == CameraType.Reflection ? false : srcFrameSettings.enableStereo && UnityEngine.XR.XRSettings.isDeviceActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both); |
|
|
|
dstFrameSettings.enableStereo = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableStereo && XRSettings.isDeviceActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both); |
|
|
|
// Force forward if we request stereo. TODO: We should not enforce that, users should be able to chose deferred
|
|
|
|
dstFrameSettings.enableForwardRenderingOnly = dstFrameSettings.enableForwardRenderingOnly || dstFrameSettings.enableStereo; |
|
|
|
|
|
|
|