mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
120 lines
2.6 KiB
Text
120 lines
2.6 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 bumpuv[2];
|
|
vec3 viewDir;
|
|
};
|
|
struct appdata {
|
|
vec4 vertex;
|
|
vec3 normal;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _World2Object;
|
|
uniform float _WaveScale;
|
|
uniform vec4 _WaveOffset;
|
|
void PositionFog (
|
|
in vec4 v_1,
|
|
out vec4 pos_2,
|
|
out float fog_3
|
|
)
|
|
{
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = (gl_ModelViewProjectionMatrix * v_1);
|
|
pos_2 = tmpvar_4;
|
|
float tmpvar_5;
|
|
tmpvar_5 = pos_2.z;
|
|
fog_3 = tmpvar_5;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v_6
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8.w = 1.0;
|
|
tmpvar_8.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = ((_World2Object * tmpvar_8).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_7 = tmpvar_9;
|
|
return (objSpaceCameraPos_7 - v_6.xyz);
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata v_10
|
|
)
|
|
{
|
|
vec4 temp_11;
|
|
v2f o_12;
|
|
PositionFog (v_10.vertex, o_12.pos, o_12.fog);
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = ((v_10.vertex.xzxz * _WaveScale) + _WaveOffset);
|
|
temp_11 = tmpvar_13.xyzw.xyzw;
|
|
vec2 tmpvar_14;
|
|
tmpvar_14 = (temp_11.xy * vec2(0.4, 0.45));
|
|
o_12.bumpuv[0] = tmpvar_14;
|
|
vec2 tmpvar_15;
|
|
tmpvar_15 = temp_11.wz;
|
|
o_12.bumpuv[1] = tmpvar_15;
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = ObjSpaceViewDir (v_10.vertex);
|
|
vec3 tmpvar_17;
|
|
tmpvar_17 = normalize (tmpvar_16);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = tmpvar_17;
|
|
o_12.viewDir = tmpvar_18.xzy.xyz;
|
|
return o_12;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata xlt_v_19;
|
|
v2f xl_retval_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
xlt_v_19.vertex = tmpvar_22;
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = gl_Normal.xyz;
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
xlt_v_19.normal = tmpvar_24;
|
|
v2f tmpvar_25;
|
|
tmpvar_25 = vert (xlt_v_19);
|
|
v2f tmpvar_26;
|
|
tmpvar_26 = tmpvar_25;
|
|
xl_retval_20 = tmpvar_26;
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = xl_retval_20.pos.xyzw;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = tmpvar_27;
|
|
gl_Position = tmpvar_28;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_29.x = xl_retval_20.fog;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = tmpvar_29;
|
|
xlv_FOG = tmpvar_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31.zw = vec2(0.0, 0.0);
|
|
tmpvar_31.xy = xl_retval_20.bumpuv[0].xy;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
gl_TexCoord[0] = tmpvar_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33.zw = vec2(0.0, 0.0);
|
|
tmpvar_33.xy = xl_retval_20.bumpuv[1].xy;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
gl_TexCoord[1] = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35.w = 0.0;
|
|
tmpvar_35.xyz = xl_retval_20.viewDir.xyz;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
gl_TexCoord[2] = tmpvar_36;
|
|
}
|
|
|