mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
49 lines
1.5 KiB
Text
49 lines
1.5 KiB
Text
varying vec4 position;
|
|
varying vec3 varyingNormalDirection;
|
|
uniform mat4 v_inv;
|
|
void main ()
|
|
{
|
|
vec3 specularReflection_1;
|
|
vec3 totalLighting_2;
|
|
float attenuation_3;
|
|
vec3 lightDirection_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = normalize(varyingNormalDirection);
|
|
vec3 tmpvar_6;
|
|
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)) {
|
|
specularReflection_1 = vec3(0.0, 0.0, 0.0);
|
|
} else {
|
|
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)
|
|
), 5.0));
|
|
};
|
|
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;
|
|
}
|
|
|
|
|
|
// 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]
|