1!!ARBvp1.0 2 3# Night texture lighting 4 5ATTRIB iPos = vertex.position; 6ATTRIB iNormal = vertex.normal; 7ATTRIB iTex0 = vertex.texcoord[0]; 8PARAM mvp[4] = { state.matrix.mvp }; 9PARAM lightDir0 = program.env[0]; 10PARAM diffuse = program.env[2]; 11PARAM lightDir1 = program.env[18]; 12PARAM zeroVec = { 0, 0, 0, 0 }; 13PARAM one = 1; 14OUTPUT oPos = result.position; 15OUTPUT oColor = result.color; 16OUTPUT oTex0 = result.texcoord[0]; 17 18TEMP diffuseFactor; 19TEMP diffuseSum; 20 21# Transform the vertex by the modelview matrix 22DP4 oPos.x, mvp[0], iPos; 23DP4 oPos.y, mvp[1], iPos; 24DP4 oPos.z, mvp[2], iPos; 25DP4 oPos.w, mvp[3], iPos; 26 27# Compute the illumination from the first light source 28DP3 diffuseFactor, iNormal, lightDir0; 29MAX diffuseFactor, diffuseFactor, zeroVec; 30MOV diffuseSum, diffuseFactor; 31 32# Compute the illumination from the second light source 33DP3 diffuseFactor, iNormal, lightDir1; 34MAX diffuseFactor, diffuseFactor, zeroVec; 35ADD diffuseSum, diffuseSum, diffuseFactor; 36 37# Use the fourth power of L dot N to create a sharper division between 38# the lit and unlit sides of the planet. 39ADD diffuseSum, one, -diffuseSum; 40MUL diffuseSum, diffuseSum, diffuseSum; 41MUL diffuseSum, diffuseSum, diffuseSum; 42 43# Output the texture 44MOV oTex0, iTex0; 45# Output the primary color 46MUL oColor, diffuse, diffuseSum; 47 48END 49