예제 #1
0
        public void HandleBlurScene(bool isBlur)
        {
            if (Camera.main == null)
            {
                return;
            }

            //todo 临时修改
            m_cameraPostEffectBehaviour = Camera.main.gameObject.GetComponent <PostEffectBehaviour>();

            m_gaussianBlurEffect = m_cameraPostEffectBehaviour.GetPostEffectsList().Find(postEffectBase => postEffectBase.et == EffectType.BlurWithMask) as BlurWithMask;
            if (!isFirst)
            {
                m_gaussianBlurEffectNormalStatus = m_gaussianBlurEffect.IsApply;
                isFirst = true;
            }
            //if (m_cameraPostEffectBehaviour == null)
            //{

            //}
            //Debug.Log("blur ==== " + isBlur + "  camera : " + m_cameraPostEffectBehaviour.name);
            if (isBlur)
            {
                //备份现有Blur的参数
                this.m_currentSceneBlurSetting_blurIterations = m_gaussianBlurEffect.blurIterations;
                this.m_currentSceneBlurSetting_blurSize       = m_gaussianBlurEffect.blurSize;
                this.m_currentSceneBlurSetting_downloadSample = m_gaussianBlurEffect.downsample;
                //this.m_originMaskTex = m_gaussianBlurEffect.m_MaskTexture;
                this.m_originMaskable = m_gaussianBlurEffect.masked;

                m_gaussianBlurEffect.factor         = 1f;
                m_gaussianBlurEffect.downsample     = DOWNLOAD_SAMPLE;
                m_gaussianBlurEffect.blurIterations = BLUR_ITERATIONS;
                m_gaussianBlurEffect.blurSize       = BLUR_SIZE;

                m_gaussianBlurEffect.IsApply = true;

                if (ReplacementMaskTexture != null)
                {
                    m_gaussianBlurEffect.masked         = true;
                    m_gaussianBlurEffect.m_MaskTexture  = ReplacementMaskTexture;
                    m_gaussianBlurEffect.blurIterations = GameConst.FOGGY_DENSITY;
                }
            }
            else
            {
                m_gaussianBlurEffect.downsample     = this.m_currentSceneBlurSetting_downloadSample;
                m_gaussianBlurEffect.blurSize       = this.m_currentSceneBlurSetting_blurSize;
                m_gaussianBlurEffect.blurIterations = this.m_currentSceneBlurSetting_blurIterations;
                m_gaussianBlurEffect.masked         = this.m_originMaskable;
                //m_gaussianBlurEffect.m_MaskTexture = this.m_originMaskTex;

                m_gaussianBlurEffect.IsApply = m_gaussianBlurEffectNormalStatus;
            }
        }
예제 #2
0
        public T GetPostFX <T>(PostFX.EffectType postFXType) where T : PostFX.PostEffectBase
        {
            T postEffect = PostEffectBehaviour.GetPostEffectsList().Find(postEffectBase => postEffectBase.et == postFXType) as T;

            return(postEffect);
        }