mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
206 lines
4.8 KiB
Text
206 lines
4.8 KiB
Text
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec3 lightDir;
|
|
vec3 viewDir;
|
|
vec3 _LightCoord;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _BumpMap_ST;
|
|
uniform mat4 _LightMatrix0;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
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);
|
|
}
|
|
|
|
vec3 ObjSpaceLightDir (
|
|
in vec4 v_10
|
|
)
|
|
{
|
|
vec3 objSpaceLightPos_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = (_World2Object * _WorldSpaceLightPos0).xyz;
|
|
objSpaceLightPos_11 = tmpvar_12;
|
|
return ((objSpaceLightPos_11.xyz * unity_Scale.w) - v_10.xyz);
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_13
|
|
)
|
|
{
|
|
mat3 rotation_14;
|
|
vec3 binormal_15;
|
|
v2f_surf o_16;
|
|
PositionFog (v_13.vertex, o_16.pos, o_16.fog);
|
|
vec2 tmpvar_17;
|
|
tmpvar_17 = ((v_13.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_16.hip_pack0.xy = tmpvar_17.xy.xy;
|
|
vec2 tmpvar_18;
|
|
tmpvar_18 = ((v_13.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
|
o_16.hip_pack0.zw = tmpvar_18.xxxy.zw;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = cross (v_13.normal, v_13.tangent.xyz);
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = (tmpvar_19 * v_13.tangent.w);
|
|
binormal_15 = tmpvar_20;
|
|
mat3 tmpvar_21;
|
|
float tmpvar_22;
|
|
tmpvar_22 = v_13.tangent.x;
|
|
tmpvar_21[0].x = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = binormal_15.x;
|
|
tmpvar_21[0].y = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = v_13.normal.x;
|
|
tmpvar_21[0].z = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = v_13.tangent.y;
|
|
tmpvar_21[1].x = tmpvar_25;
|
|
float tmpvar_26;
|
|
tmpvar_26 = binormal_15.y;
|
|
tmpvar_21[1].y = tmpvar_26;
|
|
float tmpvar_27;
|
|
tmpvar_27 = v_13.normal.y;
|
|
tmpvar_21[1].z = tmpvar_27;
|
|
float tmpvar_28;
|
|
tmpvar_28 = v_13.tangent.z;
|
|
tmpvar_21[2].x = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = binormal_15.z;
|
|
tmpvar_21[2].y = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = v_13.normal.z;
|
|
tmpvar_21[2].z = tmpvar_30;
|
|
mat3 tmpvar_31;
|
|
tmpvar_31 = tmpvar_21;
|
|
rotation_14 = tmpvar_31;
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = ObjSpaceLightDir (v_13.vertex);
|
|
vec3 tmpvar_33;
|
|
tmpvar_33 = (rotation_14 * tmpvar_32);
|
|
o_16.lightDir = tmpvar_33;
|
|
vec3 tmpvar_34;
|
|
tmpvar_34 = ObjSpaceViewDir (v_13.vertex);
|
|
vec3 tmpvar_35;
|
|
tmpvar_35 = (rotation_14 * tmpvar_34);
|
|
o_16.viewDir = tmpvar_35;
|
|
vec3 tmpvar_36;
|
|
tmpvar_36 = (_LightMatrix0 * (_Object2World * v_13.vertex)).xyz;
|
|
o_16._LightCoord = tmpvar_36;
|
|
return o_16;
|
|
}
|
|
|
|
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 = xl_retval_38.hip_pack0.xyzw;
|
|
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.lightDir.xyz;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
gl_TexCoord[1] = tmpvar_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61.w = 0.0;
|
|
tmpvar_61.xyz = xl_retval_38.viewDir.xyz;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
gl_TexCoord[2] = tmpvar_62;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63.w = 0.0;
|
|
tmpvar_63.xyz = xl_retval_38._LightCoord.xyz;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
gl_TexCoord[3] = tmpvar_64;
|
|
}
|
|
|