mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 08:41:31 -05:00
179 lines
6 KiB
Text
179 lines
6 KiB
Text
uniform vec4 _CameraPosition;
|
|
uniform vec3 _CameraRight;
|
|
uniform vec3 _CameraUp;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _WaveAndDistance;
|
|
uniform vec4 _WavingTint;
|
|
uniform vec4 unity_4LightAtten0;
|
|
uniform vec4 unity_4LightPosX0;
|
|
uniform vec4 unity_4LightPosY0;
|
|
uniform vec4 unity_4LightPosZ0;
|
|
uniform vec3 unity_LightColor0;
|
|
uniform vec3 unity_LightColor1;
|
|
uniform vec3 unity_LightColor2;
|
|
uniform vec3 unity_LightColor3;
|
|
uniform vec4 unity_SHAb;
|
|
uniform vec4 unity_SHAg;
|
|
uniform vec4 unity_SHAr;
|
|
uniform vec4 unity_SHBb;
|
|
uniform vec4 unity_SHBg;
|
|
uniform vec4 unity_SHBr;
|
|
uniform vec4 unity_SHC;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
void main ()
|
|
{
|
|
vec3 worldPos_1;
|
|
vec3 worldN_2;
|
|
vec4 pos_3;
|
|
pos_3 = gl_Vertex;
|
|
vec2 offset_4;
|
|
offset_4 = TANGENT.xy;
|
|
vec3 grasspos_5;
|
|
grasspos_5 = (gl_Vertex.xyz - _CameraPosition.xyz);
|
|
float tmpvar_6;
|
|
tmpvar_6 = dot (grasspos_5, grasspos_5);
|
|
if ((tmpvar_6 > _WaveAndDistance.w)) {
|
|
offset_4 = vec2(0.0, 0.0);
|
|
};
|
|
pos_3.xyz = (gl_Vertex.xyz + (offset_4.x * _CameraRight));
|
|
pos_3.xyz = (pos_3.xyz + (offset_4.y * _CameraUp));
|
|
vec4 vertex_7;
|
|
vertex_7.yw = pos_3.yw;
|
|
vec4 outColor_8;
|
|
vec3 waveMove_9;
|
|
float lighting_10;
|
|
vec4 s_11;
|
|
vec4 waves_12;
|
|
waveMove_9.y = 0.0;
|
|
waves_12 = (pos_3.x * (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y));
|
|
waves_12 = (waves_12 + (pos_3.z * (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y)));
|
|
waves_12 = (waves_12 + (_WaveAndDistance.x * vec4(1.2, 2.0, 1.6, 4.8)));
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = fract(waves_12);
|
|
waves_12 = tmpvar_13;
|
|
vec4 val_14;
|
|
vec4 s_15;
|
|
vec4 r2_16;
|
|
vec4 r1_17;
|
|
vec4 r5_18;
|
|
val_14 = ((tmpvar_13 * 6.40885) - 3.14159);
|
|
r5_18 = (val_14 * val_14);
|
|
r1_17 = (r5_18 * val_14);
|
|
r2_16 = (r1_17 * r5_18);
|
|
s_15 = (((val_14 +
|
|
(r1_17 * -0.161616)
|
|
) + (r2_16 * 0.0083333)) + ((r2_16 * r5_18) * -0.00019841));
|
|
s_11 = (s_15 * s_15);
|
|
s_11 = (s_11 * s_11);
|
|
lighting_10 = (dot (s_11, vec4(0.6742, 0.6742, 0.26968, 0.13484)) * 0.7);
|
|
s_11 = (s_11 * TANGENT.y);
|
|
waveMove_9.x = dot (s_11, vec4(0.024, 0.04, -0.12, 0.096));
|
|
waveMove_9.z = dot (s_11, vec4(0.006, 0.02, -0.02, 0.1));
|
|
vertex_7.xz = (pos_3.xz - (waveMove_9.xz * _WaveAndDistance.z));
|
|
outColor_8.xyz = ((gl_Color.xyz * mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, vec3(lighting_10))) * 2.0);
|
|
outColor_8.w = 1.0;
|
|
vec4 pos_19;
|
|
pos_19 = (gl_ModelViewProjectionMatrix * vertex_7);
|
|
mat3 tmpvar_20;
|
|
tmpvar_20[0] = _Object2World[0].xyz;
|
|
tmpvar_20[1] = _Object2World[1].xyz;
|
|
tmpvar_20[2] = _Object2World[2].xyz;
|
|
worldN_2 = (tmpvar_20 * (gl_Normal * unity_Scale.w));
|
|
vec4 tmpvar_21;
|
|
tmpvar_21.w = 1.0;
|
|
tmpvar_21.xyz = worldN_2;
|
|
vec3 x2_22;
|
|
vec4 vB_23;
|
|
vec3 x1_24;
|
|
x1_24.x = dot (unity_SHAr, tmpvar_21);
|
|
x1_24.y = dot (unity_SHAg, tmpvar_21);
|
|
x1_24.z = dot (unity_SHAb, tmpvar_21);
|
|
vB_23 = (worldN_2.xyzz * worldN_2.yzzx);
|
|
x2_22.x = dot (unity_SHBr, vB_23);
|
|
x2_22.y = dot (unity_SHBg, vB_23);
|
|
x2_22.z = dot (unity_SHBb, vB_23);
|
|
worldPos_1 = (_Object2World * vertex_7).xyz;
|
|
vec3 col_25;
|
|
vec4 diff_26;
|
|
vec4 ndotl_27;
|
|
vec4 lengthSq_28;
|
|
vec4 toLightZ_29;
|
|
vec4 toLightY_30;
|
|
vec4 toLightX_31;
|
|
toLightX_31 = (unity_4LightPosX0 - worldPos_1.x);
|
|
toLightY_30 = (unity_4LightPosY0 - worldPos_1.y);
|
|
toLightZ_29 = (unity_4LightPosZ0 - worldPos_1.z);
|
|
lengthSq_28 = (toLightX_31 * toLightX_31);
|
|
lengthSq_28 = (lengthSq_28 + (toLightY_30 * toLightY_30));
|
|
lengthSq_28 = (lengthSq_28 + (toLightZ_29 * toLightZ_29));
|
|
ndotl_27 = (toLightX_31 * worldN_2.x);
|
|
ndotl_27 = (ndotl_27 + (toLightY_30 * worldN_2.y));
|
|
ndotl_27 = (ndotl_27 + (toLightZ_29 * worldN_2.z));
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = max (vec4(0.0, 0.0, 0.0, 0.0), (ndotl_27 * inversesqrt(lengthSq_28)));
|
|
ndotl_27 = tmpvar_32;
|
|
diff_26 = (tmpvar_32 * (1.0/((1.0 +
|
|
(lengthSq_28 * unity_4LightAtten0)
|
|
))));
|
|
col_25 = (unity_LightColor0 * diff_26.x);
|
|
col_25 = (col_25 + (unity_LightColor1 * diff_26.y));
|
|
col_25 = (col_25 + (unity_LightColor2 * diff_26.z));
|
|
col_25 = (col_25 + (unity_LightColor3 * diff_26.w));
|
|
gl_Position = pos_19;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_33.x = pos_19.z;
|
|
xlv_FOG = tmpvar_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34.zw = vec2(0.0, 0.0);
|
|
tmpvar_34.xy = ((gl_MultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
gl_TexCoord[0] = tmpvar_34;
|
|
gl_FrontColor = outColor_8;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35.w = 0.0;
|
|
tmpvar_35.xyz = worldN_2;
|
|
gl_TexCoord[1] = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36.w = 0.0;
|
|
tmpvar_36.xyz = (((x1_24 + x2_22) + (unity_SHC.xyz *
|
|
((worldN_2.x * worldN_2.x) - (worldN_2.y * worldN_2.y))
|
|
)) + col_25);
|
|
gl_TexCoord[2] = tmpvar_36;
|
|
}
|
|
|
|
|
|
// stats: 94 alu 0 tex 1 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: 24 (total size: 0)
|
|
// #0: gl_ModelViewProjectionMatrix (high float) 4x4 [-1]
|
|
// #1: _CameraPosition (high float) 4x1 [-1]
|
|
// #2: _CameraRight (high float) 3x1 [-1]
|
|
// #3: _CameraUp (high float) 3x1 [-1]
|
|
// #4: _MainTex_ST (high float) 4x1 [-1]
|
|
// #5: _Object2World (high float) 4x4 [-1]
|
|
// #6: _WaveAndDistance (high float) 4x1 [-1]
|
|
// #7: _WavingTint (high float) 4x1 [-1]
|
|
// #8: unity_4LightAtten0 (high float) 4x1 [-1]
|
|
// #9: unity_4LightPosX0 (high float) 4x1 [-1]
|
|
// #10: unity_4LightPosY0 (high float) 4x1 [-1]
|
|
// #11: unity_4LightPosZ0 (high float) 4x1 [-1]
|
|
// #12: unity_LightColor0 (high float) 3x1 [-1]
|
|
// #13: unity_LightColor1 (high float) 3x1 [-1]
|
|
// #14: unity_LightColor2 (high float) 3x1 [-1]
|
|
// #15: unity_LightColor3 (high float) 3x1 [-1]
|
|
// #16: unity_SHAb (high float) 4x1 [-1]
|
|
// #17: unity_SHAg (high float) 4x1 [-1]
|
|
// #18: unity_SHAr (high float) 4x1 [-1]
|
|
// #19: unity_SHBb (high float) 4x1 [-1]
|
|
// #20: unity_SHBg (high float) 4x1 [-1]
|
|
// #21: unity_SHBr (high float) 4x1 [-1]
|
|
// #22: unity_SHC (high float) 4x1 [-1]
|
|
// #23: unity_Scale (high float) 4x1 [-1]
|