Esempio n. 1
0
 public void CleanRT()
 {
     CommonSet.DeleteRenderTexture(ref colorRT);
     CommonSet.DeleteRenderTexture(ref normalRT);
     CommonSet.DeleteRenderTexture(ref specRT);
     CommonSet.DeleteRenderTexture(ref depthRT);
     CommonSet.DeleteRenderTexture(ref depthCopy);
     CommonSet.DeleteRenderTexture(ref depthBackUp);
 }
Esempio n. 2
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);
    }
    public void UpdateDistortion(bool enable)
    {
        cam = GetComponent <Camera>();

        if (enable)
        {
            InitDistortionBuffer();
            cam.enabled = true;
            RefreshDistortionRT();
        }
        else
        {
            ClearCommandBuffer(ref distortionCB, CameraEvent.BeforeForwardOpaque);
            cam.targetTexture = null;
            cam.enabled       = false;
            CommonSet.DeleteRenderTexture(ref distortionRT);
        }
    }
    void RefreshDistortionRT()
    {
        int width  = EnvironmentManager.Instance.GetDistortionRTWidth();
        int height = EnvironmentManager.Instance.GetDistortionRTHeight();

        if (distortionRT)
        {
            if (width != distortionRT.width || height != distortionRT.height)
            {
                cam.targetTexture = null;
                CommonSet.DeleteRenderTexture(ref distortionRT);
            }
        }
        if (!distortionRT && EnvironmentManager.Instance.isSupportDepthTex)
        {
            distortionRT = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            distortionRT.autoGenerateMips = false;
        }
    }
 public static void RefreshRT(ref RenderTexture rt, int width, int height, int depth, RenderTextureFormat format, bool useMipMap, bool autoGenerateMips, FilterMode filterMode, ref bool forceUpdate, ref Camera cam)
 {
     if (rt)
     {
         if (width != rt.width || height != rt.height || rt.format != format || rt.depth != depth)
         {
             cam.targetTexture = null;
             CommonSet.DeleteRenderTexture(ref rt);
         }
     }
     if (!rt)
     {
         rt = new RenderTexture(width, height, depth, format, RenderTextureReadWrite.Linear);
         rt.autoGenerateMips = autoGenerateMips;
         rt.useMipMap        = useMipMap;
         rt.filterMode       = filterMode;
         forceUpdate         = true;
     }
 }
Esempio n. 6
0
    void RefreshAlphaRT()
    {
        int width  = EnvironmentManager.Instance.GetCurrentRTWidth();
        int height = EnvironmentManager.Instance.GetCurrentRTHeight();

        if (alphaRT)
        {
            if (width != alphaRT.width || height != alphaRT.height || alphaRT.format != EnvironmentManager.Instance.halfFormat)
            {
                cam.targetTexture = null;
                CommonSet.DeleteRenderTexture(ref alphaRT);
            }
        }
        if (!alphaRT && EnvironmentManager.Instance.isSupportDepthTex)
        {
            alphaRT = new RenderTexture(width, height, 24, EnvironmentManager.Instance.halfFormat, RenderTextureReadWrite.Linear);
            alphaRT.autoGenerateMips = false;
        }
    }
 public void CleanRT()
 {
     CommonSet.DeleteRenderTexture(ref distortionRT);
 }
Esempio n. 8
0
 public void CleanRT()
 {
     CommonSet.DeleteRenderTexture(ref alphaRT);
 }