diff --git a/src/rendering/backend_sokol.jai b/src/rendering/backend_sokol.jai index a1ccfc8..f465bfa 100644 --- a/src/rendering/backend_sokol.jai +++ b/src/rendering/backend_sokol.jai @@ -330,6 +330,13 @@ backend_process_command_buckets :: () { sg_apply_bindings(*gPipelines.postprocess.bind); post_process_config_uniform : Post_Process_Config; fill_uniform_with_engine_data(*post_process_config_uniform , *current_post_process); + post_process_config_uniform.vignette_intensity = current_post_process.vignette_intensity; + post_process_config_uniform.vignette_radius = current_post_process.vignette_radius; + post_process_config_uniform.scanlines_intensity = current_post_process.scanlines_intensity; + post_process_config_uniform.scanlines_density = current_post_process.scanlines_density; + post_process_config_uniform.chromatic_aberration_intensity = current_post_process.chromatic_aberration_intensity; + post_process_config_uniform.film_grain_intensity = current_post_process.film_grain_intensity; + post_process_config_uniform.barrel_distortion_intensity = current_post_process.barrel_distortion_intensity; sg_apply_uniforms(UB_post_process_config, *(sg_range.{ ptr = *post_process_config_uniform, size = size_of(type_of(post_process_config_uniform)) })); sg_draw(0, 6, 1); diff --git a/src/rendering/post_processing.jai b/src/rendering/post_processing.jai index 7f21e83..d5d2c64 100644 --- a/src/rendering/post_processing.jai +++ b/src/rendering/post_processing.jai @@ -18,6 +18,13 @@ Post_Process :: struct { bloom_separation : float = 3.0; @Slider,0,10,1; bloom_treshold : float = 0.4; @Slider,0,1,0.1; bloom_amount : float = 1.0; @Slider,0,5,0.1; + vignette_intensity: float = 0.5; @Slider,0,1,0.1; + vignette_radius: float = 0.5; @Slider,0,1,0.1; + scanlines_intensity: float = 0.1; @Slider,0,1,0.1; + scanlines_density: float = 1; @Slider,0,2,0.1; + chromatic_aberration_intensity: float = 0.0; @Slider,0,0.05,0.001; + film_grain_intensity: float = 0.0; @Slider,0,0.5,0.001; + barrel_distortion_intensity: float = 0.0; @Slider,-2,2,0.1; } current_post_process : Post_Process; diff --git a/src/shaders/jai/shader_post_process_main.jai b/src/shaders/jai/shader_post_process_main.jai index 5ed39fc..61d4aea 100644 --- a/src/shaders/jai/shader_post_process_main.jai +++ b/src/shaders/jai/shader_post_process_main.jai @@ -39,7 +39,13 @@ Post_Process_Config :: struct { saturation: float; gamma: float; tonemap: float; - _: [12]u8; + vignette_intensity: float; + vignette_radius: float; + scanlines_intensity: float; + scanlines_density: float; + chromatic_aberration_intensity: float; + film_grain_intensity: float; + barrel_distortion_intensity: float; }; /* #version 430 @@ -74,7 +80,7 @@ vs_pp_source_glsl430 := u8.[ /* #version 430 - uniform vec4 post_process_config[2]; + uniform vec4 post_process_config[3]; layout(binding = 16) uniform sampler2D pptex_ppsmp; layout(location = 0) in vec2 texcoord; @@ -85,30 +91,83 @@ vs_pp_source_glsl430 := u8.[ return clamp((x * ((x * 2.5099999904632568359375) + vec3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + vec3(0.589999973773956298828125))) + vec3(0.14000000059604644775390625)), vec3(0.0), vec3(1.0)); } + float rand(vec2 co) + { + return fract(sin(dot(co, vec2(12.98980045318603515625, 78.233001708984375))) * 43758.546875); + } + void main() { - vec4 _57 = texture(pptex_ppsmp, texcoord); - vec3 _61 = _57.xyz; - vec3 param = _61; + vec2 _66 = texcoord - vec2(0.5); + float _67 = length(_66); + vec2 _86 = (_66 * (1.0 + (_67 * post_process_config[2].w))) + vec2(0.5); + if (post_process_config[2].w > 0.0) + { + float _96 = _86.x; + bool _97 = _96 < 0.0; + bool _104; + if (!_97) + { + _104 = _96 > 1.0; + } + else + { + _104 = _97; + } + bool _112; + if (!_104) + { + _112 = _86.y < 0.0; + } + else + { + _112 = _104; + } + bool _119; + if (!_112) + { + _119 = _86.y > 1.0; + } + else + { + _119 = _112; + } + if (_119) + { + frag_color = vec4(0.0, 0.0, 0.0, 1.0); + return; + } + } + vec2 _145 = vec2(post_process_config[2].y, 0.0); + vec4 _147 = texture(pptex_ppsmp, _86 + _145); + vec4 _154 = texture(pptex_ppsmp, _86); + vec4 _165 = texture(pptex_ppsmp, _86 - _145); + vec3 _175 = vec4(_147.x, _154.y, _165.z, 1.0).xyz; + vec3 param = _175; vec3 tonemapped = aces(param); if (post_process_config[1].x > 0.5) { - vec3 param_1 = _61; + vec3 param_1 = _175; tonemapped = aces(param_1); } else { - tonemapped = _61; + tonemapped = _175; } - vec3 _106 = (((pow(tonemapped, vec3(1.0 / post_process_config[0].w)) - vec3(0.5)) * max(post_process_config[0].y, 0.0)) + vec3(0.5)) + vec3(post_process_config[0].x); - frag_color = vec4(mix(vec3(((0.2125000059604644775390625 * _106.x) + (0.7153999805450439453125 * _106.y)) + (0.07209999859333038330078125 * _106.z)), _106, vec3(post_process_config[0].z)), 1.0); + vec3 _213 = (((pow(tonemapped, vec3(1.0 / post_process_config[0].w)) - vec3(0.5)) * max(post_process_config[0].y, 0.0)) + vec3(0.5)) + vec3(post_process_config[0].x); + vec3 gammaCorrected = (mix(vec3(((0.2125000059604644775390625 * _213.x) + (0.7153999805450439453125 * _213.y)) + (0.07209999859333038330078125 * _213.z)), _213, vec3(post_process_config[0].z)) * (1.0 - (smoothstep(0.0, post_process_config[1].z, _67) * post_process_config[1].y))) * (1.0 - (((sin((texcoord.y * float(textureSize(pptex_ppsmp, 0).y)) * post_process_config[2].x) * 0.5) + 0.5) * post_process_config[1].w)); + vec2 param_2 = texcoord; + vec3 _294 = gammaCorrected; + vec3 _296 = _294 + vec3((rand(param_2) - 0.5) * post_process_config[2].z); + gammaCorrected = _296; + frag_color = vec4(_296, 1.0); } */ fs_pp_source_glsl430 := u8.[ 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x74,0x5f, - 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32, + 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x33, 0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e, 0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f, @@ -133,50 +192,146 @@ fs_pp_source_glsl430 := u8.[ 0x33,0x28,0x30,0x2e,0x31,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36, 0x30,0x34,0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29, 0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63, - 0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, - 0x33,0x20,0x5f,0x36,0x31,0x20,0x3d,0x20,0x5f,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b, + 0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x72,0x61,0x6e,0x64,0x28,0x76,0x65,0x63,0x32,0x20,0x63,0x6f,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x72,0x61, + 0x63,0x74,0x28,0x73,0x69,0x6e,0x28,0x64,0x6f,0x74,0x28,0x63,0x6f,0x2c,0x20,0x76, + 0x65,0x63,0x32,0x28,0x31,0x32,0x2e,0x39,0x38,0x39,0x38,0x30,0x30,0x34,0x35,0x33, + 0x31,0x38,0x36,0x30,0x33,0x35,0x31,0x35,0x36,0x32,0x35,0x2c,0x20,0x37,0x38,0x2e, + 0x32,0x33,0x33,0x30,0x30,0x31,0x37,0x30,0x38,0x39,0x38,0x34,0x33,0x37,0x35,0x29, + 0x29,0x29,0x20,0x2a,0x20,0x34,0x33,0x37,0x35,0x38,0x2e,0x35,0x34,0x36,0x38,0x37, + 0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x36, + 0x36,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x2d,0x20,0x76, + 0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x5f,0x36,0x37,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68, + 0x28,0x5f,0x36,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20, + 0x5f,0x38,0x36,0x20,0x3d,0x20,0x28,0x5f,0x36,0x36,0x20,0x2a,0x20,0x28,0x31,0x2e, + 0x30,0x20,0x2b,0x20,0x28,0x5f,0x36,0x37,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f, + 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32, + 0x5d,0x2e,0x77,0x29,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e, + 0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x70,0x6f,0x73,0x74, + 0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b, + 0x32,0x5d,0x2e,0x77,0x20,0x3e,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x5f,0x39,0x36,0x20,0x3d,0x20,0x5f,0x38,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x37,0x20,0x3d,0x20, + 0x5f,0x39,0x36,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x37,0x29,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x36, + 0x20,0x3e,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x37,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30,0x34,0x29, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d,0x20,0x5f,0x38, + 0x36,0x2e,0x79,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73, + 0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d,0x20,0x5f, + 0x31,0x30,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x31,0x39, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f, + 0x31,0x31,0x32,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x20, + 0x3d,0x20,0x5f,0x38,0x36,0x2e,0x79,0x20,0x3e,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39, + 0x20,0x3d,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, + 0x31,0x31,0x39,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30, + 0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a, + 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x5f, + 0x31,0x34,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x70,0x6f,0x73,0x74,0x5f, + 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32, + 0x5d,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, + 0x65,0x63,0x34,0x20,0x5f,0x31,0x34,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, + 0x72,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20, + 0x5f,0x38,0x36,0x20,0x2b,0x20,0x5f,0x31,0x34,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x35,0x34,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70, + 0x2c,0x20,0x5f,0x38,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x31,0x36,0x35,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x38,0x36, + 0x20,0x2d,0x20,0x5f,0x31,0x34,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x33,0x20,0x5f,0x31,0x37,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f, + 0x31,0x34,0x37,0x2e,0x78,0x2c,0x20,0x5f,0x31,0x35,0x34,0x2e,0x79,0x2c,0x20,0x5f, + 0x31,0x36,0x35,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x2e,0x78,0x79,0x7a,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, - 0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65, - 0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66, - 0x20,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63, - 0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x35, - 0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f, - 0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65, - 0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, - 0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20, - 0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, - 0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x30,0x36,0x20,0x3d,0x20,0x28,0x28,0x28, - 0x70,0x6f,0x77,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x2c,0x20, - 0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x70,0x6f,0x73,0x74,0x5f, - 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30, - 0x5d,0x2e,0x77,0x29,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35, - 0x29,0x29,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72, - 0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e, - 0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28, - 0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73, + 0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33, + 0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63, + 0x65,0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69, + 0x66,0x20,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f, + 0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e, + 0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20, + 0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f, + 0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, + 0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65, + 0x64,0x20,0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x31,0x33,0x20,0x3d,0x20, + 0x28,0x28,0x28,0x70,0x6f,0x77,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65, + 0x64,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x70,0x6f, + 0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69, + 0x67,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x33,0x28, + 0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x70,0x6f,0x73,0x74, + 0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b, + 0x30,0x5d,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20,0x76,0x65, + 0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28, + 0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e, + 0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, + 0x65,0x63,0x33,0x20,0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74, + 0x65,0x64,0x20,0x3d,0x20,0x28,0x6d,0x69,0x78,0x28,0x76,0x65,0x63,0x33,0x28,0x28, + 0x28,0x30,0x2e,0x32,0x31,0x32,0x35,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34, + 0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x20,0x2a,0x20,0x5f, + 0x32,0x31,0x33,0x2e,0x78,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x37,0x31,0x35,0x33, + 0x39,0x39,0x39,0x38,0x30,0x35,0x34,0x35,0x30,0x34,0x33,0x39,0x34,0x35,0x33,0x31, + 0x32,0x35,0x20,0x2a,0x20,0x5f,0x32,0x31,0x33,0x2e,0x79,0x29,0x29,0x20,0x2b,0x20, + 0x28,0x30,0x2e,0x30,0x37,0x32,0x30,0x39,0x39,0x39,0x39,0x38,0x35,0x39,0x33,0x33, + 0x33,0x30,0x33,0x38,0x33,0x33,0x30,0x30,0x37,0x38,0x31,0x32,0x35,0x20,0x2a,0x20, + 0x5f,0x32,0x31,0x33,0x2e,0x7a,0x29,0x29,0x2c,0x20,0x5f,0x32,0x31,0x33,0x2c,0x20, + 0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73, + 0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x7a,0x29,0x29,0x20, + 0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68, + 0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x30,0x2c,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70, + 0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d, + 0x2e,0x7a,0x2c,0x20,0x5f,0x36,0x37,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f, + 0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31, + 0x5d,0x2e,0x79,0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20, + 0x28,0x28,0x28,0x73,0x69,0x6e,0x28,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64, + 0x2e,0x79,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x74,0x65,0x78,0x74,0x75, + 0x72,0x65,0x53,0x69,0x7a,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73, + 0x6d,0x70,0x2c,0x20,0x30,0x29,0x2e,0x79,0x29,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73, 0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67, - 0x5b,0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x6d,0x69, - 0x78,0x28,0x76,0x65,0x63,0x33,0x28,0x28,0x28,0x30,0x2e,0x32,0x31,0x32,0x35,0x30, - 0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39, - 0x30,0x36,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36,0x2e,0x78,0x29,0x20,0x2b, - 0x20,0x28,0x30,0x2e,0x37,0x31,0x35,0x33,0x39,0x39,0x39,0x38,0x30,0x35,0x34,0x35, - 0x30,0x34,0x33,0x39,0x34,0x35,0x33,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30, - 0x36,0x2e,0x79,0x29,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x30,0x37,0x32,0x30,0x39, - 0x39,0x39,0x39,0x38,0x35,0x39,0x33,0x33,0x33,0x30,0x33,0x38,0x33,0x33,0x30,0x30, - 0x37,0x38,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36,0x2e,0x7a,0x29,0x29, - 0x2c,0x20,0x5f,0x31,0x30,0x36,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73, - 0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67, - 0x5b,0x30,0x5d,0x2e,0x7a,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x5b,0x32,0x5d,0x2e,0x78,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20, + 0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63, + 0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x77,0x29, + 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x32,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x39,0x34,0x20,0x3d,0x20, + 0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65,0x64,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x39,0x36,0x20,0x3d,0x20, + 0x5f,0x32,0x39,0x34,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x28,0x72,0x61,0x6e, + 0x64,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35, + 0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73, + 0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x7a,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65, + 0x64,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, + 0x5f,0x32,0x39,0x36,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + ]; /* #version 300 es @@ -211,7 +366,7 @@ vs_pp_source_glsl300es := u8.[ precision mediump float; precision highp int; - uniform highp vec4 post_process_config[2]; + uniform highp vec4 post_process_config[3]; uniform highp sampler2D pptex_ppsmp; in highp vec2 texcoord; @@ -222,23 +377,76 @@ vs_pp_source_glsl300es := u8.[ return clamp((x * ((x * 2.5099999904632568359375) + vec3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + vec3(0.589999973773956298828125))) + vec3(0.14000000059604644775390625)), vec3(0.0), vec3(1.0)); } + highp float rand(highp vec2 co) + { + return fract(sin(dot(co, vec2(12.98980045318603515625, 78.233001708984375))) * 43758.546875); + } + void main() { - highp vec4 _57 = texture(pptex_ppsmp, texcoord); - highp vec3 _61 = _57.xyz; - highp vec3 param = _61; + highp vec2 _66 = texcoord - vec2(0.5); + highp float _67 = length(_66); + highp vec2 _86 = (_66 * (1.0 + (_67 * post_process_config[2].w))) + vec2(0.5); + if (post_process_config[2].w > 0.0) + { + highp float _96 = _86.x; + bool _97 = _96 < 0.0; + bool _104; + if (!_97) + { + _104 = _96 > 1.0; + } + else + { + _104 = _97; + } + bool _112; + if (!_104) + { + _112 = _86.y < 0.0; + } + else + { + _112 = _104; + } + bool _119; + if (!_112) + { + _119 = _86.y > 1.0; + } + else + { + _119 = _112; + } + if (_119) + { + frag_color = vec4(0.0, 0.0, 0.0, 1.0); + return; + } + } + highp vec2 _145 = vec2(post_process_config[2].y, 0.0); + highp vec4 _147 = texture(pptex_ppsmp, _86 + _145); + highp vec4 _154 = texture(pptex_ppsmp, _86); + highp vec4 _165 = texture(pptex_ppsmp, _86 - _145); + highp vec3 _175 = vec4(_147.x, _154.y, _165.z, 1.0).xyz; + highp vec3 param = _175; highp vec3 tonemapped = aces(param); if (post_process_config[1].x > 0.5) { - highp vec3 param_1 = _61; + highp vec3 param_1 = _175; tonemapped = aces(param_1); } else { - tonemapped = _61; + tonemapped = _175; } - highp vec3 _106 = (((pow(tonemapped, vec3(1.0 / post_process_config[0].w)) - vec3(0.5)) * max(post_process_config[0].y, 0.0)) + vec3(0.5)) + vec3(post_process_config[0].x); - frag_color = vec4(mix(vec3(((0.2125000059604644775390625 * _106.x) + (0.7153999805450439453125 * _106.y)) + (0.07209999859333038330078125 * _106.z)), _106, vec3(post_process_config[0].z)), 1.0); + highp vec3 _213 = (((pow(tonemapped, vec3(1.0 / post_process_config[0].w)) - vec3(0.5)) * max(post_process_config[0].y, 0.0)) + vec3(0.5)) + vec3(post_process_config[0].x); + highp vec3 gammaCorrected = (mix(vec3(((0.2125000059604644775390625 * _213.x) + (0.7153999805450439453125 * _213.y)) + (0.07209999859333038330078125 * _213.z)), _213, vec3(post_process_config[0].z)) * (1.0 - (smoothstep(0.0, post_process_config[1].z, _67) * post_process_config[1].y))) * (1.0 - (((sin((texcoord.y * float(textureSize(pptex_ppsmp, 0).y)) * post_process_config[2].x) * 0.5) + 0.5) * post_process_config[1].w)); + highp vec2 param_2 = texcoord; + highp vec3 _294 = gammaCorrected; + highp vec3 _296 = _294 + vec3((rand(param_2) - 0.5) * post_process_config[2].z); + gammaCorrected = _296; + frag_color = vec4(_296, 1.0); } */ @@ -249,7 +457,7 @@ fs_pp_source_glsl300es := u8.[ 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, 0x34,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63, - 0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72, + 0x6f,0x6e,0x66,0x69,0x67,0x5b,0x33,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72, 0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32, 0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x3b,0x0a,0x0a, 0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65, @@ -273,52 +481,152 @@ fs_pp_source_glsl300es := u8.[ 0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34, 0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x76,0x65,0x63, 0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30, - 0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, - 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, - 0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x74, - 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69, - 0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36,0x31,0x20,0x3d,0x20,0x5f, - 0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68, - 0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f, - 0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, - 0x63,0x33,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20, - 0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x72,0x61,0x6e,0x64,0x28,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, + 0x63,0x32,0x20,0x63,0x6f,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x20,0x66,0x72,0x61,0x63,0x74,0x28,0x73,0x69,0x6e,0x28,0x64,0x6f, + 0x74,0x28,0x63,0x6f,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x32,0x2e,0x39,0x38, + 0x39,0x38,0x30,0x30,0x34,0x35,0x33,0x31,0x38,0x36,0x30,0x33,0x35,0x31,0x35,0x36, + 0x32,0x35,0x2c,0x20,0x37,0x38,0x2e,0x32,0x33,0x33,0x30,0x30,0x31,0x37,0x30,0x38, + 0x39,0x38,0x34,0x33,0x37,0x35,0x29,0x29,0x29,0x20,0x2a,0x20,0x34,0x33,0x37,0x35, + 0x38,0x2e,0x35,0x34,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f, + 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x36,0x36,0x20,0x3d, + 0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x2d,0x20,0x76,0x65,0x63,0x32, + 0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x36,0x37,0x20,0x3d,0x20,0x6c,0x65,0x6e, + 0x67,0x74,0x68,0x28,0x5f,0x36,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69, + 0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x38,0x36,0x20,0x3d,0x20,0x28, + 0x5f,0x36,0x36,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2b,0x20,0x28,0x5f,0x36, + 0x37,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73, + 0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x77,0x29,0x29,0x29,0x20, + 0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20, 0x20,0x69,0x66,0x20,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73, - 0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20, - 0x30,0x2e,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20, - 0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a, - 0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f, - 0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20, - 0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x30,0x36,0x20,0x3d,0x20,0x28,0x28,0x28,0x70, - 0x6f,0x77,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x2c,0x20,0x76, - 0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70, - 0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d, - 0x2e,0x77,0x29,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29, - 0x29,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f, - 0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x79, - 0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30, - 0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73,0x74, + 0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x77,0x20,0x3e,0x20, + 0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f, + 0x39,0x36,0x20,0x3d,0x20,0x5f,0x38,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x37,0x20,0x3d,0x20,0x5f, + 0x39,0x36,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x37,0x29,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x36,0x20, + 0x3e,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x37,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30,0x34,0x29,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d,0x20,0x5f,0x38,0x36, + 0x2e,0x79,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d,0x20,0x5f,0x31, + 0x30,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x31,0x39,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31, + 0x31,0x32,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x20,0x3d, + 0x20,0x5f,0x38,0x36,0x2e,0x79,0x20,0x3e,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x20, + 0x3d,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31, + 0x31,0x39,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x2c, + 0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, + 0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76, + 0x65,0x63,0x32,0x20,0x5f,0x31,0x34,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28, + 0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e, + 0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f, + 0x31,0x34,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x70,0x70, + 0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x38,0x36,0x20,0x2b, + 0x20,0x5f,0x31,0x34,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68, + 0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x35,0x34,0x20,0x3d,0x20,0x74,0x65, + 0x78,0x74,0x75,0x72,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d, + 0x70,0x2c,0x20,0x5f,0x38,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67, + 0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x36,0x35,0x20,0x3d,0x20,0x74, + 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73, + 0x6d,0x70,0x2c,0x20,0x5f,0x38,0x36,0x20,0x2d,0x20,0x5f,0x31,0x34,0x35,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x31,0x37,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x34,0x37, + 0x2e,0x78,0x2c,0x20,0x5f,0x31,0x35,0x34,0x2e,0x79,0x2c,0x20,0x5f,0x31,0x36,0x35, + 0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x20,0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68, + 0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61, + 0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61, + 0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x70,0x6f,0x73,0x74, 0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b, - 0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x6d,0x69,0x78, - 0x28,0x76,0x65,0x63,0x33,0x28,0x28,0x28,0x30,0x2e,0x32,0x31,0x32,0x35,0x30,0x30, - 0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39,0x30, - 0x36,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36,0x2e,0x78,0x29,0x20,0x2b,0x20, - 0x28,0x30,0x2e,0x37,0x31,0x35,0x33,0x39,0x39,0x39,0x38,0x30,0x35,0x34,0x35,0x30, - 0x34,0x33,0x39,0x34,0x35,0x33,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36, - 0x2e,0x79,0x29,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x30,0x37,0x32,0x30,0x39,0x39, - 0x39,0x39,0x38,0x35,0x39,0x33,0x33,0x33,0x30,0x33,0x38,0x33,0x33,0x30,0x30,0x37, - 0x38,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36,0x2e,0x7a,0x29,0x29,0x2c, - 0x20,0x5f,0x31,0x30,0x36,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73,0x74, - 0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b, - 0x30,0x5d,0x2e,0x7a,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, + 0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x35,0x29,0x0a,0x20,0x20,0x20,0x20, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f, + 0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e, + 0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, + 0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64, + 0x20,0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, + 0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32, + 0x31,0x33,0x20,0x3d,0x20,0x28,0x28,0x28,0x70,0x6f,0x77,0x28,0x74,0x6f,0x6e,0x65, + 0x6d,0x61,0x70,0x70,0x65,0x64,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30, + 0x20,0x2f,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f, + 0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2d,0x20, + 0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20,0x6d,0x61,0x78, + 0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f, + 0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29, + 0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20, + 0x76,0x65,0x63,0x33,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73, + 0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x67, + 0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65,0x64,0x20,0x3d,0x20, + 0x28,0x6d,0x69,0x78,0x28,0x76,0x65,0x63,0x33,0x28,0x28,0x28,0x30,0x2e,0x32,0x31, + 0x32,0x35,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,0x37,0x37, + 0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x20,0x2a,0x20,0x5f,0x32,0x31,0x33,0x2e,0x78, + 0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x37,0x31,0x35,0x33,0x39,0x39,0x39,0x38,0x30, + 0x35,0x34,0x35,0x30,0x34,0x33,0x39,0x34,0x35,0x33,0x31,0x32,0x35,0x20,0x2a,0x20, + 0x5f,0x32,0x31,0x33,0x2e,0x79,0x29,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x30,0x37, + 0x32,0x30,0x39,0x39,0x39,0x39,0x38,0x35,0x39,0x33,0x33,0x33,0x30,0x33,0x38,0x33, + 0x33,0x30,0x30,0x37,0x38,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x32,0x31,0x33,0x2e, + 0x7a,0x29,0x29,0x2c,0x20,0x5f,0x32,0x31,0x33,0x2c,0x20,0x76,0x65,0x63,0x33,0x28, + 0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e, + 0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x7a,0x29,0x29,0x20,0x2a,0x20,0x28,0x31,0x2e, + 0x30,0x20,0x2d,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28, + 0x30,0x2e,0x30,0x2c,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73, + 0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x7a,0x2c,0x20,0x5f, + 0x36,0x37,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65, + 0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x79,0x29,0x29, + 0x29,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x28,0x28,0x73,0x69, + 0x6e,0x28,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2e,0x79,0x20,0x2a,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x69,0x7a, + 0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x30, + 0x29,0x2e,0x79,0x29,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f, + 0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x78, + 0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x29,0x20, + 0x2a,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63, + 0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x32,0x39,0x34,0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72, + 0x65,0x63,0x74,0x65,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70, + 0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x39,0x36,0x20,0x3d,0x20,0x5f,0x32,0x39, + 0x34,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x28,0x72,0x61,0x6e,0x64,0x28,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a, + 0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f, + 0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65,0x64,0x20,0x3d, + 0x20,0x5f,0x32,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x32,0x39, + 0x36,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, ]; /* #include @@ -392,6 +700,13 @@ vs_pp_source_metal_macos := u8.[ float saturation; float gamma; float tonemap; + float vignette_intensity; + float vignette_radius; + float scanlines_intensity; + float scanlines_density; + float chromatic_aberration_intensity; + float film_grain_intensity; + float barrel_distortion_intensity; }; struct main0_out @@ -410,24 +725,78 @@ vs_pp_source_metal_macos := u8.[ return fast::clamp((x * ((x * 2.5099999904632568359375) + float3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + float3(0.589999973773956298828125))) + float3(0.14000000059604644775390625)), float3(0.0), float3(1.0)); } - fragment main0_out main0(main0_in in [[stage_in]], constant post_process_config& _65 [[buffer(0)]], texture2d pptex [[texture(0)]], sampler ppsmp [[sampler(0)]]) + static inline __attribute__((always_inline)) + float rand(thread const float2& co) + { + return fract(sin(dot(co, float2(12.98980045318603515625, 78.233001708984375))) * 43758.546875); + } + + fragment main0_out main0(main0_in in [[stage_in]], constant post_process_config& _74 [[buffer(0)]], texture2d pptex [[texture(0)]], sampler ppsmp [[sampler(0)]]) { main0_out out = {}; - float4 _57 = pptex.sample(ppsmp, in.texcoord); - float3 _61 = _57.xyz; - float3 param = _61; - float3 tonemapped = aces(param); - if (_65.tonemap > 0.5) + float2 _66 = in.texcoord - float2(0.5); + float _67 = length(_66); + float2 _86 = (_66 * (1.0 + (_67 * _74.barrel_distortion_intensity))) + float2(0.5); + if (_74.barrel_distortion_intensity > 0.0) { - float3 param_1 = _61; + float _96 = _86.x; + bool _97 = _96 < 0.0; + bool _104; + if (!_97) + { + _104 = _96 > 1.0; + } + else + { + _104 = _97; + } + bool _112; + if (!_104) + { + _112 = _86.y < 0.0; + } + else + { + _112 = _104; + } + bool _119; + if (!_112) + { + _119 = _86.y > 1.0; + } + else + { + _119 = _112; + } + if (_119) + { + out.frag_color = float4(0.0, 0.0, 0.0, 1.0); + return out; + } + } + float2 _145 = float2(_74.chromatic_aberration_intensity, 0.0); + float4 _147 = pptex.sample(ppsmp, (_86 + _145)); + float4 _154 = pptex.sample(ppsmp, _86); + float4 _165 = pptex.sample(ppsmp, (_86 - _145)); + float3 _175 = float4(_147.x, _154.y, _165.z, 1.0).xyz; + float3 param = _175; + float3 tonemapped = aces(param); + if (_74.tonemap > 0.5) + { + float3 param_1 = _175; tonemapped = aces(param_1); } else { - tonemapped = _61; + tonemapped = _175; } - float3 _106 = (((powr(tonemapped, float3(1.0 / _65.gamma)) - float3(0.5)) * fast::max(_65.contrast, 0.0)) + float3(0.5)) + float3(_65.exposure); - out.frag_color = float4(mix(float3(((0.2125000059604644775390625 * _106.x) + (0.7153999805450439453125 * _106.y)) + (0.07209999859333038330078125 * _106.z)), _106, float3(_65.saturation)), 1.0); + float3 _213 = (((powr(tonemapped, float3(1.0 / _74.gamma)) - float3(0.5)) * fast::max(_74.contrast, 0.0)) + float3(0.5)) + float3(_74.exposure); + float3 gammaCorrected = (mix(float3(((0.2125000059604644775390625 * _213.x) + (0.7153999805450439453125 * _213.y)) + (0.07209999859333038330078125 * _213.z)), _213, float3(_74.saturation)) * (1.0 - (smoothstep(0.0, _74.vignette_radius, _67) * _74.vignette_intensity))) * (1.0 - (((sin((in.texcoord.y * float(int2(pptex.get_width(), pptex.get_height()).y)) * _74.scanlines_density) * 0.5) + 0.5) * _74.scanlines_intensity)); + float2 param_2 = in.texcoord; + float3 _294 = gammaCorrected; + float3 _296 = _294 + float3((rand(param_2) - 0.5) * _74.film_grain_intensity); + gammaCorrected = _296; + out.frag_color = float4(_296, 1.0); return out; } @@ -449,40 +818,66 @@ fs_pp_source_metal_macos := u8.[ 0x73,0x61,0x74,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x66,0x6c,0x6f,0x61,0x74,0x20,0x67,0x61,0x6d,0x6d,0x61,0x3b,0x0a,0x20,0x20,0x20, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x3b,0x0a, - 0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, - 0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63, - 0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73, - 0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, - 0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62, - 0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e, - 0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x61,0x63, - 0x65,0x73,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x33,0x26,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c, - 0x61,0x6d,0x70,0x28,0x28,0x78,0x20,0x2a,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32, - 0x2e,0x35,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x30,0x34,0x36,0x33,0x32,0x35,0x36, - 0x38,0x33,0x35,0x39,0x33,0x37,0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x33,0x28,0x30,0x2e,0x30,0x32,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x33,0x32,0x39, - 0x34,0x34,0x37,0x37,0x34,0x36,0x32,0x37,0x36,0x38,0x35,0x35,0x34,0x36,0x38,0x37, - 0x35,0x29,0x29,0x29,0x20,0x2f,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x28,0x28,0x78, - 0x20,0x2a,0x20,0x32,0x2e,0x34,0x33,0x30,0x30,0x30,0x30,0x30,0x36,0x36,0x37,0x35, - 0x37,0x32,0x30,0x32,0x31,0x34,0x38,0x34,0x33,0x37,0x35,0x29,0x20,0x2b,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x38,0x39,0x39,0x39,0x39,0x39,0x37, - 0x33,0x37,0x37,0x33,0x39,0x35,0x36,0x32,0x39,0x38,0x38,0x32,0x38,0x31,0x32,0x35, - 0x29,0x29,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x31, - 0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34, - 0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, - 0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x69,0x67,0x6e,0x65,0x74, + 0x74,0x65,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x69,0x67,0x6e,0x65,0x74,0x74,0x65, + 0x5f,0x72,0x61,0x64,0x69,0x75,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x73,0x63,0x61,0x6e,0x6c,0x69,0x6e,0x65,0x73,0x5f,0x69,0x6e,0x74, + 0x65,0x6e,0x73,0x69,0x74,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x73,0x63,0x61,0x6e,0x6c,0x69,0x6e,0x65,0x73,0x5f,0x64,0x65,0x6e,0x73, + 0x69,0x74,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63, + 0x68,0x72,0x6f,0x6d,0x61,0x74,0x69,0x63,0x5f,0x61,0x62,0x65,0x72,0x72,0x61,0x74, + 0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x66,0x69,0x6c,0x6d,0x5f,0x67,0x72, + 0x61,0x69,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x62,0x61,0x72,0x72,0x65,0x6c,0x5f, + 0x64,0x69,0x73,0x74,0x6f,0x72,0x74,0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e, + 0x73,0x69,0x74,0x79,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74, + 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e, + 0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,0x65, + 0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a, + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f, + 0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77, + 0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f, + 0x61,0x74,0x33,0x20,0x61,0x63,0x65,0x73,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20, + 0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x26,0x20,0x78,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x61, + 0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,0x6d,0x70,0x28,0x28,0x78,0x20,0x2a,0x20,0x28, + 0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x35,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x30, + 0x34,0x36,0x33,0x32,0x35,0x36,0x38,0x33,0x35,0x39,0x33,0x37,0x35,0x29,0x20,0x2b, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x32,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x33,0x32,0x39,0x34,0x34,0x37,0x37,0x34,0x36,0x32,0x37,0x36,0x38, + 0x35,0x35,0x34,0x36,0x38,0x37,0x35,0x29,0x29,0x29,0x20,0x2f,0x20,0x28,0x28,0x78, + 0x20,0x2a,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x34,0x33,0x30,0x30,0x30, + 0x30,0x30,0x36,0x36,0x37,0x35,0x37,0x32,0x30,0x32,0x31,0x34,0x38,0x34,0x33,0x37, + 0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x38, + 0x39,0x39,0x39,0x39,0x39,0x37,0x33,0x37,0x37,0x33,0x39,0x35,0x36,0x32,0x39,0x38, + 0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x33,0x28,0x30,0x2e,0x31,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39, + 0x36,0x30,0x34,0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29, + 0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f, + 0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c, + 0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x72,0x61,0x6e,0x64,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20, + 0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x26,0x20,0x63,0x6f, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66, + 0x72,0x61,0x63,0x74,0x28,0x73,0x69,0x6e,0x28,0x64,0x6f,0x74,0x28,0x63,0x6f,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x31,0x32,0x2e,0x39,0x38,0x39,0x38,0x30, + 0x30,0x34,0x35,0x33,0x31,0x38,0x36,0x30,0x33,0x35,0x31,0x35,0x36,0x32,0x35,0x2c, + 0x20,0x37,0x38,0x2e,0x32,0x33,0x33,0x30,0x30,0x31,0x37,0x30,0x38,0x39,0x38,0x34, + 0x33,0x37,0x35,0x29,0x29,0x29,0x20,0x2a,0x20,0x34,0x33,0x37,0x35,0x38,0x2e,0x35, + 0x34,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d, 0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61, 0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20, 0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f, 0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63, - 0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x26,0x20,0x5f,0x36,0x35,0x20, + 0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x26,0x20,0x5f,0x37,0x34,0x20, 0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74, 0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20, 0x70,0x70,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, @@ -490,48 +885,140 @@ fs_pp_source_metal_macos := u8.[ 0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29, 0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x70, - 0x70,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x70,0x73,0x6d, - 0x70,0x2c,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x36,0x31,0x20, - 0x3d,0x20,0x5f,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x36, - 0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x74,0x6f, - 0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28, - 0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28, - 0x5f,0x36,0x35,0x2e,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x20,0x3e,0x20,0x30,0x2e, - 0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20, - 0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74, - 0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73, - 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d, - 0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70, - 0x65,0x64,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x30,0x36,0x20, - 0x3d,0x20,0x28,0x28,0x28,0x70,0x6f,0x77,0x72,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61, - 0x70,0x70,0x65,0x64,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30, - 0x20,0x2f,0x20,0x5f,0x36,0x35,0x2e,0x67,0x61,0x6d,0x6d,0x61,0x29,0x29,0x20,0x2d, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20, - 0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x5f,0x36,0x35,0x2e,0x63,0x6f, - 0x6e,0x74,0x72,0x61,0x73,0x74,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x36,0x35,0x2e,0x65,0x78,0x70,0x6f,0x73,0x75, - 0x72,0x65,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x28,0x6d,0x69,0x78,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x28,0x28,0x30,0x2e, - 0x32,0x31,0x32,0x35,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34, - 0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x36, - 0x2e,0x78,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x37,0x31,0x35,0x33,0x39,0x39,0x39, - 0x38,0x30,0x35,0x34,0x35,0x30,0x34,0x33,0x39,0x34,0x35,0x33,0x31,0x32,0x35,0x20, - 0x2a,0x20,0x5f,0x31,0x30,0x36,0x2e,0x79,0x29,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e, - 0x30,0x37,0x32,0x30,0x39,0x39,0x39,0x39,0x38,0x35,0x39,0x33,0x33,0x33,0x30,0x33, - 0x38,0x33,0x33,0x30,0x30,0x37,0x38,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30, - 0x36,0x2e,0x7a,0x29,0x29,0x2c,0x20,0x5f,0x31,0x30,0x36,0x2c,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x33,0x28,0x5f,0x36,0x35,0x2e,0x73,0x61,0x74,0x75,0x72,0x61,0x74,0x69, - 0x6f,0x6e,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, - + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x36,0x36,0x20,0x3d,0x20,0x69, + 0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x2d,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x5f,0x36,0x37,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68, + 0x28,0x5f,0x36,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x20,0x5f,0x38,0x36,0x20,0x3d,0x20,0x28,0x5f,0x36,0x36,0x20,0x2a,0x20,0x28, + 0x31,0x2e,0x30,0x20,0x2b,0x20,0x28,0x5f,0x36,0x37,0x20,0x2a,0x20,0x5f,0x37,0x34, + 0x2e,0x62,0x61,0x72,0x72,0x65,0x6c,0x5f,0x64,0x69,0x73,0x74,0x6f,0x72,0x74,0x69, + 0x6f,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x29,0x29,0x20, + 0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x37,0x34,0x2e,0x62,0x61,0x72,0x72,0x65, + 0x6c,0x5f,0x64,0x69,0x73,0x74,0x6f,0x72,0x74,0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x74, + 0x65,0x6e,0x73,0x69,0x74,0x79,0x20,0x3e,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20, + 0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x5f,0x39,0x36,0x20,0x3d,0x20,0x5f,0x38,0x36,0x2e,0x78,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x37,0x20, + 0x3d,0x20,0x5f,0x39,0x36,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x37, + 0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f, + 0x39,0x36,0x20,0x3e,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39, + 0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30, + 0x34,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d,0x20, + 0x5f,0x38,0x36,0x2e,0x79,0x20,0x3c,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65, + 0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x32,0x20,0x3d, + 0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31, + 0x31,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28, + 0x21,0x5f,0x31,0x31,0x32,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x31, + 0x39,0x20,0x3d,0x20,0x5f,0x38,0x36,0x2e,0x79,0x20,0x3e,0x20,0x31,0x2e,0x30,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31, + 0x31,0x39,0x20,0x3d,0x20,0x5f,0x31,0x31,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20, + 0x28,0x5f,0x31,0x31,0x39,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74, + 0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30, + 0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, + 0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x31,0x34, + 0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x37,0x34,0x2e,0x63, + 0x68,0x72,0x6f,0x6d,0x61,0x74,0x69,0x63,0x5f,0x61,0x62,0x65,0x72,0x72,0x61,0x74, + 0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x30, + 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, + 0x5f,0x31,0x34,0x37,0x20,0x3d,0x20,0x70,0x70,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d, + 0x70,0x6c,0x65,0x28,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x28,0x5f,0x38,0x36,0x20, + 0x2b,0x20,0x5f,0x31,0x34,0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x35,0x34,0x20,0x3d,0x20,0x70,0x70,0x74,0x65, + 0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20, + 0x5f,0x38,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, + 0x20,0x5f,0x31,0x36,0x35,0x20,0x3d,0x20,0x70,0x70,0x74,0x65,0x78,0x2e,0x73,0x61, + 0x6d,0x70,0x6c,0x65,0x28,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x28,0x5f,0x38,0x36, + 0x20,0x2d,0x20,0x5f,0x31,0x34,0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x37,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x28,0x5f,0x31,0x34,0x37,0x2e,0x78,0x2c,0x20,0x5f,0x31,0x35,0x34, + 0x2e,0x79,0x2c,0x20,0x5f,0x31,0x36,0x35,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29, + 0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61, + 0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61, + 0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x37,0x34,0x2e, + 0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x20,0x3e,0x20,0x30,0x2e,0x35,0x29,0x0a,0x20, + 0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x31, + 0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65, + 0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, + 0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20, + 0x3d,0x20,0x5f,0x31,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x31,0x33,0x20,0x3d,0x20, + 0x28,0x28,0x28,0x70,0x6f,0x77,0x72,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70, + 0x65,0x64,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f, + 0x20,0x5f,0x37,0x34,0x2e,0x67,0x61,0x6d,0x6d,0x61,0x29,0x29,0x20,0x2d,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20,0x66,0x61, + 0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x5f,0x37,0x34,0x2e,0x63,0x6f,0x6e,0x74, + 0x72,0x61,0x73,0x74,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x33,0x28,0x5f,0x37,0x34,0x2e,0x65,0x78,0x70,0x6f,0x73,0x75,0x72,0x65, + 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x67,0x61, + 0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65,0x64,0x20,0x3d,0x20,0x28, + 0x6d,0x69,0x78,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x28,0x28,0x30,0x2e,0x32, + 0x31,0x32,0x35,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,0x37, + 0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x20,0x2a,0x20,0x5f,0x32,0x31,0x33,0x2e, + 0x78,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x37,0x31,0x35,0x33,0x39,0x39,0x39,0x38, + 0x30,0x35,0x34,0x35,0x30,0x34,0x33,0x39,0x34,0x35,0x33,0x31,0x32,0x35,0x20,0x2a, + 0x20,0x5f,0x32,0x31,0x33,0x2e,0x79,0x29,0x29,0x20,0x2b,0x20,0x28,0x30,0x2e,0x30, + 0x37,0x32,0x30,0x39,0x39,0x39,0x39,0x38,0x35,0x39,0x33,0x33,0x33,0x30,0x33,0x38, + 0x33,0x33,0x30,0x30,0x37,0x38,0x31,0x32,0x35,0x20,0x2a,0x20,0x5f,0x32,0x31,0x33, + 0x2e,0x7a,0x29,0x29,0x2c,0x20,0x5f,0x32,0x31,0x33,0x2c,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x33,0x28,0x5f,0x37,0x34,0x2e,0x73,0x61,0x74,0x75,0x72,0x61,0x74,0x69,0x6f, + 0x6e,0x29,0x29,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x73,0x6d, + 0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x37, + 0x34,0x2e,0x76,0x69,0x67,0x6e,0x65,0x74,0x74,0x65,0x5f,0x72,0x61,0x64,0x69,0x75, + 0x73,0x2c,0x20,0x5f,0x36,0x37,0x29,0x20,0x2a,0x20,0x5f,0x37,0x34,0x2e,0x76,0x69, + 0x67,0x6e,0x65,0x74,0x74,0x65,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79, + 0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x28,0x28, + 0x73,0x69,0x6e,0x28,0x28,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64, + 0x2e,0x79,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x69,0x6e,0x74,0x32,0x28, + 0x70,0x70,0x74,0x65,0x78,0x2e,0x67,0x65,0x74,0x5f,0x77,0x69,0x64,0x74,0x68,0x28, + 0x29,0x2c,0x20,0x70,0x70,0x74,0x65,0x78,0x2e,0x67,0x65,0x74,0x5f,0x68,0x65,0x69, + 0x67,0x68,0x74,0x28,0x29,0x29,0x2e,0x79,0x29,0x29,0x20,0x2a,0x20,0x5f,0x37,0x34, + 0x2e,0x73,0x63,0x61,0x6e,0x6c,0x69,0x6e,0x65,0x73,0x5f,0x64,0x65,0x6e,0x73,0x69, + 0x74,0x79,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35, + 0x29,0x20,0x2a,0x20,0x5f,0x37,0x34,0x2e,0x73,0x63,0x61,0x6e,0x6c,0x69,0x6e,0x65, + 0x73,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x32,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x39,0x34, + 0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x43,0x6f,0x72,0x72,0x65,0x63,0x74,0x65, + 0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32, + 0x39,0x36,0x20,0x3d,0x20,0x5f,0x32,0x39,0x34,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x33,0x28,0x28,0x72,0x61,0x6e,0x64,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32, + 0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x37,0x34,0x2e,0x66, + 0x69,0x6c,0x6d,0x5f,0x67,0x72,0x61,0x69,0x6e,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73, + 0x69,0x74,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x61,0x6d,0x6d,0x61,0x43, + 0x6f,0x72,0x72,0x65,0x63,0x74,0x65,0x64,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x32,0x39, + 0x36,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, ]; postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc: sg_shader_desc; @@ -548,9 +1035,9 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.attrs[1].glsl_name = "uv"; desc.uniform_blocks[0].stage = .FRAGMENT; desc.uniform_blocks[0].layout = .STD140; - desc.uniform_blocks[0].size = 32; + desc.uniform_blocks[0].size = 48; desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 3; desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "post_process_config"; desc.images[0].stage = .FRAGMENT; desc.images[0].multisampled = false; @@ -573,9 +1060,9 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.attrs[1].glsl_name = "uv"; desc.uniform_blocks[0].stage = .FRAGMENT; desc.uniform_blocks[0].layout = .STD140; - desc.uniform_blocks[0].size = 32; + desc.uniform_blocks[0].size = 48; desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 3; desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "post_process_config"; desc.images[0].stage = .FRAGMENT; desc.images[0].multisampled = false; @@ -596,7 +1083,7 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.attrs[1].base_type = .FLOAT; desc.uniform_blocks[0].stage = .FRAGMENT; desc.uniform_blocks[0].layout = .STD140; - desc.uniform_blocks[0].size = 32; + desc.uniform_blocks[0].size = 48; desc.uniform_blocks[0].msl_buffer_n = 0; desc.images[0].stage = .FRAGMENT; desc.images[0].multisampled = false; diff --git a/src/shaders/shader_post_process_main.glsl b/src/shaders/shader_post_process_main.glsl index 3712717..4a77de1 100644 --- a/src/shaders/shader_post_process_main.glsl +++ b/src/shaders/shader_post_process_main.glsl @@ -23,6 +23,13 @@ layout(binding=0) uniform post_process_config { float saturation; float gamma; float tonemap; + float vignette_intensity; + float vignette_radius; + float scanlines_intensity; + float scanlines_density; + float chromatic_aberration_intensity; + float film_grain_intensity; + float barrel_distortion_intensity; }; vec3 aces(vec3 x) { @@ -34,8 +41,30 @@ vec3 aces(vec3 x) { return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0); } +float rand(vec2 co){ + return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); +} + void main() { - vec4 sampled = texture(sampler2D(pptex, ppsmp), texcoord.xy); + vec2 distorted_texcoord = texcoord; + float barrel_dist = length(texcoord - 0.5); + distorted_texcoord -= 0.5; + distorted_texcoord *= 1.0 + barrel_dist * barrel_distortion_intensity; + distorted_texcoord += 0.5; + + if (barrel_distortion_intensity > 0.0) { + if (distorted_texcoord.x < 0.0 || distorted_texcoord.x > 1.0 || distorted_texcoord.y < 0.0 || distorted_texcoord.y > 1.0) { + frag_color = vec4(0.0, 0.0, 0.0, 1.0); + return; + } + } + + vec4 sampled = vec4(0.0); + float r = texture(sampler2D(pptex, ppsmp), distorted_texcoord + vec2(chromatic_aberration_intensity, 0.0)).r; + float g = texture(sampler2D(pptex, ppsmp), distorted_texcoord).g; + float b = texture(sampler2D(pptex, ppsmp), distorted_texcoord - vec2(chromatic_aberration_intensity, 0.0)).b; + sampled = vec4(r, g, b, 1.0); + vec3 tonemapped = aces(sampled.xyz); if(tonemap > 0.5) { tonemapped = aces(sampled.xyz); @@ -50,6 +79,15 @@ void main() { float lum = (0.2125 * gammaCorrected.r) + (0.7154 * gammaCorrected.g) + (0.0721 * gammaCorrected.b); vec3 brtColor = vec3(lum, lum, lum); gammaCorrected.rgb = mix(brtColor, gammaCorrected.rgb, saturation); + + float vignette = 1.0 - smoothstep(0.0, vignette_radius, length(texcoord - vec2(0.5))) * vignette_intensity; + gammaCorrected.rgb *= vignette; + + float scanline = 1.0 - (sin(texcoord.y * textureSize(sampler2D(pptex, ppsmp), 0).y * scanlines_density) * 0.5 + 0.5) * scanlines_intensity; + gammaCorrected.rgb *= scanline; + + float grain = (rand(texcoord) - 0.5) * film_grain_intensity; + gammaCorrected.rgb += grain; frag_color = vec4(gammaCorrected, 1.0); }