mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
218 lines
4.8 KiB
Text
218 lines
4.8 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec3 normal;
|
|
vec3 vlight;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
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;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_35
|
|
)
|
|
{
|
|
vec3 shlight_36;
|
|
vec3 worldN_37;
|
|
v2f_surf o_38;
|
|
PositionFog (v_35.vertex, o_38.pos, o_38.fog);
|
|
vec2 tmpvar_39;
|
|
tmpvar_39 = ((v_35.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_38.hip_pack0 = tmpvar_39.xy.xy;
|
|
mat3 tmpvar_40;
|
|
tmpvar_40 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = (tmpvar_40 * (v_35.normal * unity_Scale.w));
|
|
worldN_37 = tmpvar_41;
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = worldN_37;
|
|
o_38.normal = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43.w = 1.0;
|
|
tmpvar_43.xyz = worldN_37.xyz;
|
|
vec3 tmpvar_44;
|
|
tmpvar_44 = ShadeSH9 (tmpvar_43);
|
|
vec3 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
shlight_36 = tmpvar_45;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = shlight_36;
|
|
o_38.vlight = tmpvar_46;
|
|
return o_38;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_47;
|
|
v2f_surf xl_retval_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xlt_v_47.vertex = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = TANGENT.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
xlt_v_47.tangent = tmpvar_52;
|
|
vec3 tmpvar_53;
|
|
tmpvar_53 = gl_Normal.xyz;
|
|
vec3 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
xlt_v_47.normal = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
xlt_v_47.texcoord = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
xlt_v_47.texcoord1 = tmpvar_58;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59 = gl_Color.xyzw;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
xlt_v_47.color = tmpvar_60;
|
|
v2f_surf tmpvar_61;
|
|
tmpvar_61 = vert_surf (xlt_v_47);
|
|
v2f_surf tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
xl_retval_48 = tmpvar_62;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63 = xl_retval_48.pos.xyzw;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
gl_Position = tmpvar_64;
|
|
vec4 tmpvar_65;
|
|
tmpvar_65.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_65.x = xl_retval_48.fog;
|
|
vec4 tmpvar_66;
|
|
tmpvar_66 = tmpvar_65;
|
|
xlv_FOG = tmpvar_66;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67.zw = vec2(0.0, 0.0);
|
|
tmpvar_67.xy = xl_retval_48.hip_pack0.xy;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = tmpvar_67;
|
|
gl_TexCoord[0] = tmpvar_68;
|
|
vec4 tmpvar_69;
|
|
tmpvar_69.w = 0.0;
|
|
tmpvar_69.xyz = xl_retval_48.normal.xyz;
|
|
vec4 tmpvar_70;
|
|
tmpvar_70 = tmpvar_69;
|
|
gl_TexCoord[1] = tmpvar_70;
|
|
vec4 tmpvar_71;
|
|
tmpvar_71.w = 0.0;
|
|
tmpvar_71.xyz = xl_retval_48.vlight.xyz;
|
|
vec4 tmpvar_72;
|
|
tmpvar_72 = tmpvar_71;
|
|
gl_TexCoord[2] = tmpvar_72;
|
|
}
|
|
|