public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = textureParameters.Texture.Type.IsSRgb(textureParameters.ColorSpace); DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; ShouldCompress = asset.IsCompressed; DesiredAlpha = asset.Type.Alpha; TextureHint = asset.Type.Hint; InvertY = (asset.Type.Hint == TextureHint.NormalMap) ? ((NormapMapTextureType)asset.Type).InvertY : false; GenerateMipmaps = asset.GenerateMipmaps; if (asset.Type.Alpha != AlphaFormat.None) { PremultiplyAlpha = asset.Type.PremultiplyAlpha; } ColorKeyColor = asset.Type.ColorKeyColor; ColorKeyEnabled = asset.Type.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = textureParameters.Texture.ColorSpace.ToColorSpace(textureParameters.ColorSpace, asset.Hint) == ColorSpace.Linear; DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = asset.Hint; GenerateMipmaps = asset.GenerateMipmaps; if (asset.Alpha != AlphaFormat.None) { PremultiplyAlpha = asset.PremultiplyAlpha; } ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
protected override void Prepare(AssetCompilerContext context, AssetItem assetItem, string targetUrlInStorage, AssetCompilerResult result) { var asset = (TextureAsset)assetItem.Asset; // Get absolute path of asset source on disk var assetSource = GetAbsolutePath(assetItem, asset.Source); var gameSettingsAsset = context.GetGameSettingsAsset(); var colorSpace = context.GetColorSpace(); var parameter = new TextureConvertParameters(assetSource, asset, context.Platform, context.GetGraphicsPlatform(assetItem.Package), gameSettingsAsset.GetOrCreate <RenderingSettings>(context.Platform).DefaultGraphicsProfile, gameSettingsAsset.GetOrCreate <TextureSettings>().TextureQuality, colorSpace); result.BuildSteps = new AssetBuildStep(assetItem); result.BuildSteps.Add(new TextureConvertCommand(targetUrlInStorage, parameter, assetItem.Package)); }
protected override void Compile(AssetCompilerContext context, string urlInStorage, UFile assetAbsolutePath, TextureAsset asset, AssetCompilerResult result) { if (!EnsureSourcesExist(result, asset, assetAbsolutePath)) { return; } // Get absolute path of asset source on disk var assetSource = GetAbsolutePath(assetAbsolutePath, asset.Source); var gameSettingsAsset = context.GetGameSettingsAsset(); var colorSpace = context.GetColorSpace(); var parameter = new TextureConvertParameters(assetSource, asset, context.Platform, context.GetGraphicsPlatform(AssetItem.Package), gameSettingsAsset.Get <RenderingSettings>(context.Platform).DefaultGraphicsProfile, gameSettingsAsset.Get <TextureSettings>().TextureQuality, colorSpace); result.BuildSteps = new AssetBuildStep(AssetItem) { new TextureConvertCommand(urlInStorage, parameter) }; }