struct Per_Frame_Data_std140_0 { @align(16) drag_start_0 : vec2, @align(8) mouse_0 : vec2, @align(16) grid_offset_0 : vec2, @align(8) grid_width_0 : u32, @align(4) map_width_0 : u32, @align(16) grid_height_0 : u32, }; @binding(1) @group(1) var per_frame_0 : Per_Frame_Data_std140_0; @binding(0) @group(0) var map_texture_0 : texture_2d; struct _MatrixStorage_float4x4_ColMajorstd140_0 { @align(16) data_0 : array, i32(4)>, }; @binding(0) @group(1) var view_projection_matrix_0 : _MatrixStorage_float4x4_ColMajorstd140_0; @binding(0) @group(2) var block2_tile_atlas_texture_0 : texture_2d; @binding(1) @group(2) var block2_tile_atlas_sampler_0 : sampler; @binding(2) @group(2) var block2_tile_uvs_0 : array>; @binding(0) @group(3) var block3_tint_0 : vec3; struct VertexShaderOutput_0 { @builtin(position) pos_0 : vec4, @location(0) uv_0 : vec2, @location(1) tile_0 : u32, }; @vertex fn main_vertex(@builtin(vertex_index) vertex_index_0 : u32, @builtin(instance_index) instance_index_0 : u32) -> VertexShaderOutput_0 { var output_0 : VertexShaderOutput_0; const _S1 : vec2 = vec2(0.0f, 0.0f); var vertex_pos_0 : vec2; var vertex_uv_0 : vec2; switch(vertex_index_0) { case u32(0): { vertex_pos_0 = vec2(-1.0f, 0.0f); vertex_uv_0 = _S1; } case u32(1): { const _S2 : vec2 = vec2(0.0f, 1.0f); vertex_pos_0 = vec2(-1.0f, -1.0f); vertex_uv_0 = _S2; } case u32(2): { const _S3 : vec2 = vec2(1.0f, 1.0f); vertex_pos_0 = vec2(0.0f, -1.0f); vertex_uv_0 = _S3; } case u32(3): { vertex_pos_0 = vec2(-1.0f, 0.0f); vertex_uv_0 = _S1; } case u32(4): { const _S4 : vec2 = vec2(1.0f, 1.0f); vertex_pos_0 = vec2(0.0f, -1.0f); vertex_uv_0 = _S4; } case u32(5): { const _S5 : vec2 = vec2(1.0f, 0.0f); vertex_pos_0 = _S1; vertex_uv_0 = _S5; } default : { vertex_pos_0 = _S1; vertex_uv_0 = _S1; } } var _S6 : u32 = instance_index_0 % per_frame_0.map_width_0; var _S7 : u32 = instance_index_0 / per_frame_0.map_width_0; var _S8 : vec2 = vec2(_S6, _S7); var _S9 : vec3 = vec3(vec3(_S8, u32(0))); output_0.tile_0 = (textureLoad((map_texture_0), ((_S9)).xy, ((_S9)).z).x); output_0.pos_0 = (((mat4x4(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4(vec2(_S8) + vertex_pos_0, 0.0f, 1.0f)))); output_0.uv_0 = vertex_uv_0; return output_0; } fn CombinedTextureSampler_Sample_0( this_texture_0 : texture_2d, this_sampler_0 : sampler, location_0 : vec2) -> vec4 { return (textureSample((this_texture_0), (this_sampler_0), (location_0))); } fn pixel_art_sample_0( input_texture_texture_0 : texture_2d, input_texture_sampler_0 : sampler, input_uv_0 : vec2, tile_uv_0 : vec4) -> vec4 { var dimensions_0 : vec2; var _S10 : f32 = dimensions_0[i32(0)]; var _S11 : f32 = dimensions_0[i32(1)]; {var dim = textureDimensions((input_texture_texture_0));((_S10)) = f32(dim.x);((_S11)) = f32(dim.y);}; dimensions_0[i32(0)] = _S10; dimensions_0[i32(1)] = _S11; var _S12 : vec2 = tile_uv_0.xy; var _S13 : vec2 = tile_uv_0.zw; var _S14 : vec2 = mix(_S12, _S13, input_uv_0); var _S15 : vec2 = vec2(0.5f); return CombinedTextureSampler_Sample_0(input_texture_texture_0, input_texture_sampler_0, clamp((floor(_S14) + saturate(fract(_S14) / (fwidth((_S14)))) - _S15) / dimensions_0, (_S12 + _S15) / dimensions_0, (_S13 - _S15) / dimensions_0)); } struct FragmentShaderOutput_0 { @location(0) color_0 : vec4, }; struct pixelInput_0 { @location(0) uv_1 : vec2, @location(1) tile_1 : u32, }; @fragment fn main_fragment( _S16 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 { var output_1 : FragmentShaderOutput_0; var _S17 : vec4 = pixel_art_sample_0(block2_tile_atlas_texture_0, block2_tile_atlas_sampler_0, _S16.uv_1, block2_tile_uvs_0[_S16.tile_1]); output_1.color_0 = vec4(_S17.xyz * block3_tint_0.xyz, _S17.w); return output_1; }