mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
uniform mat4 UNITY_MATRIX_IT_MV;
|
|
uniform mat4 UNITY_MATRIX_MV;
|
|
uniform mat4 UNITY_MATRIX_MVP;
|
|
uniform vec4 unity_LightAtten[4];
|
|
uniform vec4 unity_LightColor[4];
|
|
uniform vec4 unity_LightPosition[4];
|
|
varying vec4 xlv_TEXCOORD0;
|
|
void main ()
|
|
{
|
|
vec3 toLight_1;
|
|
vec3 lightColor_2;
|
|
vec3 viewN_3;
|
|
vec3 viewpos_4;
|
|
viewpos_4 = (UNITY_MATRIX_MV * gl_Vertex).xyz;
|
|
mat3 tmpvar_5;
|
|
tmpvar_5[0] = UNITY_MATRIX_IT_MV[0].xyz;
|
|
tmpvar_5[1] = UNITY_MATRIX_IT_MV[1].xyz;
|
|
tmpvar_5[2] = UNITY_MATRIX_IT_MV[2].xyz;
|
|
viewN_3 = (tmpvar_5 * gl_Normal);
|
|
toLight_1 = (unity_LightPosition[0].xyz - viewpos_4);
|
|
lightColor_2 = (unity_LightColor[0].xyz * (max (0.0,
|
|
dot (viewN_3, normalize(toLight_1))
|
|
) * (1.0/(
|
|
(1.0 + (dot (toLight_1, toLight_1) * unity_LightAtten[0].z))
|
|
))));
|
|
toLight_1 = (unity_LightPosition[1].xyz - viewpos_4);
|
|
lightColor_2 = (lightColor_2 + (unity_LightColor[1].xyz * (
|
|
max (0.0, dot (viewN_3, normalize(toLight_1)))
|
|
*
|
|
(1.0/((1.0 + (dot (toLight_1, toLight_1) * unity_LightAtten[1].z))))
|
|
)));
|
|
vec4 tmpvar_6;
|
|
tmpvar_6.w = 1.0;
|
|
tmpvar_6.xyz = (lightColor_2 * 2.0);
|
|
gl_Position = (UNITY_MATRIX_MVP * gl_Vertex);
|
|
xlv_TEXCOORD0 = tmpvar_6;
|
|
}
|
|
|
|
|
|
// stats: 26 alu 0 tex 0 flow
|
|
// inputs: 2
|
|
// #0: gl_Normal (high float) 3x1 [-1] loc 2
|
|
// #1: gl_Vertex (high float) 4x1 [-1] loc 0
|
|
// uniforms: 6 (total size: 0)
|
|
// #0: UNITY_MATRIX_IT_MV (high float) 4x4 [-1]
|
|
// #1: UNITY_MATRIX_MV (high float) 4x4 [-1]
|
|
// #2: UNITY_MATRIX_MVP (high float) 4x4 [-1]
|
|
// #3: unity_LightAtten (high float) 4x1 [4]
|
|
// #4: unity_LightColor (high float) 4x1 [4]
|
|
// #5: unity_LightPosition (high float) 4x1 [4]
|