//
// Road tracks; no lighting, just vertex colors and blending, and weirdness
// 22-09-08: Created (Ruud van Gaal)
// Mauled by David I

void main(
	  float4 inPosition : POSITION,
	  float2 inTC0      : TEXCOORD0,
	  float4 inColor    : COLOR,				// Vertex colors
	  // Output
      out float4 outPosition      : POSITION,
      out float3 outColor         : COLOR,
	  out float2 outTC0           : TEXCOORD0,
  
  // Params
  uniform float4x4 modelViewProj,
  uniform float    time,
  uniform float4x4 modelMatrix
)
{
//float displacement = 1.1 * 0.5 * (sin(inPosition.z * time) + 1);
float displacement = 1.0 * 0.1 * (sin(inPosition.xyz * time/8) + 1);
//float displacement = 1.0;
float4 oPosition= inPosition;
//oPosition.z= inPosition.z+displacement;
oPosition.xyz= inPosition.xyz+displacement;
// Transform vertex
  outPosition=mul(modelViewProj,oPosition);
  
  // Pass texcoords
  outTC0 = inTC0;

  // Pass vertex color
  outColor=inColor;
}