3 using System.Threading.Tasks;
5 using SiliconStudio.Assets.Compiler;
6 using SiliconStudio.BuildEngine;
7 using SiliconStudio.Core;
8 using SiliconStudio.Core.IO;
9 using SiliconStudio.Core.Serialization;
10 using SiliconStudio.Core.Serialization.Assets;
11 using SiliconStudio.Paradox.Graphics;
18 internal class TextureAssetCompiler : AssetCompilerBase<TextureAsset>
22 if (asset.Source == null)
24 result.Error(
"Source cannot be null for Texture Asset [{0}]", asset);
29 var assetDirectory = assetAbsolutePath.GetParent();
30 var assetSource = UPath.Combine(assetDirectory, asset.Source);
32 result.BuildSteps =
new ListBuildStep {
new TextureConvertCommand(urlInStorage,
33 new TextureConvertParameters(assetSource, asset, context.
Platform, context.GetGraphicsPlatform(), context.GetGraphicsProfile(), context.GetTextureQuality(),
false)) };
39 internal class TextureConvertCommand :
AssetCommand<TextureConvertParameters>
41 public TextureConvertCommand()
45 public TextureConvertCommand(
string url, TextureConvertParameters description)
46 : base(url, description)
50 public override System.Collections.Generic.IEnumerable<
ObjectUrl> GetInputFiles()
58 var texture = asset.Texture;
60 var importResult = TextureCommandHelper.ImportAndSaveTextureImage(asset.SourcePathFromDisk,
Url, texture, asset, asset.SeparateAlpha, CancellationToken, commandContext.Logger);
62 return Task.FromResult(importResult);
67 writer.Write(DataSerializer.BinaryFormatVersion);
87 UFile sourcePathFromDisk,
95 SourcePathFromDisk = sourcePathFromDisk;
101 SeparateAlpha = separateAlpha;
PlatformType Platform
Gets or sets the target platform for compiler is being used for.
Result of a compilation of assets when using IAssetCompiler.Compile
PlatformType
Describes the platform operating system.
GraphicsPlatform
The graphics platform.
TextureConvertParameters()
A command processing an Asset.
Implements SerializationStream as a binary writer.
TextureQuality
The desired texture quality.
The context used when compiling an asset in a Package.
TextureConvertParameters(UFile sourcePathFromDisk, TextureAsset texture, PlatformType platform, GraphicsPlatform graphicsPlatform, GraphicsProfile graphicsProfile, TextureQuality textureQuality, bool separateAlpha)
TextureQuality TextureQuality
Describes a texture asset.
GraphicsProfile GraphicsProfile
Parameters used for converting/processing the texture in the storage.
GraphicsPlatform GraphicsPlatform
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.
Defines a normalized file path. See UPath for details. This class cannot be inherited.
Base class for texture resources.