mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
302 lines
6.9 KiB
Text
302 lines
6.9 KiB
Text
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec4 hip_pack0;
|
||
|
vec3 viewDir;
|
||
|
vec3 lightDir;
|
||
|
vec3 vlight;
|
||
|
};
|
||
|
struct appdata_full {
|
||
|
vec4 vertex;
|
||
|
vec4 tangent;
|
||
|
vec3 normal;
|
||
|
vec4 texcoord;
|
||
|
vec4 texcoord1;
|
||
|
vec4 color;
|
||
|
};
|
||
|
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 vec4 _WorldSpaceLightPos0;
|
||
|
uniform vec3 _WorldSpaceCameraPos;
|
||
|
uniform mat4 _World2Object;
|
||
|
uniform mat4 _Object2World;
|
||
|
uniform vec4 _MainTex_ST;
|
||
|
uniform vec4 _BumpMap_ST;
|
||
|
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 ObjSpaceViewDir (
|
||
|
in vec4 v_35
|
||
|
)
|
||
|
{
|
||
|
vec3 objSpaceCameraPos_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37.w = 1.0;
|
||
|
tmpvar_37.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = ((_World2Object * tmpvar_37).xyz * unity_Scale.w);
|
||
|
objSpaceCameraPos_36 = tmpvar_38;
|
||
|
return (objSpaceCameraPos_36 - v_35.xyz);
|
||
|
}
|
||
|
|
||
|
vec3 ObjSpaceLightDir (
|
||
|
in vec4 v_39
|
||
|
)
|
||
|
{
|
||
|
vec3 objSpaceLightPos_40;
|
||
|
vec3 tmpvar_41;
|
||
|
tmpvar_41 = (_World2Object * _WorldSpaceLightPos0).xyz;
|
||
|
objSpaceLightPos_40 = tmpvar_41;
|
||
|
return objSpaceLightPos_40.xyz;
|
||
|
}
|
||
|
|
||
|
v2f_surf vert_surf (
|
||
|
in appdata_full v_42
|
||
|
)
|
||
|
{
|
||
|
vec3 shlight_43;
|
||
|
mat3 rotation_44;
|
||
|
vec3 binormal_45;
|
||
|
vec3 worldN_46;
|
||
|
v2f_surf o_47;
|
||
|
PositionFog (v_42.vertex, o_47.pos, o_47.fog);
|
||
|
vec2 tmpvar_48;
|
||
|
tmpvar_48 = ((v_42.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
||
|
o_47.hip_pack0.xy = tmpvar_48.xy.xy;
|
||
|
vec2 tmpvar_49;
|
||
|
tmpvar_49 = ((v_42.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
||
|
o_47.hip_pack0.zw = tmpvar_49.xxxy.zw;
|
||
|
mat3 tmpvar_50;
|
||
|
tmpvar_50 = xll_constructMat3 (_Object2World);
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = (tmpvar_50 * (v_42.normal * unity_Scale.w));
|
||
|
worldN_46 = tmpvar_51;
|
||
|
vec3 tmpvar_52;
|
||
|
tmpvar_52 = cross (v_42.normal, v_42.tangent.xyz);
|
||
|
vec3 tmpvar_53;
|
||
|
tmpvar_53 = (tmpvar_52 * v_42.tangent.w);
|
||
|
binormal_45 = tmpvar_53;
|
||
|
mat3 tmpvar_54;
|
||
|
float tmpvar_55;
|
||
|
tmpvar_55 = v_42.tangent.x;
|
||
|
tmpvar_54[0].x = tmpvar_55;
|
||
|
float tmpvar_56;
|
||
|
tmpvar_56 = binormal_45.x;
|
||
|
tmpvar_54[0].y = tmpvar_56;
|
||
|
float tmpvar_57;
|
||
|
tmpvar_57 = v_42.normal.x;
|
||
|
tmpvar_54[0].z = tmpvar_57;
|
||
|
float tmpvar_58;
|
||
|
tmpvar_58 = v_42.tangent.y;
|
||
|
tmpvar_54[1].x = tmpvar_58;
|
||
|
float tmpvar_59;
|
||
|
tmpvar_59 = binormal_45.y;
|
||
|
tmpvar_54[1].y = tmpvar_59;
|
||
|
float tmpvar_60;
|
||
|
tmpvar_60 = v_42.normal.y;
|
||
|
tmpvar_54[1].z = tmpvar_60;
|
||
|
float tmpvar_61;
|
||
|
tmpvar_61 = v_42.tangent.z;
|
||
|
tmpvar_54[2].x = tmpvar_61;
|
||
|
float tmpvar_62;
|
||
|
tmpvar_62 = binormal_45.z;
|
||
|
tmpvar_54[2].y = tmpvar_62;
|
||
|
float tmpvar_63;
|
||
|
tmpvar_63 = v_42.normal.z;
|
||
|
tmpvar_54[2].z = tmpvar_63;
|
||
|
mat3 tmpvar_64;
|
||
|
tmpvar_64 = (tmpvar_54);
|
||
|
rotation_44 = (tmpvar_64);
|
||
|
vec3 tmpvar_65;
|
||
|
tmpvar_65 = ObjSpaceLightDir (v_42.vertex);
|
||
|
vec3 tmpvar_66;
|
||
|
tmpvar_66 = (rotation_44 * tmpvar_65);
|
||
|
o_47.lightDir = tmpvar_66;
|
||
|
vec3 tmpvar_67;
|
||
|
tmpvar_67 = ObjSpaceViewDir (v_42.vertex);
|
||
|
vec3 tmpvar_68;
|
||
|
tmpvar_68 = (rotation_44 * tmpvar_67);
|
||
|
o_47.viewDir = tmpvar_68;
|
||
|
vec4 tmpvar_69;
|
||
|
tmpvar_69.w = 1.0;
|
||
|
tmpvar_69.xyz = worldN_46.xyz;
|
||
|
vec3 tmpvar_70;
|
||
|
tmpvar_70 = ShadeSH9 (tmpvar_69);
|
||
|
vec3 tmpvar_71;
|
||
|
tmpvar_71 = tmpvar_70;
|
||
|
shlight_43 = tmpvar_71;
|
||
|
vec3 tmpvar_72;
|
||
|
tmpvar_72 = shlight_43;
|
||
|
o_47.vlight = tmpvar_72;
|
||
|
return o_47;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_73;
|
||
|
v2f_surf xl_retval_74;
|
||
|
vec4 tmpvar_75;
|
||
|
tmpvar_75 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_76;
|
||
|
tmpvar_76 = tmpvar_75;
|
||
|
xlt_v_73.vertex = tmpvar_76;
|
||
|
vec4 tmpvar_77;
|
||
|
tmpvar_77 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_78;
|
||
|
tmpvar_78 = tmpvar_77;
|
||
|
xlt_v_73.tangent = tmpvar_78;
|
||
|
vec3 tmpvar_79;
|
||
|
tmpvar_79 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_80;
|
||
|
tmpvar_80 = tmpvar_79;
|
||
|
xlt_v_73.normal = tmpvar_80;
|
||
|
vec4 tmpvar_81;
|
||
|
tmpvar_81 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_82;
|
||
|
tmpvar_82 = tmpvar_81;
|
||
|
xlt_v_73.texcoord = tmpvar_82;
|
||
|
vec4 tmpvar_83;
|
||
|
tmpvar_83 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_84;
|
||
|
tmpvar_84 = tmpvar_83;
|
||
|
xlt_v_73.texcoord1 = tmpvar_84;
|
||
|
vec4 tmpvar_85;
|
||
|
tmpvar_85 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_86;
|
||
|
tmpvar_86 = tmpvar_85;
|
||
|
xlt_v_73.color = tmpvar_86;
|
||
|
v2f_surf tmpvar_87;
|
||
|
tmpvar_87 = vert_surf (xlt_v_73);
|
||
|
v2f_surf tmpvar_88;
|
||
|
tmpvar_88 = tmpvar_87;
|
||
|
xl_retval_74 = tmpvar_88;
|
||
|
vec4 tmpvar_89;
|
||
|
tmpvar_89 = xl_retval_74.pos.xyzw;
|
||
|
vec4 tmpvar_90;
|
||
|
tmpvar_90 = tmpvar_89;
|
||
|
gl_Position = tmpvar_90;
|
||
|
vec4 tmpvar_91;
|
||
|
tmpvar_91.yzw = vec3(0.0, 0.0, 0.0);
|
||
|
tmpvar_91.x = xl_retval_74.fog;
|
||
|
vec4 tmpvar_92;
|
||
|
tmpvar_92 = tmpvar_91;
|
||
|
xlv_FOG = tmpvar_92;
|
||
|
vec4 tmpvar_93;
|
||
|
tmpvar_93 = xl_retval_74.hip_pack0.xyzw;
|
||
|
vec4 tmpvar_94;
|
||
|
tmpvar_94 = tmpvar_93;
|
||
|
gl_TexCoord[0] = tmpvar_94;
|
||
|
vec4 tmpvar_95;
|
||
|
tmpvar_95.w = 0.0;
|
||
|
tmpvar_95.xyz = xl_retval_74.viewDir.xyz;
|
||
|
vec4 tmpvar_96;
|
||
|
tmpvar_96 = tmpvar_95;
|
||
|
gl_TexCoord[1] = tmpvar_96;
|
||
|
vec4 tmpvar_97;
|
||
|
tmpvar_97.w = 0.0;
|
||
|
tmpvar_97.xyz = xl_retval_74.lightDir.xyz;
|
||
|
vec4 tmpvar_98;
|
||
|
tmpvar_98 = tmpvar_97;
|
||
|
gl_TexCoord[2] = tmpvar_98;
|
||
|
vec4 tmpvar_99;
|
||
|
tmpvar_99.w = 0.0;
|
||
|
tmpvar_99.xyz = xl_retval_74.vlight.xyz;
|
||
|
vec4 tmpvar_100;
|
||
|
tmpvar_100 = tmpvar_99;
|
||
|
gl_TexCoord[3] = tmpvar_100;
|
||
|
}
|
||
|
|