mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
224 lines
5.3 KiB
Text
224 lines
5.3 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec3 viewDir;
|
|
vec4 hip_screen;
|
|
vec3 normal;
|
|
vec3 hip_lmapFade;
|
|
};
|
|
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 unity_LightmapST;
|
|
uniform vec4 unity_LightmapFade;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _World2Object;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform vec4 _MainTex_ST;
|
|
void PositionFog (
|
|
in vec4 v_1,
|
|
out vec4 pos_2,
|
|
out float fog_3
|
|
)
|
|
{
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = (gl_ModelViewProjectionMatrix * v_1);
|
|
pos_2 = tmpvar_4;
|
|
float tmpvar_5;
|
|
tmpvar_5 = pos_2.z;
|
|
fog_3 = tmpvar_5;
|
|
}
|
|
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v_6
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8.w = 1.0;
|
|
tmpvar_8.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = ((_World2Object * tmpvar_8).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_7 = tmpvar_9;
|
|
return (objSpaceCameraPos_7 - v_6.xyz);
|
|
}
|
|
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_10
|
|
)
|
|
{
|
|
vec4 o_11;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (pos_10 * 0.5);
|
|
o_11 = tmpvar_12;
|
|
vec2 tmpvar_13;
|
|
tmpvar_13.x = o_11.x;
|
|
tmpvar_13.y = (o_11.y * _ProjectionParams.x);
|
|
vec2 tmpvar_14;
|
|
tmpvar_14 = (tmpvar_13 + o_11.w);
|
|
o_11.xy = tmpvar_14.xy.xy;
|
|
vec2 tmpvar_15;
|
|
tmpvar_15 = pos_10.zw;
|
|
o_11.zw = tmpvar_15.xxxy.zw;
|
|
return o_11;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_16
|
|
)
|
|
{
|
|
mat3 rotation_17;
|
|
vec3 binormal_18;
|
|
v2f_surf o_19;
|
|
PositionFog (v_16.vertex, o_19.pos, o_19.fog);
|
|
vec2 tmpvar_20;
|
|
tmpvar_20 = ((v_16.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_19.hip_pack0 = tmpvar_20.xy.xy;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = ComputeScreenPos (o_19.pos);
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
o_19.hip_screen = tmpvar_22;
|
|
vec2 tmpvar_23;
|
|
tmpvar_23 = ((v_16.texcoord1.xy * unity_LightmapST.xy) + unity_LightmapST.zw);
|
|
o_19.hip_lmapFade.xy = tmpvar_23.xy.xy;
|
|
float tmpvar_24;
|
|
tmpvar_24 = ((-((gl_ModelViewMatrix * v_16.vertex).z) * unity_LightmapFade.z) + unity_LightmapFade.w);
|
|
o_19.hip_lmapFade.z = vec3(tmpvar_24).z;
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = cross (v_16.normal, v_16.tangent.xyz);
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = (tmpvar_25 * v_16.tangent.w);
|
|
binormal_18 = tmpvar_26;
|
|
mat3 tmpvar_27;
|
|
float tmpvar_28;
|
|
tmpvar_28 = v_16.tangent.x;
|
|
tmpvar_27[0].x = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = binormal_18.x;
|
|
tmpvar_27[0].y = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = v_16.normal.x;
|
|
tmpvar_27[0].z = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = v_16.tangent.y;
|
|
tmpvar_27[1].x = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = binormal_18.y;
|
|
tmpvar_27[1].y = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = v_16.normal.y;
|
|
tmpvar_27[1].z = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = v_16.tangent.z;
|
|
tmpvar_27[2].x = tmpvar_34;
|
|
float tmpvar_35;
|
|
tmpvar_35 = binormal_18.z;
|
|
tmpvar_27[2].y = tmpvar_35;
|
|
float tmpvar_36;
|
|
tmpvar_36 = v_16.normal.z;
|
|
tmpvar_27[2].z = tmpvar_36;
|
|
mat3 tmpvar_37;
|
|
tmpvar_37 = (tmpvar_27);
|
|
rotation_17 = (tmpvar_37);
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = (rotation_17 * (v_16.normal * unity_Scale.w));
|
|
o_19.normal = tmpvar_38;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = ObjSpaceViewDir (v_16.vertex);
|
|
vec3 tmpvar_40;
|
|
tmpvar_40 = (rotation_17 * tmpvar_39);
|
|
o_19.viewDir = tmpvar_40;
|
|
return o_19;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_41;
|
|
v2f_surf xl_retval_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_v_41.vertex = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = TANGENT.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_v_41.tangent = tmpvar_46;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = gl_Normal.xyz;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_v_41.normal = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xlt_v_41.texcoord = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
xlt_v_41.texcoord1 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = gl_Color.xyzw;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
xlt_v_41.color = tmpvar_54;
|
|
v2f_surf tmpvar_55;
|
|
tmpvar_55 = vert_surf (xlt_v_41);
|
|
v2f_surf tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
xl_retval_42 = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = xl_retval_42.pos.xyzw;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
gl_Position = tmpvar_58;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_59.x = xl_retval_42.fog;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
xlv_FOG = tmpvar_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61.zw = vec2(0.0, 0.0);
|
|
tmpvar_61.xy = xl_retval_42.hip_pack0.xy;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
gl_TexCoord[0] = tmpvar_62;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63.w = 0.0;
|
|
tmpvar_63.xyz = xl_retval_42.viewDir.xyz;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
gl_TexCoord[1] = tmpvar_64;
|
|
vec4 tmpvar_65;
|
|
tmpvar_65 = xl_retval_42.hip_screen.xyzw;
|
|
vec4 tmpvar_66;
|
|
tmpvar_66 = tmpvar_65;
|
|
gl_TexCoord[2] = tmpvar_66;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67.w = 0.0;
|
|
tmpvar_67.xyz = xl_retval_42.normal.xyz;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = tmpvar_67;
|
|
gl_TexCoord[3] = tmpvar_68;
|
|
vec4 tmpvar_69;
|
|
tmpvar_69.w = 0.0;
|
|
tmpvar_69.xyz = xl_retval_42.hip_lmapFade.xyz;
|
|
vec4 tmpvar_70;
|
|
tmpvar_70 = tmpvar_69;
|
|
gl_TexCoord[4] = tmpvar_70;
|
|
}
|
|
|