mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
306 lines
6.9 KiB
Text
306 lines
6.9 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec3 lightDir;
|
|
vec3 vlight;
|
|
vec4 _ShadowCoord;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _DecalBump_ST;
|
|
uniform vec4 _Decal_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform mat4 _World2Object;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform vec4 unity_SHAb;
|
|
uniform vec4 unity_SHAg;
|
|
uniform vec4 unity_SHAr;
|
|
uniform vec4 unity_SHBb;
|
|
uniform vec4 unity_SHBg;
|
|
uniform vec4 unity_SHBr;
|
|
uniform vec4 unity_SHC;
|
|
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;
|
|
}
|
|
|
|
vec3 ShadeSH9 (
|
|
in vec4 normal_9
|
|
)
|
|
{
|
|
vec3 x3_10;
|
|
float vC_11;
|
|
vec3 x2_12;
|
|
vec4 vB_13;
|
|
vec3 x1_14;
|
|
float tmpvar_15;
|
|
tmpvar_15 = dot (unity_SHAr, normal_9);
|
|
float tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
x1_14.x = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = dot (unity_SHAg, normal_9);
|
|
float tmpvar_18;
|
|
tmpvar_18 = tmpvar_17;
|
|
x1_14.y = vec2(tmpvar_18).y;
|
|
float tmpvar_19;
|
|
tmpvar_19 = dot (unity_SHAb, normal_9);
|
|
float tmpvar_20;
|
|
tmpvar_20 = tmpvar_19;
|
|
x1_14.z = vec3(tmpvar_20).z;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = (normal_9.xyzz * normal_9.yzzx);
|
|
vB_13 = tmpvar_21;
|
|
float tmpvar_22;
|
|
tmpvar_22 = dot (unity_SHBr, vB_13);
|
|
float tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
x2_12.x = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = dot (unity_SHBg, vB_13);
|
|
float tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
x2_12.y = vec2(tmpvar_25).y;
|
|
float tmpvar_26;
|
|
tmpvar_26 = dot (unity_SHBb, vB_13);
|
|
float tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
x2_12.z = vec3(tmpvar_27).z;
|
|
float tmpvar_28;
|
|
tmpvar_28 = ((normal_9.x * normal_9.x) - (normal_9.y * normal_9.y));
|
|
vC_11 = tmpvar_28;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = (unity_SHC.xyz * vC_11);
|
|
x3_10 = tmpvar_29;
|
|
return ((x1_14 + x2_12) + x3_10);
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_30,
|
|
out vec4 pos_31,
|
|
out float fog_32
|
|
)
|
|
{
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = (gl_ModelViewProjectionMatrix * v_30);
|
|
pos_31 = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = pos_31.z;
|
|
fog_32 = tmpvar_34;
|
|
}
|
|
|
|
vec3 ObjSpaceLightDir (
|
|
in vec4 v_35
|
|
)
|
|
{
|
|
vec3 objSpaceLightPos_36;
|
|
vec3 tmpvar_37;
|
|
tmpvar_37 = (_World2Object * _WorldSpaceLightPos0).xyz;
|
|
objSpaceLightPos_36 = tmpvar_37;
|
|
return objSpaceLightPos_36.xyz;
|
|
}
|
|
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_38
|
|
)
|
|
{
|
|
vec4 o_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = (pos_38 * 0.5);
|
|
o_39 = tmpvar_40;
|
|
vec2 tmpvar_41;
|
|
tmpvar_41.x = o_39.x;
|
|
tmpvar_41.y = (o_39.y * _ProjectionParams.x);
|
|
vec2 tmpvar_42;
|
|
tmpvar_42 = (tmpvar_41 + o_39.w);
|
|
o_39.xy = tmpvar_42.xy.xy;
|
|
vec2 tmpvar_43;
|
|
tmpvar_43 = pos_38.zw;
|
|
o_39.zw = tmpvar_43.xxxy.zw;
|
|
return o_39;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_44
|
|
)
|
|
{
|
|
vec3 shlight_45;
|
|
mat3 rotation_46;
|
|
vec3 binormal_47;
|
|
vec3 worldN_48;
|
|
v2f_surf o_49;
|
|
PositionFog (v_44.vertex, o_49.pos, o_49.fog);
|
|
vec2 tmpvar_50;
|
|
tmpvar_50 = ((v_44.texcoord.xy * _Decal_ST.xy) + _Decal_ST.zw);
|
|
o_49.hip_pack0.xy = tmpvar_50.xy.xy;
|
|
vec2 tmpvar_51;
|
|
tmpvar_51 = ((v_44.texcoord.xy * _DecalBump_ST.xy) + _DecalBump_ST.zw);
|
|
o_49.hip_pack0.zw = tmpvar_51.xxxy.zw;
|
|
mat3 tmpvar_52;
|
|
tmpvar_52 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_53;
|
|
tmpvar_53 = (tmpvar_52 * (v_44.normal * unity_Scale.w));
|
|
worldN_48 = tmpvar_53;
|
|
vec3 tmpvar_54;
|
|
tmpvar_54 = cross (v_44.normal, v_44.tangent.xyz);
|
|
vec3 tmpvar_55;
|
|
tmpvar_55 = (tmpvar_54 * v_44.tangent.w);
|
|
binormal_47 = tmpvar_55;
|
|
mat3 tmpvar_56;
|
|
float tmpvar_57;
|
|
tmpvar_57 = v_44.tangent.x;
|
|
tmpvar_56[0].x = tmpvar_57;
|
|
float tmpvar_58;
|
|
tmpvar_58 = binormal_47.x;
|
|
tmpvar_56[0].y = tmpvar_58;
|
|
float tmpvar_59;
|
|
tmpvar_59 = v_44.normal.x;
|
|
tmpvar_56[0].z = tmpvar_59;
|
|
float tmpvar_60;
|
|
tmpvar_60 = v_44.tangent.y;
|
|
tmpvar_56[1].x = tmpvar_60;
|
|
float tmpvar_61;
|
|
tmpvar_61 = binormal_47.y;
|
|
tmpvar_56[1].y = tmpvar_61;
|
|
float tmpvar_62;
|
|
tmpvar_62 = v_44.normal.y;
|
|
tmpvar_56[1].z = tmpvar_62;
|
|
float tmpvar_63;
|
|
tmpvar_63 = v_44.tangent.z;
|
|
tmpvar_56[2].x = tmpvar_63;
|
|
float tmpvar_64;
|
|
tmpvar_64 = binormal_47.z;
|
|
tmpvar_56[2].y = tmpvar_64;
|
|
float tmpvar_65;
|
|
tmpvar_65 = v_44.normal.z;
|
|
tmpvar_56[2].z = tmpvar_65;
|
|
mat3 tmpvar_66;
|
|
tmpvar_66 = tmpvar_56;
|
|
rotation_46 = tmpvar_66;
|
|
vec3 tmpvar_67;
|
|
tmpvar_67 = ObjSpaceLightDir (v_44.vertex);
|
|
vec3 tmpvar_68;
|
|
tmpvar_68 = (rotation_46 * tmpvar_67);
|
|
o_49.lightDir = tmpvar_68;
|
|
vec4 tmpvar_69;
|
|
tmpvar_69.w = 1.0;
|
|
tmpvar_69.xyz = worldN_48.xyz;
|
|
vec3 tmpvar_70;
|
|
tmpvar_70 = ShadeSH9 (tmpvar_69);
|
|
vec3 tmpvar_71;
|
|
tmpvar_71 = tmpvar_70;
|
|
shlight_45 = tmpvar_71;
|
|
vec3 tmpvar_72;
|
|
tmpvar_72 = shlight_45;
|
|
o_49.vlight = tmpvar_72;
|
|
vec4 tmpvar_73;
|
|
tmpvar_73 = ComputeScreenPos (o_49.pos);
|
|
vec4 tmpvar_74;
|
|
tmpvar_74 = tmpvar_73;
|
|
o_49._ShadowCoord = tmpvar_74;
|
|
return o_49;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_75;
|
|
v2f_surf xl_retval_76;
|
|
vec4 tmpvar_77;
|
|
tmpvar_77 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_78;
|
|
tmpvar_78 = tmpvar_77;
|
|
xlt_v_75.vertex = tmpvar_78;
|
|
vec4 tmpvar_79;
|
|
tmpvar_79 = TANGENT.xyzw;
|
|
vec4 tmpvar_80;
|
|
tmpvar_80 = tmpvar_79;
|
|
xlt_v_75.tangent = tmpvar_80;
|
|
vec3 tmpvar_81;
|
|
tmpvar_81 = gl_Normal.xyz;
|
|
vec3 tmpvar_82;
|
|
tmpvar_82 = tmpvar_81;
|
|
xlt_v_75.normal = tmpvar_82;
|
|
vec4 tmpvar_83;
|
|
tmpvar_83 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_84;
|
|
tmpvar_84 = tmpvar_83;
|
|
xlt_v_75.texcoord = tmpvar_84;
|
|
vec4 tmpvar_85;
|
|
tmpvar_85 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_86;
|
|
tmpvar_86 = tmpvar_85;
|
|
xlt_v_75.texcoord1 = tmpvar_86;
|
|
vec4 tmpvar_87;
|
|
tmpvar_87 = gl_Color.xyzw;
|
|
vec4 tmpvar_88;
|
|
tmpvar_88 = tmpvar_87;
|
|
xlt_v_75.color = tmpvar_88;
|
|
v2f_surf tmpvar_89;
|
|
tmpvar_89 = vert_surf (xlt_v_75);
|
|
v2f_surf tmpvar_90;
|
|
tmpvar_90 = tmpvar_89;
|
|
xl_retval_76 = tmpvar_90;
|
|
vec4 tmpvar_91;
|
|
tmpvar_91 = xl_retval_76.pos.xyzw;
|
|
vec4 tmpvar_92;
|
|
tmpvar_92 = tmpvar_91;
|
|
gl_Position = tmpvar_92;
|
|
vec4 tmpvar_93;
|
|
tmpvar_93.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_93.x = xl_retval_76.fog;
|
|
vec4 tmpvar_94;
|
|
tmpvar_94 = tmpvar_93;
|
|
xlv_FOG = tmpvar_94;
|
|
vec4 tmpvar_95;
|
|
tmpvar_95 = xl_retval_76.hip_pack0.xyzw;
|
|
vec4 tmpvar_96;
|
|
tmpvar_96 = tmpvar_95;
|
|
gl_TexCoord[0] = tmpvar_96;
|
|
vec4 tmpvar_97;
|
|
tmpvar_97.w = 0.0;
|
|
tmpvar_97.xyz = xl_retval_76.lightDir.xyz;
|
|
vec4 tmpvar_98;
|
|
tmpvar_98 = tmpvar_97;
|
|
gl_TexCoord[1] = tmpvar_98;
|
|
vec4 tmpvar_99;
|
|
tmpvar_99.w = 0.0;
|
|
tmpvar_99.xyz = xl_retval_76.vlight.xyz;
|
|
vec4 tmpvar_100;
|
|
tmpvar_100 = tmpvar_99;
|
|
gl_TexCoord[2] = tmpvar_100;
|
|
vec4 tmpvar_101;
|
|
tmpvar_101 = xl_retval_76._ShadowCoord.xyzw;
|
|
vec4 tmpvar_102;
|
|
tmpvar_102 = tmpvar_101;
|
|
gl_TexCoord[3] = tmpvar_102;
|
|
}
|
|
|