Tesi Robotica V+ Sim: Interprete Command Language e... | Page 105
float4 Position : POSITION;
float3 Normal
: NORMAL;
float2 TexCoord : TEXCOORD;
};
struct OutVertex
{
float4 Position : POSITION;
float3 LightDiffuse : COLOR0;
float2 TexCoord : TEXCOORD0;
};
OutVertex VertexShader(PositionNormalTextured vertex)
{
OutVertex outVertex;
float4x4 WorldView = mul( World, View);
WorldViewProjection = mul( WorldView, Projection);
// Copy the texture coordinate
outVertex.TexCoord = vertex.TexCoord;
vertex.Position=vertex.Position+float4(Vett,0);
// Transform and project position
outVertex.Position = mul(vertex.Position,
WorldViewProjection);
// Transform normal for lighting
float3 normal = normalize(mul(vertex.Normal, World));
104