mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
186 lines
3.9 KiB
Text
186 lines
3.9 KiB
Text
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
struct Input {
|
|
vec3 foo;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec3 cust_foo;
|
|
vec3 normal;
|
|
vec3 lightDir;
|
|
vec2 _LightCoord;
|
|
};
|
|
uniform mat4 _LightMatrix0;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
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;
|
|
}
|
|
|
|
void vert (
|
|
inout appdata_full v_9,
|
|
out Input o_10
|
|
)
|
|
{
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = ((v_9.normal * 0.5) + 0.5);
|
|
o_10.foo = tmpvar_11;
|
|
}
|
|
|
|
vec3 WorldSpaceLightDir (
|
|
in vec4 v_12
|
|
)
|
|
{
|
|
vec3 worldPos_13;
|
|
vec3 tmpvar_14;
|
|
tmpvar_14 = (_Object2World * v_12).xyz;
|
|
worldPos_13 = tmpvar_14;
|
|
return _WorldSpaceLightPos0.xyz;
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_15,
|
|
out vec4 pos_16,
|
|
out float fog_17
|
|
)
|
|
{
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = (gl_ModelViewProjectionMatrix * v_15);
|
|
pos_16 = tmpvar_18;
|
|
float tmpvar_19;
|
|
tmpvar_19 = pos_16.z;
|
|
fog_17 = tmpvar_19;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_20
|
|
)
|
|
{
|
|
v2f_surf o_21;
|
|
Input customInputData_22;
|
|
vert (v_20, customInputData_22);
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = customInputData_22.foo;
|
|
o_21.cust_foo = tmpvar_23;
|
|
PositionFog (v_20.vertex, o_21.pos, o_21.fog);
|
|
mat3 tmpvar_24;
|
|
tmpvar_24 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = (tmpvar_24 * (v_20.normal * unity_Scale.w));
|
|
o_21.normal = tmpvar_25;
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = WorldSpaceLightDir (v_20.vertex);
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
o_21.lightDir = tmpvar_27;
|
|
vec2 tmpvar_28;
|
|
tmpvar_28 = (_LightMatrix0 * (_Object2World * v_20.vertex)).xy;
|
|
o_21._LightCoord = tmpvar_28;
|
|
return o_21;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_29;
|
|
v2f_surf xl_retval_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
xlt_v_29.vertex = tmpvar_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = TANGENT.xyzw;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
xlt_v_29.tangent = tmpvar_34;
|
|
vec3 tmpvar_35;
|
|
tmpvar_35 = gl_Normal.xyz;
|
|
vec3 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xlt_v_29.normal = tmpvar_36;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_v_29.texcoord = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xlt_v_29.texcoord1 = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = gl_Color.xyzw;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_v_29.color = tmpvar_42;
|
|
v2f_surf tmpvar_43;
|
|
tmpvar_43 = vert_surf (xlt_v_29);
|
|
v2f_surf tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xl_retval_30 = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = xl_retval_30.pos.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
gl_Position = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_47.x = xl_retval_30.fog;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlv_FOG = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49.w = 0.0;
|
|
tmpvar_49.xyz = xl_retval_30.cust_foo.xyz;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
gl_TexCoord[0] = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51.w = 0.0;
|
|
tmpvar_51.xyz = xl_retval_30.normal.xyz;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
gl_TexCoord[1] = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53.w = 0.0;
|
|
tmpvar_53.xyz = xl_retval_30.lightDir.xyz;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
gl_TexCoord[2] = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55.zw = vec2(0.0, 0.0);
|
|
tmpvar_55.xy = xl_retval_30._LightCoord.xy;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
gl_TexCoord[3] = tmpvar_56;
|
|
}
|
|
|