// 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.
/// <summary>
/// Defines the 3 transformations steps used in the pipeline.
/// The first is performed at the end of the VS.
/// The second is performed after the tessellation.
/// The third is performed at the end of the geometry pipeline.
/// </summary>
shader TransformationBase : ShaderBase
{
    // End of the VS (usually skinning)
    stage void PreTransformPosition() {}

    // End of tessellation (usually displacement mapping in world space, etc...)
    stage void TransformPosition() {}

    // At the end of the geometry pipeline (to generate ShadingPosition)
    stage void PostTransformPosition() {}
    
    // Used in cases where a shading position needs to be calculated from a given world position
    //  for example: in tesselation, which needs to determine the triangle size on the screen
    stage float4 ComputeShadingPosition(float4 world) { return 0; }

    stage void BaseTransformVS()
    {
        this.PreTransformPosition();
        this.TransformPosition();
        this.PostTransformPosition();
    }

    stage override void VSMain()
    {
        base.VSMain();
        this.BaseTransformVS();
    }
};
