FSO.Files.Formats.IFF.Chunks.SPR2Frame.GetZTexture C# (CSharp) Method

GetZTexture() public method

Gets a z-texture representing this SPR2Frame.
public GetZTexture ( GraphicsDevice device ) : Microsoft.Xna.Framework.Graphics.Texture2D
device GraphicsDevice GraphicsDevice instance used for drawing.
return Microsoft.Xna.Framework.Graphics.Texture2D
        public Texture2D GetZTexture(GraphicsDevice device)
        {
            DecodeIfRequired();
            if (ZCache == null)
            {
                if (ZBufferData == null || this.Width == 0 || this.Height == 0)
                {
                    return null;
                }
                ZCache = new Texture2D(device, this.Width, this.Height, false, SurfaceFormat.Alpha8);
                ZCache.SetData<byte>(this.ZBufferData);
                if (!IffFile.RETAIN_CHUNK_DATA) ZBufferData = null;
            }
            return ZCache;
        }