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