示例#1
0
        /// <summary>Draws this node now (but doesn't transfer it into a texture).</summary>
        public void DrawGPU(DrawInfo info, SurfaceTexture tex)
        {
            // Get current active RT (as draw will probably overwrite it):
            RenderTexture prevActive = RenderTexture.active;

            // If the size has changed then require a stack (re)allocate:
            if (info.ImageX != tex.LatestImageX || info.ImageY != tex.LatestImageY)
            {
                // Realloc textures:
                tex.ReallocateSize(info);

                // Must reallocate:
                AllocateRequired = true;
            }

            if (AllocateRequired)
            {
                // Clear flag:
                AllocateRequired = false;

                // Allocate the first node:
                int stackCount = 0;
                Allocate(info, tex, ref stackCount);
            }

            // Draw now!
            Draw(info);
            info.CurrentParent = null;

            // Restore active:
            RenderTexture.active = prevActive;
        }
示例#2
0
        /// <summary>Allocates now.</summary>
        public void PreAllocate(DrawInfo info, SurfaceTexture tex)
        {
            // If the size has changed then require a stack (re)allocate:
            if (info.ImageX != tex.LatestImageX || info.ImageY != tex.LatestImageY)
            {
                // Realloc textures:
                tex.ReallocateSize(info);

                // Must reallocate:
                AllocateRequired = true;
            }

            if (AllocateRequired)
            {
                // Clear flag:
                AllocateRequired = false;

                // Allocate the first node:
                int stackCount = 0;
                Allocate(info, tex, ref stackCount);
            }
        }