mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
182 lines
3.8 KiB
Text
182 lines
3.8 KiB
Text
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec2 hip_pack0;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec3 viewDir;
|
||
|
};
|
||
|
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 _WorldSpaceLightPos0;
|
||
|
uniform vec3 _WorldSpaceCameraPos;
|
||
|
uniform mat4 _Object2World;
|
||
|
uniform vec4 _MainTex_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 WorldSpaceViewDir (
|
||
|
in vec4 v_9
|
||
|
)
|
||
|
{
|
||
|
return (_WorldSpaceCameraPos.xyz - (_Object2World * v_9).xyz);
|
||
|
}
|
||
|
|
||
|
vec3 WorldSpaceLightDir (
|
||
|
in vec4 v_10
|
||
|
)
|
||
|
{
|
||
|
vec3 worldPos_11;
|
||
|
vec3 tmpvar_12;
|
||
|
tmpvar_12 = (_Object2World * v_10).xyz;
|
||
|
worldPos_11 = tmpvar_12;
|
||
|
return _WorldSpaceLightPos0.xyz;
|
||
|
}
|
||
|
|
||
|
void PositionFog (
|
||
|
in vec4 v_13,
|
||
|
out vec4 pos_14,
|
||
|
out float fog_15
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_16;
|
||
|
tmpvar_16 = (gl_ModelViewProjectionMatrix * v_13);
|
||
|
pos_14 = tmpvar_16;
|
||
|
float tmpvar_17;
|
||
|
tmpvar_17 = pos_14.z;
|
||
|
fog_15 = tmpvar_17;
|
||
|
}
|
||
|
|
||
|
v2f_surf vert_surf (
|
||
|
in appdata_full v_18
|
||
|
)
|
||
|
{
|
||
|
v2f_surf o_19;
|
||
|
PositionFog (v_18.vertex, o_19.pos, o_19.fog);
|
||
|
vec2 tmpvar_20;
|
||
|
tmpvar_20 = ((v_18.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
||
|
o_19.hip_pack0 = tmpvar_20.xy.xy;
|
||
|
mat3 tmpvar_21;
|
||
|
tmpvar_21 = xll_constructMat3 (_Object2World);
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = (tmpvar_21 * (v_18.normal * unity_Scale.w));
|
||
|
o_19.normal = tmpvar_22;
|
||
|
vec3 tmpvar_23;
|
||
|
tmpvar_23 = WorldSpaceLightDir (v_18.vertex);
|
||
|
vec3 tmpvar_24;
|
||
|
tmpvar_24 = tmpvar_23;
|
||
|
o_19.lightDir = tmpvar_24;
|
||
|
vec3 tmpvar_25;
|
||
|
tmpvar_25 = WorldSpaceViewDir (v_18.vertex);
|
||
|
vec3 tmpvar_26;
|
||
|
tmpvar_26 = tmpvar_25;
|
||
|
o_19.viewDir = tmpvar_26;
|
||
|
return o_19;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_27;
|
||
|
v2f_surf xl_retval_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
xlt_v_27.vertex = tmpvar_30;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_31;
|
||
|
xlt_v_27.tangent = tmpvar_32;
|
||
|
vec3 tmpvar_33;
|
||
|
tmpvar_33 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_34;
|
||
|
tmpvar_34 = tmpvar_33;
|
||
|
xlt_v_27.normal = tmpvar_34;
|
||
|
vec4 tmpvar_35;
|
||
|
tmpvar_35 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_v_27.texcoord = tmpvar_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_v_27.texcoord1 = tmpvar_38;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_v_27.color = tmpvar_40;
|
||
|
v2f_surf tmpvar_41;
|
||
|
tmpvar_41 = vert_surf (xlt_v_27);
|
||
|
v2f_surf tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xl_retval_28 = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = xl_retval_28.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_28.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_28.hip_pack0.xy;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = tmpvar_47;
|
||
|
gl_TexCoord[0] = tmpvar_48;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49.w = 0.0;
|
||
|
tmpvar_49.xyz = xl_retval_28.normal.xyz;
|
||
|
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_28.lightDir.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_28.viewDir.xyz;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
gl_TexCoord[3] = tmpvar_54;
|
||
|
}
|
||
|
|