mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
161 lines
3.4 KiB
Text
161 lines
3.4 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec3 normal;
|
|
vec3 lightDir;
|
|
};
|
|
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 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 WorldSpaceLightDir (
|
|
in vec4 v_9
|
|
)
|
|
{
|
|
vec3 worldPos_10;
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = (_Object2World * v_9).xyz;
|
|
worldPos_10 = tmpvar_11;
|
|
return _WorldSpaceLightPos0.xyz;
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_12,
|
|
out vec4 pos_13,
|
|
out float fog_14
|
|
)
|
|
{
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = (gl_ModelViewProjectionMatrix * v_12);
|
|
pos_13 = tmpvar_15;
|
|
float tmpvar_16;
|
|
tmpvar_16 = pos_13.z;
|
|
fog_14 = tmpvar_16;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_17
|
|
)
|
|
{
|
|
v2f_surf o_18;
|
|
PositionFog (v_17.vertex, o_18.pos, o_18.fog);
|
|
vec2 tmpvar_19;
|
|
tmpvar_19 = ((v_17.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_18.hip_pack0 = tmpvar_19.xy.xy;
|
|
mat3 tmpvar_20;
|
|
tmpvar_20 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = (tmpvar_20 * (v_17.normal * unity_Scale.w));
|
|
o_18.normal = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = WorldSpaceLightDir (v_17.vertex);
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
o_18.lightDir = tmpvar_23;
|
|
return o_18;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_24;
|
|
v2f_surf xl_retval_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
xlt_v_24.vertex = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = TANGENT.xyzw;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
xlt_v_24.tangent = tmpvar_29;
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = gl_Normal.xyz;
|
|
vec3 tmpvar_31;
|
|
tmpvar_31 = tmpvar_30;
|
|
xlt_v_24.normal = tmpvar_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
xlt_v_24.texcoord = tmpvar_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xlt_v_24.texcoord1 = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = gl_Color.xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_v_24.color = tmpvar_37;
|
|
v2f_surf tmpvar_38;
|
|
tmpvar_38 = vert_surf (xlt_v_24);
|
|
v2f_surf tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xl_retval_25 = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = xl_retval_25.pos.xyzw;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
gl_Position = tmpvar_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_42.x = xl_retval_25.fog;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
xlv_FOG = tmpvar_43;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44.zw = vec2(0.0, 0.0);
|
|
tmpvar_44.xy = xl_retval_25.hip_pack0.xy;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
gl_TexCoord[0] = tmpvar_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46.w = 0.0;
|
|
tmpvar_46.xyz = xl_retval_25.normal.xyz;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
gl_TexCoord[1] = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48.w = 0.0;
|
|
tmpvar_48.xyz = xl_retval_25.lightDir.xyz;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
gl_TexCoord[2] = tmpvar_49;
|
|
}
|
|
|