From 966513a64d97cbdc843b0038c8ed90c336f47370 Mon Sep 17 00:00:00 2001 From: Katajisto Date: Wed, 8 Oct 2025 22:30:18 +0300 Subject: [PATCH] work on post processing pipeline, still some bugs --- src/platform_specific/common.jai | 2 +- src/rendering/backend_sokol.jai | 22 +- src/rendering/helpers.jai | 24 + src/rendering/pipelines.jai | 162 +++- src/rendering/tasks.jai | 8 +- src/shaders/jai/shader_plane.jai | 768 ++++++++++--------- src/shaders/jai/shader_post_process_main.jai | 325 ++++++++ src/shaders/shader_plane.glsl | 5 +- src/shaders/shader_post_process_main.glsl | 26 + src/ui/ui.jai | 4 - 10 files changed, 942 insertions(+), 404 deletions(-) create mode 100644 src/shaders/jai/shader_post_process_main.jai create mode 100644 src/shaders/shader_post_process_main.glsl diff --git a/src/platform_specific/common.jai b/src/platform_specific/common.jai index cc7e643..b5e5b59 100644 --- a/src/platform_specific/common.jai +++ b/src/platform_specific/common.jai @@ -38,7 +38,7 @@ sapp_init :: () { window_title = wi.title, // icon = .{ sokol_default = true }, logger = .{ func = slog_func }, - sample_count = platconf.sample_count, + sample_count = 1, // I think I'll end up pixelifying the whole thing, so I don't think we need MSAA. })); } } diff --git a/src/rendering/backend_sokol.jai b/src/rendering/backend_sokol.jai index 1f22ede..76fa11a 100644 --- a/src/rendering/backend_sokol.jai +++ b/src/rendering/backend_sokol.jai @@ -139,7 +139,7 @@ backend_draw_ground :: (wc: *World_Config) { vs_params : Plane_Vs_Params; world_conf : Plane_World_Config; plane_data : Plane_Data; - w, h := get_window_size(); + w, h := get_render_size(); plane_data.screen_w = w; plane_data.screen_h = h; @@ -147,6 +147,8 @@ backend_draw_ground :: (wc: *World_Config) { vs_params.mvp = mvp.floats; sg_apply_pipeline(gPipelines.plane.pipeline); + gPipelines.plane.bind.samplers[2] = g_shadowmap_sampler; + gPipelines.plane.bind.images[2] = g_shadowmap; sg_apply_bindings(*gPipelines.plane.bind); sg_apply_uniforms(UB_plane_vs_params, *(sg_range.{ ptr = *vs_params, size = size_of(type_of(vs_params)) })); sg_apply_uniforms(UB_plane_world_config, *(sg_range.{ptr = *world_conf, size = size_of(type_of(world_conf))})); @@ -177,22 +179,30 @@ backend_process_command_buckets :: () { current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. // 3. Main pass - sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() })); + sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = g_rendertex_attachments})); for render_command_buckets.main { backend_handle_command(it); } + sg_end_pass(); current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. - // 3.2 Draw the UI. @ToDo: This should probably happen after post processing once we have that. - // Also, it's kind of stupid that this has it's own command system. It should be moved to using the - // same backend commands we are using for other rendering. + + // Begin main pass + sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() })); + + // Draw the render texture and do post processing: + sg_apply_pipeline(gPipelines.postprocess.pipeline); + gPipelines.postprocess.bind.images[0] = g_rendertex; + sg_apply_bindings(*gPipelines.postprocess.bind); + sg_draw(0, 6, 1); + sgl_defaults(); sgl_matrix_mode_projection(); sgl_ortho(0.0, sapp_widthf(), sapp_heightf(), 0.0, -1.0, +1.0); arb_tri_flush(); // End the main pass - sg_end_pass(); + sg_end_pass(); sg_commit(); diff --git a/src/rendering/helpers.jai b/src/rendering/helpers.jai index 226b17c..867203d 100644 --- a/src/rendering/helpers.jai +++ b/src/rendering/helpers.jai @@ -30,3 +30,27 @@ create_set_cam_rendering_task :: (cam: Camera) { camtask := Rendering_Task_Set_Camera.{type = .SET_CAMERA, camera = cam}; add_rendering_task(camtask); } + +get_low_res :: (width: s32, height: s32, max_dimension: s32 = 720) -> (s32, s32) { + if width == 0 || height == 0 { + return 0, 0; + } + aspect_ratio := cast(float)width / cast(float)height; + w: s32; + h: s32; + if width > height { + w = max_dimension; + h = cast(s32)floor(cast(float)w / aspect_ratio); + } else { + h = max_dimension; + w = cast(s32)floor(cast(float)h * aspect_ratio); + } + + return w, h; +} + +get_render_size :: () -> (s32, s32) { + w,h := get_window_size(); + wl, hl := get_low_res(w,h, 360); + return wl, hl; +} diff --git a/src/rendering/pipelines.jai b/src/rendering/pipelines.jai index 9b7184a..2c97719 100644 --- a/src/rendering/pipelines.jai +++ b/src/rendering/pipelines.jai @@ -8,9 +8,15 @@ Pipeline_Binding :: struct { } g_specular_lut : sg_image; -g_shadowmap : sg_image; -g_shadowmap_img : sg_image; // Apparently we are requried to have one of these, sigh... we don't use this. + +g_shadowmap : sg_image; +g_shadowmap_img : sg_image; g_shadowmap_attachments : sg_attachments; +g_shadowmap_sampler : sg_sampler; + +g_rendertex : sg_image; +g_rendertex_depth : sg_image; +g_rendertex_attachments : sg_attachments; gPipelines : struct { @@ -31,6 +37,37 @@ gPipelines : struct { // Renders the ground plane. plane : Pipeline_Binding; + postprocess : Pipeline_Binding; +} + +create_final_image :: () { + // @ToDo: Some smarter logic for this. + w,h := get_render_size(); + + if g_rendertex.id != INVALID_ID then sg_destroy_image(g_rendertex); + if g_rendertex_depth.id != INVALID_ID then sg_destroy_image(g_rendertex); + + img_desc := sg_image_desc.{ + width = w, + height = h, + pixel_format = .RGBA32F, + render_target = true, + }; + depth_desc := sg_image_desc.{ + width = w, + height = h, + pixel_format = .DEPTH, + render_target = true, + }; + g_rendertex = sg_make_image(*img_desc); + g_rendertex_depth = sg_make_image(*depth_desc); + attachmentsDesc : sg_attachments_desc; + attachmentsDesc = .{ + colors[0].image = g_rendertex, + depth_stencil.image = g_rendertex_depth, + }; + // sg_destroy_attachments(g_rendertex_attachments); + g_rendertex_attachments = sg_make_attachments(*attachmentsDesc); } create_shadowmap_image :: () { @@ -42,13 +79,13 @@ create_shadowmap_image :: () { depth_desc := sg_image_desc.{ width = w, height = h, - pixel_format = .DEPTH_STENCIL, + pixel_format = .DEPTH, render_target = true, }; img_desc := sg_image_desc.{ width = w, height = h, - pixel_format = .RGBA8, + pixel_format = .RGBA32F, render_target = true, }; g_shadowmap = sg_make_image(*depth_desc); @@ -68,7 +105,10 @@ create_pipelines :: () { create_trile_pipeline(); create_sky_pipeline(); create_plane_pipeline(); + create_postprocess_pipeline(); + create_shadowmap_image(); + create_final_image(); } TRIXEL_SIZE_HALF : float : 1.0/32.0; @@ -82,8 +122,6 @@ Position_Color :: struct { } create_trixel_pipeline :: () { - platconf := get_plat_conf(); - pipeline: sg_pipeline_desc; shader_desc := trixel_shader_desc(sg_query_backend()); pipeline.shader = sg_make_shader(*shader_desc); @@ -99,20 +137,19 @@ create_trixel_pipeline :: () { pipeline.depth = .{ write_enabled = true, compare = .LESS_EQUAL, + pixel_format = .DEPTH, }; color_state := sg_color_target_state.{ - pixel_format = .RGBA8, + pixel_format = .RGBA32F, blend = .{ enabled = true, src_factor_rgb = .SRC_ALPHA, dst_factor_rgb = .ONE_MINUS_SRC_ALPHA } + }; - pipeline.sample_count = platconf.sample_count; - - vertices : [24]Vector3 = .[ .{-TRIXEL_SIZE/2, -TRIXEL_SIZE/2, TRIXEL_SIZE/2}, .{TRIXEL_SIZE/2, -TRIXEL_SIZE/2, TRIXEL_SIZE/2}, @@ -201,7 +238,6 @@ create_trixel_pipeline :: () { } create_trile_pipeline :: () { - platconf := get_plat_conf(); pipeline: sg_pipeline_desc; shader_desc := trile_shader_desc(sg_query_backend()); pipeline.shader = sg_make_shader(*shader_desc); @@ -219,11 +255,11 @@ create_trile_pipeline :: () { pipeline.depth = .{ write_enabled = true, compare = .LESS_EQUAL, + pixel_format = .DEPTH, }; - pipeline.sample_count = platconf.sample_count; color_state := sg_color_target_state.{ - pixel_format = .RGBA8, + pixel_format = .RGBA32F, blend = .{ enabled = true, src_factor_rgb = .SRC_ALPHA, @@ -246,22 +282,21 @@ create_trile_pipeline :: () { } create_sky_pipeline :: () { - platconf := get_plat_conf(); pipeline: sg_pipeline_desc; shader_desc := sky_shader_desc(sg_query_backend()); pipeline.shader = sg_make_shader(*shader_desc); pipeline.layout.buffers[0].stride = 4*3; - pipeline.sample_count = platconf.sample_count; pipeline.layout.attrs[ATTR_sky_position] = .{ format = .FLOAT3, buffer_index = 0 }; pipeline.index_type = .UINT16; pipeline.depth = .{ write_enabled = true, compare = .LESS_EQUAL, + pixel_format = .DEPTH, }; color_state := sg_color_target_state.{ - pixel_format = .RGBA8, + pixel_format = .RGBA32F, blend = .{ enabled = true, src_factor_rgb = .SRC_ALPHA, @@ -328,49 +363,40 @@ create_sky_pipeline :: () { // @ToDo: This needs to be redone when the window is resized; create_plane_pipeline_reflection_images :: () { - platconf := get_plat_conf(); binding := *gPipelines.plane.bind; if binding.images[4].id != INVALID_ID then sg_destroy_image(binding.images[4]); if binding.images[5].id != INVALID_ID then sg_destroy_image(binding.images[5]); if binding.images[0].id != INVALID_ID then sg_destroy_image(binding.images[0]); - w, h := get_window_size(); + w, h := get_render_size(); img_desc := sg_image_desc.{ width = w, height = h, - pixel_format = .RGBA8, + pixel_format = .RGBA32F, render_target = true, }; depth_desc := sg_image_desc.{ width = w, height = h, - pixel_format = .DEPTH_STENCIL, + pixel_format = .DEPTH, render_target = true, }; binding.images[4] = sg_make_image(*img_desc); img_desc.sample_count = 1; binding.images[0] = sg_make_image(*img_desc); binding.images[5] = sg_make_image(*depth_desc); + attachmentsDesc : sg_attachments_desc; - if platconf.sample_count > 1 { - attachmentsDesc = .{ - colors[0].image = gPipelines.plane.bind.images[4], - resolves[0].image = gPipelines.plane.bind.images[0], - depth_stencil.image = gPipelines.plane.bind.images[5], - }; - } else { - attachmentsDesc = .{ - colors[0].image = gPipelines.plane.bind.images[0], - depth_stencil.image = gPipelines.plane.bind.images[5], - }; - } + attachmentsDesc = .{ + colors[0].image = gPipelines.plane.bind.images[0], + depth_stencil.image = gPipelines.plane.bind.images[5], + }; sg_destroy_attachments(gPipelines.plane.attachments); gPipelines.plane.attachments = sg_make_attachments(*attachmentsDesc); } create_plane_pipeline :: () { - platconf := get_plat_conf(); pipeline: sg_pipeline_desc; shader_desc := plane_shader_desc(sg_query_backend()); pipeline.shader = sg_make_shader(*shader_desc); @@ -382,11 +408,11 @@ create_plane_pipeline :: () { pipeline.depth = .{ write_enabled = true, compare = .LESS_EQUAL, - pixel_format = .DEPTH_STENCIL + pixel_format = .DEPTH }; color_state := sg_color_target_state.{ - pixel_format = .RGBA8, + pixel_format = .RGBA32F, blend = .{ enabled = true, src_factor_rgb = .SRC_ALPHA, @@ -406,7 +432,6 @@ create_plane_pipeline :: () { 0, 2, 3, ]; - pipeline.sample_count = platconf.sample_count; pipeline.color_count = 1; pipeline.colors[0] = color_state; @@ -432,6 +457,14 @@ create_plane_pipeline :: () { min_filter = .NEAREST, mag_filter = .NEAREST, })); + + g_shadowmap_sampler = sg_make_sampler(*(sg_sampler_desc.{ + wrap_u = .CLAMP_TO_EDGE, + wrap_v = .CLAMP_TO_EDGE, + min_filter = .LINEAR, + mag_filter = .LINEAR, + compare = .LESS, + })); gPipelines.plane.bind.samplers[1] = sg_make_sampler(*(sg_sampler_desc.{ wrap_u = .CLAMP_TO_EDGE, @@ -462,7 +495,6 @@ create_arbtri_pipeline :: () { pipeline.layout.attrs[ATTR_triangle_position] = .{ format = .FLOAT3 }; pipeline.layout.attrs[ATTR_triangle_color0] = .{ format = .FLOAT4 }; pipeline.layout.attrs[ATTR_triangle_uv] = .{ format = .FLOAT2 }; - pipeline.sample_count = platconf.sample_count; color_state := sg_color_target_state.{ pixel_format = .RGBA8, @@ -488,3 +520,59 @@ create_arbtri_pipeline :: () { })); } + +create_postprocess_pipeline :: () { + platconf := get_plat_conf(); + pipeline: sg_pipeline_desc; + shader_desc := postprocess_shader_desc(sg_query_backend()); + pipeline.shader = sg_make_shader(*shader_desc); + + pipeline.layout.attrs[ATTR_postprocess_position] = .{ format = .FLOAT2 }; + pipeline.layout.attrs[ATTR_postprocess_uv] = .{ format = .FLOAT2 }; + pipeline.index_type = .UINT16; + + color_state := sg_color_target_state.{ + pixel_format = .RGBA8, + blend = .{ + enabled = true, + src_factor_rgb = .SRC_ALPHA, + dst_factor_rgb = .ONE_MINUS_SRC_ALPHA + } + }; + + pipeline.color_count = 1; + pipeline.colors[0] = color_state; + + gPipelines.postprocess.pipeline = sg_make_pipeline(*pipeline); + + quad_vertices : [16]float = .[ + -1.0, 1.0, 0.0, 1.0, // top-let + -1.0, -1.0, 0.0, 0.0, // bottom-let + 1.0, -1.0, 1.0, 0.0, // bottom-right + 1.0, 1.0, 1.0, 1.0, // top-right + ]; + quad_indices : [6]u16 = .[ + 0, 1, 2, 0, 2, 3 + ]; + + vbuffer := sg_buffer_desc.{ size = size_of(float) * 16, data = .{ + ptr = quad_vertices.data, + size = 16 * 4 + }}; + ibuffer := sg_buffer_desc.{ size = size_of(u16) * 6, data = .{ + ptr = quad_indices.data, + size = 6 * 2 + }, + type = .INDEXBUFFER, + }; + + gPipelines.postprocess.bind.vertex_buffers[0] = sg_make_buffer(*vbuffer); + gPipelines.postprocess.bind.index_buffer = sg_make_buffer(*ibuffer); + gPipelines.postprocess.bind.samplers[0] = sg_make_sampler(*(sg_sampler_desc.{ + wrap_u = .CLAMP_TO_EDGE, + wrap_v = .CLAMP_TO_EDGE, + min_filter = .NEAREST, + mag_filter = .NEAREST, + })); + +} diff --git a/src/rendering/tasks.jai b/src/rendering/tasks.jai index 05da6b5..3b6a71c 100644 --- a/src/rendering/tasks.jai +++ b/src/rendering/tasks.jai @@ -2,13 +2,13 @@ Rendering_Task_Type :: enum { INVALID; - GROUND; + GROUND; // We need to add an ability to invalidate buffer here too. SKY; SET_CAMERA; - TRILE; // not implemented yet + TRILE; // We need to add an ability to invalidate buffer instead of updating it constantly. Also probably have a buffer for static world triles and one for moving ones. TRIXELS; - SPRITE; // not implemented yet - PARTICLES; // not implemented yet + SPRITE; + PARTICLES; }; Rendering_Task :: struct { diff --git a/src/shaders/jai/shader_plane.jai b/src/shaders/jai/shader_plane.jai index abfce75..02fbc89 100644 --- a/src/shaders/jai/shader_plane.jai +++ b/src/shaders/jai/shader_plane.jai @@ -34,12 +34,20 @@ Sample type: .FLOAT Multisampled: false Bind slot: IMG_groundtex => 1 + Image 'shadow': + Image type: ._2D + Sample type: .DEPTH + Multisampled: false + Bind slot: IMG_shadow => 2 Sampler 'refsmp': Type: .FILTERING Bind slot: SMP_refsmp => 0 Sampler 'groundsmp': Type: .FILTERING Bind slot: SMP_groundsmp => 1 + Sampler 'shadowsmp': + Type: .COMPARISON + Bind slot: SMP_shadowsmp => 2 */ ATTR_plane_position :: 0; UB_plane_vs_params :: 0; @@ -47,8 +55,10 @@ UB_plane_data :: 2; UB_plane_world_config :: 1; IMG_reftex :: 0; IMG_groundtex :: 1; +IMG_shadow :: 2; SMP_refsmp :: 0; SMP_groundsmp :: 1; +SMP_shadowsmp :: 2; Plane_Vs_Params :: struct { mvp: [16]float; }; @@ -148,10 +158,11 @@ vs_plane_source_glsl430 := u8.[ float grassDensity; }; - uniform plane_world_config _313; + uniform plane_world_config _324; layout(binding = 16) uniform sampler2D reftex_refsmp; layout(binding = 17) uniform sampler2D groundtex_groundsmp; + layout(binding = 18) uniform sampler2DShadow shadow_shadowsmp; layout(location = 0) in vec4 pos; layout(location = 0) out vec4 frag_color; @@ -227,15 +238,15 @@ vs_plane_source_glsl430 := u8.[ vec4 param_13 = _220; float param_14 = float(sign2(param_11)); float param_15 = float(sign2(param_12)); - vec3 _297 = vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); - vec3 _304 = mix(get_ground_sample(param_8, param_9, param_10), get_ground_sample(param_13, param_14, param_15), _297); - if (_313.planeType == 1) + float _303 = texture(shadow_shadowsmp, vec3(vec3(0.0).xy, 0.0)); + vec3 _308 = vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); + if (_324.planeType == 1) { - frag_color = vec4(mix(mix(get_ground_sample(param, param_1, param_2), get_ground_sample(param_4, param_5, param_6), _297), _304, vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); + frag_color = vec4(mix(mix(get_ground_sample(param, param_1, param_2), get_ground_sample(param_4, param_5, param_6), _308), mix(get_ground_sample(param_8, param_9, param_10), get_ground_sample(param_13, param_14, param_15), _308), vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); } else { - frag_color = vec4(_304, 1.0); + frag_color = vec4(_303, _303, _303, 1.0); } } @@ -266,7 +277,7 @@ fs_plane_source_glsl430 := u8.[ 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x67,0x72,0x61,0x73,0x73, 0x44,0x65,0x6e,0x73,0x69,0x74,0x79,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69, 0x66,0x6f,0x72,0x6d,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x77,0x6f,0x72,0x6c,0x64, - 0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x20,0x5f,0x33,0x31,0x33,0x3b,0x0a,0x0a,0x6c, + 0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x20,0x5f,0x33,0x32,0x34,0x3b,0x0a,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,0x72,0x65,0x66,0x74,0x65,0x78,0x5f,0x72,0x65,0x66, @@ -274,177 +285,185 @@ fs_plane_source_glsl430 := u8.[ 0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72, 0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x72,0x6f,0x75, 0x6e,0x64,0x74,0x65,0x78,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x3b, - 0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70, - 0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74, - 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63, - 0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x31,0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x69,0x6e,0x74,0x20,0x69, - 0x64,0x78,0x3b,0x0a,0x0a,0x75,0x69,0x6e,0x74,0x20,0x6d,0x75,0x72,0x6d,0x75,0x72, - 0x48,0x61,0x73,0x68,0x31,0x32,0x28,0x69,0x6e,0x6f,0x75,0x74,0x20,0x75,0x76,0x65, - 0x63,0x32,0x20,0x73,0x72,0x63,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72, - 0x63,0x20,0x2a,0x3d,0x20,0x75,0x76,0x65,0x63,0x32,0x28,0x31,0x35,0x34,0x30,0x34, - 0x38,0x33,0x34,0x37,0x37,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72,0x63, - 0x20,0x5e,0x3d,0x20,0x28,0x73,0x72,0x63,0x20,0x3e,0x3e,0x20,0x75,0x76,0x65,0x63, - 0x32,0x28,0x32,0x34,0x75,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72,0x63, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20, + 0x3d,0x20,0x31,0x38,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61, + 0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x53,0x68,0x61,0x64,0x6f,0x77,0x20,0x73,0x68, + 0x61,0x64,0x6f,0x77,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f, + 0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79, + 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31, + 0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x69,0x6e,0x74,0x20,0x69,0x64, + 0x78,0x3b,0x0a,0x0a,0x75,0x69,0x6e,0x74,0x20,0x6d,0x75,0x72,0x6d,0x75,0x72,0x48, + 0x61,0x73,0x68,0x31,0x32,0x28,0x69,0x6e,0x6f,0x75,0x74,0x20,0x75,0x76,0x65,0x63, + 0x32,0x20,0x73,0x72,0x63,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72,0x63, 0x20,0x2a,0x3d,0x20,0x75,0x76,0x65,0x63,0x32,0x28,0x31,0x35,0x34,0x30,0x34,0x38, - 0x33,0x34,0x37,0x37,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74, - 0x20,0x5f,0x36,0x34,0x20,0x3d,0x20,0x28,0x28,0x33,0x37,0x34,0x34,0x35,0x34,0x36, - 0x37,0x33,0x39,0x75,0x20,0x5e,0x20,0x73,0x72,0x63,0x2e,0x78,0x29,0x20,0x2a,0x20, - 0x31,0x35,0x34,0x30,0x34,0x38,0x33,0x34,0x37,0x37,0x75,0x29,0x20,0x5e,0x20,0x73, - 0x72,0x63,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f, - 0x37,0x31,0x20,0x3d,0x20,0x28,0x5f,0x36,0x34,0x20,0x5e,0x20,0x28,0x5f,0x36,0x34, - 0x20,0x3e,0x3e,0x20,0x31,0x33,0x75,0x29,0x29,0x20,0x2a,0x20,0x31,0x35,0x34,0x30, - 0x34,0x38,0x33,0x34,0x37,0x37,0x75,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, - 0x75,0x72,0x6e,0x20,0x5f,0x37,0x31,0x20,0x5e,0x20,0x28,0x5f,0x37,0x31,0x20,0x3e, - 0x3e,0x20,0x31,0x35,0x75,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x68,0x61,0x73,0x68,0x31,0x32,0x28,0x76,0x65,0x63,0x32,0x20,0x73,0x72,0x63, - 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x65,0x63,0x32,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x42,0x69,0x74,0x73,0x54, - 0x6f,0x55,0x69,0x6e,0x74,0x28,0x73,0x72,0x63,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x75,0x69,0x6e,0x74,0x20,0x5f,0x38,0x34,0x20,0x3d,0x20,0x6d,0x75,0x72,0x6d,0x75, - 0x72,0x48,0x61,0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x75,0x69,0x6e,0x74,0x42, - 0x69,0x74,0x73,0x54,0x6f,0x46,0x6c,0x6f,0x61,0x74,0x28,0x28,0x5f,0x38,0x34,0x20, - 0x26,0x20,0x38,0x33,0x38,0x38,0x36,0x30,0x37,0x75,0x29,0x20,0x7c,0x20,0x31,0x30, - 0x36,0x35,0x33,0x35,0x33,0x32,0x31,0x36,0x75,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x33,0x20,0x67,0x65,0x74,0x5f,0x67,0x72, - 0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x76,0x65,0x63,0x34, - 0x20,0x70,0x6f,0x73,0x5f,0x31,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69, - 0x72,0x58,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x72,0x59,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x36,0x36,0x20, - 0x3d,0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74,0x63,0x68,0x28,0x67,0x72,0x6f, - 0x75,0x6e,0x64,0x74,0x65,0x78,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70, - 0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x66,0x6c,0x6f,0x6f, - 0x72,0x28,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x20,0x2b,0x20,0x64,0x69,0x72,0x58, - 0x29,0x20,0x2b,0x20,0x35,0x30,0x30,0x2e,0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28, - 0x66,0x6c,0x6f,0x6f,0x72,0x28,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x7a,0x20,0x2b,0x20, - 0x64,0x69,0x72,0x59,0x29,0x20,0x2b,0x20,0x35,0x30,0x30,0x2e,0x30,0x29,0x29,0x2c, - 0x20,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x20,0x3d,0x20,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x7a,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x20,0x3d,0x20,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x7a,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x36,0x36,0x2e,0x7a,0x20,0x3d,0x3d,0x20,0x31, - 0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65, - 0x74,0x63,0x68,0x28,0x72,0x65,0x66,0x74,0x65,0x78,0x5f,0x72,0x65,0x66,0x73,0x6d, - 0x70,0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f, - 0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2e,0x78,0x29,0x2c,0x20,0x69,0x6e, - 0x74,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x64,0x61, - 0x74,0x61,0x5b,0x30,0x5d,0x2e,0x79,0x29,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x46,0x72, - 0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2e,0x79,0x29,0x29,0x2c,0x20,0x30,0x29,0x2e, - 0x78,0x79,0x7a,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20, - 0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32, - 0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x38,0x30, - 0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35, - 0x30,0x37,0x38,0x31,0x32,0x35,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,0x69,0x66,0x20,0x28,0x5f,0x31,0x36,0x36,0x2e,0x78, - 0x20,0x3d,0x3d,0x20,0x31,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72, - 0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x38,0x30,0x30, + 0x33,0x34,0x37,0x37,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72,0x63,0x20, + 0x5e,0x3d,0x20,0x28,0x73,0x72,0x63,0x20,0x3e,0x3e,0x20,0x75,0x76,0x65,0x63,0x32, + 0x28,0x32,0x34,0x75,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x72,0x63,0x20, + 0x2a,0x3d,0x20,0x75,0x76,0x65,0x63,0x32,0x28,0x31,0x35,0x34,0x30,0x34,0x38,0x33, + 0x34,0x37,0x37,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, + 0x5f,0x36,0x34,0x20,0x3d,0x20,0x28,0x28,0x33,0x37,0x34,0x34,0x35,0x34,0x36,0x37, + 0x33,0x39,0x75,0x20,0x5e,0x20,0x73,0x72,0x63,0x2e,0x78,0x29,0x20,0x2a,0x20,0x31, + 0x35,0x34,0x30,0x34,0x38,0x33,0x34,0x37,0x37,0x75,0x29,0x20,0x5e,0x20,0x73,0x72, + 0x63,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x37, + 0x31,0x20,0x3d,0x20,0x28,0x5f,0x36,0x34,0x20,0x5e,0x20,0x28,0x5f,0x36,0x34,0x20, + 0x3e,0x3e,0x20,0x31,0x33,0x75,0x29,0x29,0x20,0x2a,0x20,0x31,0x35,0x34,0x30,0x34, + 0x38,0x33,0x34,0x37,0x37,0x75,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x20,0x5f,0x37,0x31,0x20,0x5e,0x20,0x28,0x5f,0x37,0x31,0x20,0x3e,0x3e, + 0x20,0x31,0x35,0x75,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x68,0x61,0x73,0x68,0x31,0x32,0x28,0x76,0x65,0x63,0x32,0x20,0x73,0x72,0x63,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x42,0x69,0x74,0x73,0x54,0x6f, + 0x55,0x69,0x6e,0x74,0x28,0x73,0x72,0x63,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, + 0x69,0x6e,0x74,0x20,0x5f,0x38,0x34,0x20,0x3d,0x20,0x6d,0x75,0x72,0x6d,0x75,0x72, + 0x48,0x61,0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x75,0x69,0x6e,0x74,0x42,0x69, + 0x74,0x73,0x54,0x6f,0x46,0x6c,0x6f,0x61,0x74,0x28,0x28,0x5f,0x38,0x34,0x20,0x26, + 0x20,0x38,0x33,0x38,0x38,0x36,0x30,0x37,0x75,0x29,0x20,0x7c,0x20,0x31,0x30,0x36, + 0x35,0x33,0x35,0x33,0x32,0x31,0x36,0x75,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x3b, + 0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x33,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f, + 0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x76,0x65,0x63,0x34,0x20, + 0x70,0x6f,0x73,0x5f,0x31,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x72, + 0x58,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x72,0x59,0x29,0x0a,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x36,0x36,0x20,0x3d, + 0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74,0x63,0x68,0x28,0x67,0x72,0x6f,0x75, + 0x6e,0x64,0x74,0x65,0x78,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x2c, + 0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x66,0x6c,0x6f,0x6f,0x72, + 0x28,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x20,0x2b,0x20,0x64,0x69,0x72,0x58,0x29, + 0x20,0x2b,0x20,0x35,0x30,0x30,0x2e,0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x66, + 0x6c,0x6f,0x6f,0x72,0x28,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x7a,0x20,0x2b,0x20,0x64, + 0x69,0x72,0x59,0x29,0x20,0x2b,0x20,0x35,0x30,0x30,0x2e,0x30,0x29,0x29,0x2c,0x20, + 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x20,0x3d,0x20,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x7a,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20, + 0x3d,0x20,0x70,0x6f,0x73,0x5f,0x31,0x2e,0x78,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x69,0x66,0x20,0x28,0x5f,0x31,0x36,0x36,0x2e,0x7a,0x20,0x3d,0x3d,0x20,0x31,0x2e, + 0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74, + 0x63,0x68,0x28,0x72,0x65,0x66,0x74,0x65,0x78,0x5f,0x72,0x65,0x66,0x73,0x6d,0x70, + 0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x46, + 0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2e,0x78,0x29,0x2c,0x20,0x69,0x6e,0x74, + 0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x64,0x61,0x74, + 0x61,0x5b,0x30,0x5d,0x2e,0x79,0x29,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61, + 0x67,0x43,0x6f,0x6f,0x72,0x64,0x2e,0x79,0x29,0x29,0x2c,0x20,0x30,0x29,0x2e,0x78, + 0x79,0x7a,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30, + 0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38, + 0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30, 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30, - 0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x36,0x39,0x39,0x39,0x39,0x39,0x39, - 0x38,0x38,0x30,0x37,0x39,0x30,0x37,0x31,0x30,0x34,0x34,0x39,0x32,0x31,0x38,0x37, - 0x35,0x2c,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x6d,0x69,0x78,0x28,0x30,0x2e, - 0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39, - 0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x68, - 0x61,0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,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,0x72,0x65,0x74,0x75, - 0x72,0x6e,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,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,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, - 0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c, - 0x20,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39, - 0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x20,0x2a,0x20,0x6d, - 0x69,0x78,0x28,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32, - 0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31, - 0x2e,0x30,0x2c,0x20,0x68,0x61,0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x31,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a, - 0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x69,0x6e,0x74,0x20,0x73,0x69,0x67, - 0x6e,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x69,0x66,0x20,0x28,0x78,0x20,0x3c,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20, - 0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74, - 0x75,0x72,0x6e,0x20,0x2d,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x31,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,0x32,0x32,0x30,0x20,0x3d,0x20,0x72,0x6f,0x75, - 0x6e,0x64,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a, - 0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x32,0x33,0x35,0x20,0x3d,0x20,0x5f, - 0x32,0x32,0x30,0x2e,0x78,0x7a,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x66,0x6c, - 0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x78,0x29,0x20,0x2b,0x20,0x30,0x2e, - 0x35,0x2c,0x20,0x66,0x6c,0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x7a,0x29, - 0x20,0x2b,0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x78, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x34,0x35, - 0x20,0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x30, - 0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d, - 0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x36,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x5f, - 0x32,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x38,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x20, - 0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x29, - 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x31,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32, - 0x20,0x3d,0x20,0x5f,0x32,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, - 0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x20,0x3d,0x20,0x5f,0x32,0x32, + 0x37,0x38,0x31,0x32,0x35,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,0x69,0x66,0x20,0x28,0x5f,0x31,0x36,0x36,0x2e,0x78,0x20, + 0x3d,0x3d,0x20,0x31,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x38,0x30,0x30,0x30, + 0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37, + 0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x36,0x39,0x39,0x39,0x39,0x39,0x39,0x38, + 0x38,0x30,0x37,0x39,0x30,0x37,0x31,0x30,0x34,0x34,0x39,0x32,0x31,0x38,0x37,0x35, + 0x2c,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x6d,0x69,0x78,0x28,0x30,0x2e,0x38, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35, + 0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x68,0x61, + 0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,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,0x72,0x65,0x74,0x75,0x72, + 0x6e,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,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,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39, + 0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20, + 0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32, + 0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x20,0x2a,0x20,0x6d,0x69, + 0x78,0x28,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30, + 0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e, + 0x30,0x2c,0x20,0x68,0x61,0x73,0x68,0x31,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, + 0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x69,0x6e,0x74,0x20,0x73,0x69,0x67,0x6e, + 0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x69,0x66,0x20,0x28,0x78,0x20,0x3c,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20, + 0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x20,0x2d,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x31,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,0x32,0x32,0x30,0x20,0x3d,0x20,0x72,0x6f,0x75,0x6e, + 0x64,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20, + 0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x32,0x33,0x35,0x20,0x3d,0x20,0x5f,0x32, + 0x32,0x30,0x2e,0x78,0x7a,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x66,0x6c,0x6f, + 0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x78,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35, + 0x2c,0x20,0x66,0x6c,0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x7a,0x29,0x20, + 0x2b,0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x78,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x34,0x35,0x20, + 0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x31,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x30,0x2e, 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x31,0x34,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69, - 0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x29,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x31,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32, - 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x39,0x37,0x20,0x3d,0x20,0x76,0x65,0x63, - 0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32, - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33, - 0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20, - 0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35, - 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x30,0x34, - 0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e, - 0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x31,0x30,0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64, - 0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x35,0x29,0x2c,0x20,0x5f,0x32,0x39,0x37,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x31,0x33,0x2e,0x70,0x6c,0x61,0x6e,0x65, - 0x54,0x79,0x70,0x65,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b, - 0x0a,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,0x6d,0x69,0x78,0x28,0x6d, - 0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x67, - 0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, - 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x35,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x29,0x2c,0x20,0x5f,0x32,0x39, - 0x37,0x29,0x2c,0x20,0x5f,0x33,0x30,0x34,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x73, - 0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30, - 0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36, - 0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73, - 0x28,0x5f,0x32,0x34,0x35,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29,0x2c, - 0x20,0x31,0x2e,0x30,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,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, - 0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x33,0x30,0x34,0x2c,0x20,0x31,0x2e,0x30,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00, + 0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20, + 0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28, + 0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x36,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x5f,0x32, + 0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x38,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x20,0x3d, + 0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x29,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x31,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x20, + 0x3d,0x20,0x5f,0x32,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x31,0x34,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67, + 0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x29,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x30,0x33,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x28,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x73,0x68,0x61,0x64, + 0x6f,0x77,0x73,0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x76,0x65,0x63,0x33, + 0x28,0x30,0x2e,0x30,0x29,0x2e,0x78,0x79,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x30,0x38,0x20,0x3d, + 0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70, + 0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32, + 0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30, + 0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a, + 0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, + 0x33,0x32,0x34,0x2e,0x70,0x6c,0x61,0x6e,0x65,0x54,0x79,0x70,0x65,0x20,0x3d,0x3d, + 0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,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,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f, + 0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61, + 0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75, + 0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x36,0x29,0x2c,0x20,0x5f,0x33,0x30,0x38,0x29,0x2c,0x20,0x6d,0x69,0x78, + 0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70, + 0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x39,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x29,0x2c,0x20, + 0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c, + 0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x35,0x29,0x2c, + 0x20,0x5f,0x33,0x30,0x38,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x6d,0x6f, + 0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35, + 0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f, + 0x32,0x34,0x35,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29,0x2c,0x20,0x31, + 0x2e,0x30,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,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76, + 0x65,0x63,0x34,0x28,0x5f,0x33,0x30,0x33,0x2c,0x20,0x5f,0x33,0x30,0x33,0x2c,0x20, + 0x5f,0x33,0x30,0x33,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x7d,0x0a,0x7d,0x0a,0x0a,0x00, ]; /* #version 300 es @@ -512,10 +531,11 @@ vs_plane_source_glsl300es := u8.[ highp float grassDensity; }; - uniform plane_world_config _313; + uniform plane_world_config _324; uniform highp sampler2D reftex_refsmp; uniform highp sampler2D groundtex_groundsmp; + uniform highp sampler2DShadow shadow_shadowsmp; in highp vec4 pos; layout(location = 0) out highp vec4 frag_color; @@ -591,15 +611,15 @@ vs_plane_source_glsl300es := u8.[ highp vec4 param_13 = _220; highp float param_14 = float(sign2(param_11)); highp float param_15 = float(sign2(param_12)); - highp vec3 _297 = vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); - highp vec3 _304 = mix(get_ground_sample(param_8, param_9, param_10), get_ground_sample(param_13, param_14, param_15), _297); - if (_313.planeType == 1) + highp float _303 = texture(shadow_shadowsmp, vec3(vec3(0.0).xy, 0.0)); + highp vec3 _308 = vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); + if (_324.planeType == 1) { - frag_color = vec4(mix(mix(get_ground_sample(param, param_1, param_2), get_ground_sample(param_4, param_5, param_6), _297), _304, vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); + frag_color = vec4(mix(mix(get_ground_sample(param, param_1, param_2), get_ground_sample(param_4, param_5, param_6), _308), mix(get_ground_sample(param_8, param_9, param_10), get_ground_sample(param_13, param_14, param_15), _308), vec3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); } else { - frag_color = vec4(_304, 1.0); + frag_color = vec4(_303, _303, _303, 1.0); } } @@ -638,12 +658,15 @@ fs_plane_source_glsl300es := u8.[ 0x6f,0x61,0x74,0x20,0x67,0x72,0x61,0x73,0x73,0x44,0x65,0x6e,0x73,0x69,0x74,0x79, 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x70,0x6c, 0x61,0x6e,0x65,0x5f,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67, - 0x20,0x5f,0x33,0x31,0x33,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, + 0x20,0x5f,0x33,0x32,0x34,0x3b,0x0a,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, 0x72,0x65,0x66,0x74,0x65,0x78,0x5f,0x72,0x65,0x66,0x73,0x6d,0x70,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,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65,0x78, - 0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20, + 0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,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,0x53,0x68,0x61,0x64,0x6f,0x77,0x20,0x73,0x68,0x61,0x64,0x6f,0x77, + 0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20, 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a, 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76, @@ -791,40 +814,44 @@ fs_plane_source_glsl300es := u8.[ 0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, 0x5f,0x31,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e, 0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x29,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x39, - 0x37,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73, - 0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39, - 0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35, - 0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29, - 0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69, - 0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x30,0x34,0x20,0x3d,0x20, - 0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73, - 0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x2c,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x39,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30, - 0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x2c,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x35,0x29,0x2c,0x20,0x5f,0x32,0x39,0x37,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69, - 0x66,0x20,0x28,0x5f,0x33,0x31,0x33,0x2e,0x70,0x6c,0x61,0x6e,0x65,0x54,0x79,0x70, - 0x65,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,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,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28, - 0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x67,0x65,0x74,0x5f, - 0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20, - 0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x29,0x2c,0x20,0x5f,0x32,0x39,0x37,0x29,0x2c, - 0x20,0x5f,0x33,0x30,0x34,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x6d,0x6f,0x6f, - 0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30, - 0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33, - 0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32, - 0x34,0x35,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e, - 0x30,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,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65, - 0x63,0x34,0x28,0x5f,0x33,0x30,0x34,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00, + 0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33, + 0x30,0x33,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x73,0x68,0x61, + 0x64,0x6f,0x77,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x73,0x6d,0x70,0x2c,0x20,0x76, + 0x65,0x63,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2e,0x78,0x79, + 0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67, + 0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x30,0x38,0x20,0x3d,0x20,0x76, + 0x65,0x63,0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30, + 0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32, + 0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35, + 0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x30, + 0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x32, + 0x34,0x2e,0x70,0x6c,0x61,0x6e,0x65,0x54,0x79,0x70,0x65,0x20,0x3d,0x3d,0x20,0x31, + 0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,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,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72, + 0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61, + 0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x32,0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64, + 0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x36,0x29,0x2c,0x20,0x5f,0x33,0x30,0x38,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,0x67, + 0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, + 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x39,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x29,0x2c,0x20,0x67,0x65, + 0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x35,0x29,0x2c,0x20,0x5f, + 0x33,0x30,0x38,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74, + 0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,0x31, + 0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32,0x34, + 0x35,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30, + 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, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63, + 0x34,0x28,0x5f,0x33,0x30,0x33,0x2c,0x20,0x5f,0x33,0x30,0x33,0x2c,0x20,0x5f,0x33, + 0x30,0x33,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, + 0x7d,0x0a,0x0a,0x00, ]; /* #include @@ -998,7 +1025,7 @@ vs_plane_source_metal_macos := u8.[ return 1; } - fragment main0_out main0(main0_in in [[stage_in]], constant plane_data& _145 [[buffer(0)]], constant plane_world_config& _313 [[buffer(1)]], texture2d reftex [[texture(0)]], texture2d groundtex [[texture(1)]], sampler refsmp [[sampler(0)]], sampler groundsmp [[sampler(1)]], float4 gl_FragCoord [[position]]) + fragment main0_out main0(main0_in in [[stage_in]], constant plane_data& _145 [[buffer(0)]], constant plane_world_config& _324 [[buffer(1)]], texture2d reftex [[texture(0)]], texture2d groundtex [[texture(1)]], depth2d shadow [[texture(2)]], sampler refsmp [[sampler(0)]], sampler groundsmp [[sampler(1)]], sampler shadowsmp [[sampler(2)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; float4 _220 = round(in.pos * 16.0) * float4(0.0625); @@ -1021,15 +1048,15 @@ vs_plane_source_metal_macos := u8.[ float4 param_13 = _220; float param_14 = float(sign2(param_11)); float param_15 = float(sign2(param_12)); - float3 _297 = float3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); - float3 _304 = mix(get_ground_sample(param_8, param_9, param_10, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), get_ground_sample(param_13, param_14, param_15, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), _297); - if (_313.planeType == 1) + float _303 = shadow.sample_compare(shadowsmp, float3(0.0).xy, 0.0); + float3 _308 = float3(smoothstep(0.20000000298023223876953125, 0.5, abs(_239)) * 0.5); + if (_324.planeType == 1) { - out.frag_color = float4(mix(mix(get_ground_sample(param, param_1, param_2, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), get_ground_sample(param_4, param_5, param_6, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), _297), _304, float3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); + out.frag_color = float4(mix(mix(get_ground_sample(param, param_1, param_2, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), get_ground_sample(param_4, param_5, param_6, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), _308), mix(get_ground_sample(param_8, param_9, param_10, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), get_ground_sample(param_13, param_14, param_15, reftex, refsmp, gl_FragCoord, _145, groundtex, groundsmp), _308), float3(smoothstep(0.20000000298023223876953125, 0.5, abs(_245)) * 0.5)), 1.0); } else { - out.frag_color = float4(_304, 1.0); + out.frag_color = float4(_303, _303, _303, 1.0); } return out; } @@ -1199,113 +1226,121 @@ fs_plane_source_metal_macos := u8.[ 0x5f,0x31,0x34,0x35,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29, 0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x70,0x6c,0x61, 0x6e,0x65,0x5f,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x26, - 0x20,0x5f,0x33,0x31,0x33,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x31, + 0x20,0x5f,0x33,0x32,0x34,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x31, 0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66, 0x6c,0x6f,0x61,0x74,0x3e,0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74, 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x67,0x72, 0x6f,0x75,0x6e,0x64,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72, - 0x65,0x28,0x31,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20, - 0x72,0x65,0x66,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, - 0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x67, - 0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x28,0x31,0x29,0x5d,0x5d,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x32,0x32,0x30,0x20,0x3d,0x20,0x72,0x6f,0x75,0x6e,0x64,0x28,0x69,0x6e,0x2e, - 0x70,0x6f,0x73,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x32,0x33,0x35,0x20,0x3d,0x20, - 0x5f,0x32,0x32,0x30,0x2e,0x78,0x7a,0x20,0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x28,0x66,0x6c,0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x78,0x29,0x20,0x2b, - 0x20,0x30,0x2e,0x35,0x2c,0x20,0x66,0x6c,0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30, - 0x2e,0x7a,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x5f,0x32,0x33, - 0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f, - 0x32,0x34,0x35,0x20,0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d, - 0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x32,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x5f,0x32,0x33, - 0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20, - 0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20,0x30,0x2e,0x30, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x37,0x20,0x3d,0x20,0x5f,0x32,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x20,0x3d, - 0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x31,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32, - 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x20,0x3d, - 0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x20,0x3d,0x20,0x5f,0x32,0x34,0x35, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x31,0x33,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x34, - 0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x35,0x20,0x3d,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x32,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x33,0x20,0x5f,0x32,0x39,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, + 0x65,0x28,0x31,0x29,0x5d,0x5d,0x2c,0x20,0x64,0x65,0x70,0x74,0x68,0x32,0x64,0x3c, + 0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x20,0x5b,0x5b, + 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x32,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61, + 0x6d,0x70,0x6c,0x65,0x72,0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d, + 0x70,0x6c,0x65,0x72,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x20,0x5b, + 0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x31,0x29,0x5d,0x5d,0x2c,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x73,0x6d,0x70, + 0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x32,0x29,0x5d,0x5d,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43, + 0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x32,0x32,0x30,0x20,0x3d,0x20,0x72, + 0x6f,0x75,0x6e,0x64,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x20,0x2a,0x20,0x31,0x36, + 0x2e,0x30,0x29,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30, + 0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, + 0x20,0x5f,0x32,0x33,0x35,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x2e,0x78,0x7a,0x20, + 0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x66,0x6c,0x6f,0x6f,0x72,0x28,0x5f, + 0x32,0x32,0x30,0x2e,0x78,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x2c,0x20,0x66,0x6c, + 0x6f,0x6f,0x72,0x28,0x5f,0x32,0x32,0x30,0x2e,0x7a,0x29,0x20,0x2b,0x20,0x30,0x2e, + 0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32, + 0x33,0x39,0x20,0x3d,0x20,0x5f,0x32,0x33,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x34,0x35,0x20,0x3d,0x20,0x5f,0x32, + 0x33,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x33,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20, + 0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28, + 0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x36,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x5f,0x32, + 0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x38,0x20,0x3d,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39, + 0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37, + 0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x31,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x32,0x20,0x3d,0x20,0x5f,0x32,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x20,0x3d,0x20, + 0x5f,0x32,0x32,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x34,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x28,0x73,0x69,0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x29, + 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x31,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x73,0x69, + 0x67,0x6e,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x32,0x29,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x30,0x33,0x20,0x3d, + 0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x63, + 0x6f,0x6d,0x70,0x61,0x72,0x65,0x28,0x73,0x68,0x61,0x64,0x6f,0x77,0x73,0x6d,0x70, + 0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2e,0x78,0x79, + 0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x33,0x20,0x5f,0x33,0x30,0x38,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, 0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30, 0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38, 0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61, 0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x33,0x30, - 0x34,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75, - 0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x38,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x2c,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x30,0x2c,0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65, - 0x66,0x73,0x6d,0x70,0x2c,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f, - 0x72,0x64,0x2c,0x20,0x5f,0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64, - 0x74,0x65,0x78,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c, - 0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70, - 0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x2c,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x35,0x2c, - 0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c, - 0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f, - 0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65,0x78,0x2c,0x20, - 0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c,0x20,0x5f,0x32,0x39,0x37, - 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x31,0x33,0x2e, - 0x70,0x6c,0x61,0x6e,0x65,0x54,0x79,0x70,0x65,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a, - 0x20,0x20,0x20,0x20,0x7b,0x0a,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,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x67,0x65, - 0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28, - 0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20, - 0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c, - 0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67, - 0x43,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f,0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f, - 0x75,0x6e,0x64,0x74,0x65,0x78,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d, - 0x70,0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73, - 0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c, - 0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c, - 0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f, - 0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65,0x78,0x2c,0x20, - 0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c,0x20,0x5f,0x32,0x39,0x37, - 0x29,0x2c,0x20,0x5f,0x33,0x30,0x34,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28, - 0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30, - 0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37, - 0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62, - 0x73,0x28,0x5f,0x32,0x34,0x35,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29, - 0x2c,0x20,0x31,0x2e,0x30,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,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,0x33,0x30, - 0x34,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, - 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x32,0x34,0x2e,0x70, + 0x6c,0x61,0x6e,0x65,0x54,0x79,0x70,0x65,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20, + 0x20,0x20,0x20,0x7b,0x0a,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,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x67,0x65,0x74, + 0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70, + 0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20, + 0x72,0x65,0x66,0x73,0x6d,0x70,0x2c,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43, + 0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f,0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75, + 0x6e,0x64,0x74,0x65,0x78,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70, + 0x29,0x2c,0x20,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61, + 0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20, + 0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c,0x20, + 0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f,0x31, + 0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65,0x78,0x2c,0x20,0x67, + 0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c,0x20,0x5f,0x33,0x30,0x38,0x29, + 0x2c,0x20,0x6d,0x69,0x78,0x28,0x67,0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64, + 0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x2c, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x30,0x2c,0x20,0x72,0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65,0x66,0x73, + 0x6d,0x70,0x2c,0x20,0x67,0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64, + 0x2c,0x20,0x5f,0x31,0x34,0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65, + 0x78,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c,0x20,0x67, + 0x65,0x74,0x5f,0x67,0x72,0x6f,0x75,0x6e,0x64,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, + 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x33,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x31,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x35,0x2c,0x20,0x72, + 0x65,0x66,0x74,0x65,0x78,0x2c,0x20,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c,0x20,0x67, + 0x6c,0x5f,0x46,0x72,0x61,0x67,0x43,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x5f,0x31,0x34, + 0x35,0x2c,0x20,0x67,0x72,0x6f,0x75,0x6e,0x64,0x74,0x65,0x78,0x2c,0x20,0x67,0x72, + 0x6f,0x75,0x6e,0x64,0x73,0x6d,0x70,0x29,0x2c,0x20,0x5f,0x33,0x30,0x38,0x29,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74, + 0x65,0x70,0x28,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38, + 0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x2c, + 0x20,0x30,0x2e,0x35,0x2c,0x20,0x61,0x62,0x73,0x28,0x5f,0x32,0x34,0x35,0x29,0x29, + 0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,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,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,0x33,0x30,0x33,0x2c,0x20,0x5f,0x33,0x30,0x33,0x2c, + 0x20,0x5f,0x33,0x30,0x33,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, + 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, ]; plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc: sg_shader_desc; @@ -1329,49 +1364,49 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.uniform_blocks[1].size = 144; desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "_313.skyBase"; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "_324.skyBase"; desc.uniform_blocks[1].glsl_uniforms[1].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[1].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[1].glsl_name = "_313.skyTop"; + desc.uniform_blocks[1].glsl_uniforms[1].glsl_name = "_324.skyTop"; desc.uniform_blocks[1].glsl_uniforms[2].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[2].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[2].glsl_name = "_313.sunDisk"; + desc.uniform_blocks[1].glsl_uniforms[2].glsl_name = "_324.sunDisk"; desc.uniform_blocks[1].glsl_uniforms[3].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[3].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[3].glsl_name = "_313.horizonHalo"; + desc.uniform_blocks[1].glsl_uniforms[3].glsl_name = "_324.horizonHalo"; desc.uniform_blocks[1].glsl_uniforms[4].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[4].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[4].glsl_name = "_313.sunHalo"; + desc.uniform_blocks[1].glsl_uniforms[4].glsl_name = "_324.sunHalo"; desc.uniform_blocks[1].glsl_uniforms[5].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[5].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[5].glsl_name = "_313.sunLightColor"; + desc.uniform_blocks[1].glsl_uniforms[5].glsl_name = "_324.sunLightColor"; desc.uniform_blocks[1].glsl_uniforms[6].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[6].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[6].glsl_name = "_313.sunPosition"; + desc.uniform_blocks[1].glsl_uniforms[6].glsl_name = "_324.sunPosition"; desc.uniform_blocks[1].glsl_uniforms[7].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[7].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[7].glsl_name = "_313.sunIntensity"; + desc.uniform_blocks[1].glsl_uniforms[7].glsl_name = "_324.sunIntensity"; desc.uniform_blocks[1].glsl_uniforms[8].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[8].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[8].glsl_name = "_313.skyIntensity"; + desc.uniform_blocks[1].glsl_uniforms[8].glsl_name = "_324.skyIntensity"; desc.uniform_blocks[1].glsl_uniforms[9].type = .INT; desc.uniform_blocks[1].glsl_uniforms[9].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[9].glsl_name = "_313.hasClouds"; + desc.uniform_blocks[1].glsl_uniforms[9].glsl_name = "_324.hasClouds"; desc.uniform_blocks[1].glsl_uniforms[10].type = .INT; desc.uniform_blocks[1].glsl_uniforms[10].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[10].glsl_name = "_313.hasPlane"; + desc.uniform_blocks[1].glsl_uniforms[10].glsl_name = "_324.hasPlane"; desc.uniform_blocks[1].glsl_uniforms[11].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[11].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[11].glsl_name = "_313.planeHeight"; + desc.uniform_blocks[1].glsl_uniforms[11].glsl_name = "_324.planeHeight"; desc.uniform_blocks[1].glsl_uniforms[12].type = .INT; desc.uniform_blocks[1].glsl_uniforms[12].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[12].glsl_name = "_313.planeType"; + desc.uniform_blocks[1].glsl_uniforms[12].glsl_name = "_324.planeType"; desc.uniform_blocks[1].glsl_uniforms[13].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[13].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[13].glsl_name = "_313.time"; + desc.uniform_blocks[1].glsl_uniforms[13].glsl_name = "_324.time"; desc.uniform_blocks[1].glsl_uniforms[14].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[14].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[14].glsl_name = "_313.grassDensity"; + desc.uniform_blocks[1].glsl_uniforms[14].glsl_name = "_324.grassDensity"; desc.uniform_blocks[2].stage = .FRAGMENT; desc.uniform_blocks[2].layout = .STD140; desc.uniform_blocks[2].size = 16; @@ -1386,10 +1421,16 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .DEPTH; desc.samplers[0].stage = .FRAGMENT; desc.samplers[0].sampler_type = .FILTERING; desc.samplers[1].stage = .FRAGMENT; desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[2].stage = .FRAGMENT; + desc.samplers[2].sampler_type = .COMPARISON; desc.image_sampler_pairs[0].stage = .FRAGMENT; desc.image_sampler_pairs[0].image_slot = 0; desc.image_sampler_pairs[0].sampler_slot = 0; @@ -1398,6 +1439,10 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.image_sampler_pairs[1].image_slot = 1; desc.image_sampler_pairs[1].sampler_slot = 1; desc.image_sampler_pairs[1].glsl_name = "groundtex_groundsmp"; + desc.image_sampler_pairs[2].stage = .FRAGMENT; + desc.image_sampler_pairs[2].image_slot = 2; + desc.image_sampler_pairs[2].sampler_slot = 2; + desc.image_sampler_pairs[2].glsl_name = "shadow_shadowsmp"; case .GLES3; desc.vertex_func.source = xx *vs_plane_source_glsl300es; desc.vertex_func.entry = "main"; @@ -1416,49 +1461,49 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.uniform_blocks[1].size = 144; desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "_313.skyBase"; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "_324.skyBase"; desc.uniform_blocks[1].glsl_uniforms[1].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[1].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[1].glsl_name = "_313.skyTop"; + desc.uniform_blocks[1].glsl_uniforms[1].glsl_name = "_324.skyTop"; desc.uniform_blocks[1].glsl_uniforms[2].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[2].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[2].glsl_name = "_313.sunDisk"; + desc.uniform_blocks[1].glsl_uniforms[2].glsl_name = "_324.sunDisk"; desc.uniform_blocks[1].glsl_uniforms[3].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[3].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[3].glsl_name = "_313.horizonHalo"; + desc.uniform_blocks[1].glsl_uniforms[3].glsl_name = "_324.horizonHalo"; desc.uniform_blocks[1].glsl_uniforms[4].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[4].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[4].glsl_name = "_313.sunHalo"; + desc.uniform_blocks[1].glsl_uniforms[4].glsl_name = "_324.sunHalo"; desc.uniform_blocks[1].glsl_uniforms[5].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[5].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[5].glsl_name = "_313.sunLightColor"; + desc.uniform_blocks[1].glsl_uniforms[5].glsl_name = "_324.sunLightColor"; desc.uniform_blocks[1].glsl_uniforms[6].type = .FLOAT3; desc.uniform_blocks[1].glsl_uniforms[6].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[6].glsl_name = "_313.sunPosition"; + desc.uniform_blocks[1].glsl_uniforms[6].glsl_name = "_324.sunPosition"; desc.uniform_blocks[1].glsl_uniforms[7].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[7].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[7].glsl_name = "_313.sunIntensity"; + desc.uniform_blocks[1].glsl_uniforms[7].glsl_name = "_324.sunIntensity"; desc.uniform_blocks[1].glsl_uniforms[8].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[8].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[8].glsl_name = "_313.skyIntensity"; + desc.uniform_blocks[1].glsl_uniforms[8].glsl_name = "_324.skyIntensity"; desc.uniform_blocks[1].glsl_uniforms[9].type = .INT; desc.uniform_blocks[1].glsl_uniforms[9].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[9].glsl_name = "_313.hasClouds"; + desc.uniform_blocks[1].glsl_uniforms[9].glsl_name = "_324.hasClouds"; desc.uniform_blocks[1].glsl_uniforms[10].type = .INT; desc.uniform_blocks[1].glsl_uniforms[10].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[10].glsl_name = "_313.hasPlane"; + desc.uniform_blocks[1].glsl_uniforms[10].glsl_name = "_324.hasPlane"; desc.uniform_blocks[1].glsl_uniforms[11].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[11].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[11].glsl_name = "_313.planeHeight"; + desc.uniform_blocks[1].glsl_uniforms[11].glsl_name = "_324.planeHeight"; desc.uniform_blocks[1].glsl_uniforms[12].type = .INT; desc.uniform_blocks[1].glsl_uniforms[12].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[12].glsl_name = "_313.planeType"; + desc.uniform_blocks[1].glsl_uniforms[12].glsl_name = "_324.planeType"; desc.uniform_blocks[1].glsl_uniforms[13].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[13].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[13].glsl_name = "_313.time"; + desc.uniform_blocks[1].glsl_uniforms[13].glsl_name = "_324.time"; desc.uniform_blocks[1].glsl_uniforms[14].type = .FLOAT; desc.uniform_blocks[1].glsl_uniforms[14].array_count = 0; - desc.uniform_blocks[1].glsl_uniforms[14].glsl_name = "_313.grassDensity"; + desc.uniform_blocks[1].glsl_uniforms[14].glsl_name = "_324.grassDensity"; desc.uniform_blocks[2].stage = .FRAGMENT; desc.uniform_blocks[2].layout = .STD140; desc.uniform_blocks[2].size = 16; @@ -1473,10 +1518,16 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .DEPTH; desc.samplers[0].stage = .FRAGMENT; desc.samplers[0].sampler_type = .FILTERING; desc.samplers[1].stage = .FRAGMENT; desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[2].stage = .FRAGMENT; + desc.samplers[2].sampler_type = .COMPARISON; desc.image_sampler_pairs[0].stage = .FRAGMENT; desc.image_sampler_pairs[0].image_slot = 0; desc.image_sampler_pairs[0].sampler_slot = 0; @@ -1485,6 +1536,10 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.image_sampler_pairs[1].image_slot = 1; desc.image_sampler_pairs[1].sampler_slot = 1; desc.image_sampler_pairs[1].glsl_name = "groundtex_groundsmp"; + desc.image_sampler_pairs[2].stage = .FRAGMENT; + desc.image_sampler_pairs[2].image_slot = 2; + desc.image_sampler_pairs[2].sampler_slot = 2; + desc.image_sampler_pairs[2].glsl_name = "shadow_shadowsmp"; case .METAL_MACOS; desc.vertex_func.source = xx *vs_plane_source_metal_macos; desc.vertex_func.entry = "main0"; @@ -1513,18 +1568,29 @@ plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc { desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; desc.images[1].msl_texture_n = 1; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .DEPTH; + desc.images[2].msl_texture_n = 2; desc.samplers[0].stage = .FRAGMENT; desc.samplers[0].sampler_type = .FILTERING; desc.samplers[0].msl_sampler_n = 0; desc.samplers[1].stage = .FRAGMENT; desc.samplers[1].sampler_type = .FILTERING; desc.samplers[1].msl_sampler_n = 1; + desc.samplers[2].stage = .FRAGMENT; + desc.samplers[2].sampler_type = .COMPARISON; + desc.samplers[2].msl_sampler_n = 2; desc.image_sampler_pairs[0].stage = .FRAGMENT; desc.image_sampler_pairs[0].image_slot = 0; desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; desc.image_sampler_pairs[1].image_slot = 1; desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[2].stage = .FRAGMENT; + desc.image_sampler_pairs[2].image_slot = 2; + desc.image_sampler_pairs[2].sampler_slot = 2; } return desc; } diff --git a/src/shaders/jai/shader_post_process_main.jai b/src/shaders/jai/shader_post_process_main.jai new file mode 100644 index 0000000..c7234e5 --- /dev/null +++ b/src/shaders/jai/shader_post_process_main.jai @@ -0,0 +1,325 @@ +/* + #version:1# (machine generated, don't edit!) + + Generated by sokol-shdc (https://github.com/floooh/sokol-tools) + + Cmdline: + sokol-shdc -i shader_post_process_main.glsl -o ./jai/shader_post_process_main.jai -l glsl430:glsl300es:metal_macos -f sokol_jai + + Overview: + ========= + Shader program: 'postprocess': + Get shader desc: postprocess_shader_desc(sg_query_backend()) + Vertex Shader: vs_pp + Fragment Shader: fs_pp + Attributes: + ATTR_postprocess_position => 0 + ATTR_postprocess_uv => 1 + Bindings: + Image 'pptex': + Image type: ._2D + Sample type: .FLOAT + Multisampled: false + Bind slot: IMG_pptex => 0 + Sampler 'ppsmp': + Type: .FILTERING + Bind slot: SMP_ppsmp => 0 +*/ +ATTR_postprocess_position :: 0; +ATTR_postprocess_uv :: 1; +IMG_pptex :: 0; +SMP_ppsmp :: 0; +/* + #version 430 + + layout(location = 0) in vec2 position; + layout(location = 0) out vec2 texcoord; + layout(location = 1) in vec2 uv; + + void main() + { + gl_Position = vec4(position, 0.5, 1.0); + texcoord = uv; + } + +*/ +vs_pp_source_glsl430 := u8.[ + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, + 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, + 0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61, + 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65, + 0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79, + 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31, + 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76, + 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76, + 0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e, + 0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + +]; +/* + #version 430 + + layout(binding = 16) uniform sampler2D pptex_ppsmp; + + layout(location = 0) in vec2 texcoord; + layout(location = 0) out vec4 frag_color; + + void main() + { + frag_color = texture(pptex_ppsmp, texcoord); + } + +*/ +fs_pp_source_glsl430 := u8.[ + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,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,0x70,0x70,0x73,0x6d,0x70, + 0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, + 0x72,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,0x7d,0x0a,0x0a,0x00, +]; +/* + #version 300 es + + layout(location = 0) in vec2 position; + out vec2 texcoord; + layout(location = 1) in vec2 uv; + + void main() + { + gl_Position = vec4(position, 0.5, 1.0); + texcoord = uv; + } + +*/ +vs_pp_source_glsl300es := u8.[ + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32, + 0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, + 0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69, + 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63, + 0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x35,0x2c, + 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,0x65,0x78,0x63,0x6f, + 0x6f,0x72,0x64,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +]; +/* + #version 300 es + precision mediump float; + precision highp int; + + uniform highp sampler2D pptex_ppsmp; + + in highp vec2 texcoord; + layout(location = 0) out highp vec4 frag_color; + + void main() + { + frag_color = texture(pptex_ppsmp, texcoord); + } + +*/ +fs_pp_source_glsl300es := u8.[ + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, + 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, + 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,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,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79, + 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, + 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f, + 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,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,0x7d,0x0a,0x0a, + 0x00, +]; +/* + #include + #include + + using namespace metal; + + struct main0_out + { + float2 texcoord [[user(locn0)]]; + float4 gl_Position [[position]]; + }; + + struct main0_in + { + float2 position [[attribute(0)]]; + float2 uv [[attribute(1)]]; + }; + + vertex main0_out main0(main0_in in [[stage_in]]) + { + main0_out out = {}; + out.gl_Position = float4(in.position, 0.5, 1.0); + out.texcoord = in.uv; + return out; + } + +*/ +vs_pp_source_metal_macos := u8.[ + 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, + 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, + 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, + 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, + 0x6d,0x65,0x74,0x61,0x6c,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,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, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, + 0x6e,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,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b, + 0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b, + 0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,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,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,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e, + 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x31, + 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x75,0x76,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x00, +]; +/* + #include + #include + + using namespace metal; + + struct main0_out + { + float4 frag_color [[color(0)]]; + }; + + struct main0_in + { + float2 texcoord [[user(locn0)]]; + }; + + fragment main0_out main0(main0_in in [[stage_in]], texture2d pptex [[texture(0)]], sampler ppsmp [[sampler(0)]]) + { + main0_out out = {}; + out.frag_color = pptex.sample(ppsmp, in.texcoord); + return out; + } + +*/ +fs_pp_source_metal_macos := u8.[ + 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, + 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, + 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, + 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, + 0x6d,0x65,0x74,0x61,0x6c,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,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,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,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20, + 0x70,0x70,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,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,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,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; + desc.label = "postprocess_shader"; + if backend == { + case .GLCORE; + desc.vertex_func.source = xx *vs_pp_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = xx *fs_pp_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "position"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "uv"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; + desc.image_sampler_pairs[0].glsl_name = "pptex_ppsmp"; + case .GLES3; + desc.vertex_func.source = xx *vs_pp_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = xx *fs_pp_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "position"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "uv"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; + desc.image_sampler_pairs[0].glsl_name = "pptex_ppsmp"; + case .METAL_MACOS; + desc.vertex_func.source = xx *vs_pp_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = xx *fs_pp_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; + } + return desc; +} diff --git a/src/shaders/shader_plane.glsl b/src/shaders/shader_plane.glsl index 563f574..1955d43 100644 --- a/src/shaders/shader_plane.glsl +++ b/src/shaders/shader_plane.glsl @@ -69,8 +69,10 @@ layout(binding=2) uniform plane_data { layout(binding = 0) uniform texture2D reftex; layout(binding = 1) uniform texture2D groundtex; +layout(binding = 2) uniform texture2D shadow; layout(binding = 0) uniform sampler refsmp; layout(binding = 1) uniform sampler groundsmp; +layout(binding = 2) uniform sampler shadowsmp; float random (vec2 st) { return fract(sin(dot(st.xy, @@ -139,6 +141,7 @@ void main() { vec3 c1 = get_ground_sample(npos, sign2(toCenter.x), 0.0); vec3 c2 = get_ground_sample(npos, 0.0, sign2(toCenter.y)); vec3 c3 = get_ground_sample(npos, sign2(toCenter.x), sign2(toCenter.y)); + float shadowp = texture(sampler2DShadow(shadow, shadowsmp), vec3(0,0,0)); // @ToDo: Consider using cool Inigo Quilez trick here to make it even smoother. vec3 b01 = mix(c0, c1, u); @@ -148,7 +151,7 @@ void main() { if(planeType == 1) { frag_color = vec4(bf, 1.0); } else { - frag_color = vec4(b23, 1.0); + frag_color = vec4(vec3(shadowp), 1.0); } } @end diff --git a/src/shaders/shader_post_process_main.glsl b/src/shaders/shader_post_process_main.glsl new file mode 100644 index 0000000..0c993cd --- /dev/null +++ b/src/shaders/shader_post_process_main.glsl @@ -0,0 +1,26 @@ +@vs vs_pp +in vec2 position; +in vec2 uv; + +out vec2 texcoord; + +void main() { + gl_Position = vec4(position, 0.5, 1.0); + texcoord = uv; +} +@end + +@fs fs_pp +in vec2 texcoord; +out vec4 frag_color; + +layout(binding = 0) uniform texture2D pptex; +layout(binding = 0) uniform sampler ppsmp; + +void main() { + vec4 sampled = texture(sampler2D(pptex, ppsmp), texcoord.xy); + frag_color = sampled; +} +@end + +@program postprocess vs_pp fs_pp diff --git a/src/ui/ui.jai b/src/ui/ui.jai index 768761d..a0f0c57 100644 --- a/src/ui/ui.jai +++ b/src/ui/ui.jai @@ -145,10 +145,6 @@ texture_load_from_memory :: (texture: *Ui_Texture, memory: []u8, srgb: bool, bui gScissor : Ui_Rect; gScissorActive : bool = false; -get_render_size :: () -> (s32, s32) { - return 700, 700; -} - set_scissor :: (x0: s32, y0: s32, x1: s32, y1: s32) { arb_tri_command_add(.{ type = .SET_SCISSOR, scissor = .{x0, y0, x1 - x0, y1 - y0}}); }