示例#1
0
        public void Write()
        {
            RenderTexture renderTexture;

            if (Target == null)
            {
                renderTexture = new RenderTexture(TextureSize.x, TextureSize.y, 0, TextureFormat);
                renderTexture.enableRandomWrite = true;
                try
                {
                    Wirte(renderTexture);
                    TextureGeneratorHelper.WriteTexture(this, renderTexture);
                }
                finally
                {
                    if (renderTexture == RenderTexture.active)
                    {
                        RenderTexture.active = null;
                    }
                    renderTexture.Release();
                }
            }
            else
            {
                renderTexture = Target;
                Wirte(renderTexture);
            }

            Debug.Log("Write completed!");
        }
示例#2
0
        public void OuputTextureTo()
        {
            var texture = CreateTexture();

            TextureGeneratorHelper.WriteTexture(this, texture);
            DestroyImmediate(texture);
        }