mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
279 lines
6.6 KiB
Text
279 lines
6.6 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec4 hip_screen;
|
|
vec4 TtoW0;
|
|
vec4 TtoW1;
|
|
vec4 TtoW2;
|
|
vec3 hip_lmapFade;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _BumpMap_ST;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform vec4 unity_LightmapFade;
|
|
uniform vec4 unity_LightmapST;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
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 PositionFog (
|
|
in vec4 v_9,
|
|
out vec4 pos_10,
|
|
out float fog_11
|
|
)
|
|
{
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (gl_ModelViewProjectionMatrix * v_9);
|
|
pos_10 = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = pos_10.z;
|
|
fog_11 = tmpvar_13;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v_14
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16.w = 1.0;
|
|
tmpvar_16.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_17;
|
|
tmpvar_17 = ((_World2Object * tmpvar_16).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_15 = tmpvar_17;
|
|
return (objSpaceCameraPos_15 - v_14.xyz);
|
|
}
|
|
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_18
|
|
)
|
|
{
|
|
vec4 o_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = (pos_18 * 0.5);
|
|
o_19 = tmpvar_20;
|
|
vec2 tmpvar_21;
|
|
tmpvar_21.x = o_19.x;
|
|
tmpvar_21.y = (o_19.y * _ProjectionParams.x);
|
|
vec2 tmpvar_22;
|
|
tmpvar_22 = (tmpvar_21 + o_19.w);
|
|
o_19.xy = tmpvar_22.xy.xy;
|
|
vec2 tmpvar_23;
|
|
tmpvar_23 = pos_18.zw;
|
|
o_19.zw = tmpvar_23.xxxy.zw;
|
|
return o_19;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_24
|
|
)
|
|
{
|
|
mat3 rotation_25;
|
|
vec3 binormal_26;
|
|
vec3 worldRefl_27;
|
|
vec3 viewDir_28;
|
|
v2f_surf o_29;
|
|
PositionFog (v_24.vertex, o_29.pos, o_29.fog);
|
|
vec2 tmpvar_30;
|
|
tmpvar_30 = ((v_24.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_29.hip_pack0.xy = tmpvar_30.xy.xy;
|
|
vec2 tmpvar_31;
|
|
tmpvar_31 = ((v_24.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
|
o_29.hip_pack0.zw = tmpvar_31.xxxy.zw;
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = ObjSpaceViewDir (v_24.vertex);
|
|
vec3 tmpvar_33;
|
|
tmpvar_33 = -(tmpvar_32);
|
|
viewDir_28 = tmpvar_33;
|
|
mat3 tmpvar_34;
|
|
tmpvar_34 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_35;
|
|
tmpvar_35 = (tmpvar_34 * viewDir_28);
|
|
worldRefl_27 = tmpvar_35;
|
|
vec3 tmpvar_36;
|
|
tmpvar_36 = cross (v_24.normal, v_24.tangent.xyz);
|
|
vec3 tmpvar_37;
|
|
tmpvar_37 = (tmpvar_36 * v_24.tangent.w);
|
|
binormal_26 = tmpvar_37;
|
|
mat3 tmpvar_38;
|
|
float tmpvar_39;
|
|
tmpvar_39 = v_24.tangent.x;
|
|
tmpvar_38[0].x = tmpvar_39;
|
|
float tmpvar_40;
|
|
tmpvar_40 = binormal_26.x;
|
|
tmpvar_38[0].y = tmpvar_40;
|
|
float tmpvar_41;
|
|
tmpvar_41 = v_24.normal.x;
|
|
tmpvar_38[0].z = tmpvar_41;
|
|
float tmpvar_42;
|
|
tmpvar_42 = v_24.tangent.y;
|
|
tmpvar_38[1].x = tmpvar_42;
|
|
float tmpvar_43;
|
|
tmpvar_43 = binormal_26.y;
|
|
tmpvar_38[1].y = tmpvar_43;
|
|
float tmpvar_44;
|
|
tmpvar_44 = v_24.normal.y;
|
|
tmpvar_38[1].z = tmpvar_44;
|
|
float tmpvar_45;
|
|
tmpvar_45 = v_24.tangent.z;
|
|
tmpvar_38[2].x = tmpvar_45;
|
|
float tmpvar_46;
|
|
tmpvar_46 = binormal_26.z;
|
|
tmpvar_38[2].y = tmpvar_46;
|
|
float tmpvar_47;
|
|
tmpvar_47 = v_24.normal.z;
|
|
tmpvar_38[2].z = tmpvar_47;
|
|
mat3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_38;
|
|
rotation_25 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49.xyz = (rotation_25 * _Object2World[0].xyz).xyz;
|
|
tmpvar_49.w = worldRefl_27.x;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = (tmpvar_49 * unity_Scale.w);
|
|
o_29.TtoW0 = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51.xyz = (rotation_25 * _Object2World[1].xyz).xyz;
|
|
tmpvar_51.w = worldRefl_27.y;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = (tmpvar_51 * unity_Scale.w);
|
|
o_29.TtoW1 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53.xyz = (rotation_25 * _Object2World[2].xyz).xyz;
|
|
tmpvar_53.w = worldRefl_27.z;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = (tmpvar_53 * unity_Scale.w);
|
|
o_29.TtoW2 = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = ComputeScreenPos (o_29.pos);
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
o_29.hip_screen = tmpvar_56;
|
|
vec2 tmpvar_57;
|
|
tmpvar_57 = ((v_24.texcoord1.xy * unity_LightmapST.xy) + unity_LightmapST.zw);
|
|
o_29.hip_lmapFade.xy = tmpvar_57.xy.xy;
|
|
float tmpvar_58;
|
|
tmpvar_58 = ((-(
|
|
(gl_ModelViewMatrix * v_24.vertex)
|
|
.z) * unity_LightmapFade.z) + unity_LightmapFade.w);
|
|
o_29.hip_lmapFade.z = vec3(tmpvar_58).z;
|
|
return o_29;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_59;
|
|
v2f_surf xl_retval_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
xlt_v_59.vertex = tmpvar_62;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63 = TANGENT.xyzw;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
xlt_v_59.tangent = tmpvar_64;
|
|
vec3 tmpvar_65;
|
|
tmpvar_65 = gl_Normal.xyz;
|
|
vec3 tmpvar_66;
|
|
tmpvar_66 = tmpvar_65;
|
|
xlt_v_59.normal = tmpvar_66;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = tmpvar_67;
|
|
xlt_v_59.texcoord = tmpvar_68;
|
|
vec4 tmpvar_69;
|
|
tmpvar_69 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_70;
|
|
tmpvar_70 = tmpvar_69;
|
|
xlt_v_59.texcoord1 = tmpvar_70;
|
|
vec4 tmpvar_71;
|
|
tmpvar_71 = gl_Color.xyzw;
|
|
vec4 tmpvar_72;
|
|
tmpvar_72 = tmpvar_71;
|
|
xlt_v_59.color = tmpvar_72;
|
|
v2f_surf tmpvar_73;
|
|
tmpvar_73 = vert_surf (xlt_v_59);
|
|
v2f_surf tmpvar_74;
|
|
tmpvar_74 = tmpvar_73;
|
|
xl_retval_60 = tmpvar_74;
|
|
vec4 tmpvar_75;
|
|
tmpvar_75 = xl_retval_60.pos.xyzw;
|
|
vec4 tmpvar_76;
|
|
tmpvar_76 = tmpvar_75;
|
|
gl_Position = tmpvar_76;
|
|
vec4 tmpvar_77;
|
|
tmpvar_77.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_77.x = xl_retval_60.fog;
|
|
vec4 tmpvar_78;
|
|
tmpvar_78 = tmpvar_77;
|
|
xlv_FOG = tmpvar_78;
|
|
vec4 tmpvar_79;
|
|
tmpvar_79 = xl_retval_60.hip_pack0.xyzw;
|
|
vec4 tmpvar_80;
|
|
tmpvar_80 = tmpvar_79;
|
|
gl_TexCoord[0] = tmpvar_80;
|
|
vec4 tmpvar_81;
|
|
tmpvar_81 = xl_retval_60.hip_screen.xyzw;
|
|
vec4 tmpvar_82;
|
|
tmpvar_82 = tmpvar_81;
|
|
gl_TexCoord[1] = tmpvar_82;
|
|
vec4 tmpvar_83;
|
|
tmpvar_83 = xl_retval_60.TtoW0.xyzw;
|
|
vec4 tmpvar_84;
|
|
tmpvar_84 = tmpvar_83;
|
|
gl_TexCoord[2] = tmpvar_84;
|
|
vec4 tmpvar_85;
|
|
tmpvar_85 = xl_retval_60.TtoW1.xyzw;
|
|
vec4 tmpvar_86;
|
|
tmpvar_86 = tmpvar_85;
|
|
gl_TexCoord[3] = tmpvar_86;
|
|
vec4 tmpvar_87;
|
|
tmpvar_87 = xl_retval_60.TtoW2.xyzw;
|
|
vec4 tmpvar_88;
|
|
tmpvar_88 = tmpvar_87;
|
|
gl_TexCoord[4] = tmpvar_88;
|
|
vec4 tmpvar_89;
|
|
tmpvar_89.w = 0.0;
|
|
tmpvar_89.xyz = xl_retval_60.hip_lmapFade.xyz;
|
|
vec4 tmpvar_90;
|
|
tmpvar_90 = tmpvar_89;
|
|
gl_TexCoord[5] = tmpvar_90;
|
|
}
|
|
|