mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
346 lines
8.2 KiB
Text
346 lines
8.2 KiB
Text
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec4 lop_color;
|
|
vec3 normal;
|
|
vec3 lightDir;
|
|
vec4 _LightCoord;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
attribute vec4 TANGENT;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform vec4 _WavingTint;
|
|
uniform vec4 _WaveAndDistance;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _LightMatrix0;
|
|
mat3 xll_constructMat3 (
|
|
in mat4 m_1
|
|
)
|
|
{
|
|
vec3 tmpvar_2;
|
|
tmpvar_2 = m_1[0].xyz;
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = m_1[1].xyz;
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = m_1[2].xyz;
|
|
mat3 tmpvar_5;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = tmpvar_2;
|
|
tmpvar_5[0] = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = tmpvar_3;
|
|
tmpvar_5[1] = tmpvar_7;
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = tmpvar_4;
|
|
tmpvar_5[2] = tmpvar_8;
|
|
return tmpvar_5;
|
|
}
|
|
|
|
void FastSinCos (
|
|
in vec4 val_9,
|
|
out vec4 s_10,
|
|
out vec4 c_11
|
|
)
|
|
{
|
|
vec4 cos8_12;
|
|
vec4 sin7_13;
|
|
vec4 r3_14;
|
|
vec4 r2_15;
|
|
vec4 r1_16;
|
|
vec4 r8_17;
|
|
vec4 r7_18;
|
|
vec4 r6_19;
|
|
vec4 r5_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = vec4(1.0, -0.161616, 0.0083333, -0.00019841);
|
|
sin7_13 = tmpvar_21;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = vec4(-0.5, 0.0416667, -0.00138889, 2.48016e-05);
|
|
cos8_12 = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = ((val_9 * 6.40885) - 3.14159);
|
|
val_9 = tmpvar_23;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = (val_9 * val_9);
|
|
r5_20 = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = (r5_20 * r5_20);
|
|
r6_19 = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = (r6_19 * r5_20);
|
|
r7_18 = tmpvar_26;
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = (r6_19 * r5_20);
|
|
r8_17 = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = (r5_20 * val_9);
|
|
r1_16 = tmpvar_28;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = (r1_16 * r5_20);
|
|
r2_15 = tmpvar_29;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = (r2_15 * r5_20);
|
|
r3_14 = tmpvar_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = (((val_9 + (r1_16 * sin7_13.y)) + (r2_15 * sin7_13.z)) + (r3_14 * sin7_13.w));
|
|
s_10 = tmpvar_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = ((((1.0 + (r5_20 * cos8_12.x)) + (r6_19 * cos8_12.y)) + (r7_18 * cos8_12.z)) + (r8_17 * cos8_12.w));
|
|
c_11 = tmpvar_32;
|
|
}
|
|
|
|
void TerrainWaveGrass (
|
|
inout vec4 vertex_33,
|
|
in float waveAmount_34,
|
|
in vec3 color_35,
|
|
out vec4 outColor_36
|
|
)
|
|
{
|
|
vec3 waveColor_37;
|
|
vec3 waveMove_38;
|
|
float lighting_39;
|
|
vec4 c_40;
|
|
vec4 s_41;
|
|
vec4 waves_42;
|
|
vec4 _waveZmove_43;
|
|
vec4 _waveXmove_44;
|
|
vec4 waveSpeed_45;
|
|
vec4 _waveZSize_46;
|
|
vec4 _waveXSize_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = vec4(1.2, 2.0, 1.6, 4.8);
|
|
waveSpeed_45 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = vec4(0.024, 0.04, -0.12, 0.096);
|
|
_waveXmove_44 = tmpvar_49;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = vec4(0.006, 0.02, -0.02, 0.1);
|
|
_waveZmove_43 = tmpvar_50;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = vec3(0.0, 0.0, 0.0);
|
|
waveMove_38 = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y);
|
|
_waveXSize_47 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y);
|
|
_waveZSize_46 = tmpvar_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = (vertex_33.x * _waveXSize_47);
|
|
waves_42 = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = (waves_42 + (vertex_33.z * _waveZSize_46));
|
|
waves_42 = tmpvar_55;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = (waves_42 + (_WaveAndDistance.x * waveSpeed_45));
|
|
waves_42 = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = fract (waves_42);
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
waves_42 = tmpvar_58;
|
|
FastSinCos (waves_42, s_41, c_40);
|
|
vec4 tmpvar_59;
|
|
tmpvar_59 = (s_41 * s_41);
|
|
s_41 = tmpvar_59;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = (s_41 * s_41);
|
|
s_41 = tmpvar_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = normalize (vec4(1.0, 1.0, 0.4, 0.2));
|
|
float tmpvar_62;
|
|
tmpvar_62 = dot (s_41, tmpvar_61);
|
|
float tmpvar_63;
|
|
tmpvar_63 = (tmpvar_62 * 0.7);
|
|
lighting_39 = tmpvar_63;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = (s_41 * waveAmount_34);
|
|
s_41 = tmpvar_64;
|
|
float tmpvar_65;
|
|
tmpvar_65 = dot (s_41, _waveXmove_44);
|
|
float tmpvar_66;
|
|
tmpvar_66 = tmpvar_65;
|
|
waveMove_38.x = tmpvar_66;
|
|
float tmpvar_67;
|
|
tmpvar_67 = dot (s_41, _waveZmove_43);
|
|
float tmpvar_68;
|
|
tmpvar_68 = tmpvar_67;
|
|
waveMove_38.z = vec3(tmpvar_68).z;
|
|
vec2 tmpvar_69;
|
|
tmpvar_69 = (vertex_33.xz - (waveMove_38.xz * _WaveAndDistance.z));
|
|
vertex_33.xz = tmpvar_69.xxy.xz;
|
|
vec3 tmpvar_70;
|
|
tmpvar_70 = vec3(lighting_39);
|
|
vec3 tmpvar_71;
|
|
tmpvar_71 = mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, tmpvar_70);
|
|
vec3 tmpvar_72;
|
|
tmpvar_72 = tmpvar_71;
|
|
waveColor_37 = tmpvar_72;
|
|
vec3 tmpvar_73;
|
|
tmpvar_73 = ((color_35 * waveColor_37) * 2.0);
|
|
outColor_36.xyz = tmpvar_73.xyz.xyz;
|
|
float tmpvar_74;
|
|
tmpvar_74 = 1.0;
|
|
outColor_36.w = vec4(tmpvar_74).w;
|
|
}
|
|
|
|
void vert (
|
|
inout appdata_full v_75
|
|
)
|
|
{
|
|
vec4 color_76;
|
|
float waveAmount_77;
|
|
float tmpvar_78;
|
|
tmpvar_78 = (v_75.color.w * _WaveAndDistance.z);
|
|
waveAmount_77 = tmpvar_78;
|
|
TerrainWaveGrass (v_75.vertex, waveAmount_77, v_75.color.xyz, color_76);
|
|
vec4 tmpvar_79;
|
|
tmpvar_79 = color_76;
|
|
v_75.color = tmpvar_79;
|
|
}
|
|
|
|
vec3 WorldSpaceLightDir (
|
|
in vec4 v_80
|
|
)
|
|
{
|
|
vec3 worldPos_81;
|
|
vec3 tmpvar_82;
|
|
tmpvar_82 = (_Object2World * v_80).xyz;
|
|
worldPos_81 = tmpvar_82;
|
|
return (_WorldSpaceLightPos0.xyz - worldPos_81);
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_83,
|
|
out vec4 pos_84,
|
|
out float fog_85
|
|
)
|
|
{
|
|
vec4 tmpvar_86;
|
|
tmpvar_86 = (gl_ModelViewProjectionMatrix * v_83);
|
|
pos_84 = tmpvar_86;
|
|
float tmpvar_87;
|
|
tmpvar_87 = pos_84.z;
|
|
fog_85 = tmpvar_87;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_88
|
|
)
|
|
{
|
|
v2f_surf o_89;
|
|
vert (v_88);
|
|
PositionFog (v_88.vertex, o_89.pos, o_89.fog);
|
|
vec2 tmpvar_90;
|
|
tmpvar_90 = ((v_88.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_89.hip_pack0 = tmpvar_90.xy.xy;
|
|
vec4 tmpvar_91;
|
|
tmpvar_91 = v_88.color;
|
|
o_89.lop_color = tmpvar_91;
|
|
mat3 tmpvar_92;
|
|
tmpvar_92 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_93;
|
|
tmpvar_93 = (tmpvar_92 * (v_88.normal * unity_Scale.w));
|
|
o_89.normal = tmpvar_93;
|
|
vec3 tmpvar_94;
|
|
tmpvar_94 = WorldSpaceLightDir (v_88.vertex);
|
|
vec3 tmpvar_95;
|
|
tmpvar_95 = tmpvar_94;
|
|
o_89.lightDir = tmpvar_95;
|
|
vec4 tmpvar_96;
|
|
tmpvar_96 = (_LightMatrix0 * (_Object2World * v_88.vertex));
|
|
o_89._LightCoord = tmpvar_96;
|
|
return o_89;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_97;
|
|
v2f_surf xl_retval_98;
|
|
vec4 tmpvar_99;
|
|
tmpvar_99 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_100;
|
|
tmpvar_100 = tmpvar_99;
|
|
xlt_v_97.vertex = tmpvar_100;
|
|
vec4 tmpvar_101;
|
|
tmpvar_101 = TANGENT.xyzw;
|
|
vec4 tmpvar_102;
|
|
tmpvar_102 = tmpvar_101;
|
|
xlt_v_97.tangent = tmpvar_102;
|
|
vec3 tmpvar_103;
|
|
tmpvar_103 = gl_Normal.xyz;
|
|
vec3 tmpvar_104;
|
|
tmpvar_104 = tmpvar_103;
|
|
xlt_v_97.normal = tmpvar_104;
|
|
vec4 tmpvar_105;
|
|
tmpvar_105 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_106;
|
|
tmpvar_106 = tmpvar_105;
|
|
xlt_v_97.texcoord = tmpvar_106;
|
|
vec4 tmpvar_107;
|
|
tmpvar_107 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_108;
|
|
tmpvar_108 = tmpvar_107;
|
|
xlt_v_97.texcoord1 = tmpvar_108;
|
|
vec4 tmpvar_109;
|
|
tmpvar_109 = gl_Color.xyzw;
|
|
vec4 tmpvar_110;
|
|
tmpvar_110 = tmpvar_109;
|
|
xlt_v_97.color = tmpvar_110;
|
|
v2f_surf tmpvar_111;
|
|
tmpvar_111 = vert_surf (xlt_v_97);
|
|
v2f_surf tmpvar_112;
|
|
tmpvar_112 = tmpvar_111;
|
|
xl_retval_98 = tmpvar_112;
|
|
vec4 tmpvar_113;
|
|
tmpvar_113 = xl_retval_98.pos.xyzw;
|
|
vec4 tmpvar_114;
|
|
tmpvar_114 = tmpvar_113;
|
|
gl_Position = tmpvar_114;
|
|
vec4 tmpvar_115;
|
|
tmpvar_115.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_115.x = xl_retval_98.fog;
|
|
vec4 tmpvar_116;
|
|
tmpvar_116 = tmpvar_115;
|
|
xlv_FOG = tmpvar_116;
|
|
vec4 tmpvar_117;
|
|
tmpvar_117.zw = vec2(0.0, 0.0);
|
|
tmpvar_117.xy = xl_retval_98.hip_pack0.xy;
|
|
vec4 tmpvar_118;
|
|
tmpvar_118 = tmpvar_117;
|
|
gl_TexCoord[0] = tmpvar_118;
|
|
vec4 tmpvar_119;
|
|
tmpvar_119 = xl_retval_98.lop_color.xyzw;
|
|
vec4 tmpvar_120;
|
|
tmpvar_120 = tmpvar_119;
|
|
gl_FrontColor = tmpvar_120;
|
|
vec4 tmpvar_121;
|
|
tmpvar_121.w = 0.0;
|
|
tmpvar_121.xyz = xl_retval_98.normal.xyz;
|
|
vec4 tmpvar_122;
|
|
tmpvar_122 = tmpvar_121;
|
|
gl_TexCoord[1] = tmpvar_122;
|
|
vec4 tmpvar_123;
|
|
tmpvar_123.w = 0.0;
|
|
tmpvar_123.xyz = xl_retval_98.lightDir.xyz;
|
|
vec4 tmpvar_124;
|
|
tmpvar_124 = tmpvar_123;
|
|
gl_TexCoord[2] = tmpvar_124;
|
|
vec4 tmpvar_125;
|
|
tmpvar_125 = xl_retval_98._LightCoord.xyzw;
|
|
vec4 tmpvar_126;
|
|
tmpvar_126 = tmpvar_125;
|
|
gl_TexCoord[3] = tmpvar_126;
|
|
}
|
|
|