// 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.
shader SpriteBase : ShaderBase, Texturing
{
    // -------------------------------------
    // streams
    // -------------------------------------
    stage stream float4 Position : POSITION;

    cbuffer PerDraw
    {
        // -------------------------------------
        // uniforms
        // -------------------------------------
        // A general transformation matrix
        stage float4x4 MatrixTransform;
    }
        
    // -------------------------------------
    // VertexShader
    // -------------------------------------
    stage override void VSMain()
    {
        streams.ShadingPosition = mul(streams.Position, MatrixTransform);
    }

    // Shading of the sprite
    stage override void PSMain()
    {
        streams.ColorTarget = Shading();
    }

    stage float4 Shading()
    {
        return Texture0.Sample(Sampler, streams.TexCoord);
    }
};
