Пример #1
0
        static OverridableFrameSettingsArea GetFrameSettingSectionContent(int group, SerializedFrameSettings serialized, Editor owner)
        {
            RenderPipelineSettings hdrpSettings         = GetHDRPAssetFor(owner).currentPlatformRenderPipelineSettings;
            FrameSettings          defaultFrameSettings = GetDefaultFrameSettingsFor(owner);
            var area = OverridableFrameSettingsArea.GetGroupContent(group, defaultFrameSettings, serialized);

            return(area);
        }
Пример #2
0
        static void Drawer_SectionLightingSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride)
        {
            RenderPipelineSettings hdrpSettings         = GetHDRPAssetFor(owner).currentPlatformRenderPipelineSettings;
            FrameSettings          defaultFrameSettings = GetDefaultFrameSettingsFor(owner);
            var area = OverridableFrameSettingsArea.GetGroupContent(1, defaultFrameSettings, serialized);

            area.AmmendInfo(FrameSettingsField.ShadowMask, overrideable: () => hdrpSettings.supportShadowMask);
            area.AmmendInfo(FrameSettingsField.SSR, overrideable: () => hdrpSettings.supportSSR);
            area.AmmendInfo(FrameSettingsField.SSAO, overrideable: () => hdrpSettings.supportSSAO);
            area.AmmendInfo(FrameSettingsField.SubsurfaceScattering, overrideable: () => hdrpSettings.supportSubsurfaceScattering);
            area.AmmendInfo(FrameSettingsField.Volumetrics, overrideable: () => hdrpSettings.supportVolumetrics);
            area.AmmendInfo(FrameSettingsField.ReprojectionForVolumetrics, overrideable: () => hdrpSettings.supportVolumetrics);
            area.AmmendInfo(FrameSettingsField.LightLayers, overrideable: () => hdrpSettings.supportLightLayers);
            area.Draw(withOverride);
        }
Пример #3
0
        public static OverridableFrameSettingsArea GetGroupContent(int groupIndex, FrameSettings defaultFrameSettings, SerializedFrameSettings serializedFrameSettings)
        {
            if (!attributesGroup.ContainsKey(groupIndex) || attributesGroup[groupIndex] == null)
            {
                attributesGroup[groupIndex] = attributes?.Where(pair => pair.Value?.group == groupIndex)?.OrderBy(pair => pair.Value.orderInGroup);
            }
            if (!attributesGroup.ContainsKey(groupIndex))
            {
                throw new ArgumentException("Unknown groupIndex");
            }

            var area = new OverridableFrameSettingsArea(attributesGroup[groupIndex].Count(), defaultFrameSettings, serializedFrameSettings);

            foreach (var field in attributesGroup[groupIndex])
            {
                area.Add(field.Key);
            }
            return(area);
        }
Пример #4
0
        static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride)
        {
            RenderPipelineSettings hdrpSettings         = GetHDRPAssetFor(owner).currentPlatformRenderPipelineSettings;
            FrameSettings          defaultFrameSettings = GetDefaultFrameSettingsFor(owner);
            var area = OverridableFrameSettingsArea.GetGroupContent(0, defaultFrameSettings, serialized);

            LitShaderMode defaultShaderLitMode;

            switch (hdrpSettings.supportedLitShaderMode)
            {
            case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly:
                defaultShaderLitMode = LitShaderMode.Forward;
                break;

            case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly:
                defaultShaderLitMode = LitShaderMode.Deferred;
                break;

            case RenderPipelineSettings.SupportedLitShaderMode.Both:
                defaultShaderLitMode = defaultFrameSettings.litShaderMode;
                break;

            default:
                throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode");
            }

            area.AmmendInfo(FrameSettingsField.LitShaderMode,
                            overrideable: () => !GL.wireframe && hdrpSettings.supportedLitShaderMode == RenderPipelineSettings.SupportedLitShaderMode.Both,
                            overridedDefaultValue: defaultShaderLitMode);

            bool hdrpAssetSupportForward         = hdrpSettings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly;
            bool hdrpAssetSupportDeferred        = hdrpSettings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly;
            bool frameSettingsOverrideToForward  = serialized.GetOverrides(FrameSettingsField.LitShaderMode) && serialized.litShaderMode == LitShaderMode.Forward;
            bool frameSettingsOverrideToDeferred = serialized.GetOverrides(FrameSettingsField.LitShaderMode) && serialized.litShaderMode == LitShaderMode.Deferred;
            bool defaultForwardUsed    = !serialized.GetOverrides(FrameSettingsField.LitShaderMode) && defaultShaderLitMode == LitShaderMode.Forward;
            bool defaultDefferedUsed   = !serialized.GetOverrides(FrameSettingsField.LitShaderMode) && defaultShaderLitMode == LitShaderMode.Deferred;
            bool msaaEnablable         = !GL.wireframe && hdrpAssetSupportForward && hdrpSettings.supportMSAA && (frameSettingsOverrideToForward || defaultForwardUsed);
            bool depthPrepassEnablable = hdrpAssetSupportDeferred && (defaultDefferedUsed || frameSettingsOverrideToDeferred);

            area.AmmendInfo(FrameSettingsField.MSAA,
                            overrideable: () => msaaEnablable,
                            overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA),
                            customOverrideable: () =>
            {
                switch (hdrpSettings.supportedLitShaderMode)
                {
                case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly:
                    return(false);        //negative dependency

                case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly:
                    return(true);        //negative dependency

                case RenderPipelineSettings.SupportedLitShaderMode.Both:
                    return(!(frameSettingsOverrideToForward || defaultForwardUsed));        //negative dependency

                default:
                    throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode");
                }
            });
            area.AmmendInfo(FrameSettingsField.DepthPrepassWithDeferredRendering,
                            overrideable: () => depthPrepassEnablable,
                            overridedDefaultValue: depthPrepassEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.DepthPrepassWithDeferredRendering),
                            customOverrideable: () =>
            {
                switch (hdrpSettings.supportedLitShaderMode)
                {
                case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly:
                    return(false);

                case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly:
                    return(true);

                case RenderPipelineSettings.SupportedLitShaderMode.Both:
                    return(frameSettingsOverrideToDeferred || defaultDefferedUsed);

                default:
                    throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode");
                }
            });

            area.AmmendInfo(FrameSettingsField.MotionVectors, overrideable: () => hdrpSettings.supportMotionVectors);
            area.AmmendInfo(FrameSettingsField.ObjectMotionVectors, overrideable: () => hdrpSettings.supportMotionVectors);
            area.AmmendInfo(FrameSettingsField.Decals, overrideable: () => hdrpSettings.supportDecals);
            area.AmmendInfo(FrameSettingsField.Distortion, overrideable: () => hdrpSettings.supportDistortion);

            area.AmmendInfo(
                FrameSettingsField.LODBiasMode,
                overridedDefaultValue: LODBiasMode.FromQualitySettings,
                customGetter: () => (LODBiasMode)serialized.lodBiasMode.enumValueIndex,
                customSetter: v => serialized.lodBiasMode.enumValueIndex = (int)v
                );
            area.AmmendInfo(FrameSettingsField.LODBias,
                            overridedDefaultValue: QualitySettings.lodBias,
                            customGetter: () => serialized.lodBias.floatValue,
                            customSetter: v => serialized.lodBias.floatValue = (float)v,
                            customOverrideable: () => serialized.lodBiasMode.enumValueIndex != (int)LODBiasMode.FromQualitySettings);

            area.AmmendInfo(
                FrameSettingsField.MaximumLODLevelMode,
                overridedDefaultValue: MaximumLODLevelMode.FromQualitySettings,
                customGetter: () => (MaximumLODLevelMode)serialized.maximumLODLevelMode.enumValueIndex,
                customSetter: v => serialized.maximumLODLevelMode.enumValueIndex = (int)v
                );
            area.AmmendInfo(FrameSettingsField.MaximumLODLevel,
                            overridedDefaultValue: QualitySettings.maximumLODLevel,
                            customGetter: () => serialized.maximumLODLevel.intValue,
                            customSetter: v => serialized.maximumLODLevel.intValue = (int)v,
                            customOverrideable: () => serialized.maximumLODLevelMode.enumValueIndex != (int)MaximumLODLevelMode.FromQualitySettings);

            area.Draw(withOverride);
        }