Esempio n. 1
0
        public override object Parse(Asset asset, BinaryReader reader, AssetImportCollection imports, AssetParseContext context)
        {
            var twelve = reader.ReadUInt32();

            if (twelve != 12)
            {
                throw new InvalidDataException();
            }

            reader.ReadUInt32(); // Length

            var ddsFile = DdsFile.FromStream(reader.BaseStream);

            var result = context.GraphicsDevice.CreateStaticTexture2D(
                ddsFile.Header.Width,
                ddsFile.Header.Height,
                ddsFile.ArraySize,
                ddsFile.MipMaps,
                ddsFile.PixelFormat,
                ddsFile.Dimension == DdsTextureDimension.TextureCube);

            result.Name = asset.Name;

            return(new Graphics.TextureAsset(result, asset));
        }
        public static void CreateTexture(
            Stream stream,
            D3D11Device device,
            D3D11DeviceContext context,
            out D3D11ShaderResourceView textureView)
        {
            DdsFile dds = DdsFile.FromStream(stream);

            CreateTexture(dds, device, context, out textureView);
        }
Esempio n. 3
0
        public override object Parse(Asset asset, BinaryReader reader, uint[] relocations, AssetImport[] imports)
        {
            var zero = reader.ReadUInt32();

            if (zero != 0)
            {
                throw new InvalidDataException();
            }

            var twelve = reader.ReadUInt32();

            if (twelve != 12)
            {
                throw new InvalidDataException();
            }

            var ddsLength = reader.ReadUInt32();

            return(DdsFile.FromStream(reader.BaseStream));
        }