Exemple #1
0
    bool RefreshRT()
    {
        int width  = EnvironmentManager.Instance.GetCurrentRTWidth();
        int height = EnvironmentManager.Instance.GetCurrentRTHeight();

        bool update = false;

        CommonSet.RefreshRT(ref colorRT, width, height, EnvironmentManager.Instance.isSupportDepthTex ? 0 : 24, EnvironmentManager.Instance.halfFormat, false, false, FilterMode.Bilinear, ref update, ref cam);

        if (NormalBufferEnable())
        {
            CommonSet.RefreshRT(ref normalRT, width, height, 0, RenderTextureFormat.ARGBHalf, false, false, FilterMode.Bilinear, ref update, ref cam);
            CommonSet.RefreshRT(ref specRT, width, height, 0, RenderTextureFormat.ARGB32, false, false, FilterMode.Bilinear, ref update, ref cam);
            bufs[0] = colorRT.colorBuffer;
            bufs[1] = normalRT.colorBuffer;
            bufs[2] = specRT.colorBuffer;
        }
        else
        {
            CommonSet.DeleteRenderTexture(ref normalRT);
            CommonSet.DeleteRenderTexture(ref specRT);
        }

        if (EnvironmentManager.Instance.isSupportDepthTex)
        {
            CommonSet.RefreshRT(ref depthRT, width, height, 24, RenderTextureFormat.Depth, false, false, FilterMode.Bilinear, ref update, ref cam);
            RenderTextureFormat depthRawFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat) ? RenderTextureFormat.RFloat : RenderTextureFormat.RHalf;
            CommonSet.RefreshRT(ref depthCopy, width, height, 0, depthRawFormat, true, true, FilterMode.Point, ref update, ref cam);
        }
        else
        {
            CommonSet.DeleteRenderTexture(ref depthRT);
            CommonSet.DeleteRenderTexture(ref depthCopy);
        }

        if (StochasticSSREnable())
        {
            RenderTextureFormat depthRawFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat) ? RenderTextureFormat.RFloat : RenderTextureFormat.RHalf;
            CommonSet.RefreshRT(ref depthBackUp, width, height, 0, depthRawFormat, true, false, FilterMode.Point, ref update, ref cam);
            CommonSet.RefreshRT(ref temporal[0], width / (int)mProperty.reflectionResolution, height / (int)mProperty.reflectionResolution, 0, RenderTextureFormat.ARGBHalf, false, false, FilterMode.Bilinear, ref update, ref cam);
            CommonSet.RefreshRT(ref temporal[1], width / (int)mProperty.reflectionResolution, height / (int)mProperty.reflectionResolution, 0, RenderTextureFormat.ARGBHalf, false, false, FilterMode.Bilinear, ref update, ref cam);
        }
        else
        {
            CommonSet.DeleteRenderTexture(ref depthBackUp);
            CommonSet.DeleteRenderTexture(ref temporal[0]);
            CommonSet.DeleteRenderTexture(ref temporal[1]);
        }

        return(update);
    }