|
| 1 | +#version 300 es |
| 2 | +precision mediump float; |
| 3 | +precision highp int; |
| 4 | + |
| 5 | +uniform highp vec4 fs_params[41]; |
| 6 | +uniform highp sampler2D tex_smp; |
| 7 | +uniform highp sampler2D tex_emissive_smp; |
| 8 | + |
| 9 | +in highp vec2 uv; |
| 10 | +in highp vec4 color; |
| 11 | +in highp vec4 position; |
| 12 | +in highp vec3 normal; |
| 13 | +layout(location = 0) out highp vec4 frag_color; |
| 14 | +in highp vec4 tangent; |
| 15 | + |
| 16 | +highp float sqr(highp float x) |
| 17 | +{ |
| 18 | + return x * x; |
| 19 | +} |
| 20 | + |
| 21 | +highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff) |
| 22 | +{ |
| 23 | + highp float _30 = _distance / radius; |
| 24 | + if (_30 >= 1.0) |
| 25 | + { |
| 26 | + return 0.0; |
| 27 | + } |
| 28 | + highp float param = _30; |
| 29 | + highp float param_1 = 1.0 - sqr(param); |
| 30 | + return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0); |
| 31 | +} |
| 32 | + |
| 33 | +highp float calcFogFactor(highp float distance_to_eye) |
| 34 | +{ |
| 35 | + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); |
| 36 | +} |
| 37 | + |
| 38 | +void main() |
| 39 | +{ |
| 40 | + highp vec4 _113 = texture(tex_smp, uv) * color; |
| 41 | + highp vec4 c = _113; |
| 42 | + highp vec4 lit_color = fs_params[3]; |
| 43 | + if (_113.w <= fs_params[2].x) |
| 44 | + { |
| 45 | + discard; |
| 46 | + } |
| 47 | + for (int i = 0; i < int(fs_params[6].x); i++) |
| 48 | + { |
| 49 | + int _145 = i * 2; |
| 50 | + highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; |
| 51 | + highp float param = length(_168); |
| 52 | + highp float param_1 = fs_params[_145 * 1 + 7].w; |
| 53 | + highp float param_2 = 1.0; |
| 54 | + highp float param_3 = 1.0; |
| 55 | + highp vec4 _198 = lit_color; |
| 56 | + highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); |
| 57 | + highp vec4 _329 = _198; |
| 58 | + _329.x = _200.x; |
| 59 | + _329.y = _200.y; |
| 60 | + _329.z = _200.z; |
| 61 | + lit_color = _329; |
| 62 | + } |
| 63 | + highp vec4 _239 = lit_color; |
| 64 | + highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); |
| 65 | + highp vec4 _335 = _239; |
| 66 | + _335.x = _241.x; |
| 67 | + _335.y = _241.y; |
| 68 | + _335.z = _241.z; |
| 69 | + lit_color = _335; |
| 70 | + highp vec4 _250 = c * _335; |
| 71 | + highp vec4 _257 = texture(tex_emissive_smp, uv); |
| 72 | + highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; |
| 73 | + highp vec4 _344 = _250; |
| 74 | + _344.x = _275.x; |
| 75 | + _344.y = _275.y; |
| 76 | + _344.z = _275.z; |
| 77 | + highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); |
| 78 | + highp vec4 _350 = _344; |
| 79 | + _350.x = _296.x; |
| 80 | + _350.y = _296.y; |
| 81 | + _350.z = _296.z; |
| 82 | + c = _350; |
| 83 | + highp float param_4 = length(fs_params[0] - position); |
| 84 | + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); |
| 85 | +} |
| 86 | + |
0 commit comments