mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
158 lines
5.3 KiB
Text
158 lines
5.3 KiB
Text
uniform vec4 _BumpMap_ST;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform mat4 _World2Object;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform vec4 unity_4LightAtten0;
|
|
uniform vec4 unity_4LightPosX0;
|
|
uniform vec4 unity_4LightPosY0;
|
|
uniform vec4 unity_4LightPosZ0;
|
|
uniform vec3 unity_LightColor0;
|
|
uniform vec3 unity_LightColor1;
|
|
uniform vec3 unity_LightColor2;
|
|
uniform vec3 unity_LightColor3;
|
|
uniform vec4 unity_SHAb;
|
|
uniform vec4 unity_SHAg;
|
|
uniform vec4 unity_SHAr;
|
|
uniform vec4 unity_SHBb;
|
|
uniform vec4 unity_SHBg;
|
|
uniform vec4 unity_SHBr;
|
|
uniform vec4 unity_SHC;
|
|
uniform vec4 unity_Scale;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
void main ()
|
|
{
|
|
vec3 worldPos_1;
|
|
vec3 binormal_2;
|
|
vec3 worldN_3;
|
|
vec4 tmpvar_4;
|
|
vec4 pos_5;
|
|
pos_5 = (gl_ModelViewProjectionMatrix * gl_Vertex);
|
|
tmpvar_4.xy = ((gl_MultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
tmpvar_4.zw = ((gl_MultiTexCoord0.xy * _BumpMap_ST.xy) + _BumpMap_ST.zw);
|
|
mat3 tmpvar_6;
|
|
tmpvar_6[0] = _Object2World[0].xyz;
|
|
tmpvar_6[1] = _Object2World[1].xyz;
|
|
tmpvar_6[2] = _Object2World[2].xyz;
|
|
worldN_3 = (tmpvar_6 * (gl_Normal * unity_Scale.w));
|
|
binormal_2 = (((gl_Normal.yzx * TANGENT.zxy) - (gl_Normal.zxy * TANGENT.yzx)) * TANGENT.w);
|
|
mat3 tmpvar_7;
|
|
tmpvar_7[0].x = TANGENT.x;
|
|
tmpvar_7[0].y = binormal_2.x;
|
|
tmpvar_7[0].z = gl_Normal.x;
|
|
tmpvar_7[1].x = TANGENT.y;
|
|
tmpvar_7[1].y = binormal_2.y;
|
|
tmpvar_7[1].z = gl_Normal.y;
|
|
tmpvar_7[2].x = TANGENT.z;
|
|
tmpvar_7[2].y = binormal_2.z;
|
|
tmpvar_7[2].z = gl_Normal.z;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8.w = 1.0;
|
|
tmpvar_8.xyz = _WorldSpaceCameraPos;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9.w = 1.0;
|
|
tmpvar_9.xyz = worldN_3;
|
|
vec3 x2_10;
|
|
vec4 vB_11;
|
|
vec3 x1_12;
|
|
x1_12.x = dot (unity_SHAr, tmpvar_9);
|
|
x1_12.y = dot (unity_SHAg, tmpvar_9);
|
|
x1_12.z = dot (unity_SHAb, tmpvar_9);
|
|
vB_11 = (worldN_3.xyzz * worldN_3.yzzx);
|
|
x2_10.x = dot (unity_SHBr, vB_11);
|
|
x2_10.y = dot (unity_SHBg, vB_11);
|
|
x2_10.z = dot (unity_SHBb, vB_11);
|
|
worldPos_1 = (_Object2World * gl_Vertex).xyz;
|
|
vec3 col_13;
|
|
vec4 diff_14;
|
|
vec4 ndotl_15;
|
|
vec4 lengthSq_16;
|
|
vec4 toLightZ_17;
|
|
vec4 toLightY_18;
|
|
vec4 toLightX_19;
|
|
toLightX_19 = (unity_4LightPosX0 - worldPos_1.x);
|
|
toLightY_18 = (unity_4LightPosY0 - worldPos_1.y);
|
|
toLightZ_17 = (unity_4LightPosZ0 - worldPos_1.z);
|
|
lengthSq_16 = (toLightX_19 * toLightX_19);
|
|
lengthSq_16 = (lengthSq_16 + (toLightY_18 * toLightY_18));
|
|
lengthSq_16 = (lengthSq_16 + (toLightZ_17 * toLightZ_17));
|
|
ndotl_15 = (toLightX_19 * worldN_3.x);
|
|
ndotl_15 = (ndotl_15 + (toLightY_18 * worldN_3.y));
|
|
ndotl_15 = (ndotl_15 + (toLightZ_17 * worldN_3.z));
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = max (vec4(0.0, 0.0, 0.0, 0.0), (ndotl_15 * inversesqrt(lengthSq_16)));
|
|
ndotl_15 = tmpvar_20;
|
|
diff_14 = (tmpvar_20 * (1.0/((1.0 +
|
|
(lengthSq_16 * unity_4LightAtten0)
|
|
))));
|
|
col_13 = (unity_LightColor0 * diff_14.x);
|
|
col_13 = (col_13 + (unity_LightColor1 * diff_14.y));
|
|
col_13 = (col_13 + (unity_LightColor2 * diff_14.z));
|
|
col_13 = (col_13 + (unity_LightColor3 * diff_14.w));
|
|
vec4 o_21;
|
|
o_21 = (pos_5 * 0.5);
|
|
vec2 tmpvar_22;
|
|
tmpvar_22.x = o_21.x;
|
|
tmpvar_22.y = (o_21.y * _ProjectionParams.x);
|
|
o_21.xy = (tmpvar_22 + o_21.w);
|
|
o_21.zw = pos_5.zw;
|
|
gl_Position = pos_5;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_23.x = pos_5.z;
|
|
xlv_FOG = tmpvar_23;
|
|
gl_TexCoord[0] = tmpvar_4;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24.w = 0.0;
|
|
tmpvar_24.xyz = (tmpvar_7 * ((
|
|
(_World2Object * tmpvar_8)
|
|
.xyz * unity_Scale.w) - gl_Vertex.xyz));
|
|
gl_TexCoord[1] = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.w = 0.0;
|
|
tmpvar_25.xyz = (tmpvar_7 * (_World2Object * _WorldSpaceLightPos0).xyz);
|
|
gl_TexCoord[2] = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26.w = 0.0;
|
|
tmpvar_26.xyz = (((x1_12 + x2_10) + (unity_SHC.xyz *
|
|
((worldN_3.x * worldN_3.x) - (worldN_3.y * worldN_3.y))
|
|
)) + col_13);
|
|
gl_TexCoord[3] = tmpvar_26;
|
|
gl_TexCoord[4] = o_21;
|
|
}
|
|
|
|
|
|
// stats: 68 alu 0 tex 0 flow
|
|
// inputs: 4
|
|
// #0: gl_MultiTexCoord0 (high float) 4x1 [-1] loc 8
|
|
// #1: gl_Normal (high float) 3x1 [-1] loc 2
|
|
// #2: gl_Vertex (high float) 4x1 [-1] loc 0
|
|
// #3: TANGENT (high float) 4x1 [-1]
|
|
// uniforms: 24 (total size: 0)
|
|
// #0: gl_ModelViewProjectionMatrix (high float) 4x4 [-1]
|
|
// #1: _BumpMap_ST (high float) 4x1 [-1]
|
|
// #2: _MainTex_ST (high float) 4x1 [-1]
|
|
// #3: _Object2World (high float) 4x4 [-1]
|
|
// #4: _ProjectionParams (high float) 4x1 [-1]
|
|
// #5: _World2Object (high float) 4x4 [-1]
|
|
// #6: _WorldSpaceCameraPos (high float) 3x1 [-1]
|
|
// #7: _WorldSpaceLightPos0 (high float) 4x1 [-1]
|
|
// #8: unity_4LightAtten0 (high float) 4x1 [-1]
|
|
// #9: unity_4LightPosX0 (high float) 4x1 [-1]
|
|
// #10: unity_4LightPosY0 (high float) 4x1 [-1]
|
|
// #11: unity_4LightPosZ0 (high float) 4x1 [-1]
|
|
// #12: unity_LightColor0 (high float) 3x1 [-1]
|
|
// #13: unity_LightColor1 (high float) 3x1 [-1]
|
|
// #14: unity_LightColor2 (high float) 3x1 [-1]
|
|
// #15: unity_LightColor3 (high float) 3x1 [-1]
|
|
// #16: unity_SHAb (high float) 4x1 [-1]
|
|
// #17: unity_SHAg (high float) 4x1 [-1]
|
|
// #18: unity_SHAr (high float) 4x1 [-1]
|
|
// #19: unity_SHBb (high float) 4x1 [-1]
|
|
// #20: unity_SHBg (high float) 4x1 [-1]
|
|
// #21: unity_SHBr (high float) 4x1 [-1]
|
|
// #22: unity_SHC (high float) 4x1 [-1]
|
|
// #23: unity_Scale (high float) 4x1 [-1]
|