Esempio n. 1
0
 /// <summary>Unregister HDAdditionalCameraData for DebugMenu</summary>
 /// <param name="camera">The camera to unregister.</param>
 public static void UnRegisterCamera(HDAdditionalCameraData camera)
 {
     if (cameras.Contains(camera))
     {
         cameras.Remove(camera);
     }
 }
Esempio n. 2
0
 /// <summary>Register HDAdditionalCameraData for DebugMenu</summary>
 /// <param name="camera">The camera to register.</param>
 public static void RegisterCamera(HDAdditionalCameraData camera)
 {
     if (!cameras.Contains(camera))
     {
         cameras.Add(camera);
     }
 }
Esempio n. 3
0
        /// <summary>Register FrameSettingsHistory for DebugMenu</summary>
        public static IDebugData RegisterDebug(Camera camera, HDAdditionalCameraData additionalCameraData)
        {
            HDRenderPipelineAsset hdrpAsset = GraphicsSettings.currentRenderPipeline as HDRenderPipelineAsset;
            var defaultHdrpAsset            = HDRenderPipeline.defaultAsset;

            Assertions.Assert.IsNotNull(hdrpAsset);

            // complete frame settings history is required for displaying debug menu.
            // AggregateFrameSettings will finish the registration if it is not yet registered
            FrameSettings registering = new FrameSettings();

            AggregateFrameSettings(ref registering, camera, additionalCameraData, hdrpAsset, defaultHdrpAsset);
            GenerateFrameSettingsPanel(camera.name, frameSettingsHistory[camera]);
#if UNITY_EDITOR
            if (sceneViewCamera == null && camera.cameraType == CameraType.SceneView)
            {
                sceneViewCamera = camera;
            }
#endif
            return(frameSettingsHistory[camera]);
        }
Esempio n. 4
0
        // Note: this version is the one tested as there is issue getting HDRenderPipelineAsset in batchmode in unit test framework currently.
        /// <summary>Same than FrameSettings.AggregateFrameSettings but keep history of agregation in a collection for DebugMenu.
        /// Aggregation is default with override of the renderer then sanitazed depending on supported features of hdrpasset. Then the DebugMenu override occurs.</summary>
        /// <param name="aggregatedFrameSettings">The aggregated FrameSettings result.</param>
        /// <param name="camera">The camera rendering.</param>
        /// <param name="additionalData">Additional data of the camera rendering.</param>
        /// <param name="defaultFrameSettings">Base framesettings to copy prior any override.</param>
        /// <param name="supportedFeatures">Currently supported feature for the sanitazation pass.</param>
        public static void AggregateFrameSettings(ref FrameSettings aggregatedFrameSettings, Camera camera, HDAdditionalCameraData additionalData, ref FrameSettings defaultFrameSettings, RenderPipelineSettings supportedFeatures)
        {
            FrameSettingsHistory history = new FrameSettingsHistory
            {
                camera      = camera,
                defaultType = additionalData ? additionalData.defaultFrameSettings : FrameSettingsRenderType.Camera
            };

            aggregatedFrameSettings = defaultFrameSettings;
            if (additionalData && additionalData.customRenderingSettings)
            {
                FrameSettings.Override(ref aggregatedFrameSettings, additionalData.renderingPathCustomFrameSettings, additionalData.renderingPathCustomFrameSettingsOverrideMask);
                history.customMask = additionalData.renderingPathCustomFrameSettingsOverrideMask;
            }
            history.overridden = aggregatedFrameSettings;
            FrameSettings.Sanitize(ref aggregatedFrameSettings, camera, supportedFeatures);

            bool noHistory        = !frameSettingsHistory.ContainsKey(camera);
            bool updatedComponent = !noHistory && frameSettingsHistory[camera].sanitazed != aggregatedFrameSettings;
            bool dirty            = noHistory || updatedComponent;

            history.sanitazed = aggregatedFrameSettings;
            if (dirty)
            {
                history.debug = history.sanitazed;
            }
            else
            {
                history.debug = frameSettingsHistory[camera].debug;

                // Ensure user is not trying to activate unsupported settings in DebugMenu
                FrameSettings.Sanitize(ref history.debug, camera, supportedFeatures);
            }

            aggregatedFrameSettings      = history.debug;
            frameSettingsHistory[camera] = history;
        }
Esempio n. 5
0
 /// <summary>Same than FrameSettings.AggregateFrameSettings but keep history of agregation in a collection for DebugMenu.
 /// Aggregation is default with override of the renderer then sanitazed depending on supported features of hdrpasset. Then the DebugMenu override occurs.</summary>
 /// <param name="aggregatedFrameSettings">The aggregated FrameSettings result.</param>
 /// <param name="camera">The camera rendering.</param>
 /// <param name="additionalData">Additional data of the camera rendering.</param>
 /// <param name="hdrpAsset">HDRenderPipelineAsset contening default FrameSettings.</param>
 public static void AggregateFrameSettings(ref FrameSettings aggregatedFrameSettings, Camera camera, HDAdditionalCameraData additionalData, HDRenderPipelineAsset hdrpAsset, HDRenderPipelineAsset defaultHdrpAsset)
 => AggregateFrameSettings(
     ref aggregatedFrameSettings,
     camera,
     additionalData,
     ref defaultHdrpAsset.GetDefaultFrameSettings(additionalData?.defaultFrameSettings ?? FrameSettingsRenderType.Camera),     //fallback on Camera for SceneCamera and PreviewCamera
     hdrpAsset.currentPlatformRenderPipelineSettings
     );