mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
197 lines
4.2 KiB
Text
197 lines
4.2 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec3 worldRefl;
|
|
vec4 hip_screen;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
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 PositionFog (
|
|
in vec4 v_9,
|
|
out vec4 pos_10,
|
|
out float fog_11
|
|
)
|
|
{
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (gl_ModelViewProjectionMatrix * v_9);
|
|
pos_10 = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = pos_10.z;
|
|
fog_11 = tmpvar_13;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v_14
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16.w = 1.0;
|
|
tmpvar_16.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_17;
|
|
tmpvar_17 = ((_World2Object * tmpvar_16).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_15 = tmpvar_17;
|
|
return (objSpaceCameraPos_15 - v_14.xyz);
|
|
}
|
|
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_18
|
|
)
|
|
{
|
|
vec4 o_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = (pos_18 * 0.5);
|
|
o_19 = tmpvar_20;
|
|
vec2 tmpvar_21;
|
|
tmpvar_21.x = o_19.x;
|
|
tmpvar_21.y = (o_19.y * _ProjectionParams.x);
|
|
vec2 tmpvar_22;
|
|
tmpvar_22 = (tmpvar_21 + o_19.w);
|
|
o_19.xy = tmpvar_22.xy.xy;
|
|
vec2 tmpvar_23;
|
|
tmpvar_23 = pos_18.zw;
|
|
o_19.zw = tmpvar_23.xxxy.zw;
|
|
return o_19;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_24
|
|
)
|
|
{
|
|
vec3 viewRefl_25;
|
|
vec3 viewDir_26;
|
|
v2f_surf o_27;
|
|
PositionFog (v_24.vertex, o_27.pos, o_27.fog);
|
|
vec2 tmpvar_28;
|
|
tmpvar_28 = ((v_24.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_27.hip_pack0 = tmpvar_28.xy.xy;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = ObjSpaceViewDir (v_24.vertex);
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = -(tmpvar_29);
|
|
viewDir_26 = tmpvar_30;
|
|
vec3 tmpvar_31;
|
|
tmpvar_31 = reflect (viewDir_26, v_24.normal);
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
viewRefl_25 = tmpvar_32;
|
|
mat3 tmpvar_33;
|
|
tmpvar_33 = xll_constructMat3 (_Object2World);
|
|
vec3 tmpvar_34;
|
|
tmpvar_34 = (tmpvar_33 * viewRefl_25);
|
|
o_27.worldRefl = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = ComputeScreenPos (o_27.pos);
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
o_27.hip_screen = tmpvar_36;
|
|
return o_27;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_37;
|
|
v2f_surf xl_retval_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xlt_v_37.vertex = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = TANGENT.xyzw;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_v_37.tangent = tmpvar_42;
|
|
vec3 tmpvar_43;
|
|
tmpvar_43 = gl_Normal.xyz;
|
|
vec3 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_v_37.normal = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_v_37.texcoord = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_v_37.texcoord1 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = gl_Color.xyzw;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xlt_v_37.color = tmpvar_50;
|
|
v2f_surf tmpvar_51;
|
|
tmpvar_51 = vert_surf (xlt_v_37);
|
|
v2f_surf tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
xl_retval_38 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = xl_retval_38.pos.xyzw;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
gl_Position = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_55.x = xl_retval_38.fog;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
xlv_FOG = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57.zw = vec2(0.0, 0.0);
|
|
tmpvar_57.xy = xl_retval_38.hip_pack0.xy;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
gl_TexCoord[0] = tmpvar_58;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59.w = 0.0;
|
|
tmpvar_59.xyz = xl_retval_38.worldRefl.xyz;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
gl_TexCoord[1] = tmpvar_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = xl_retval_38.hip_screen.xyzw;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
gl_TexCoord[2] = tmpvar_62;
|
|
}
|
|
|