mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
72 lines
2.6 KiB
Text
72 lines
2.6 KiB
Text
attribute vec4 TANGENT;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _World2Object;
|
|
uniform float _TranslucencyViewDependency;
|
|
uniform vec3 _TerrainTreeLightDirections[4];
|
|
void main ()
|
|
{
|
|
vec3 viewDir;
|
|
vec3 tmpvar_1;
|
|
vec3 tmpvar_2;
|
|
vec3 tmpvar_3;
|
|
float tmpvar_4;
|
|
tmpvar_4 = (1.0 - abs (TANGENT.w));
|
|
vec4 tmpvar_5;
|
|
tmpvar_5.w = 0.0;
|
|
tmpvar_5.xyz = gl_Normal;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6.zw = vec2(0.0, 0.0);
|
|
tmpvar_6.xy = gl_Normal.xy;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = (gl_Vertex + ((tmpvar_6 * gl_ModelViewMatrixInverseTranspose) * tmpvar_4));
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = mix (gl_Normal, normalize ((tmpvar_5 * gl_ModelViewMatrixInverseTranspose)).xyz, vec3(tmpvar_4));
|
|
vec4 tmpvar_9;
|
|
tmpvar_9.w = 1.0;
|
|
tmpvar_9.xyz = _WorldSpaceCameraPos;
|
|
viewDir = normalize ((((_World2Object * tmpvar_9).xyz * unity_Scale.w) - tmpvar_7.xyz));
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = _TerrainTreeLightDirections[0];
|
|
float tmpvar_11;
|
|
tmpvar_11 = dot (tmpvar_8, tmpvar_10);
|
|
tmpvar_1.x = (mix (clamp (-(tmpvar_11), 0.0, 1.0), clamp (dot (viewDir, -(tmpvar_10)), 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
tmpvar_2.x = max (0.0, ((tmpvar_11 * 0.6) + 0.4));
|
|
tmpvar_3.x = max (0.0, dot (tmpvar_8, normalize ((tmpvar_10 + viewDir))));
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = _TerrainTreeLightDirections[1];
|
|
float tmpvar_13;
|
|
tmpvar_13 = dot (tmpvar_8, tmpvar_12);
|
|
tmpvar_1.y = (mix (clamp (-(tmpvar_13), 0.0, 1.0), clamp (dot (viewDir, -(tmpvar_12)), 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
tmpvar_2.y = max (0.0, ((tmpvar_13 * 0.6) + 0.4));
|
|
tmpvar_3.y = max (0.0, dot (tmpvar_8, normalize ((tmpvar_12 + viewDir))));
|
|
vec3 tmpvar_14;
|
|
tmpvar_14 = _TerrainTreeLightDirections[2];
|
|
float tmpvar_15;
|
|
tmpvar_15 = dot (tmpvar_8, tmpvar_14);
|
|
tmpvar_1.z = (mix (clamp (-(tmpvar_15), 0.0, 1.0), clamp (dot (viewDir, -(tmpvar_14)), 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
tmpvar_2.z = max (0.0, ((tmpvar_15 * 0.6) + 0.4));
|
|
tmpvar_3.z = max (0.0, dot (tmpvar_8, normalize ((tmpvar_14 + viewDir))));
|
|
gl_Position = (gl_ModelViewProjectionMatrix * tmpvar_7);
|
|
vec4 tmpvar_16;
|
|
tmpvar_16.zw = vec2(0.0, 0.0);
|
|
tmpvar_16.xy = gl_MultiTexCoord0.xy;
|
|
gl_TexCoord[0] = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17.w = 0.0;
|
|
tmpvar_17.xyz = gl_Color.www;
|
|
gl_TexCoord[1] = tmpvar_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18.w = 0.0;
|
|
tmpvar_18.xyz = tmpvar_1;
|
|
gl_TexCoord[2] = tmpvar_18;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19.w = 0.0;
|
|
tmpvar_19.xyz = tmpvar_2;
|
|
gl_TexCoord[3] = tmpvar_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20.w = 0.0;
|
|
tmpvar_20.xyz = tmpvar_3;
|
|
gl_TexCoord[4] = tmpvar_20;
|
|
}
|
|
|