mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
87 lines
4.3 KiB
Text
87 lines
4.3 KiB
Text
#version 300 es
|
|
precision highp float;
|
|
uniform vec4 unity_LightColor[8];
|
|
uniform vec4 unity_LightPosition[8];
|
|
uniform vec4 unity_LightAtten[8];
|
|
uniform vec4 unity_SpotDirection[8];
|
|
uniform mat4 glstate_matrix_mvp;
|
|
uniform mat4 glstate_matrix_modelview0;
|
|
uniform mat4 glstate_matrix_invtrans_modelview0;
|
|
uniform vec4 glstate_lightmodel_ambient;
|
|
uniform vec4 _MainTex_ST;
|
|
uniform vec4 _Color;
|
|
uniform vec4 _ReflectColor;
|
|
in highp vec4 in_POSITION0;
|
|
in highp vec4 in_NORMAL0;
|
|
in highp vec4 in_TEXCOORD0;
|
|
out highp vec4 TEXCOORD0;
|
|
out highp vec4 COLOR0;
|
|
highp vec4 phase0_Output2;
|
|
highp vec4 Temp_2;
|
|
highp vec4 Temp_3;
|
|
highp ivec4 Temp_int_0;
|
|
highp ivec4 Temp_int_1;
|
|
void main ()
|
|
{
|
|
Temp_int_0 = floatBitsToInt((in_POSITION0.yyyy * glstate_matrix_mvp[1]));
|
|
Temp_int_0 = floatBitsToInt(((glstate_matrix_mvp[0] * in_POSITION0.xxxx) + intBitsToFloat(Temp_int_0)));
|
|
Temp_int_0 = floatBitsToInt(((glstate_matrix_mvp[2] * in_POSITION0.zzzz) + intBitsToFloat(Temp_int_0)));
|
|
phase0_Output2 = ((glstate_matrix_mvp[3] * in_POSITION0.wwww) + intBitsToFloat(Temp_int_0));
|
|
TEXCOORD0.xy = ((in_TEXCOORD0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
Temp_int_0.xyz = floatBitsToInt((in_POSITION0.yyy * glstate_matrix_modelview0[1].xyz));
|
|
Temp_int_0.xyz = floatBitsToInt(((glstate_matrix_modelview0[0].xyz * in_POSITION0.xxx) + intBitsToFloat(Temp_int_0).xyz));
|
|
Temp_int_0.xyz = floatBitsToInt(((glstate_matrix_modelview0[2].xyz * in_POSITION0.zzz) + intBitsToFloat(Temp_int_0).xyz));
|
|
Temp_int_0.xyz = floatBitsToInt(((glstate_matrix_modelview0[3].xyz * in_POSITION0.www) + intBitsToFloat(Temp_int_0).xyz));
|
|
Temp_int_1.xyz = floatBitsToInt((in_NORMAL0.yyy * glstate_matrix_invtrans_modelview0[1].xyz));
|
|
Temp_int_1.xyz = floatBitsToInt(((glstate_matrix_invtrans_modelview0[0].xyz * in_NORMAL0.xxx) + intBitsToFloat(Temp_int_1).xyz));
|
|
Temp_int_1.xyz = floatBitsToInt(((glstate_matrix_invtrans_modelview0[2].xyz * in_NORMAL0.zzz) + intBitsToFloat(Temp_int_1).xyz));
|
|
Temp_int_0.w = floatBitsToInt(dot (intBitsToFloat(Temp_int_1).xyz, intBitsToFloat(Temp_int_1).xyz));
|
|
Temp_int_0.w = floatBitsToInt(inversesqrt(intBitsToFloat(Temp_int_0).w));
|
|
Temp_int_1.xyz = floatBitsToInt((intBitsToFloat(Temp_int_0).www * intBitsToFloat(Temp_int_1).xyz));
|
|
Temp_2.xyz = glstate_lightmodel_ambient.xyz;
|
|
Temp_int_0.w = 0;
|
|
for (; Temp_int_0.w < 4; Temp_int_0.w = (Temp_int_0.w + 1)) {
|
|
Temp_3.xyz = ((-(
|
|
intBitsToFloat(Temp_int_0)
|
|
.xyz) * unity_LightPosition[Temp_int_0.w].www) + unity_LightPosition[Temp_int_0.w].xyz);
|
|
Temp_int_1.w = floatBitsToInt(dot (Temp_3.xyz, Temp_3.xyz));
|
|
Temp_2.w = inversesqrt(intBitsToFloat(Temp_int_1).w);
|
|
Temp_3.xyz = (Temp_2.www * Temp_3.xyz);
|
|
Temp_int_1.w = floatBitsToInt(((
|
|
intBitsToFloat(Temp_int_1)
|
|
.w * unity_LightAtten[Temp_int_0.w].z) + 1.0));
|
|
Temp_int_1.w = floatBitsToInt((1.0/(intBitsToFloat(Temp_int_1).w)));
|
|
Temp_2.w = dot (Temp_3.xyz, unity_SpotDirection[Temp_int_0.w].xyz);
|
|
Temp_2.w = max (Temp_2.w, 0.0);
|
|
Temp_2.w = (Temp_2.w - unity_LightAtten[Temp_int_0.w].x);
|
|
Temp_2.w = (Temp_2.w * unity_LightAtten[Temp_int_0.w].y);
|
|
Temp_2.w = clamp (Temp_2.w, 0.0, 1.0);
|
|
Temp_int_1.w = floatBitsToInt((intBitsToFloat(Temp_int_1).w * Temp_2.w));
|
|
Temp_2.w = dot (intBitsToFloat(Temp_int_1).xyz, Temp_3.xyz);
|
|
Temp_2.w = max (Temp_2.w, 0.0);
|
|
Temp_int_1.w = floatBitsToInt((intBitsToFloat(Temp_int_1).w * Temp_2.w));
|
|
Temp_2.xyz = ((unity_LightColor[Temp_int_0.w].xyz * intBitsToFloat(Temp_int_1).www) + Temp_2.xyz);
|
|
};
|
|
COLOR0.xyz = (Temp_2.xyz * _Color.xyz);
|
|
COLOR0.w = (_Color.w * _ReflectColor.w);
|
|
gl_Position = phase0_Output2;
|
|
}
|
|
|
|
|
|
// stats: 88 alu 0 tex 2 flow
|
|
// inputs: 3
|
|
// #0: in_POSITION0 (high float) 4x1 [-1]
|
|
// #1: in_NORMAL0 (high float) 4x1 [-1]
|
|
// #2: in_TEXCOORD0 (high float) 4x1 [-1]
|
|
// uniforms: 11 (total size: 0)
|
|
// #0: unity_LightColor (high float) 4x1 [8]
|
|
// #1: unity_LightPosition (high float) 4x1 [8]
|
|
// #2: unity_LightAtten (high float) 4x1 [8]
|
|
// #3: unity_SpotDirection (high float) 4x1 [8]
|
|
// #4: glstate_matrix_mvp (high float) 4x4 [-1]
|
|
// #5: glstate_matrix_modelview0 (high float) 4x4 [-1]
|
|
// #6: glstate_matrix_invtrans_modelview0 (high float) 4x4 [-1]
|
|
// #7: glstate_lightmodel_ambient (high float) 4x1 [-1]
|
|
// #8: _MainTex_ST (high float) 4x1 [-1]
|
|
// #9: _Color (high float) 4x1 [-1]
|
|
// #10: _ReflectColor (high float) 4x1 [-1]
|