mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
193 lines
4.2 KiB
Text
193 lines
4.2 KiB
Text
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec2 hip_pack0;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec3 viewDir;
|
||
|
vec2 _LightCoord;
|
||
|
};
|
||
|
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;
|
||
|
uniform mat4 _LightMatrix0;
|
||
|
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;
|
||
|
vec2 tmpvar_27;
|
||
|
tmpvar_27 = (_LightMatrix0 * (_Object2World * v_18.vertex)).xy;
|
||
|
o_19._LightCoord = tmpvar_27;
|
||
|
return o_19;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_28;
|
||
|
v2f_surf xl_retval_29;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_30;
|
||
|
xlt_v_28.vertex = tmpvar_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = tmpvar_32;
|
||
|
xlt_v_28.tangent = tmpvar_33;
|
||
|
vec3 tmpvar_34;
|
||
|
tmpvar_34 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = tmpvar_34;
|
||
|
xlt_v_28.normal = tmpvar_35;
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
xlt_v_28.texcoord = tmpvar_37;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
xlt_v_28.texcoord1 = tmpvar_39;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = tmpvar_40;
|
||
|
xlt_v_28.color = tmpvar_41;
|
||
|
v2f_surf tmpvar_42;
|
||
|
tmpvar_42 = vert_surf (xlt_v_28);
|
||
|
v2f_surf tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
xl_retval_29 = tmpvar_43;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = xl_retval_29.pos.xyzw;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = tmpvar_44;
|
||
|
gl_Position = tmpvar_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46.yzw = vec3(0.0, 0.0, 0.0);
|
||
|
tmpvar_46.x = xl_retval_29.fog;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
xlv_FOG = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_48.xy = xl_retval_29.hip_pack0.xy;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
gl_TexCoord[0] = tmpvar_49;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50.w = 0.0;
|
||
|
tmpvar_50.xyz = xl_retval_29.normal.xyz;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
gl_TexCoord[1] = tmpvar_51;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52.w = 0.0;
|
||
|
tmpvar_52.xyz = xl_retval_29.lightDir.xyz;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
gl_TexCoord[2] = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54.w = 0.0;
|
||
|
tmpvar_54.xyz = xl_retval_29.viewDir.xyz;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
gl_TexCoord[3] = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_56.xy = xl_retval_29._LightCoord.xy;
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
gl_TexCoord[4] = tmpvar_57;
|
||
|
}
|
||
|
|