Beispiel #1
0
        public static Texture GetTexture(int height)
        {
            if (dummyTextures.ContainsKey(height))
            {
                return(dummyTextures[height]);
            }
            else
            {
                var patch = new TexturePatch[] { new TexturePatch(0, 0, GetPatch()) };

                dummyTextures.Add(height, new Texture("DUMMY", false, 64, height, patch));

                return(dummyTextures[height]);
            }
        }
Beispiel #2
0
        public static Texture FromData(byte[] data, int offset, Patch[] patchLookup)
        {
            var name       = DoomInterop.ToString(data, offset, 8);
            var masked     = BitConverter.ToInt32(data, offset + 8);
            var width      = BitConverter.ToInt16(data, offset + 12);
            var height     = BitConverter.ToInt16(data, offset + 14);
            var patchCount = BitConverter.ToInt16(data, offset + 20);
            var patches    = new TexturePatch[patchCount];

            for (var i = 0; i < patchCount; i++)
            {
                var patchOffset = offset + 22 + TexturePatch.DataSize * i;
                patches[i] = TexturePatch.FromData(data, patchOffset, patchLookup);
            }

            return(new Texture(
                       name,
                       masked != 0,
                       width,
                       height,
                       patches));
        }