#include "common.hlsl" struct input { float3 pos : pos; float2 uv : uv; float4 color : color; float3 normal : norm; }; struct output { float4 pos : SV_POSITION; float2 uv: TEXCOORD0; float4 color : COLOR0; float3 normal : NORMAL; float3 gouraud : COLOR1; }; float3 ps1_directional_light(float3 normal, float3 direction, float3 ambient, float3 lightcolor) { float NdotL = dot(normal, normalize(-direction)); NdotL = max(NdotL, 0.0f); float3 color = ambient + lightcolor*NdotL; return color; } output main(input i) { output o; o.pos = mul(world_to_projection, float4(i.pos,1.0)); o.uv = i.uv; o.color = i.color; o.normal = i.normal; float3 ambient = float3(0.2,0.2,0.2); float3 lightdir = normalize(float3(1,1,1)); o.gouraud = ps1_directional_light(i.normal, lightdir, ambient, float3(1,1,1)); return o; }