// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

namespace Stride.Rendering.Images
{
    /// <summary>
    /// A copier shader
    /// </summary>
    internal shader ImageScalerShader : ImageEffectShader
    {
        // TODO: Color and IsOnlyChannelRed could be part of a color filter that we can pre-prend automatically
        [Color]
        stage float4 Color;
        stage float IsOnlyChannelRed;

        // Shading of the sprite
        stage override float4 Shading()
        {
            float4 color = base.Shading();
            if (IsOnlyChannelRed != 0)
            {
                color = float4(color.rrr, 1);
            }
            return color * Color;
        }
    };
}
