mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
167 lines
3.8 KiB
Text
167 lines
3.8 KiB
Text
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec4 hip_pack0;
|
||
|
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 _WorldSpaceLightPos0;
|
||
|
uniform mat4 _World2Object;
|
||
|
uniform vec4 _MainTex_ST;
|
||
|
uniform vec4 _BumpMap_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 ObjSpaceLightDir (
|
||
|
in vec4 v_6
|
||
|
)
|
||
|
{
|
||
|
vec3 objSpaceLightPos_7;
|
||
|
vec3 tmpvar_8;
|
||
|
tmpvar_8 = (_World2Object * _WorldSpaceLightPos0).xyz;
|
||
|
objSpaceLightPos_7 = tmpvar_8;
|
||
|
return objSpaceLightPos_7.xyz;
|
||
|
}
|
||
|
|
||
|
v2f_surf vert_surf (
|
||
|
in appdata_full v_9
|
||
|
)
|
||
|
{
|
||
|
mat3 rotation_10;
|
||
|
vec3 binormal_11;
|
||
|
v2f_surf o_12;
|
||
|
PositionFog (v_9.vertex, o_12.pos, o_12.fog);
|
||
|
vec2 tmpvar_13;
|
||
|
tmpvar_13 = ((v_9.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
||
|
o_12.hip_pack0.xy = tmpvar_13.xy.xy;
|
||
|
vec2 tmpvar_14;
|
||
|
tmpvar_14 = ((v_9.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
||
|
o_12.hip_pack0.zw = tmpvar_14.xxxy.zw;
|
||
|
vec3 tmpvar_15;
|
||
|
tmpvar_15 = cross (v_9.normal, v_9.tangent.xyz);
|
||
|
vec3 tmpvar_16;
|
||
|
tmpvar_16 = (tmpvar_15 * v_9.tangent.w);
|
||
|
binormal_11 = tmpvar_16;
|
||
|
mat3 tmpvar_17;
|
||
|
float tmpvar_18;
|
||
|
tmpvar_18 = v_9.tangent.x;
|
||
|
tmpvar_17[0].x = tmpvar_18;
|
||
|
float tmpvar_19;
|
||
|
tmpvar_19 = binormal_11.x;
|
||
|
tmpvar_17[0].y = tmpvar_19;
|
||
|
float tmpvar_20;
|
||
|
tmpvar_20 = v_9.normal.x;
|
||
|
tmpvar_17[0].z = tmpvar_20;
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = v_9.tangent.y;
|
||
|
tmpvar_17[1].x = tmpvar_21;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = binormal_11.y;
|
||
|
tmpvar_17[1].y = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = v_9.normal.y;
|
||
|
tmpvar_17[1].z = tmpvar_23;
|
||
|
float tmpvar_24;
|
||
|
tmpvar_24 = v_9.tangent.z;
|
||
|
tmpvar_17[2].x = tmpvar_24;
|
||
|
float tmpvar_25;
|
||
|
tmpvar_25 = binormal_11.z;
|
||
|
tmpvar_17[2].y = tmpvar_25;
|
||
|
float tmpvar_26;
|
||
|
tmpvar_26 = v_9.normal.z;
|
||
|
tmpvar_17[2].z = tmpvar_26;
|
||
|
mat3 tmpvar_27;
|
||
|
tmpvar_27 = (tmpvar_17);
|
||
|
rotation_10 = (tmpvar_27);
|
||
|
vec3 tmpvar_28;
|
||
|
tmpvar_28 = ObjSpaceLightDir (v_9.vertex);
|
||
|
vec3 tmpvar_29;
|
||
|
tmpvar_29 = (rotation_10 * tmpvar_28);
|
||
|
o_12.lightDir = tmpvar_29;
|
||
|
return o_12;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_30;
|
||
|
v2f_surf xl_retval_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = tmpvar_32;
|
||
|
xlt_v_30.vertex = tmpvar_33;
|
||
|
vec4 tmpvar_34;
|
||
|
tmpvar_34 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_35;
|
||
|
tmpvar_35 = tmpvar_34;
|
||
|
xlt_v_30.tangent = tmpvar_35;
|
||
|
vec3 tmpvar_36;
|
||
|
tmpvar_36 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
xlt_v_30.normal = tmpvar_37;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
xlt_v_30.texcoord = tmpvar_39;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = tmpvar_40;
|
||
|
xlt_v_30.texcoord1 = tmpvar_41;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
xlt_v_30.color = tmpvar_43;
|
||
|
v2f_surf tmpvar_44;
|
||
|
tmpvar_44 = vert_surf (xlt_v_30);
|
||
|
v2f_surf tmpvar_45;
|
||
|
tmpvar_45 = tmpvar_44;
|
||
|
xl_retval_31 = tmpvar_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = xl_retval_31.pos.xyzw;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
gl_Position = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48.yzw = vec3(0.0, 0.0, 0.0);
|
||
|
tmpvar_48.x = xl_retval_31.fog;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlv_FOG = tmpvar_49;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = xl_retval_31.hip_pack0.xyzw;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
gl_TexCoord[0] = tmpvar_51;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52.w = 0.0;
|
||
|
tmpvar_52.xyz = xl_retval_31.lightDir.xyz;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
gl_TexCoord[1] = tmpvar_53;
|
||
|
}
|
||
|
|