public void Setup(MyPostProcessingAsset asset)
 {
     postProcessingAsset = asset;
 }
    public MyPipeline(bool dynamicBatching, bool instancing
                      , MyPostProcessingAsset _postProcessingAsset, MyPostProcessingStack _defaultStack,
                      Texture2D _ditherTexture, float _ditherAnimationSpeed, int _shadowMapSize, float _shadowDistance
                      , float _shadowFadeRange, int _shadowCascades, Vector3 _shadowCascadeSplit, float _renderScale
                      , int _msaaSamples, bool _allowHDR, bool _syncGameCamera)
    {
        //Unity 认为光的强度是在伽马空间中定义的,即使我们是在线性空间中工作。
        GraphicsSettings.lightsUseLinearIntensity = true;

        //如果Z相反 阴影的z最远是1
        if (SystemInfo.usesReversedZBuffer)
        {
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }

        if (dynamicBatching)
        {
            drawFlags = DrawRendererFlags.EnableDynamicBatching;
        }

        ditherTexture = _ditherTexture;
        if (_ditherAnimationSpeed > 0f)
        {
            ConfigureDitherAnimation(_ditherAnimationSpeed);
        }

        if (instancing)
        {
            drawFlags |= DrawRendererFlags.EnableInstancing;
        }

        postProcessingAsset = _postProcessingAsset;
        defaultStack        = _defaultStack;

        shadowMapSize      = _shadowMapSize;
        shadowDistance     = _shadowDistance;
        globalShadowData.y = 1f / _shadowFadeRange;
        shadowCascades     = _shadowCascades;
        shadowCascadeSplit = _shadowCascadeSplit;
        renderScale        = _renderScale;
        //设置msaa 如果硬件不支持 则为自动回退为1
        QualitySettings.antiAliasing = _msaaSamples;
        msaaSamples = Mathf.Max(QualitySettings.antiAliasing, 1);
        allowHDR    = _allowHDR;

#if UNITY_EDITOR
        if (SceneView.onSceneGUIDelegate != null)
        {
            SceneView.onSceneGUIDelegate -= OnSceneView;
        }

        if (_syncGameCamera)
        {
            SceneView.onSceneGUIDelegate += OnSceneView;
        }
#endif

#if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightDelegate);
#endif
    }