mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
249 lines
6 KiB
Text
249 lines
6 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
vec4 nz;
|
|
};
|
|
struct appdata_grass {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec4 color;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
};
|
|
attribute vec4 TANGENT;
|
|
uniform vec4 _WavingTint;
|
|
uniform vec4 _WaveAndDistance;
|
|
uniform vec4 _ProjectionParams;
|
|
void FastSinCos (
|
|
in vec4 val_1,
|
|
out vec4 s_2,
|
|
out vec4 c_3
|
|
)
|
|
{
|
|
vec4 cos8_4;
|
|
vec4 sin7_5;
|
|
vec4 r3_6;
|
|
vec4 r2_7;
|
|
vec4 r1_8;
|
|
vec4 r8_9;
|
|
vec4 r7_10;
|
|
vec4 r6_11;
|
|
vec4 r5_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = vec4(1.0, -0.161616, 0.0083333, -0.00019841);
|
|
sin7_5 = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = vec4(-0.5, 0.0416667, -0.00138889, 2.48016e-05);
|
|
cos8_4 = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = ((val_1 * 6.40885) - 3.14159);
|
|
val_1 = tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = (val_1 * val_1);
|
|
r5_12 = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = (r5_12 * r5_12);
|
|
r6_11 = tmpvar_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = (r6_11 * r5_12);
|
|
r7_10 = tmpvar_18;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = (r6_11 * r5_12);
|
|
r8_9 = tmpvar_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = (r5_12 * val_1);
|
|
r1_8 = tmpvar_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = (r1_8 * r5_12);
|
|
r2_7 = tmpvar_21;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = (r2_7 * r5_12);
|
|
r3_6 = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = (((val_1 + (r1_8 * sin7_5.y)) + (r2_7 * sin7_5.z)) + (r3_6 * sin7_5.w));
|
|
s_2 = tmpvar_23;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = ((((1.0 + (r5_12 * cos8_4.x)) + (r6_11 * cos8_4.y)) + (r7_10 * cos8_4.z)) + (r8_9 * cos8_4.w));
|
|
c_3 = tmpvar_24;
|
|
}
|
|
|
|
void TerrainWaveGrass (
|
|
inout vec4 vertex_25,
|
|
in float waveAmount_26,
|
|
in vec3 color_27,
|
|
out vec4 outColor_28
|
|
)
|
|
{
|
|
vec3 waveColor_29;
|
|
vec3 waveMove_30;
|
|
float lighting_31;
|
|
vec4 c_32;
|
|
vec4 s_33;
|
|
vec4 waves_34;
|
|
vec4 _waveZmove_35;
|
|
vec4 _waveXmove_36;
|
|
vec4 waveSpeed_37;
|
|
vec4 _waveZSize_38;
|
|
vec4 _waveXSize_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = vec4(1.2, 2.0, 1.6, 4.8);
|
|
waveSpeed_37 = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = vec4(0.024, 0.04, -0.12, 0.096);
|
|
_waveXmove_36 = tmpvar_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = vec4(0.006, 0.02, -0.02, 0.1);
|
|
_waveZmove_35 = tmpvar_42;
|
|
vec3 tmpvar_43;
|
|
tmpvar_43 = vec3(0.0, 0.0, 0.0);
|
|
waveMove_30 = tmpvar_43;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y);
|
|
_waveXSize_39 = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y);
|
|
_waveZSize_38 = tmpvar_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = (vertex_25.x * _waveXSize_39);
|
|
waves_34 = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = (waves_34 + (vertex_25.z * _waveZSize_38));
|
|
waves_34 = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = (waves_34 + (_WaveAndDistance.x * waveSpeed_37));
|
|
waves_34 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = fract (waves_34);
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
waves_34 = tmpvar_50;
|
|
FastSinCos (waves_34, s_33, c_32);
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = (s_33 * s_33);
|
|
s_33 = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = (s_33 * s_33);
|
|
s_33 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = normalize (vec4(1.0, 1.0, 0.4, 0.2));
|
|
float tmpvar_54;
|
|
tmpvar_54 = dot (s_33, tmpvar_53);
|
|
float tmpvar_55;
|
|
tmpvar_55 = (tmpvar_54 * 0.7);
|
|
lighting_31 = tmpvar_55;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = (s_33 * waveAmount_26);
|
|
s_33 = tmpvar_56;
|
|
float tmpvar_57;
|
|
tmpvar_57 = dot (s_33, _waveXmove_36);
|
|
float tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
waveMove_30.x = tmpvar_58;
|
|
float tmpvar_59;
|
|
tmpvar_59 = dot (s_33, _waveZmove_35);
|
|
float tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
waveMove_30.z = vec3(tmpvar_60).z;
|
|
vec2 tmpvar_61;
|
|
tmpvar_61 = (vertex_25.xz - (waveMove_30.xz * _WaveAndDistance.z));
|
|
vertex_25.xz = tmpvar_61.xxy.xz;
|
|
vec3 tmpvar_62;
|
|
tmpvar_62 = vec3(lighting_31);
|
|
vec3 tmpvar_63;
|
|
tmpvar_63 = mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, tmpvar_62);
|
|
vec3 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
waveColor_29 = tmpvar_64;
|
|
vec3 tmpvar_65;
|
|
tmpvar_65 = ((color_27 * waveColor_29) * 2.0);
|
|
outColor_28.xyz = tmpvar_65.xyz.xyz;
|
|
float tmpvar_66;
|
|
tmpvar_66 = 1.0;
|
|
outColor_28.w = vec4(tmpvar_66).w;
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_grass v_67
|
|
)
|
|
{
|
|
v2f o_68;
|
|
vec4 dummyColor_69;
|
|
float waveAmount_70;
|
|
float tmpvar_71;
|
|
tmpvar_71 = (v_67.color.w * _WaveAndDistance.z);
|
|
waveAmount_70 = tmpvar_71;
|
|
vec4 tmpvar_72;
|
|
tmpvar_72 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
dummyColor_69 = tmpvar_72;
|
|
vec3 tmpvar_73;
|
|
tmpvar_73 = dummyColor_69.xyz;
|
|
TerrainWaveGrass (v_67.vertex, waveAmount_70, tmpvar_73, dummyColor_69);
|
|
vec4 tmpvar_74;
|
|
tmpvar_74 = (gl_ModelViewProjectionMatrix * v_67.vertex);
|
|
o_68.pos = tmpvar_74;
|
|
vec2 tmpvar_75;
|
|
tmpvar_75 = v_67.texcoord.xy;
|
|
vec2 tmpvar_76;
|
|
tmpvar_76 = tmpvar_75;
|
|
o_68.uv = tmpvar_76;
|
|
vec3 tmpvar_77;
|
|
tmpvar_77 = vec3(0.0, 0.0, 1.0);
|
|
o_68.nz.xyz = tmpvar_77.xyz.xyz;
|
|
float tmpvar_78;
|
|
tmpvar_78 = -(((gl_ModelViewMatrix * v_67.vertex).z * _ProjectionParams.w));
|
|
o_68.nz.w = vec4(tmpvar_78).w;
|
|
return o_68;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_grass xlt_v_79;
|
|
v2f xl_retval_80;
|
|
vec4 tmpvar_81;
|
|
tmpvar_81 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_82;
|
|
tmpvar_82 = tmpvar_81;
|
|
xlt_v_79.vertex = tmpvar_82;
|
|
vec4 tmpvar_83;
|
|
tmpvar_83 = TANGENT.xyzw;
|
|
vec4 tmpvar_84;
|
|
tmpvar_84 = tmpvar_83;
|
|
xlt_v_79.tangent = tmpvar_84;
|
|
vec4 tmpvar_85;
|
|
tmpvar_85 = gl_Color.xyzw;
|
|
vec4 tmpvar_86;
|
|
tmpvar_86 = tmpvar_85;
|
|
xlt_v_79.color = tmpvar_86;
|
|
vec4 tmpvar_87;
|
|
tmpvar_87 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_88;
|
|
tmpvar_88 = tmpvar_87;
|
|
xlt_v_79.texcoord = tmpvar_88;
|
|
vec4 tmpvar_89;
|
|
tmpvar_89 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_90;
|
|
tmpvar_90 = tmpvar_89;
|
|
xlt_v_79.texcoord1 = tmpvar_90;
|
|
v2f tmpvar_91;
|
|
tmpvar_91 = vert (xlt_v_79);
|
|
v2f tmpvar_92;
|
|
tmpvar_92 = tmpvar_91;
|
|
xl_retval_80 = tmpvar_92;
|
|
vec4 tmpvar_93;
|
|
tmpvar_93 = xl_retval_80.pos.xyzw;
|
|
vec4 tmpvar_94;
|
|
tmpvar_94 = tmpvar_93;
|
|
gl_Position = tmpvar_94;
|
|
vec4 tmpvar_95;
|
|
tmpvar_95.zw = vec2(0.0, 0.0);
|
|
tmpvar_95.xy = xl_retval_80.uv.xy;
|
|
vec4 tmpvar_96;
|
|
tmpvar_96 = tmpvar_95;
|
|
gl_TexCoord[0] = tmpvar_96;
|
|
vec4 tmpvar_97;
|
|
tmpvar_97 = xl_retval_80.nz.xyzw;
|
|
vec4 tmpvar_98;
|
|
tmpvar_98 = tmpvar_97;
|
|
gl_TexCoord[1] = tmpvar_98;
|
|
}
|
|
|