mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
189 lines
4.3 KiB
Text
189 lines
4.3 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 uv;
|
|
vec2 uv2;
|
|
vec3 I;
|
|
vec3 TtoW0;
|
|
vec3 TtoW1;
|
|
vec3 TtoW2;
|
|
};
|
|
struct appdata_tan {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
attribute vec4 TANGENT;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform vec4 _BumpMap_ST;
|
|
vec3 WorldSpaceViewDir (
|
|
in vec4 v_1
|
|
)
|
|
{
|
|
return (_WorldSpaceCameraPos.xyz - (_Object2World * v_1).xyz);
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_2,
|
|
out vec4 pos_3,
|
|
out float fog_4
|
|
)
|
|
{
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = (gl_ModelViewProjectionMatrix * v_2);
|
|
pos_3 = tmpvar_5;
|
|
float tmpvar_6;
|
|
tmpvar_6 = pos_3.z;
|
|
fog_4 = tmpvar_6;
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_tan v_7
|
|
)
|
|
{
|
|
mat3 rotation_8;
|
|
vec3 binormal_9;
|
|
v2f o_10;
|
|
PositionFog (v_7.vertex, o_10.pos, o_10.fog);
|
|
vec2 tmpvar_11;
|
|
tmpvar_11 = ((v_7.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_10.uv = tmpvar_11;
|
|
vec2 tmpvar_12;
|
|
tmpvar_12 = ((v_7.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
|
o_10.uv2 = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = WorldSpaceViewDir (v_7.vertex);
|
|
vec3 tmpvar_14;
|
|
tmpvar_14 = -(tmpvar_13);
|
|
o_10.I = tmpvar_14;
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = cross (v_7.normal, v_7.tangent.xyz);
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = (tmpvar_15 * v_7.tangent.w);
|
|
binormal_9 = tmpvar_16;
|
|
mat3 tmpvar_17;
|
|
float tmpvar_18;
|
|
tmpvar_18 = v_7.tangent.x;
|
|
tmpvar_17[0].x = tmpvar_18;
|
|
float tmpvar_19;
|
|
tmpvar_19 = binormal_9.x;
|
|
tmpvar_17[0].y = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = v_7.normal.x;
|
|
tmpvar_17[0].z = tmpvar_20;
|
|
float tmpvar_21;
|
|
tmpvar_21 = v_7.tangent.y;
|
|
tmpvar_17[1].x = tmpvar_21;
|
|
float tmpvar_22;
|
|
tmpvar_22 = binormal_9.y;
|
|
tmpvar_17[1].y = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = v_7.normal.y;
|
|
tmpvar_17[1].z = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = v_7.tangent.z;
|
|
tmpvar_17[2].x = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = binormal_9.z;
|
|
tmpvar_17[2].y = tmpvar_25;
|
|
float tmpvar_26;
|
|
tmpvar_26 = v_7.normal.z;
|
|
tmpvar_17[2].z = tmpvar_26;
|
|
mat3 tmpvar_27;
|
|
tmpvar_27 = (tmpvar_17);
|
|
rotation_8 = (tmpvar_27);
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = (rotation_8 * (_Object2World[0].xyz * unity_Scale.w));
|
|
o_10.TtoW0 = tmpvar_28;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = (rotation_8 * (_Object2World[1].xyz * unity_Scale.w));
|
|
o_10.TtoW1 = tmpvar_29;
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = (rotation_8 * (_Object2World[2].xyz * unity_Scale.w));
|
|
o_10.TtoW2 = tmpvar_30;
|
|
return o_10;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_tan xlt_v_31;
|
|
v2f xl_retval_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
xlt_v_31.vertex = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = TANGENT.xyzw;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xlt_v_31.tangent = tmpvar_36;
|
|
vec3 tmpvar_37;
|
|
tmpvar_37 = gl_Normal.xyz;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_v_31.normal = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xlt_v_31.texcoord = tmpvar_40;
|
|
v2f tmpvar_41;
|
|
tmpvar_41 = vert (xlt_v_31);
|
|
v2f tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xl_retval_32 = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = xl_retval_32.pos.xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
gl_Position = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_45.x = xl_retval_32.fog;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlv_FOG = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47.zw = vec2(0.0, 0.0);
|
|
tmpvar_47.xy = xl_retval_32.uv.xy;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
gl_TexCoord[0] = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49.zw = vec2(0.0, 0.0);
|
|
tmpvar_49.xy = xl_retval_32.uv2.xy;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
gl_TexCoord[1] = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51.w = 0.0;
|
|
tmpvar_51.xyz = xl_retval_32.I.xyz;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
gl_TexCoord[2] = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53.w = 0.0;
|
|
tmpvar_53.xyz = xl_retval_32.TtoW0.xyz;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
gl_TexCoord[3] = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55.w = 0.0;
|
|
tmpvar_55.xyz = xl_retval_32.TtoW1.xyz;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
gl_TexCoord[4] = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57.w = 0.0;
|
|
tmpvar_57.xyz = xl_retval_32.TtoW2.xyz;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
gl_TexCoord[5] = tmpvar_58;
|
|
}
|
|
|