- struct VertexInput
- {
- float3 position : POSITION;
- float4 color : COLOR0;
- float3 next : NORMAL;
- };
- struct VertexOutput
- {
- float4 position : POSITION;
- float4 color : COLOR0;
- float texCoord : TEXCOORD0;
- };
- VertexOutput main( VertexInput IN,
- uniform float4x4 ModelViewProj,
- uniform float3 viewPos,
- uniform float radius
- )
- {
- VertexOutput OUT;
- float3 up = normalize( cross( (viewPos - IN.position), (IN.next - IN.position) ) );
- up *= radius;
- if (IN.color.a == 0)
- {
- OUT.position.xyz = IN.position - up;
- OUT.texCoord = 0;
- }
- else
- {
- OUT.position.xyz = IN.position + up;
- OUT.texCoord = 1;
- }
- OUT.position.w = 1;
- OUT.position = mul( ModelViewProj, OUT.position );
- OUT.color.xzy = IN.color.xzy;
- OUT.color.a = 1;
- return OUT;
- }