Beispiel #1
0
            private ResultStatus Import(ICommandContext commandContext, TextureTool textureTool, TexImage texImage, TextureHelper.ImportParameters convertParameters)
            {
                var assetManager             = new ContentManager();
                var useSeparateDataContainer = TextureHelper.ShouldUseDataContainer(Parameters.IsStreamable, texImage.Dimension);

                // Note: for streamable textures we want to store mip maps in a separate storage container and read them on request instead of whole asset deserialization (at once)

                return(useSeparateDataContainer
                    ? TextureHelper.ImportStreamableTextureImage(assetManager, textureTool, texImage, convertParameters, CancellationToken, commandContext)
                    : TextureHelper.ImportTextureImage(assetManager, textureTool, texImage, convertParameters, CancellationToken, commandContext.Logger));
            }
            protected override Task <ResultStatus> DoCommandOverride(ICommandContext commandContext)
            {
                var convertParameters = new TextureHelper.ImportParameters(AssetParameters)
                {
                    OutputUrl = Url
                };

                using (var texTool = new TextureTool())
                    using (var texImage = texTool.Load(AssetParameters.SourcePathFromDisk, convertParameters.IsSRgb))
                    {
                        var importResult = TextureHelper.ImportTextureImage(texTool, texImage, convertParameters, CancellationToken, commandContext.Logger);

                        return(Task.FromResult(importResult));
                    }
            }