Пример #1
0
    private void EnablePostFX(PerformanceInfo.ePOSTFX keyword, bool enabled)
    {
        //string shaderKeywordPrefix = "EBG_POSTFX_COMPOSITE_" + keyword.ToString().ToUpper();
        if (enabled)
        {
            //_CompositeMaterial.DisableKeyword(shaderKeywordPrefix + "_OFF");
            //_CompositeMaterial.EnableKeyword(shaderKeywordPrefix + "_ON");
#if UNITY_EDITOR
            if (CurrentPostFX.Contains(keyword))
            {
                EB.Debug.LogError("Enabling already enabled PostFX: {0}", keyword);
            }
#endif
            CurrentPostFX.Add(keyword);
        }
        else
        {
            //_CompositeMaterial.DisableKeyword(shaderKeywordPrefix + "_ON");
            //_CompositeMaterial.EnableKeyword(shaderKeywordPrefix + "_OFF");
#if UNITY_EDITOR
            if (!CurrentPostFX.Contains(keyword))
            {
                EB.Debug.LogError("Disabling already disabled PostFX: {0}", keyword);
            }
#endif
            CurrentPostFX.Remove(keyword);
        }

        EnableMaterialKeyword(keyword, enabled);
    }
Пример #2
0
    private void DestroyEffect(PerformanceInfo.ePOSTFX postfx)
    {
        EnablePostFX(postfx, false);

        switch (postfx)
        {
#if EBG_POSTFX_BLOOM
        case (PerformanceInfo.ePOSTFX.Bloom):
            EB.Debug.Log("PostFXManager: Destroying Bloom");
            DestroyBloom();
            break;
#endif
#if EBG_POSTFX_VIGNETTE
        case (PerformanceInfo.ePOSTFX.Vignette):
            EB.Debug.Log("PostFXManager: Destroying Vignette");
            DestroyVignette();
            break;
#endif
#if EBG_POSTFX_VIGNETTE2
        case (PerformanceInfo.ePOSTFX.Vignette2):
            EB.Debug.Log("PostFXManager: Destroying Vignette2");
            DestroyVignette2();
            break;
#endif
#if EBG_POSTFX_WARP
        case (PerformanceInfo.ePOSTFX.Warp):
            EB.Debug.Log("PostFXManager: Destroying Warp");
            DestroyWarp();
            break;
#endif
#if EBG_POSTFX_TONE_MAP
        case (PerformanceInfo.ePOSTFX.ToneMap):
            EB.Debug.Log("PostFXManager: Destroying Tone Mapping");
            DestroyToneMapping();
            break;
#endif
#if EBG_POSTFX_COLOR_GRADE
        case (PerformanceInfo.ePOSTFX.ColorGrade):
            EB.Debug.Log("PostFXManager: Destroying Color Grading");
            DestroyColorGrade();
            break;
#endif
#if EBG_POSTFX_RADIAL_BLUR
        case (PerformanceInfo.ePOSTFX.RadialBlur):
            EB.Debug.Log("PostFXManager: Destroying Radial Blur");
            DestroyRadialBlur();
            break;
#endif
        case PerformanceInfo.ePOSTFX.None1:
        case PerformanceInfo.ePOSTFX.None2:
            EB.Debug.Log("PostFXManager: Destroying None1 or None2");
            break;

        default:
            EB.Debug.LogError("Don't know how to destroy postfx {0}", postfx.ToString());
            break;
        }
    }
Пример #3
0
    private void InitEffect(PerformanceInfo.ePOSTFX postfx, Camera camera)
    {
        EnablePostFX(postfx, true);

        switch (postfx)
        {
#if EBG_POSTFX_BLOOM
        case (PerformanceInfo.ePOSTFX.Bloom):
            EB.Debug.Log("PostFXManager: Initing Bloom");
            InitBloom();
            break;
#endif
#if EBG_POSTFX_VIGNETTE
        case (PerformanceInfo.ePOSTFX.Vignette):
            EB.Debug.Log("PostFXManager: Initing Vignette");
            InitVignette();
            break;
#endif
#if EBG_POSTFX_VIGNETTE2
        case (PerformanceInfo.ePOSTFX.Vignette2):
            EB.Debug.Log("PostFXManager: Initing Vignette2");
            InitVignette2();
            break;
#endif
#if EBG_POSTFX_WARP
        case (PerformanceInfo.ePOSTFX.Warp):
            EB.Debug.Log("PostFXManager: Initing Warp");
            InitWarp(camera);
            break;
#endif
#if EBG_POSTFX_TONE_MAP
        case (PerformanceInfo.ePOSTFX.ToneMap):
            EB.Debug.Log("PostFXManager: Initing Tone Mapping");
            InitToneMapping();
            break;
#endif
#if EBG_POSTFX_COLOR_GRADE
        case (PerformanceInfo.ePOSTFX.ColorGrade):
            EB.Debug.Log("PostFXManager: Initing Color Grading");
            InitColorGrade();
            break;
#endif
#if EBG_POSTFX_RADIAL_BLUR
        case PerformanceInfo.ePOSTFX.RadialBlur:
            EB.Debug.Log("PostFXManager: Initing Radial Blur");
            InitRadialBlur();
            break;
#endif
        case PerformanceInfo.ePOSTFX.None1:
        case PerformanceInfo.ePOSTFX.None2:
            EB.Debug.Log("PostFXManager: Initing None1 or None2");
            break;

        default:
            EB.Debug.LogError("Don't know how to init postfx {0}", postfx.ToString());
            break;
        }
    }
Пример #4
0
    private void EnableMaterialKeyword(PerformanceInfo.ePOSTFX keyword, bool enabled)
    {
        string shaderKeywordPrefix = "EBG_POSTFX_COMPOSITE_" + keyword.ToString().ToUpper();

        if (enabled)
        {
            _CompositeMaterial.DisableKeyword(shaderKeywordPrefix + "_OFF");
            _CompositeMaterial.EnableKeyword(shaderKeywordPrefix + "_ON");
        }
        else
        {
            _CompositeMaterial.DisableKeyword(shaderKeywordPrefix + "_ON");
            _CompositeMaterial.EnableKeyword(shaderKeywordPrefix + "_OFF");
        }
    }
Пример #5
0
 public bool IsActive(PerformanceInfo.ePOSTFX postfx)
 {
     return(CurrentPostFX.Contains(postfx));
 }