mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
173 lines
3.7 KiB
Text
173 lines
3.7 KiB
Text
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec2 hip_pack0;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec3 _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 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 WorldSpaceLightDir (
|
||
|
in vec4 v_9
|
||
|
)
|
||
|
{
|
||
|
vec3 worldPos_10;
|
||
|
vec3 tmpvar_11;
|
||
|
tmpvar_11 = (_Object2World * v_9).xyz;
|
||
|
worldPos_10 = tmpvar_11;
|
||
|
return (_WorldSpaceLightPos0.xyz - worldPos_10);
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
vec3 tmpvar_24;
|
||
|
tmpvar_24 = (_LightMatrix0 * (_Object2World * v_17.vertex)).xyz;
|
||
|
o_18._LightCoord = tmpvar_24;
|
||
|
return o_18;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_25;
|
||
|
v2f_surf xl_retval_26;
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = tmpvar_27;
|
||
|
xlt_v_25.vertex = tmpvar_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
xlt_v_25.tangent = tmpvar_30;
|
||
|
vec3 tmpvar_31;
|
||
|
tmpvar_31 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_31;
|
||
|
xlt_v_25.normal = tmpvar_32;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_34;
|
||
|
tmpvar_34 = tmpvar_33;
|
||
|
xlt_v_25.texcoord = tmpvar_34;
|
||
|
vec4 tmpvar_35;
|
||
|
tmpvar_35 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_v_25.texcoord1 = tmpvar_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_v_25.color = tmpvar_38;
|
||
|
v2f_surf tmpvar_39;
|
||
|
tmpvar_39 = vert_surf (xlt_v_25);
|
||
|
v2f_surf tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xl_retval_26 = tmpvar_40;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = xl_retval_26.pos.xyzw;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
gl_Position = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43.yzw = vec3(0.0, 0.0, 0.0);
|
||
|
tmpvar_43.x = xl_retval_26.fog;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
xlv_FOG = tmpvar_44;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_45.xy = xl_retval_26.hip_pack0.xy;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = tmpvar_45;
|
||
|
gl_TexCoord[0] = tmpvar_46;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47.w = 0.0;
|
||
|
tmpvar_47.xyz = xl_retval_26.normal.xyz;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = tmpvar_47;
|
||
|
gl_TexCoord[1] = tmpvar_48;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49.w = 0.0;
|
||
|
tmpvar_49.xyz = xl_retval_26.lightDir.xyz;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = tmpvar_49;
|
||
|
gl_TexCoord[2] = tmpvar_50;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51.w = 0.0;
|
||
|
tmpvar_51.xyz = xl_retval_26._LightCoord.xyz;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = tmpvar_51;
|
||
|
gl_TexCoord[3] = tmpvar_52;
|
||
|
}
|
||
|
|