mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
189 lines
4.1 KiB
Text
189 lines
4.1 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 uv;
|
|
vec2 uv2;
|
|
vec3 I;
|
|
vec3 TtoW0;
|
|
vec3 TtoW1;
|
|
vec3 TtoW2;
|
|
};
|
|
struct appdata_tan {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
attribute vec4 TANGENT;
|
|
uniform vec4 unity_Scale;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform vec4 _BumpMap_ST;
|
|
vec3 WorldSpaceViewDir (
|
|
in vec4 v
|
|
)
|
|
{
|
|
return (_WorldSpaceCameraPos.xyz - (_Object2World * v).xyz);
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v,
|
|
out vec4 pos,
|
|
out float fog
|
|
)
|
|
{
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = (gl_ModelViewProjectionMatrix * v);
|
|
pos = tmpvar_1;
|
|
float tmpvar_2;
|
|
tmpvar_2 = pos.z;
|
|
fog = tmpvar_2;
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_tan v
|
|
)
|
|
{
|
|
mat3 rotation;
|
|
vec3 binormal;
|
|
v2f o;
|
|
PositionFog (v.vertex, o.pos, o.fog);
|
|
vec2 tmpvar_1;
|
|
tmpvar_1 = ((v.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o.uv = tmpvar_1;
|
|
vec2 tmpvar_2;
|
|
tmpvar_2 = ((v.texcoord.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
|
o.uv2 = tmpvar_2;
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = WorldSpaceViewDir (v.vertex);
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = -(tmpvar_3);
|
|
o.I = tmpvar_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = cross (v.normal, v.tangent.xyz);
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = (tmpvar_5 * v.tangent.w);
|
|
binormal = tmpvar_6;
|
|
mat3 tmpvar_7;
|
|
float tmpvar_8;
|
|
tmpvar_8 = v.tangent.x;
|
|
tmpvar_7[0].x = tmpvar_8;
|
|
float tmpvar_9;
|
|
tmpvar_9 = binormal.x;
|
|
tmpvar_7[0].y = tmpvar_9;
|
|
float tmpvar_10;
|
|
tmpvar_10 = v.normal.x;
|
|
tmpvar_7[0].z = tmpvar_10;
|
|
float tmpvar_11;
|
|
tmpvar_11 = v.tangent.y;
|
|
tmpvar_7[1].x = tmpvar_11;
|
|
float tmpvar_12;
|
|
tmpvar_12 = binormal.y;
|
|
tmpvar_7[1].y = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = v.normal.y;
|
|
tmpvar_7[1].z = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = v.tangent.z;
|
|
tmpvar_7[2].x = tmpvar_14;
|
|
float tmpvar_15;
|
|
tmpvar_15 = binormal.z;
|
|
tmpvar_7[2].y = tmpvar_15;
|
|
float tmpvar_16;
|
|
tmpvar_16 = v.normal.z;
|
|
tmpvar_7[2].z = tmpvar_16;
|
|
mat3 tmpvar_17;
|
|
tmpvar_17 = (tmpvar_7);
|
|
rotation = (tmpvar_17);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = (rotation * (_Object2World[0].xyz * unity_Scale.w));
|
|
o.TtoW0 = tmpvar_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = (rotation * (_Object2World[1].xyz * unity_Scale.w));
|
|
o.TtoW1 = tmpvar_19;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = (rotation * (_Object2World[2].xyz * unity_Scale.w));
|
|
o.TtoW2 = tmpvar_20;
|
|
return o;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_tan xlt_v;
|
|
v2f xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1;
|
|
xlt_v.vertex = tmpvar_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = TANGENT.xyzw;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = tmpvar_3;
|
|
xlt_v.tangent = tmpvar_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = gl_Normal.xyz;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
xlt_v.normal = tmpvar_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
xlt_v.texcoord = tmpvar_8;
|
|
v2f tmpvar_9;
|
|
tmpvar_9 = vert (xlt_v);
|
|
v2f tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
xl_retval = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = xl_retval.pos.xyzw;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
gl_Position = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_13.x = xl_retval.fog;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
xlv_FOG = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15.zw = vec2(0.0, 0.0);
|
|
tmpvar_15.xy = xl_retval.uv.xy;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
gl_TexCoord[0] = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17.zw = vec2(0.0, 0.0);
|
|
tmpvar_17.xy = xl_retval.uv2.xy;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = tmpvar_17;
|
|
gl_TexCoord[1] = tmpvar_18;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19.w = 0.0;
|
|
tmpvar_19.xyz = xl_retval.I.xyz;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = tmpvar_19;
|
|
gl_TexCoord[2] = tmpvar_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21.w = 0.0;
|
|
tmpvar_21.xyz = xl_retval.TtoW0.xyz;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
gl_TexCoord[3] = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23.w = 0.0;
|
|
tmpvar_23.xyz = xl_retval.TtoW1.xyz;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
gl_TexCoord[4] = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.w = 0.0;
|
|
tmpvar_25.xyz = xl_retval.TtoW2.xyz;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = tmpvar_25;
|
|
gl_TexCoord[5] = tmpvar_26;
|
|
}
|
|
|