Esempio n. 1
0
            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;
            }
Esempio n. 2
0
        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));
        }