mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
119 lines
4.2 KiB
Text
119 lines
4.2 KiB
Text
varying vec4 xlv_FOG;
|
|
attribute vec4 TANGENT;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec4 unity_SHC;
|
|
uniform vec4 unity_SHBr;
|
|
uniform vec4 unity_SHBg;
|
|
uniform vec4 unity_SHBb;
|
|
uniform vec4 unity_SHAr;
|
|
uniform vec4 unity_SHAg;
|
|
uniform vec4 unity_SHAb;
|
|
uniform vec3 unity_LightColor3;
|
|
uniform vec3 unity_LightColor2;
|
|
uniform vec3 unity_LightColor1;
|
|
uniform vec3 unity_LightColor0;
|
|
uniform vec4 unity_4LightPosZ0;
|
|
uniform vec4 unity_4LightPosY0;
|
|
uniform vec4 unity_4LightPosX0;
|
|
uniform vec4 unity_4LightAtten0;
|
|
uniform vec4 _WavingTint;
|
|
uniform vec4 _WaveAndDistance;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform vec3 _CameraUp;
|
|
uniform vec3 _CameraRight;
|
|
uniform vec4 _CameraPosition;
|
|
void main ()
|
|
{
|
|
vec4 pos;
|
|
pos = gl_Vertex;
|
|
vec2 offset;
|
|
offset = TANGENT.xy;
|
|
vec3 tmpvar_1;
|
|
tmpvar_1 = (gl_Vertex.xyz - _CameraPosition.xyz);
|
|
float tmpvar_2;
|
|
tmpvar_2 = dot (tmpvar_1, tmpvar_1);
|
|
if ((tmpvar_2 > _WaveAndDistance.w)) {
|
|
offset = vec2(0.0, 0.0);
|
|
};
|
|
pos.xyz = (gl_Vertex.xyz + (offset.x * _CameraRight));
|
|
pos.xyz = (pos.xyz + (offset.y * _CameraUp));
|
|
vec4 vertex;
|
|
vertex = pos;
|
|
vec4 outColor;
|
|
vec3 waveMove;
|
|
waveMove = vec3(0.0, 0.0, 0.0);
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = ((fract ((((pos.x * (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y)) + (pos.z * (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y))) + (_WaveAndDistance.x * vec4(1.2, 2.0, 1.6, 4.8)))) * 6.40885) - 3.14159);
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = (tmpvar_3 * tmpvar_3);
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = (tmpvar_4 * tmpvar_3);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = (tmpvar_5 * tmpvar_4);
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = (((tmpvar_3 + (tmpvar_5 * -0.161616)) + (tmpvar_6 * 0.0083333)) + ((tmpvar_6 * tmpvar_4) * -0.00019841));
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = (tmpvar_7 * tmpvar_7);
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = (tmpvar_8 * tmpvar_8);
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = (tmpvar_9 * TANGENT.y);
|
|
waveMove.x = dot (tmpvar_10, vec4(0.024, 0.04, -0.12, 0.096));
|
|
waveMove.z = dot (tmpvar_10, vec4(0.006, 0.02, -0.02, 0.1));
|
|
vertex.xz = (pos.xz - (waveMove.xz * _WaveAndDistance.z));
|
|
outColor.xyz = ((gl_Color.xyz * mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, vec3((dot (tmpvar_9, vec4(0.6742, 0.6742, 0.26968, 0.13484)) * 0.7)))) * 2.0);
|
|
outColor.w = 1.0;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = (gl_ModelViewProjectionMatrix * vertex);
|
|
mat3 tmpvar_12;
|
|
tmpvar_12[0] = _Object2World[0].xyz;
|
|
tmpvar_12[1] = _Object2World[1].xyz;
|
|
tmpvar_12[2] = _Object2World[2].xyz;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = (tmpvar_12 * (gl_Normal * unity_Scale.w));
|
|
vec4 tmpvar_14;
|
|
tmpvar_14.w = 1.0;
|
|
tmpvar_14.xyz = tmpvar_13;
|
|
vec3 x2;
|
|
vec3 x1;
|
|
x1.x = dot (unity_SHAr, tmpvar_14);
|
|
x1.y = dot (unity_SHAg, tmpvar_14);
|
|
x1.z = dot (unity_SHAb, tmpvar_14);
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = (tmpvar_13.xyzz * tmpvar_13.yzzx);
|
|
x2.x = dot (unity_SHBr, tmpvar_15);
|
|
x2.y = dot (unity_SHBg, tmpvar_15);
|
|
x2.z = dot (unity_SHBb, tmpvar_15);
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = (_Object2World * vertex).xyz;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = (unity_4LightPosX0 - tmpvar_16.x);
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = (unity_4LightPosY0 - tmpvar_16.y);
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = (unity_4LightPosZ0 - tmpvar_16.z);
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = (((tmpvar_17 * tmpvar_17) + (tmpvar_18 * tmpvar_18)) + (tmpvar_19 * tmpvar_19));
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = (max (vec4(0.0, 0.0, 0.0, 0.0), ((((tmpvar_17 * tmpvar_13.x) + (tmpvar_18 * tmpvar_13.y)) + (tmpvar_19 * tmpvar_13.z)) * inversesqrt (tmpvar_20))) * (1.0/((1.0 + (tmpvar_20 * unity_4LightAtten0)))));
|
|
gl_Position = tmpvar_11;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_22.x = tmpvar_11.z;
|
|
xlv_FOG = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23.zw = vec2(0.0, 0.0);
|
|
tmpvar_23.xy = ((gl_MultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
gl_TexCoord[0] = tmpvar_23;
|
|
gl_FrontColor = outColor;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24.w = 0.0;
|
|
tmpvar_24.xyz = tmpvar_13;
|
|
gl_TexCoord[1] = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.w = 0.0;
|
|
tmpvar_25.xyz = (((x1 + x2) + (unity_SHC.xyz * ((tmpvar_13.x * tmpvar_13.x) - (tmpvar_13.y * tmpvar_13.y)))) + ((((unity_LightColor0 * tmpvar_21.x) + (unity_LightColor1 * tmpvar_21.y)) + (unity_LightColor2 * tmpvar_21.z)) + (unity_LightColor3 * tmpvar_21.w)));
|
|
gl_TexCoord[2] = tmpvar_25;
|
|
}
|
|
|