// Software vertex shader generated by Wild Magic.
//
// var float3   kModelPosition  $vin.POSITION
// var float4   kClipPosition   $vout.POSITION
// var float4   kDiffuseColor   $vout.COLOR
// var float4x4 WVPMatrix       c[0]
// var float4   MaterialDiffuse c[4]

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

namespace Wm4
{

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

    // Get the input attributes.
    Vector4f kModelPosition(afInVertex[0],afInVertex[1],afInVertex[2],1.0f);

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

    // *** program ***

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

    // Pass through the material diffuse color.
    rkDiffuseColor = rkMatDif;
}

WM4_IMPLEMENT_VPROGRAM(Material);

}
