// // Simple ambient lighting model // I=Aintensity * Acolour // Where: // Aintensity is the ambient light intensity // Acolour is the colour of the ambient light // These lines are just for EffectEdit: string XFile = "tiger\\tiger.x"; // model int BCLR = 0xff202080; // background // transformations provided by the app: float4x4 matWorldViewProj: WORLDVIEWPROJECTION; struct PSOutput { float4 colour : COLOR; }; // Pixel shader that calculates ambient light PSOutput PS() { PSOutput Out=(PSOutput)0; float Aintensity=0.8f; float4 Acolour=float4(1.0,0.5,0.5,1.0); Out.colour=Aintensity*Acolour; return Out; } // the format of our vertex data struct VS_OUTPUT { float4 Pos : POSITION; }; // Vertex Shader - simply carry out transformation VS_OUTPUT VS(float4 Pos : POSITION) { VS_OUTPUT Out = (VS_OUTPUT)0; Out.Pos = mul(Pos,matWorldViewProj); return Out; } // Effect technique to be used technique TVertexAndPixelShader { pass P0 { // shaders VertexShader = compile vs_1_1 VS(); PixelShader = compile ps_1_1 PS(); } }