Пример #1
0
        internal static TextureAsset ParseAsset(BinaryReader reader, Asset asset, 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 TextureAsset(result, asset));
        }
Пример #2
0
        internal static ModelMesh ParseAsset(BinaryReader reader, Asset asset, AssetImportCollection imports, AssetParseContext context)
        {
            var w3xMesh = W3xMesh.Parse(reader, imports, asset.Header);

            return(new ModelMesh(w3xMesh, asset, context.AssetStore.LoadContext));
        }