mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
120 lines
2.4 KiB
Text
120 lines
2.4 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,
|
|
out vec4 pos,
|
|
out float fog
|
|
)
|
|
{
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = (gl_ModelViewProjectionMatrix * v);
|
|
pos = tmpvar_1;
|
|
float tmpvar_2;
|
|
tmpvar_2 = pos.z;
|
|
fog = tmpvar_2;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1.w = 1.0;
|
|
tmpvar_1.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_2;
|
|
tmpvar_2 = ((_World2Object * tmpvar_1).xyz * unity_Scale.w);
|
|
objSpaceCameraPos = tmpvar_2;
|
|
return (objSpaceCameraPos - v.xyz);
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata v
|
|
)
|
|
{
|
|
vec4 temp;
|
|
v2f o;
|
|
PositionFog (v.vertex, o.pos, o.fog);
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = ((v.vertex.xzxz * _WaveScale) + _WaveOffset);
|
|
temp = tmpvar_1.xyzw.xyzw;
|
|
vec2 tmpvar_2;
|
|
tmpvar_2 = (temp.xy * vec2(0.4, 0.45));
|
|
o.bumpuv[0] = tmpvar_2;
|
|
vec2 tmpvar_3;
|
|
tmpvar_3 = temp.wz;
|
|
o.bumpuv[1] = tmpvar_3;
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = ObjSpaceViewDir (v.vertex);
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = normalize (tmpvar_4);
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
o.viewDir = tmpvar_6.xzy.xyz;
|
|
return o;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata xlt_v;
|
|
v2f xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1;
|
|
xlt_v.vertex = tmpvar_2;
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = gl_Normal.xyz;
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = tmpvar_3;
|
|
xlt_v.normal = tmpvar_4;
|
|
v2f tmpvar_5;
|
|
tmpvar_5 = vert (xlt_v);
|
|
v2f tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
xl_retval = tmpvar_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = xl_retval.pos.xyzw;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
gl_Position = tmpvar_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_9.x = xl_retval.fog;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
xlv_FOG = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11.zw = vec2(0.0, 0.0);
|
|
tmpvar_11.xy = xl_retval.bumpuv[0].xy;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
gl_TexCoord[0] = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13.zw = vec2(0.0, 0.0);
|
|
tmpvar_13.xy = xl_retval.bumpuv[1].xy;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
gl_TexCoord[1] = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15.w = 0.0;
|
|
tmpvar_15.xyz = xl_retval.viewDir.xyz;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
gl_TexCoord[2] = tmpvar_16;
|
|
}
|
|
|