// Software vertex shader generated by Wild Magic.
//
// var float3   kModelPosition $vin.POSITION
// var float2   kInBaseTCoord  $vin.TEXCOORD0
// var float4   kClipPosition  $vout.POSITION
// var float2   kOutBaseTCoord $vout.TEXCOORD0
// var float4x4 WVPMatrix      c[0]

#include "Wm4SoftRendererPCH.h"
#include "Wm4SoftRenderer.h"
#include "Wm4Matrix4.h"
#include "Wm4Vector2.h"

namespace Wm4
{

void v_Texture (const float* afRegister, const float* afInVertex,
    float* afOutVertex)
{
    // Get the shader constants.
    const Matrix4f& rkWVPMatrix = *(const Matrix4f*)&afRegister[0];

    // Get the input attributes.
    Vector4f kModelPosition(afInVertex[0],afInVertex[1],afInVertex[2],1.0f);
    const Vector2f& rkInBaseTCoord = *(const Vector2f*)&afInVertex[3];

    // Access the output attributes.
    Vector4f& rkClipPosition = *(Vector4f*)&afOutVertex[0];
    Vector2f& rkOutBaseTCoord = *(Vector2f*)&afOutVertex[4];

    // *** program ***

    // Transform the position from model space to clip space.
    rkClipPosition = kModelPosition*rkWVPMatrix;

    // Pass through the texture coordinate.
    rkOutBaseTCoord = rkInBaseTCoord;
}

WM4_IMPLEMENT_VPROGRAM(Texture);

}
