mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
190 lines
4.1 KiB
Text
190 lines
4.1 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec3 worldRefl;
|
|
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 vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _World2Object;
|
|
uniform mat4 _Object2World;
|
|
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;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v_17
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_18;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19.w = 1.0;
|
|
tmpvar_19.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = ((_World2Object * tmpvar_19).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_18 = tmpvar_20;
|
|
return (objSpaceCameraPos_18 - v_17.xyz);
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_21
|
|
)
|
|
{
|
|
vec3 viewRefl_22;
|
|
vec3 viewDir_23;
|
|
v2f_surf o_24;
|
|
PositionFog (v_21.vertex, o_24.pos, o_24.fog);
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = ObjSpaceViewDir (v_21.vertex);
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = -(tmpvar_25);
|
|
viewDir_23 = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = reflect (viewDir_23, v_21.normal);
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = tmpvar_27;
|
|
viewRefl_22 = tmpvar_28;
|
|
mat3 tmpvar_29;
|
|
tmpvar_29 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = (tmpvar_29 * viewRefl_22);
|
|
o_24.worldRefl = tmpvar_30;
|
|
mat3 tmpvar_31;
|
|
tmpvar_31 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = (tmpvar_31 * (v_21.normal * unity_Scale.w));
|
|
o_24.normal = tmpvar_32;
|
|
vec3 tmpvar_33;
|
|
tmpvar_33 = WorldSpaceLightDir (v_21.vertex);
|
|
vec3 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
o_24.lightDir = tmpvar_34;
|
|
return o_24;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_35;
|
|
v2f_surf xl_retval_36;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_v_35.vertex = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = TANGENT.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xlt_v_35.tangent = tmpvar_40;
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = gl_Normal.xyz;
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_v_35.normal = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_v_35.texcoord = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_v_35.texcoord1 = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = gl_Color.xyzw;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_v_35.color = tmpvar_48;
|
|
v2f_surf tmpvar_49;
|
|
tmpvar_49 = vert_surf (xlt_v_35);
|
|
v2f_surf tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xl_retval_36 = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = xl_retval_36.pos.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
gl_Position = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_53.x = xl_retval_36.fog;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
xlv_FOG = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55.w = 0.0;
|
|
tmpvar_55.xyz = xl_retval_36.worldRefl.xyz;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
gl_TexCoord[0] = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57.w = 0.0;
|
|
tmpvar_57.xyz = xl_retval_36.normal.xyz;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
gl_TexCoord[1] = tmpvar_58;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59.w = 0.0;
|
|
tmpvar_59.xyz = xl_retval_36.lightDir.xyz;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
gl_TexCoord[2] = tmpvar_60;
|
|
}
|
|
|