Ejemplo n.º 1
0
        // This function is call at the beginning of camera loop in HDRenderPipeline.Render()
        // It allow to correctly init the m_FrameSettingsRuntime to use.
        // If the camera use defaultFrameSettings it must be copied in m_FrameSettingsRuntime
        // otherwise it is the serialized m_FrameSettings that are used
        // This is required so each camera have its own debug settings even if they all use the RenderingPath.Default path
        // and important at Runtime as Default Camera from Scene Preview doesn't exist
        // assetFrameSettingsIsDirty is the current dirty frame settings state of HDRenderPipelineAsset
        // if it is dirty and camera use RenderingPath.Default, we need to update it
        // defaultFrameSettings are the settings store in the HDRenderPipelineAsset
        public void UpdateDirtyFrameSettings(bool assetFrameSettingsIsDirty, FrameSettings defaultFrameSettings)
        {
            if (m_frameSettingsIsDirty || assetFrameSettingsIsDirty)
            {
                // We do a copy of the settings to those effectively used
                if (renderingPath == RenderingPath.UseGraphicsSettings)
                {
                    defaultFrameSettings.CopyTo(m_FrameSettingsRuntime);
                }
                else
                {
                    m_FrameSettings.Override(defaultFrameSettings).CopyTo(m_FrameSettingsRuntime);
                }

                m_frameSettingsIsDirty = false;
            }
        }
Ejemplo n.º 2
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;
        }