#line 1 "loops-for-in.txt" float4 unity_LightColor[4]; float4 unity_LightPosition[4]; float4 unity_LightAtten[4]; float4x4 UNITY_MATRIX_MVP; float4x4 UNITY_MATRIX_MV; float4x4 UNITY_MATRIX_IT_MV; struct appdata { float4 vertex : POSITION; float3 normal : NORMAL; }; struct v2f { half4 pos : POSITION; half4 color : TEXCOORD0; }; float3 ShadeMyVertexLights (float4 vertex, float3 normal) { float3 viewpos = mul(UNITY_MATRIX_MV, vertex).xyz; float3 viewN = mul((float3x3) UNITY_MATRIX_IT_MV, normal); float3 lightColor = float3(0.0,0.0,0.0); for (int i = 0; i < 2; i++) { float3 toLight = unity_LightPosition[i].xyz - viewpos.xyz; float lengthSq = dot(toLight, toLight); float atten = 1.0 / (1.0 + lengthSq * unity_LightAtten[i].z); float diff = max (0, dot (viewN, normalize(toLight))); lightColor += unity_LightColor[i].rgb * (diff * atten); } return (lightColor * 2.0); } v2f main (appdata v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.color = float4 (ShadeMyVertexLights(v.vertex, v.normal), 1.0); return o; }