mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
127 lines
3.8 KiB
Text
127 lines
3.8 KiB
Text
uniform vec3 _TerrainTreeLightDirections[4];
|
|
uniform float _TranslucencyViewDependency;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
void main ()
|
|
{
|
|
vec3 lightDir_1;
|
|
vec3 viewDir_2;
|
|
vec3 tmpvar_3;
|
|
vec3 tmpvar_4;
|
|
vec3 tmpvar_5;
|
|
vec4 pos_6;
|
|
float isBillboard_7;
|
|
isBillboard_7 = (1.0 - abs(TANGENT.w));
|
|
vec4 tmpvar_8;
|
|
tmpvar_8.w = 0.0;
|
|
tmpvar_8.xyz = gl_Normal;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9.zw = vec2(0.0, 0.0);
|
|
tmpvar_9.xy = gl_Normal.xy;
|
|
pos_6 = (gl_Vertex + ((tmpvar_9 * gl_ModelViewMatrixInverseTranspose) * isBillboard_7));
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = mix (gl_Normal, normalize((tmpvar_8 * gl_ModelViewMatrixInverseTranspose)).xyz, vec3(isBillboard_7));
|
|
vec4 tmpvar_11;
|
|
tmpvar_11.w = 1.0;
|
|
tmpvar_11.xyz = _WorldSpaceCameraPos;
|
|
viewDir_2 = normalize(((
|
|
(_World2Object * tmpvar_11)
|
|
.xyz * unity_Scale.w) - pos_6.xyz));
|
|
lightDir_1 = _TerrainTreeLightDirections[0];
|
|
float tmpvar_12;
|
|
tmpvar_12 = dot (tmpvar_10, lightDir_1);
|
|
vec3 tmpvar_13;
|
|
tmpvar_13.yz = tmpvar_3.yz;
|
|
tmpvar_13.x = (mix (clamp (
|
|
-(tmpvar_12)
|
|
, 0.0, 1.0), clamp (
|
|
dot (viewDir_2, -(lightDir_1))
|
|
, 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
vec3 tmpvar_14;
|
|
tmpvar_14.yz = tmpvar_4.yz;
|
|
tmpvar_14.x = max (0.0, ((tmpvar_12 * 0.6) + 0.4));
|
|
vec3 tmpvar_15;
|
|
tmpvar_15.yz = tmpvar_5.yz;
|
|
tmpvar_15.x = max (0.0, dot (tmpvar_10, normalize(
|
|
(lightDir_1 + viewDir_2)
|
|
)));
|
|
lightDir_1 = _TerrainTreeLightDirections[1];
|
|
float tmpvar_16;
|
|
tmpvar_16 = dot (tmpvar_10, lightDir_1);
|
|
vec3 tmpvar_17;
|
|
tmpvar_17.xz = tmpvar_13.xz;
|
|
tmpvar_17.y = (mix (clamp (
|
|
-(tmpvar_16)
|
|
, 0.0, 1.0), clamp (
|
|
dot (viewDir_2, -(lightDir_1))
|
|
, 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18.xz = tmpvar_14.xz;
|
|
tmpvar_18.y = max (0.0, ((tmpvar_16 * 0.6) + 0.4));
|
|
vec3 tmpvar_19;
|
|
tmpvar_19.xz = tmpvar_15.xz;
|
|
tmpvar_19.y = max (0.0, dot (tmpvar_10, normalize(
|
|
(lightDir_1 + viewDir_2)
|
|
)));
|
|
lightDir_1 = _TerrainTreeLightDirections[2];
|
|
float tmpvar_20;
|
|
tmpvar_20 = dot (tmpvar_10, lightDir_1);
|
|
vec3 tmpvar_21;
|
|
tmpvar_21.xy = tmpvar_17.xy;
|
|
tmpvar_21.z = (mix (clamp (
|
|
-(tmpvar_20)
|
|
, 0.0, 1.0), clamp (
|
|
dot (viewDir_2, -(lightDir_1))
|
|
, 0.0, 1.0), _TranslucencyViewDependency) * 2.0);
|
|
tmpvar_3 = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22.xy = tmpvar_18.xy;
|
|
tmpvar_22.z = max (0.0, ((tmpvar_20 * 0.6) + 0.4));
|
|
tmpvar_4 = tmpvar_22;
|
|
vec3 tmpvar_23;
|
|
tmpvar_23.xy = tmpvar_19.xy;
|
|
tmpvar_23.z = max (0.0, dot (tmpvar_10, normalize(
|
|
(lightDir_1 + viewDir_2)
|
|
)));
|
|
tmpvar_5 = tmpvar_23;
|
|
gl_Position = (gl_ModelViewProjectionMatrix * pos_6);
|
|
vec4 tmpvar_24;
|
|
tmpvar_24.zw = vec2(0.0, 0.0);
|
|
tmpvar_24.xy = gl_MultiTexCoord0.xy;
|
|
gl_TexCoord[0] = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.w = 0.0;
|
|
tmpvar_25.xyz = gl_Color.www;
|
|
gl_TexCoord[1] = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26.w = 0.0;
|
|
tmpvar_26.xyz = tmpvar_21;
|
|
gl_TexCoord[2] = tmpvar_26;
|
|
vec4 tmpvar_27;
|
|
tmpvar_27.w = 0.0;
|
|
tmpvar_27.xyz = tmpvar_22;
|
|
gl_TexCoord[3] = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28.w = 0.0;
|
|
tmpvar_28.xyz = tmpvar_23;
|
|
gl_TexCoord[4] = tmpvar_28;
|
|
}
|
|
|
|
|
|
// stats: 66 alu 0 tex 0 flow
|
|
// inputs: 5
|
|
// #0: gl_MultiTexCoord0 (high float) 4x1 [-1] loc 8
|
|
// #1: gl_Color (high float) 4x1 [-1] loc 3
|
|
// #2: gl_Normal (high float) 3x1 [-1] loc 2
|
|
// #3: gl_Vertex (high float) 4x1 [-1] loc 0
|
|
// #4: TANGENT (high float) 4x1 [-1]
|
|
// uniforms: 7 (total size: 0)
|
|
// #0: gl_ModelViewMatrixInverseTranspose (high float) 4x4 [-1]
|
|
// #1: gl_ModelViewProjectionMatrix (high float) 4x4 [-1]
|
|
// #2: _TerrainTreeLightDirections (high float) 3x1 [4]
|
|
// #3: _TranslucencyViewDependency (high float) 1x1 [-1]
|
|
// #4: _World2Object (high float) 4x4 [-1]
|
|
// #5: _WorldSpaceCameraPos (high float) 3x1 [-1]
|
|
// #6: unity_Scale (high float) 4x1 [-1]
|