export declare const vert = "\nlayout(std140) uniform SceneUniforms {\n mat3 u_ProjectionMatrix;\n mat3 u_ViewMatrix;\n mat3 u_ViewProjectionInvMatrix;\n vec4 u_BackgroundColor;\n vec4 u_GridColor;\n float u_ZoomScale;\n float u_CheckboardStyle;\n};\n\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_Position;\n\nvec2 project_clipspace_to_world(vec2 p) {\n return (u_ViewProjectionInvMatrix * vec3(p, 1)).xy;\n}\n\nvoid main() {\n v_Position = project_clipspace_to_world(a_Position);\n gl_Position = vec4(a_Position, 0, 1);\n}\n"; export declare const frag = "\nlayout(std140) uniform SceneUniforms {\n mat3 u_ProjectionMatrix;\n mat3 u_ViewMatrix;\n mat3 u_ViewProjectionInvMatrix;\n vec4 u_BackgroundColor;\n vec4 u_GridColor;\n float u_ZoomScale;\n float u_CheckboardStyle;\n};\n\nout vec4 outputColor;\n\nin vec2 v_Position;\n\nconst int CHECKERBOARD_STYLE_NONE = 0;\nconst int CHECKERBOARD_STYLE_GRID = 1;\nconst int CHECKERBOARD_STYLE_DOTS = 2;\nconst float BASE_GRID_PIXEL_SIZE = 100.0;\nconst float BASE_DOT_SIZE = 8.0;\n\nvec2 scale_grid_size(float zoom) {\n if (zoom < 0.125) return vec2(BASE_GRID_PIXEL_SIZE * 125.0, 0.125);\n else if (zoom < 0.25) return vec2(BASE_GRID_PIXEL_SIZE * 25.0, 0.25);\n else if (zoom < 0.5) return vec2(BASE_GRID_PIXEL_SIZE * 5.0, 0.5);\n return vec2(BASE_GRID_PIXEL_SIZE, 4.0);\n}\n\nvec4 render_grid_checkerboard(vec2 coord) {\n float alpha = 0.0;\n\n vec2 size = scale_grid_size(u_ZoomScale);\n float gridSize1 = size.x;\n float gridSize2 = gridSize1 / 10.0;\n float zoomStep = size.y;\n int checkboardStyle = int(floor(u_CheckboardStyle + 0.5));\n\n if (checkboardStyle == CHECKERBOARD_STYLE_GRID) {\n vec2 grid1 = abs(fract(coord / gridSize1 - 0.5) - 0.5) / fwidth(coord) * gridSize1 / 2.0;\n vec2 grid2 = abs(fract(coord / gridSize2 - 0.5) - 0.5) / fwidth(coord) * gridSize2;\n float v1 = 1.0 - min(min(grid1.x, grid1.y), 1.0);\n float v2 = 1.0 - min(min(grid2.x, grid2.y), 1.0);\n\n if (v1 > 0.0) {\n alpha = v1;\n } else {\n alpha = v2 * clamp(u_ZoomScale / zoomStep, 0.0, 1.0);\n }\n } else if (checkboardStyle == CHECKERBOARD_STYLE_DOTS) {\n vec2 grid2 = abs(fract(coord / gridSize2 - 0.5) - 0.5) / fwidth(coord) * gridSize2;\n alpha = 1.0 - smoothstep(0.0, 1.0, length(grid2) - BASE_DOT_SIZE * u_ZoomScale / zoomStep);\n }\n\n return mix(u_BackgroundColor, u_GridColor, alpha);\n}\n\nvoid main() {\n outputColor = render_grid_checkerboard(v_Position);\n}\n";