コード例 #1
0
    void OnDisable()
    {
        Camera cam = GetComponent <Camera>();

        if (cam == null)
        {
            return;
        }

        if (cam.targetTexture == null)
        {
            SSAA.internal_SSAA aa = gameObject.GetComponent <SSAA.internal_SSAA>();
            if (aa != null)
            {
                Destroy(aa);
            }
        }
        else
        {
            SSAA.SSAARenderTarget aaRenderTgt = gameObject.GetComponent <SSAA.SSAARenderTarget>();
            if (aaRenderTgt != null)
            {
                if (Application.isPlaying)
                {
                    Destroy(aaRenderTgt);
                }
                else
                {
                    DestroyImmediate(aaRenderTgt);
                }
            }
        }
    }
コード例 #2
0
    void OnEnable()
    {
        Camera cam = GetComponent <Camera>();

        if (cam == null)
        {
            Debug.LogWarning("No Camera attached!");
            return;
        }


        if (cam.targetTexture == null)
        {
            SSAA.internal_SSAA aa = gameObject.AddComponent <SSAA.internal_SSAA>();
            //aa.hideFlags = HideFlags.HideAndDontSave;
            aa.hideFlags = (HideFlags)((int)HideFlags.HideAndDontSave + (int)HideFlags.HideInInspector);
            SSAA.internal_SSAA.Filter = Filter;
            SSAA.internal_SSAA.ChangeScale(Scale);
            SSAA.internal_SSAA.Format = renderTextureFormat;
        }
        else
        {
            SSAA.SSAARenderTarget aa = gameObject.AddComponent <SSAA.SSAARenderTarget>();
            //aa.hideFlags = HideFlags.HideAndDontSave;
            aa.hideFlags     = (HideFlags)((int)HideFlags.HideAndDontSave + (int)HideFlags.HideInInspector);
            aa.Scale         = Scale;
            aa.TargetTexture = cam.targetTexture;
            aa.Filter        = Filter;
            aa.Format        = renderTextureFormat;
        }
    }