2014-02-11 02:06:13 -05:00
|
|
|
varying vec4 position;
|
|
|
|
varying vec3 varyingNormalDirection;
|
|
|
|
uniform mat4 v_inv;
|
|
|
|
void main ()
|
|
|
|
{
|
|
|
|
vec3 specularReflection_1;
|
2014-10-11 15:32:43 -04:00
|
|
|
vec3 totalLighting_2;
|
|
|
|
float attenuation_3;
|
|
|
|
vec3 lightDirection_4;
|
|
|
|
vec3 tmpvar_5;
|
|
|
|
tmpvar_5 = normalize(varyingNormalDirection);
|
2014-02-11 02:06:13 -05:00
|
|
|
vec3 tmpvar_6;
|
2014-10-11 15:32:43 -04:00
|
|
|
tmpvar_6 = normalize(((v_inv * vec4(0.0, 0.0, 0.0, 1.0)) - position).xyz);
|
|
|
|
totalLighting_2 = vec3(0.04, 0.04, 0.04);
|
|
|
|
vec3 tmpvar_7;
|
|
|
|
tmpvar_7 = (vec4(0.0, 3.0, 0.0, 1.0) - position).xyz;
|
|
|
|
float tmpvar_8;
|
|
|
|
tmpvar_8 = dot (tmpvar_7, tmpvar_7);
|
|
|
|
lightDirection_4 = (inversesqrt(tmpvar_8) * tmpvar_7);
|
|
|
|
attenuation_3 = (2.0 * inversesqrt(tmpvar_8));
|
|
|
|
vec3 tmpvar_9;
|
|
|
|
tmpvar_9 = ((vec3(attenuation_3) * vec3(1.0, 0.8, 0.8)) * max (0.0, dot (tmpvar_5, lightDirection_4)));
|
|
|
|
float tmpvar_10;
|
|
|
|
tmpvar_10 = dot (tmpvar_5, lightDirection_4);
|
|
|
|
if ((tmpvar_10 < 0.0)) {
|
2014-02-11 02:06:13 -05:00
|
|
|
specularReflection_1 = vec3(0.0, 0.0, 0.0);
|
|
|
|
} else {
|
2014-10-11 15:32:43 -04:00
|
|
|
vec3 I_11;
|
|
|
|
I_11 = -(lightDirection_4);
|
|
|
|
specularReflection_1 = (vec3(attenuation_3) * pow (max (0.0,
|
|
|
|
dot ((I_11 - (2.0 * (
|
|
|
|
dot (tmpvar_5, I_11)
|
|
|
|
* tmpvar_5))), tmpvar_6)
|
2014-02-11 02:06:13 -05:00
|
|
|
), 5.0));
|
|
|
|
};
|
2014-10-11 15:32:43 -04:00
|
|
|
totalLighting_2 = ((vec3(0.04, 0.04, 0.04) + tmpvar_9) + specularReflection_1);
|
|
|
|
vec4 tmpvar_12;
|
|
|
|
tmpvar_12.w = 1.0;
|
|
|
|
tmpvar_12.xyz = totalLighting_2;
|
|
|
|
gl_FragColor = tmpvar_12;
|
2014-02-11 02:06:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-11 15:32:43 -04:00
|
|
|
// stats: 30 alu 0 tex 1 flow
|
|
|
|
// inputs: 2
|
|
|
|
// #0: position (high float) 4x1 [-1]
|
|
|
|
// #1: varyingNormalDirection (high float) 3x1 [-1]
|
|
|
|
// uniforms: 1 (total size: 0)
|
|
|
|
// #0: v_inv (high float) 4x4 [-1]
|