private void UpdatePreviewTexture()
        {
            RenderTexture buffer = m_Recorder.RecordingUnit.ScratchBuffer;

            if (buffer != null)
            {
                if (previewTexture != null)
                {
                    bool created = previewTexture.IsCreated();
                    bool resized = (previewTexture.width != buffer.width || previewTexture.height != buffer.height);

                    if (created && !resized)
                    {
                        return;
                    }

                    DisposalHelper.Dispose(ref previewTexture);
                }

                RenderTexture texture = new RenderTexture(buffer.width, buffer.height, 0, RenderTextureFormat.ARGB32);
                texture.wrapMode = TextureWrapMode.Repeat;
                texture.Create();

                previewTexture = DisposalHelper.Mark(texture);
            }
        }
Exemple #2
0
        private void ReleaseAllBuffers()
        {
            if (scratchBuffers != null)
            {
                for (int i = 0; i < scratchBuffers.Length; i++)
                {
                    DisposalHelper.Dispose(ref scratchBuffers[i]);
                }

                scratchBuffers = null;
            }
        }
Exemple #3
0
        private void ReleaseAllBuffers()
        {
            DisposalHelper.Dispose(ref buffer);

            if (gbuffer != null)
            {
                for (int i = 0; i < gbuffer.Length; i++)
                {
                    DisposalHelper.Dispose(ref gbuffer[i]);
                }

                gbuffer = null;
            }
        }
Exemple #4
0
        private static bool RequireRegeneration(ref RenderTexture texture, int width, int height)
        {
            if (texture != null)
            {
                bool created = texture.IsCreated();
                bool resized = (texture.width != width || texture.height != height);

                if (created && !resized)
                {
                    return(false);
                }

                DisposalHelper.Dispose(ref texture);
            }

            return(true);
        }
Exemple #5
0
        private static bool RequireRegeneration(ref RenderTexture texture, RenderTexture target)
        {
            if (texture != null)
            {
                bool created       = texture.IsCreated();
                bool resized       = (texture.width != target.width || texture.height != target.height);
                bool formatChanged = (texture.format != target.format);

                if (created && !resized && !formatChanged)
                {
                    return(false);
                }

                DisposalHelper.Dispose(ref texture);
            }

            return(true);
        }
 public virtual void ReleaseResources()
 {
     DisposalHelper.Dispose(ref quad);
     DisposalHelper.Dispose(ref copyMaterial);
 }
Exemple #7
0
 private void ReleaseScratchBuffer()
 {
     DisposalHelper.Dispose(ref scratchBuffer);
 }
 protected void OnDisable()
 {
     DisposalHelper.Dispose(ref previewTexture);
 }