mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
41 lines
1.2 KiB
Text
41 lines
1.2 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 lightColor_1;
|
|
vec3 viewN_2;
|
|
vec3 viewpos_3;
|
|
viewpos_3 = (UNITY_MATRIX_MV * gl_Vertex).xyz;
|
|
mat3 tmpvar_4;
|
|
tmpvar_4[0] = UNITY_MATRIX_IT_MV[0].xyz;
|
|
tmpvar_4[1] = UNITY_MATRIX_IT_MV[1].xyz;
|
|
tmpvar_4[2] = UNITY_MATRIX_IT_MV[2].xyz;
|
|
viewN_2 = (tmpvar_4 * gl_Normal);
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = (unity_LightPosition[0].xyz - viewpos_3);
|
|
lightColor_1 = (unity_LightColor[0].xyz * (max (0.0,
|
|
dot (viewN_2, normalize(tmpvar_5))
|
|
) * (1.0/(
|
|
(1.0 + (dot (tmpvar_5, tmpvar_5) * unity_LightAtten[0].z))
|
|
))));
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = (unity_LightPosition[1].xyz - viewpos_3);
|
|
lightColor_1 = (lightColor_1 + (unity_LightColor[1].xyz * (
|
|
max (0.0, dot (viewN_2, normalize(tmpvar_6)))
|
|
*
|
|
(1.0/((1.0 + (dot (tmpvar_6, tmpvar_6) * unity_LightAtten[1].z))))
|
|
)));
|
|
vec4 tmpvar_7;
|
|
tmpvar_7.w = 1.0;
|
|
tmpvar_7.xyz = (lightColor_1 * 2.0);
|
|
gl_Position = (UNITY_MATRIX_MVP * gl_Vertex);
|
|
xlv_TEXCOORD0 = tmpvar_7;
|
|
}
|
|
|
|
|
|
// inputs: 2, stats: 26 alu 0 tex 0 flow
|