@yali-engine/render 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/bvh.d.ts +66 -0
  2. package/dist/bvh.js +493 -0
  3. package/dist/bvh.js.map +1 -0
  4. package/dist/camera.d.ts +34 -0
  5. package/dist/camera.js +66 -0
  6. package/dist/camera.js.map +1 -0
  7. package/dist/cluster-build.d.ts +46 -0
  8. package/dist/cluster-build.js +179 -0
  9. package/dist/cluster-build.js.map +1 -0
  10. package/dist/cluster-pages.d.ts +70 -0
  11. package/dist/cluster-pages.js +203 -0
  12. package/dist/cluster-pages.js.map +1 -0
  13. package/dist/cluster-stream.d.ts +83 -0
  14. package/dist/cluster-stream.js +226 -0
  15. package/dist/cluster-stream.js.map +1 -0
  16. package/dist/culled-draws.d.ts +30 -0
  17. package/dist/culled-draws.js +103 -0
  18. package/dist/culled-draws.js.map +1 -0
  19. package/dist/debug-lines.d.ts +51 -0
  20. package/dist/debug-lines.js +158 -0
  21. package/dist/debug-lines.js.map +1 -0
  22. package/dist/device-profile.d.ts +100 -0
  23. package/dist/device-profile.js +131 -0
  24. package/dist/device-profile.js.map +1 -0
  25. package/dist/device.d.ts +39 -0
  26. package/dist/device.js +79 -0
  27. package/dist/device.js.map +1 -0
  28. package/dist/environment.d.ts +60 -0
  29. package/dist/environment.js +204 -0
  30. package/dist/environment.js.map +1 -0
  31. package/dist/extract.d.ts +74 -0
  32. package/dist/extract.js +194 -0
  33. package/dist/extract.js.map +1 -0
  34. package/dist/frame-graph.d.ts +112 -0
  35. package/dist/frame-graph.js +226 -0
  36. package/dist/frame-graph.js.map +1 -0
  37. package/dist/gpu-health.d.ts +74 -0
  38. package/dist/gpu-health.js +106 -0
  39. package/dist/gpu-health.js.map +1 -0
  40. package/dist/gpu-timer.d.ts +26 -0
  41. package/dist/gpu-timer.js +93 -0
  42. package/dist/gpu-timer.js.map +1 -0
  43. package/dist/headless.d.ts +28 -0
  44. package/dist/headless.js +91 -0
  45. package/dist/headless.js.map +1 -0
  46. package/dist/index.d.ts +34 -0
  47. package/dist/index.js +36 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/lights.d.ts +81 -0
  50. package/dist/lights.js +247 -0
  51. package/dist/lights.js.map +1 -0
  52. package/dist/matrix.d.ts +6 -0
  53. package/dist/matrix.js +59 -0
  54. package/dist/matrix.js.map +1 -0
  55. package/dist/meshes.d.ts +411 -0
  56. package/dist/meshes.js +545 -0
  57. package/dist/meshes.js.map +1 -0
  58. package/dist/meshlets-decoder.d.ts +20 -0
  59. package/dist/meshlets-decoder.js +47 -0
  60. package/dist/meshlets-decoder.js.map +1 -0
  61. package/dist/meshlets.d.ts +186 -0
  62. package/dist/meshlets.js +1040 -0
  63. package/dist/meshlets.js.map +1 -0
  64. package/dist/occlusion.d.ts +51 -0
  65. package/dist/occlusion.js +188 -0
  66. package/dist/occlusion.js.map +1 -0
  67. package/dist/pick-decoder.d.ts +19 -0
  68. package/dist/pick-decoder.js +45 -0
  69. package/dist/pick-decoder.js.map +1 -0
  70. package/dist/pick.d.ts +86 -0
  71. package/dist/pick.js +452 -0
  72. package/dist/pick.js.map +1 -0
  73. package/dist/pipeline-cache.d.ts +53 -0
  74. package/dist/pipeline-cache.js +96 -0
  75. package/dist/pipeline-cache.js.map +1 -0
  76. package/dist/post-options.d.ts +109 -0
  77. package/dist/post-options.js +23 -0
  78. package/dist/post-options.js.map +1 -0
  79. package/dist/post-shaders.gen.d.ts +40 -0
  80. package/dist/post-shaders.gen.js +43 -0
  81. package/dist/post-shaders.gen.js.map +1 -0
  82. package/dist/post.d.ts +101 -0
  83. package/dist/post.js +555 -0
  84. package/dist/post.js.map +1 -0
  85. package/dist/render-plugin.d.ts +239 -0
  86. package/dist/render-plugin.js +633 -0
  87. package/dist/render-plugin.js.map +1 -0
  88. package/dist/scene.d.ts +406 -0
  89. package/dist/scene.js +2005 -0
  90. package/dist/scene.js.map +1 -0
  91. package/dist/shaders.gen.d.ts +40 -0
  92. package/dist/shaders.gen.js +43 -0
  93. package/dist/shaders.gen.js.map +1 -0
  94. package/dist/shadows.d.ts +104 -0
  95. package/dist/shadows.js +227 -0
  96. package/dist/shadows.js.map +1 -0
  97. package/dist/staging-ring.d.ts +41 -0
  98. package/dist/staging-ring.js +125 -0
  99. package/dist/staging-ring.js.map +1 -0
  100. package/dist/textures.d.ts +165 -0
  101. package/dist/textures.js +361 -0
  102. package/dist/textures.js.map +1 -0
  103. package/dist/tonemap.d.ts +45 -0
  104. package/dist/tonemap.js +141 -0
  105. package/dist/tonemap.js.map +1 -0
  106. package/dist/viewport.d.ts +78 -0
  107. package/dist/viewport.js +130 -0
  108. package/dist/viewport.js.map +1 -0
  109. package/dist/webgl2/plugin.d.ts +40 -0
  110. package/dist/webgl2/plugin.js +190 -0
  111. package/dist/webgl2/plugin.js.map +1 -0
  112. package/dist/webgl2/program.d.ts +27 -0
  113. package/dist/webgl2/program.js +74 -0
  114. package/dist/webgl2/program.js.map +1 -0
  115. package/dist/webgl2/renderer.d.ts +128 -0
  116. package/dist/webgl2/renderer.js +976 -0
  117. package/dist/webgl2/renderer.js.map +1 -0
  118. package/dist/webgl2/shaders.glsl.gen.d.ts +27 -0
  119. package/dist/webgl2/shaders.glsl.gen.js +20 -0
  120. package/dist/webgl2/shaders.glsl.gen.js.map +1 -0
  121. package/dist/webgl2/textures.d.ts +11 -0
  122. package/dist/webgl2/textures.js +82 -0
  123. package/dist/webgl2/textures.js.map +1 -0
  124. package/dist/webgl2/webgl2.d.ts +1 -0
  125. package/dist/webgl2/webgl2.js +4 -0
  126. package/dist/webgl2/webgl2.js.map +1 -0
  127. package/dist/worker-mode.d.ts +85 -0
  128. package/dist/worker-mode.js +204 -0
  129. package/dist/worker-mode.js.map +1 -0
  130. package/package.json +47 -3
  131. package/README.md +0 -3
@@ -0,0 +1,20 @@
1
+ // GENERATED by tools/glsl-gen.mjs from the linked engine shaders (naga, GLSL ES 3.00). Do not edit.
2
+ // Each stage carries the uniform blocks ([group, binding, block name]) and combined samplers
3
+ // ([name, texture group, texture binding, sampler group, sampler binding]) the runtime binds by name.
4
+ export const glDraw = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct MaterialExt {\n float coat;\n float coat_rough;\n float transmission;\n vec4 sheen;\n float ior;\n float thickness;\n float att_distance;\n vec3 att_color;\n float dispersion;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nstruct Brdf {\n vec3 n;\n vec3 v;\n float nv;\n float a2_;\n vec3 f0_;\n vec3 diffuse_color;\n float coat;\n float coat_a2_;\n vec3 sheen;\n float sheen_rough;\n float sheen_scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level_1 = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level_1);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level_1);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nvec3 env_brdf(vec3 f0_, float roughness, float nv) {\n vec4 c0_ = vec4(-1.0, -0.0275, -0.572, 0.022);\n vec4 c1_ = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = ((roughness * c0_) + c1_);\n float a004_ = ((min((r.x * r.x), exp2((-9.28 * nv))) * r.x) + r.y);\n vec2 ab = ((vec2(-1.04, 1.04) * a004_) + r.zw);\n return ((f0_ * ab.x) + vec3(ab.y));\n}\n\nfloat sheen_d(float rough, float nh) {\n float inv = (1.0 / max((rough * rough), 0.001));\n float sin2_ = max((1.0 - (nh * nh)), 0.0078125);\n return (((2.0 + inv) * pow(sin2_, (inv * 0.5))) / 6.2831855);\n}\n\nfloat sheen_env(float nv_1, float rough_1) {\n float r2_ = (rough_1 * rough_1);\n bool lo = (rough_1 < 0.25);\n float a = (lo ? (((-339.2 * r2_) + (161.4 * rough_1)) - 25.9) : (((-8.48 * r2_) + (14.3 * rough_1)) - 9.95));\n float b_3 = (lo ? (((44.0 * r2_) - (23.7 * rough_1)) + 3.26) : (((1.97 * r2_) - (3.27 * rough_1)) + 0.72));\n float dg = (exp(((a * nv_1) + b_3)) + (lo ? 0.0 : (0.1 * (rough_1 - 0.25))));\n return min(dg, 3.1415927);\n}\n\nvec3 direct_light(Brdf b, vec3 l, vec3 radiance) {\n vec3 c_1 = vec3(0.0);\n vec3 h = normalize((b.v + l));\n float nl = clamp(dot(b.n, l), 0.0, 1.0);\n float nh_1 = clamp(dot(b.n, h), 0.0, 1.0);\n float vh = clamp(dot(b.v, h), 0.0, 1.0);\n vec3 f = (b.f0_ + ((vec3(1.0) - b.f0_) * pow((1.0 - vh), 5.0)));\n float dd = (((nh_1 * nh_1) * (b.a2_ - 1.0)) + 1.0);\n float d = (b.a2_ / ((3.1415927 * dd) * dd));\n float vis = (0.5 / max(((nl * sqrt((((b.nv * b.nv) * (1.0 - b.a2_)) + b.a2_))) + (b.nv * sqrt((((nl * nl) * (1.0 - b.a2_)) + b.a2_)))), 1e-5));\n c_1 = ((((b.diffuse_color / vec3(3.1415927)) + ((d * vis) * f)) * radiance) * nl);\n if ((b.sheen_scale < 1.0)) {\n float sv = (1.0 / max((4.0 * ((nl + b.nv) - (nl * b.nv))), 0.0001));\n vec3 _e88 = c_1;\n float _e93 = sheen_d(b.sheen_rough, nh_1);\n c_1 = ((_e88 * b.sheen_scale) + ((b.sheen * ((_e93 * sv) * nl)) * radiance));\n }\n if ((b.coat > 0.0)) {\n float fc = ((0.04 + (0.96 * pow((1.0 - vh), 5.0))) * b.coat);\n float cd = (((nh_1 * nh_1) * (b.coat_a2_ - 1.0)) + 1.0);\n float dc = (b.coat_a2_ / ((3.1415927 * cd) * cd));\n vec3 _e124 = c_1;\n c_1 = ((_e124 * (1.0 - fc)) + (vec3(((((dc * 0.25) / max((vh * vh), 0.0001)) * fc) * nl)) * radiance));\n }\n vec3 _e139 = c_1;\n return _e139;\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_2) {\n uvec2 tile = min(uvec2(((frag / c_2.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_2.proj.z) / c_2.proj.z)) / c_2.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_3) {\n return -(dot(c_3.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_3 = (dist / range);\n float t = clamp((1.0 - (((x_3 * x_3) * x_3) * x_3)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_lights(Brdf b_1, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e6 = _group_0_binding_12_fs.screen.z;\n if ((_e6 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e12 = _group_0_binding_12_fs;\n float _e13 = view_depth(p_1, _e12);\n ClusterParams _e15 = _group_0_binding_12_fs;\n uint _e16 = cluster_index(frag_1, _e13, _e15);\n uvec4 _e21 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e16)), 0);\n uint count = _e21.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e81 = k;\n k = (_e81 + 1u);\n }\n loop_init = false;\n uint _e28 = k;\n if ((_e28 < count)) {\n } else {\n break;\n }\n {\n uint _e33 = k;\n uvec4 _e38 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e33 + 1u), _e16)), 0);\n Light light = _group_0_binding_11_fs.lights[_e38.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n float dist_1 = sqrt(dist2_);\n vec3 l_1 = (to_light / vec3(dist_1));\n float _e53 = range_window(dist_1, light.pos_range.w);\n atten = (_e53 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l_1), light.dir_outer.xyz));\n float _e65 = atten;\n atten = (_e65 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e73 = sum;\n float _e76 = atten;\n vec3 _e78 = direct_light(b_1, l_1, (light.color_kind.xyz * _e76));\n sum = (_e73 + _e78);\n }\n }\n vec3 _e83 = sum;\n return _e83;\n}\n\nvec3 shade_pbr(Surface s, vec3 v, vec3 p_2, vec2 frag_2, float sun, MaterialExt ext) {\n Brdf b_2 = Brdf(vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), 0.0, 0.0);\n vec3 ambient = vec3(0.0);\n float rough_2 = clamp(s.roughness, 0.045, 1.0);\n float a_1 = (rough_2 * rough_2);\n b_2.n = s.normal;\n b_2.v = v;\n b_2.nv = max(dot(s.normal, v), 0.0001);\n b_2.a2_ = (a_1 * a_1);\n float eta = ((ext.ior > 0.0) ? ((ext.ior - 1.0) / (ext.ior + 1.0)) : 0.2);\n b_2.f0_ = mix(vec3((eta * eta)), s.base_color, s.metalness);\n b_2.diffuse_color = ((s.base_color * (1.0 - s.metalness)) * (1.0 - ext.transmission));\n b_2.coat = ext.coat;\n float coat_rough = clamp(ext.coat_rough, 0.045, 1.0);\n b_2.coat_a2_ = (((coat_rough * coat_rough) * coat_rough) * coat_rough);\n b_2.sheen = ext.sheen.xyz;\n b_2.sheen_rough = max(ext.sheen.w, 0.07);\n float _e71 = b_2.sheen.x;\n float _e74 = b_2.sheen.y;\n float _e77 = b_2.sheen.z;\n b_2.sheen_scale = (1.0 - (max(_e71, max(_e74, _e77)) * 0.157));\n Brdf _e84 = b_2;\n vec4 _e87 = _group_0_binding_0_fs.light_dir;\n vec4 _e91 = _group_0_binding_7_fs.sun_color;\n vec3 _e94 = direct_light(_e84, _e87.xyz, (_e91.xyz * sun));\n Brdf _e95 = b_2;\n vec3 _e96 = clustered_lights(_e95, p_2, frag_2);\n vec3 direct = (_e94 + _e96);\n vec3 _e100 = b_2.n;\n vec3 r_1 = reflect(-(v), _e100);\n float _e107 = _group_0_binding_7_fs.env.x;\n vec4 _e111 = textureLod(_group_0_binding_8_fs, vec3(r_1), (rough_2 * (_e107 - 1.0)));\n vec3 _e114 = b_2.f0_;\n float _e116 = b_2.nv;\n vec3 _e117 = env_brdf(_e114, rough_2, _e116);\n vec3 specular_env = (_e111.xyz * _e117);\n vec3 _e120 = b_2.diffuse_color;\n vec3 _e122 = b_2.n;\n vec3 _e123 = sh_irradiance(_e122);\n ambient = ((_e120 * _e123) + specular_env);\n float _e128 = b_2.sheen_scale;\n if ((_e128 < 1.0)) {\n vec3 _e131 = ambient;\n float _e133 = b_2.sheen_scale;\n vec3 _e136 = b_2.sheen;\n vec3 _e138 = b_2.n;\n vec3 _e139 = sh_irradiance(_e138);\n float _e142 = b_2.nv;\n float _e144 = b_2.sheen_rough;\n float _e145 = sheen_env(_e142, _e144);\n ambient = ((_e131 * _e133) + ((_e136 * _e139) * _e145));\n }\n float _e149 = b_2.coat;\n if ((_e149 > 0.0)) {\n float _e153 = b_2.nv;\n float _e163 = b_2.coat;\n float fc_1 = ((0.04 + (0.96 * pow((1.0 - _e153), 5.0))) * _e163);\n float _e170 = _group_0_binding_7_fs.env.x;\n vec4 _e174 = textureLod(_group_0_binding_8_fs, vec3(r_1), (coat_rough * (_e170 - 1.0)));\n float _e179 = b_2.nv;\n vec3 _e180 = env_brdf(vec3(0.04), coat_rough, _e179);\n vec3 coat_env = (_e174.xyz * _e180);\n vec3 _e182 = ambient;\n float _e187 = b_2.coat;\n ambient = ((_e182 * (1.0 - fc_1)) + (coat_env * _e187));\n }\n vec3 _e190 = ambient;\n float _e196 = _group_0_binding_7_fs.sun_color.w;\n return ((direct + ((_e190 * s.occlusion) * _e196)) + s.emissive);\n}\n\nvec3 screen_level(vec2 uv_3, int level) {\n ivec2 size_1 = ivec2(uvec2(textureSize(_group_0_binding_19_fs, level).xy));\n vec2 p_5 = ((clamp(uv_3, vec2(0.0), vec2(1.0)) * vec2(size_1)) - vec2(0.5));\n ivec2 i = ivec2(floor(p_5));\n vec2 t_1 = (p_5 - floor(p_5));\n ivec2 hi = (size_1 - ivec2(1));\n vec4 _e26 = texelFetch(_group_0_binding_19_fs, min(max(i, ivec2(0)), hi), level);\n vec3 a_2 = _e26.xyz;\n vec4 _e36 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 0)), ivec2(0)), hi), level);\n vec3 b_4 = _e36.xyz;\n vec4 _e46 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(0, 1)), ivec2(0)), hi), level);\n vec3 c_7 = _e46.xyz;\n vec4 _e56 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 1)), ivec2(0)), hi), level);\n vec3 d_1 = _e56.xyz;\n return mix(mix(a_2, b_4, t_1.x), mix(c_7, d_1, t_1.x), t_1.y);\n}\n\nvec3 screen_blur(vec2 uv_4, float roughness_1) {\n float _e5 = _group_0_binding_7_fs.screen.w;\n float levels = max(_e5, 1.0);\n float r_2 = (((roughness_1 * roughness_1) * 0.04) * float(uvec2(textureSize(_group_0_binding_19_fs, 0).xy).y));\n float lod = clamp(log2(max(r_2, 1e-6)), 0.0, (levels - 1.0));\n float l0_ = floor(lod);\n vec3 _e25 = screen_level(uv_4, int(l0_));\n vec3 _e32 = screen_level(uv_4, int(min((l0_ + 1.0), (levels - 1.0))));\n return mix(_e25, _e32, (lod - l0_));\n}\n\nMaterialExt material_ext_of(uint id, Material m_1, SurfaceInput si) {\n MaterialExt x = MaterialExt(0.0, 0.0, 0.0, vec4(0.0), 0.0, 0.0, 0.0, vec3(0.0), 0.0);\n uint i_1 = (min(id, 255u) * 4u);\n if (((m_1.maps.x >> 26u) != 0u)) {\n MaterialExt _e14 = x;\n return _e14;\n }\n uvec4 vol = _group_0_binding_18_fs[(i_1 + 2u)];\n x.ior = uintBitsToFloat(vol.x);\n x.thickness = uintBitsToFloat(vol.y);\n x.att_distance = uintBitsToFloat(vol.z);\n uint _e30 = vol.w;\n x.att_color = (vec4(_e30 & 0xFFu, _e30 >> 8 & 0xFFu, _e30 >> 16 & 0xFFu, _e30 >> 24) / 255.0).xyz;\n uvec4 w = _group_0_binding_18_fs[i_1];\n if (all(equal(w, uvec4(0u)))) {\n MaterialExt _e40 = x;\n return _e40;\n }\n uvec4 slots = _group_0_binding_18_fs[(i_1 + 1u)];\n uint _e46 = w.w;\n vec4 sheen = (vec4(_e46 & 0xFFu, _e46 >> 8 & 0xFFu, _e46 >> 16 & 0xFFu, _e46 >> 24) / 255.0);\n vec4 _e55 = sample_linear(slots.x, si.uv, si.ddx, si.ddy);\n x.coat = (uintBitsToFloat(w.x) * _e55.x);\n vec4 _e65 = sample_linear(slots.y, si.uv, si.ddx, si.ddy);\n x.coat_rough = (uintBitsToFloat(w.y) * _e65.y);\n vec4 _e75 = sample_linear(slots.z, si.uv, si.ddx, si.ddy);\n x.transmission = (uintBitsToFloat(w.z) * _e75.x);\n uvec4 more = _group_0_binding_18_fs[(i_1 + 3u)];\n x.dispersion = uintBitsToFloat(more.x);\n float _e87 = x.thickness;\n if ((_e87 > 0.0)) {\n float _e91 = x.thickness;\n vec4 _e96 = sample_linear(more.y, si.uv, si.ddx, si.ddy);\n x.thickness = (_e91 * _e96.y);\n }\n vec4 _e105 = sample_srgb(slots.w, si.uv, si.ddx, si.ddy);\n x.sheen = vec4((sheen.xyz * _e105.xyz), sheen.w);\n MaterialExt _e110 = x;\n return _e110;\n}\n\nfloat shadow_compare(vec2 uv_5, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_5, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_2 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_6 = ((uv_5 * size_2) - vec2(0.5));\n vec2 f_1 = fract(p_6);\n vec2 base = ((floor(p_6) + vec2(0.5)) / size_2);\n vec2 dx = vec2((1.0 / size_2.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_2.y));\n float a_3 = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b_5 = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_8 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a_3, b_5, f_1.x), mix(c_8, d_2, f_1.x), f_1.y);\n}\n\nfloat sun_shadow(vec3 p_3, vec3 n_1, float depth_1) {\n bool local = false;\n uint c_4 = 0u;\n float lit = 0.0;\n int y = 0;\n int x_1 = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_4;\n c_4 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_4;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_4;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(n_1, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_4;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_1 * (0.75 + (1.5 * (1.0 - nl_1)))) + _e51.xyz) * _e58);\n uint _e62 = c_4;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_3 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_6 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_4;\n vec2 tile_1 = vec2(((uv_6.x + float(_e94)) / float(count_1)), uv_6.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r_3 = int(_e110);\n y = -(r_3);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r_3)) {\n } else {\n break;\n }\n {\n x_1 = -(r_3);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x_1;\n x_1 = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x_1;\n if ((_e120 <= r_3)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x_1;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r_3) + 1) * ((2 * r_3) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_2) {\n Surface _e3 = standard_surface(in_2, m_2);\n return _e3;\n}\n\nvec3 facing(vec3 n_2, bool front_1) {\n return (front_1 ? n_2 : -(n_2));\n}\n\nSurfaceInput surface_input(VertexOut in_3, bool front_2, Material m_3) {\n SurfaceInput si_1 = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n si_1.uv = in_3.uv;\n vec3 _e9 = facing(normalize(in_3.normal), front_2);\n si_1.normal_world = _e9;\n si_1.position_world = in_3.position;\n si_1.view_dir = normalize(-(in_3.position));\n si_1.instance_color = in_3.color;\n float _e22 = _group_0_binding_0_fs.light_dir.w;\n si_1.time = _e22;\n si_1.maps = (m_3.maps & uvec4(67108863u));\n vec2 _e30 = dFdx(in_3.uv);\n si_1.ddx = _e30;\n vec2 _e33 = dFdy(in_3.uv);\n si_1.ddy = _e33;\n vec3 dp1_ = dFdx(in_3.position);\n vec3 dp2_ = dFdy(in_3.position);\n vec3 n_4 = si_1.normal_world;\n vec3 dp2perp = cross(dp2_, n_4);\n vec3 dp1perp = cross(n_4, dp1_);\n float _e44 = si_1.ddx.x;\n float _e48 = si_1.ddy.x;\n vec3 t_2 = ((dp2perp * _e44) + (dp1perp * _e48));\n float _e53 = si_1.ddx.y;\n float _e57 = si_1.ddy.y;\n vec3 b_6 = ((dp2perp * _e53) + (dp1perp * _e57));\n float inv_1 = inversesqrt(max(max(dot(t_2, t_2), dot(b_6, b_6)), 1e-20));\n si_1.tangent = (-(t_2) * inv_1);\n si_1.bitangent = (b_6 * inv_1);\n SurfaceInput _e71 = si_1;\n return _e71;\n}\n\nvec2 refracted_uv(vec3 p_4, vec3 view_dir, vec3 n_3, float ior, float thick) {\n vec3 rd = refract(-(view_dir), n_3, (1.0 / max(ior, 1.0)));\n mat4x4 _e13 = _group_0_binding_0_fs.view_proj;\n vec4 clip = (_e13 * vec4((p_4 + (rd * thick)), 1.0));\n return (((clip.xy / vec2(max(clip.w, 0.0001))) * vec2(0.5, -0.5)) + vec2(0.5));\n}\n\nvec4 frag_pbr(VertexOut in_4, bool front_3) {\n vec3 behind = vec3(0.0);\n Material m_4 = _group_0_binding_3_fs[min(in_4.material, 255u)];\n SurfaceInput _e8 = surface_input(in_4, front_3, m_4);\n Surface _e13 = material_surface((m_4.maps.x >> 26u), _e8, m_4);\n ClusterParams _e18 = _group_0_binding_12_fs;\n float _e19 = view_depth(in_4.position, _e18);\n float _e20 = sun_shadow(in_4.position, _e8.normal_world, _e19);\n MaterialExt _e22 = material_ext_of(in_4.material, m_4, _e8);\n vec3 _e27 = shade_pbr(_e13, _e8.view_dir, in_4.position, in_4.clip.xy, _e20, _e22);\n if ((_e22.transmission <= 0.0)) {\n return vec4(_e27, _e13.opacity);\n }\n float f0_1 = ((_e22.ior > 0.0) ? pow(((_e22.ior - 1.0) / (_e22.ior + 1.0)), 2.0) : 0.04);\n float fresnel = (f0_1 + ((1.0 - f0_1) * pow((1.0 - max(dot(_e13.normal, _e8.view_dir), 0.0)), 5.0)));\n float _e63 = _group_0_binding_7_fs.screen.x;\n if ((_e63 > 0.5)) {\n float thick_1 = (_e22.thickness * in_4.scale);\n if ((_e22.dispersion > 0.0)) {\n float spread = (((_e22.ior - 1.0) * 0.025) * _e22.dispersion);\n vec2 _e85 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior - spread), thick_1);\n vec3 _e87 = screen_blur(_e85, _e13.roughness);\n vec2 _e93 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e95 = screen_blur(_e93, _e13.roughness);\n vec2 _e102 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior + spread), thick_1);\n vec3 _e104 = screen_blur(_e102, _e13.roughness);\n behind = vec3(_e87.x, _e95.y, _e104.z);\n } else {\n vec2 _e111 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e113 = screen_blur(_e111, _e13.roughness);\n behind = _e113;\n }\n if ((_e22.att_distance > 0.0)) {\n vec3 _e117 = behind;\n behind = (_e117 * pow(_e22.att_color, vec3((thick_1 / _e22.att_distance))));\n }\n vec3 _e124 = behind;\n return vec4((_e27 + (((_e124 * _e13.base_color) * _e22.transmission) * (1.0 - fresnel))), 1.0);\n }\n float alpha_1 = (_e13.opacity * (1.0 - (_e22.transmission * (1.0 - fresnel))));\n return vec4((_e27 / vec3(max(alpha_1, 0.02))), alpha_1);\n}\n\nvec3 srgb_encode(vec3 c_5) {\n vec3 lo_1 = (c_5 * 12.92);\n vec3 hi_1 = ((1.055 * pow(c_5, vec3(0.41666666))) - vec3(0.055));\n return mix(hi_1, lo_1, lessThanEqual(c_5, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_6 = vec3(0.0);\n float x_4 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_4 < 0.08) ? (x_4 - ((6.25 * x_4) * x_4)) : 0.04);\n c_6 = (color - vec3(offset_1));\n float _e20 = c_6.x;\n float _e22 = c_6.y;\n float _e24 = c_6.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_6;\n return _e28;\n }\n float d_3 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_3 * d_3) / ((peak + d_3) - 0.76)));\n vec3 _e37 = c_6;\n c_6 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_6;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_2) {\n return clamp(((x_2 * ((2.51 * x_2) + vec3(0.03))) / ((x_2 * ((2.43 * x_2) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_pbr(in_, front);\n vec4 _e5 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e5;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
5
+ export const glDrawLambert = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_1) {\n uvec2 tile = min(uvec2(((frag / c_1.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_1.proj.z) / c_1.proj.z)) / c_1.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_2) {\n return -(dot(c_2.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_2 = (dist / range);\n float t = clamp((1.0 - (((x_2 * x_2) * x_2) * x_2)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n_1, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n_1, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nfloat shadow_compare(vec2 uv_3, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_3, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_1 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_3 = ((uv_3 * size_1) - vec2(0.5));\n vec2 f = fract(p_3);\n vec2 base = ((floor(p_3) + vec2(0.5)) / size_1);\n vec2 dx = vec2((1.0 / size_1.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_1.y));\n float a = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_6 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a, b, f.x), mix(c_6, d, f.x), f.y);\n}\n\nfloat sun_shadow(vec3 p_2, vec3 n_2, float depth_1) {\n bool local = false;\n uint c_3 = 0u;\n float lit = 0.0;\n int y = 0;\n int x = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_3;\n c_3 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_3;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_3;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(n_2, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_3;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_2 * (0.75 + (1.5 * (1.0 - nl)))) + _e51.xyz) * _e58);\n uint _e62 = c_3;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_2 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_4 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_3;\n vec2 tile_1 = vec2(((uv_4.x + float(_e94)) / float(count_1)), uv_4.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r = int(_e110);\n y = -(r);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r)) {\n } else {\n break;\n }\n {\n x = -(r);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x;\n x = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x;\n if ((_e120 <= r)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r) + 1) * ((2 * r) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_1) {\n Surface _e3 = standard_surface(in_2, m_1);\n return _e3;\n}\n\nvec3 facing(vec3 n_3, bool front_1) {\n return (front_1 ? n_3 : -(n_3));\n}\n\nvec3 srgb_encode(vec3 c_4) {\n vec3 lo = (c_4 * 12.92);\n vec3 hi = ((1.055 * pow(c_4, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_4, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_5 = vec3(0.0);\n float x_3 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_3 < 0.08) ? (x_3 - ((6.25 * x_3) * x_3)) : 0.04);\n c_5 = (color - vec3(offset_1));\n float _e20 = c_5.x;\n float _e22 = c_5.y;\n float _e24 = c_5.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_5;\n return _e28;\n }\n float d_1 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_1 * d_1) / ((peak + d_1) - 0.76)));\n vec3 _e37 = c_5;\n c_5 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_5;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_1) {\n return clamp(((x_1 * ((2.51 * x_1) + vec3(0.03))) / ((x_1 * ((2.43 * x_1) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b_1 = float(_e43.x);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b_1 + d_2) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_lambert(VertexOut in_3, bool front_2) {\n SurfaceInput si = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n vec3 color_2 = vec3(0.0);\n Material m_2 = _group_0_binding_3_fs[min(in_3.material, 255u)];\n si.uv = in_3.uv;\n vec3 _e14 = facing(normalize(in_3.normal), front_2);\n si.normal_world = _e14;\n si.position_world = in_3.position;\n si.view_dir = normalize(-(in_3.position));\n si.instance_color = in_3.color;\n float _e27 = _group_0_binding_0_fs.light_dir.w;\n si.time = _e27;\n si.maps = ((m_2.maps & uvec4(67108863u)) & uvec4(4294967295u, 0u, 4294967295u, 4294967295u));\n vec2 _e41 = dFdx(in_3.uv);\n si.ddx = _e41;\n vec2 _e44 = dFdy(in_3.uv);\n si.ddy = _e44;\n SurfaceInput _e49 = si;\n Surface _e50 = material_surface((m_2.maps.x >> 26u), _e49, m_2);\n vec3 _e53 = si.normal_world;\n ClusterParams _e56 = _group_0_binding_12_fs;\n float _e57 = view_depth(in_3.position, _e56);\n float _e58 = sun_shadow(in_3.position, _e53, _e57);\n vec3 diffuse_1 = (_e50.base_color * (1.0 - (0.5 * _e50.metalness)));\n vec4 _e69 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(_e50.normal, _e69.xyz), 0.0, 1.0);\n vec4 _e78 = _group_0_binding_7_fs.sun_color;\n vec3 _e84 = sh_irradiance(_e50.normal);\n float _e91 = _group_0_binding_7_fs.sun_color.w;\n vec3 _e100 = clustered_diffuse(_e50.normal, diffuse_1, in_3.position, in_3.clip.xy);\n color_2 = (((((((diffuse_1 / vec3(3.1415927)) * _e78.xyz) * _e58) * nl_1) + (((diffuse_1 * _e84) * _e50.occlusion) * _e91)) + _e50.emissive) + _e100);\n float _e106 = _group_0_binding_7_fs.env.x;\n if ((_e106 < 0.0)) {\n vec3 _e109 = color_2;\n vec3 _e110 = bindings_anchor();\n color_2 = (_e109 + _e110);\n }\n vec3 _e112 = color_2;\n return vec4(_e112, _e50.opacity);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_lambert(in_, front);\n vec4 _e5 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e5;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
6
+ export const glDrawFlat = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c) {\n uvec2 tile = min(uvec2(((frag / c.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c.proj.z) / c.proj.z)) / c.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_1) {\n return -(dot(c_1.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_1 = (dist / range);\n float t = clamp((1.0 - (((x_1 * x_1) * x_1) * x_1)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nvec3 facing(vec3 n_1, bool front_1) {\n return (front_1 ? n_1 : -(n_1));\n}\n\nvec3 srgb_encode(vec3 c_2) {\n vec3 lo = (c_2 * 12.92);\n vec3 hi = ((1.055 * pow(c_2, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_2, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_3 = vec3(0.0);\n float x_2 = min(color.x, min(color.y, color.z));\n float offset = ((x_2 < 0.08) ? (x_2 - ((6.25 * x_2) * x_2)) : 0.04);\n c_3 = (color - vec3(offset));\n float _e20 = c_3.x;\n float _e22 = c_3.y;\n float _e24 = c_3.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_3;\n return _e28;\n }\n float d = (1.0 - 0.76);\n float new_peak = (1.0 - ((d * d) / ((peak + d) - 0.76)));\n vec3 _e37 = c_3;\n c_3 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_3;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x) {\n return clamp(((x * ((2.51 * x) + vec3(0.03))) / ((x * ((2.43 * x) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b = float(_e43.x);\n float d_1 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b + d_1) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_flat(VertexOut in_1, bool front_2) {\n vec3 color_2 = vec3(0.0);\n Material m = _group_0_binding_3_fs[min(in_1.material, 255u)];\n vec3 base = (in_1.color * m.base_color.xyz);\n vec3 _e14 = facing(normalize(in_1.normal), front_2);\n vec4 _e17 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(_e14, _e17.xyz), 0.0, 1.0);\n vec4 _e24 = _group_0_binding_7_fs.sh[0];\n float _e34 = _group_0_binding_7_fs.sun_color.w;\n vec3 ambient = (max((_e24.xyz * 0.282095), vec3(0.0)) * _e34);\n vec4 _e41 = _group_0_binding_7_fs.sun_color;\n vec3 _e54 = clustered_diffuse(_e14, base, in_1.position, in_1.clip.xy);\n color_2 = ((((((base / vec3(3.1415927)) * _e41.xyz) * nl) + (base * ambient)) + m.params[1].xyz) + _e54);\n float _e60 = _group_0_binding_7_fs.env.x;\n if ((_e60 < 0.0)) {\n vec3 _e63 = color_2;\n vec3 _e64 = bindings_anchor();\n color_2 = (_e63 + _e64);\n }\n vec3 _e66 = color_2;\n return vec4(_e66, m.base_color.w);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_flat(in_, front);\n vec4 _e5 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e5;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
7
+ export const glDrawMask = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct MaterialExt {\n float coat;\n float coat_rough;\n float transmission;\n vec4 sheen;\n float ior;\n float thickness;\n float att_distance;\n vec3 att_color;\n float dispersion;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nstruct Brdf {\n vec3 n;\n vec3 v;\n float nv;\n float a2_;\n vec3 f0_;\n vec3 diffuse_color;\n float coat;\n float coat_a2_;\n vec3 sheen;\n float sheen_rough;\n float sheen_scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level_1 = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level_1);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level_1);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nvec3 env_brdf(vec3 f0_, float roughness, float nv) {\n vec4 c0_ = vec4(-1.0, -0.0275, -0.572, 0.022);\n vec4 c1_ = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = ((roughness * c0_) + c1_);\n float a004_ = ((min((r.x * r.x), exp2((-9.28 * nv))) * r.x) + r.y);\n vec2 ab = ((vec2(-1.04, 1.04) * a004_) + r.zw);\n return ((f0_ * ab.x) + vec3(ab.y));\n}\n\nfloat sheen_d(float rough, float nh) {\n float inv = (1.0 / max((rough * rough), 0.001));\n float sin2_ = max((1.0 - (nh * nh)), 0.0078125);\n return (((2.0 + inv) * pow(sin2_, (inv * 0.5))) / 6.2831855);\n}\n\nfloat sheen_env(float nv_1, float rough_1) {\n float r2_ = (rough_1 * rough_1);\n bool lo = (rough_1 < 0.25);\n float a = (lo ? (((-339.2 * r2_) + (161.4 * rough_1)) - 25.9) : (((-8.48 * r2_) + (14.3 * rough_1)) - 9.95));\n float b_3 = (lo ? (((44.0 * r2_) - (23.7 * rough_1)) + 3.26) : (((1.97 * r2_) - (3.27 * rough_1)) + 0.72));\n float dg = (exp(((a * nv_1) + b_3)) + (lo ? 0.0 : (0.1 * (rough_1 - 0.25))));\n return min(dg, 3.1415927);\n}\n\nvec3 direct_light(Brdf b, vec3 l, vec3 radiance) {\n vec3 c_1 = vec3(0.0);\n vec3 h = normalize((b.v + l));\n float nl = clamp(dot(b.n, l), 0.0, 1.0);\n float nh_1 = clamp(dot(b.n, h), 0.0, 1.0);\n float vh = clamp(dot(b.v, h), 0.0, 1.0);\n vec3 f = (b.f0_ + ((vec3(1.0) - b.f0_) * pow((1.0 - vh), 5.0)));\n float dd = (((nh_1 * nh_1) * (b.a2_ - 1.0)) + 1.0);\n float d = (b.a2_ / ((3.1415927 * dd) * dd));\n float vis = (0.5 / max(((nl * sqrt((((b.nv * b.nv) * (1.0 - b.a2_)) + b.a2_))) + (b.nv * sqrt((((nl * nl) * (1.0 - b.a2_)) + b.a2_)))), 1e-5));\n c_1 = ((((b.diffuse_color / vec3(3.1415927)) + ((d * vis) * f)) * radiance) * nl);\n if ((b.sheen_scale < 1.0)) {\n float sv = (1.0 / max((4.0 * ((nl + b.nv) - (nl * b.nv))), 0.0001));\n vec3 _e88 = c_1;\n float _e93 = sheen_d(b.sheen_rough, nh_1);\n c_1 = ((_e88 * b.sheen_scale) + ((b.sheen * ((_e93 * sv) * nl)) * radiance));\n }\n if ((b.coat > 0.0)) {\n float fc = ((0.04 + (0.96 * pow((1.0 - vh), 5.0))) * b.coat);\n float cd = (((nh_1 * nh_1) * (b.coat_a2_ - 1.0)) + 1.0);\n float dc = (b.coat_a2_ / ((3.1415927 * cd) * cd));\n vec3 _e124 = c_1;\n c_1 = ((_e124 * (1.0 - fc)) + (vec3(((((dc * 0.25) / max((vh * vh), 0.0001)) * fc) * nl)) * radiance));\n }\n vec3 _e139 = c_1;\n return _e139;\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_2) {\n uvec2 tile = min(uvec2(((frag / c_2.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_2.proj.z) / c_2.proj.z)) / c_2.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_3) {\n return -(dot(c_3.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_3 = (dist / range);\n float t = clamp((1.0 - (((x_3 * x_3) * x_3) * x_3)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_lights(Brdf b_1, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e6 = _group_0_binding_12_fs.screen.z;\n if ((_e6 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e12 = _group_0_binding_12_fs;\n float _e13 = view_depth(p_1, _e12);\n ClusterParams _e15 = _group_0_binding_12_fs;\n uint _e16 = cluster_index(frag_1, _e13, _e15);\n uvec4 _e21 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e16)), 0);\n uint count = _e21.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e81 = k;\n k = (_e81 + 1u);\n }\n loop_init = false;\n uint _e28 = k;\n if ((_e28 < count)) {\n } else {\n break;\n }\n {\n uint _e33 = k;\n uvec4 _e38 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e33 + 1u), _e16)), 0);\n Light light = _group_0_binding_11_fs.lights[_e38.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n float dist_1 = sqrt(dist2_);\n vec3 l_1 = (to_light / vec3(dist_1));\n float _e53 = range_window(dist_1, light.pos_range.w);\n atten = (_e53 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l_1), light.dir_outer.xyz));\n float _e65 = atten;\n atten = (_e65 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e73 = sum;\n float _e76 = atten;\n vec3 _e78 = direct_light(b_1, l_1, (light.color_kind.xyz * _e76));\n sum = (_e73 + _e78);\n }\n }\n vec3 _e83 = sum;\n return _e83;\n}\n\nvec3 shade_pbr(Surface s, vec3 v, vec3 p_2, vec2 frag_2, float sun, MaterialExt ext) {\n Brdf b_2 = Brdf(vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), 0.0, 0.0);\n vec3 ambient = vec3(0.0);\n float rough_2 = clamp(s.roughness, 0.045, 1.0);\n float a_1 = (rough_2 * rough_2);\n b_2.n = s.normal;\n b_2.v = v;\n b_2.nv = max(dot(s.normal, v), 0.0001);\n b_2.a2_ = (a_1 * a_1);\n float eta = ((ext.ior > 0.0) ? ((ext.ior - 1.0) / (ext.ior + 1.0)) : 0.2);\n b_2.f0_ = mix(vec3((eta * eta)), s.base_color, s.metalness);\n b_2.diffuse_color = ((s.base_color * (1.0 - s.metalness)) * (1.0 - ext.transmission));\n b_2.coat = ext.coat;\n float coat_rough = clamp(ext.coat_rough, 0.045, 1.0);\n b_2.coat_a2_ = (((coat_rough * coat_rough) * coat_rough) * coat_rough);\n b_2.sheen = ext.sheen.xyz;\n b_2.sheen_rough = max(ext.sheen.w, 0.07);\n float _e71 = b_2.sheen.x;\n float _e74 = b_2.sheen.y;\n float _e77 = b_2.sheen.z;\n b_2.sheen_scale = (1.0 - (max(_e71, max(_e74, _e77)) * 0.157));\n Brdf _e84 = b_2;\n vec4 _e87 = _group_0_binding_0_fs.light_dir;\n vec4 _e91 = _group_0_binding_7_fs.sun_color;\n vec3 _e94 = direct_light(_e84, _e87.xyz, (_e91.xyz * sun));\n Brdf _e95 = b_2;\n vec3 _e96 = clustered_lights(_e95, p_2, frag_2);\n vec3 direct = (_e94 + _e96);\n vec3 _e100 = b_2.n;\n vec3 r_1 = reflect(-(v), _e100);\n float _e107 = _group_0_binding_7_fs.env.x;\n vec4 _e111 = textureLod(_group_0_binding_8_fs, vec3(r_1), (rough_2 * (_e107 - 1.0)));\n vec3 _e114 = b_2.f0_;\n float _e116 = b_2.nv;\n vec3 _e117 = env_brdf(_e114, rough_2, _e116);\n vec3 specular_env = (_e111.xyz * _e117);\n vec3 _e120 = b_2.diffuse_color;\n vec3 _e122 = b_2.n;\n vec3 _e123 = sh_irradiance(_e122);\n ambient = ((_e120 * _e123) + specular_env);\n float _e128 = b_2.sheen_scale;\n if ((_e128 < 1.0)) {\n vec3 _e131 = ambient;\n float _e133 = b_2.sheen_scale;\n vec3 _e136 = b_2.sheen;\n vec3 _e138 = b_2.n;\n vec3 _e139 = sh_irradiance(_e138);\n float _e142 = b_2.nv;\n float _e144 = b_2.sheen_rough;\n float _e145 = sheen_env(_e142, _e144);\n ambient = ((_e131 * _e133) + ((_e136 * _e139) * _e145));\n }\n float _e149 = b_2.coat;\n if ((_e149 > 0.0)) {\n float _e153 = b_2.nv;\n float _e163 = b_2.coat;\n float fc_1 = ((0.04 + (0.96 * pow((1.0 - _e153), 5.0))) * _e163);\n float _e170 = _group_0_binding_7_fs.env.x;\n vec4 _e174 = textureLod(_group_0_binding_8_fs, vec3(r_1), (coat_rough * (_e170 - 1.0)));\n float _e179 = b_2.nv;\n vec3 _e180 = env_brdf(vec3(0.04), coat_rough, _e179);\n vec3 coat_env = (_e174.xyz * _e180);\n vec3 _e182 = ambient;\n float _e187 = b_2.coat;\n ambient = ((_e182 * (1.0 - fc_1)) + (coat_env * _e187));\n }\n vec3 _e190 = ambient;\n float _e196 = _group_0_binding_7_fs.sun_color.w;\n return ((direct + ((_e190 * s.occlusion) * _e196)) + s.emissive);\n}\n\nvec3 screen_level(vec2 uv_3, int level) {\n ivec2 size_1 = ivec2(uvec2(textureSize(_group_0_binding_19_fs, level).xy));\n vec2 p_5 = ((clamp(uv_3, vec2(0.0), vec2(1.0)) * vec2(size_1)) - vec2(0.5));\n ivec2 i = ivec2(floor(p_5));\n vec2 t_1 = (p_5 - floor(p_5));\n ivec2 hi = (size_1 - ivec2(1));\n vec4 _e26 = texelFetch(_group_0_binding_19_fs, min(max(i, ivec2(0)), hi), level);\n vec3 a_2 = _e26.xyz;\n vec4 _e36 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 0)), ivec2(0)), hi), level);\n vec3 b_4 = _e36.xyz;\n vec4 _e46 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(0, 1)), ivec2(0)), hi), level);\n vec3 c_7 = _e46.xyz;\n vec4 _e56 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 1)), ivec2(0)), hi), level);\n vec3 d_1 = _e56.xyz;\n return mix(mix(a_2, b_4, t_1.x), mix(c_7, d_1, t_1.x), t_1.y);\n}\n\nvec3 screen_blur(vec2 uv_4, float roughness_1) {\n float _e5 = _group_0_binding_7_fs.screen.w;\n float levels = max(_e5, 1.0);\n float r_2 = (((roughness_1 * roughness_1) * 0.04) * float(uvec2(textureSize(_group_0_binding_19_fs, 0).xy).y));\n float lod = clamp(log2(max(r_2, 1e-6)), 0.0, (levels - 1.0));\n float l0_ = floor(lod);\n vec3 _e25 = screen_level(uv_4, int(l0_));\n vec3 _e32 = screen_level(uv_4, int(min((l0_ + 1.0), (levels - 1.0))));\n return mix(_e25, _e32, (lod - l0_));\n}\n\nMaterialExt material_ext_of(uint id, Material m_1, SurfaceInput si) {\n MaterialExt x = MaterialExt(0.0, 0.0, 0.0, vec4(0.0), 0.0, 0.0, 0.0, vec3(0.0), 0.0);\n uint i_1 = (min(id, 255u) * 4u);\n if (((m_1.maps.x >> 26u) != 0u)) {\n MaterialExt _e14 = x;\n return _e14;\n }\n uvec4 vol = _group_0_binding_18_fs[(i_1 + 2u)];\n x.ior = uintBitsToFloat(vol.x);\n x.thickness = uintBitsToFloat(vol.y);\n x.att_distance = uintBitsToFloat(vol.z);\n uint _e30 = vol.w;\n x.att_color = (vec4(_e30 & 0xFFu, _e30 >> 8 & 0xFFu, _e30 >> 16 & 0xFFu, _e30 >> 24) / 255.0).xyz;\n uvec4 w = _group_0_binding_18_fs[i_1];\n if (all(equal(w, uvec4(0u)))) {\n MaterialExt _e40 = x;\n return _e40;\n }\n uvec4 slots = _group_0_binding_18_fs[(i_1 + 1u)];\n uint _e46 = w.w;\n vec4 sheen = (vec4(_e46 & 0xFFu, _e46 >> 8 & 0xFFu, _e46 >> 16 & 0xFFu, _e46 >> 24) / 255.0);\n vec4 _e55 = sample_linear(slots.x, si.uv, si.ddx, si.ddy);\n x.coat = (uintBitsToFloat(w.x) * _e55.x);\n vec4 _e65 = sample_linear(slots.y, si.uv, si.ddx, si.ddy);\n x.coat_rough = (uintBitsToFloat(w.y) * _e65.y);\n vec4 _e75 = sample_linear(slots.z, si.uv, si.ddx, si.ddy);\n x.transmission = (uintBitsToFloat(w.z) * _e75.x);\n uvec4 more = _group_0_binding_18_fs[(i_1 + 3u)];\n x.dispersion = uintBitsToFloat(more.x);\n float _e87 = x.thickness;\n if ((_e87 > 0.0)) {\n float _e91 = x.thickness;\n vec4 _e96 = sample_linear(more.y, si.uv, si.ddx, si.ddy);\n x.thickness = (_e91 * _e96.y);\n }\n vec4 _e105 = sample_srgb(slots.w, si.uv, si.ddx, si.ddy);\n x.sheen = vec4((sheen.xyz * _e105.xyz), sheen.w);\n MaterialExt _e110 = x;\n return _e110;\n}\n\nfloat shadow_compare(vec2 uv_5, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_5, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_2 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_6 = ((uv_5 * size_2) - vec2(0.5));\n vec2 f_1 = fract(p_6);\n vec2 base = ((floor(p_6) + vec2(0.5)) / size_2);\n vec2 dx = vec2((1.0 / size_2.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_2.y));\n float a_3 = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b_5 = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_8 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a_3, b_5, f_1.x), mix(c_8, d_2, f_1.x), f_1.y);\n}\n\nfloat sun_shadow(vec3 p_3, vec3 n_1, float depth_1) {\n bool local = false;\n uint c_4 = 0u;\n float lit = 0.0;\n int y = 0;\n int x_1 = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_4;\n c_4 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_4;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_4;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(n_1, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_4;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_1 * (0.75 + (1.5 * (1.0 - nl_1)))) + _e51.xyz) * _e58);\n uint _e62 = c_4;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_3 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_6 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_4;\n vec2 tile_1 = vec2(((uv_6.x + float(_e94)) / float(count_1)), uv_6.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r_3 = int(_e110);\n y = -(r_3);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r_3)) {\n } else {\n break;\n }\n {\n x_1 = -(r_3);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x_1;\n x_1 = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x_1;\n if ((_e120 <= r_3)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x_1;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r_3) + 1) * ((2 * r_3) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_2) {\n Surface _e3 = standard_surface(in_2, m_2);\n return _e3;\n}\n\nvec3 facing(vec3 n_2, bool front_1) {\n return (front_1 ? n_2 : -(n_2));\n}\n\nSurfaceInput surface_input(VertexOut in_3, bool front_2, Material m_3) {\n SurfaceInput si_1 = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n si_1.uv = in_3.uv;\n vec3 _e9 = facing(normalize(in_3.normal), front_2);\n si_1.normal_world = _e9;\n si_1.position_world = in_3.position;\n si_1.view_dir = normalize(-(in_3.position));\n si_1.instance_color = in_3.color;\n float _e22 = _group_0_binding_0_fs.light_dir.w;\n si_1.time = _e22;\n si_1.maps = (m_3.maps & uvec4(67108863u));\n vec2 _e30 = dFdx(in_3.uv);\n si_1.ddx = _e30;\n vec2 _e33 = dFdy(in_3.uv);\n si_1.ddy = _e33;\n vec3 dp1_ = dFdx(in_3.position);\n vec3 dp2_ = dFdy(in_3.position);\n vec3 n_4 = si_1.normal_world;\n vec3 dp2perp = cross(dp2_, n_4);\n vec3 dp1perp = cross(n_4, dp1_);\n float _e44 = si_1.ddx.x;\n float _e48 = si_1.ddy.x;\n vec3 t_2 = ((dp2perp * _e44) + (dp1perp * _e48));\n float _e53 = si_1.ddx.y;\n float _e57 = si_1.ddy.y;\n vec3 b_6 = ((dp2perp * _e53) + (dp1perp * _e57));\n float inv_1 = inversesqrt(max(max(dot(t_2, t_2), dot(b_6, b_6)), 1e-20));\n si_1.tangent = (-(t_2) * inv_1);\n si_1.bitangent = (b_6 * inv_1);\n SurfaceInput _e71 = si_1;\n return _e71;\n}\n\nvec2 refracted_uv(vec3 p_4, vec3 view_dir, vec3 n_3, float ior, float thick) {\n vec3 rd = refract(-(view_dir), n_3, (1.0 / max(ior, 1.0)));\n mat4x4 _e13 = _group_0_binding_0_fs.view_proj;\n vec4 clip = (_e13 * vec4((p_4 + (rd * thick)), 1.0));\n return (((clip.xy / vec2(max(clip.w, 0.0001))) * vec2(0.5, -0.5)) + vec2(0.5));\n}\n\nvec4 frag_pbr(VertexOut in_4, bool front_3) {\n vec3 behind = vec3(0.0);\n Material m_5 = _group_0_binding_3_fs[min(in_4.material, 255u)];\n SurfaceInput _e8 = surface_input(in_4, front_3, m_5);\n Surface _e13 = material_surface((m_5.maps.x >> 26u), _e8, m_5);\n ClusterParams _e18 = _group_0_binding_12_fs;\n float _e19 = view_depth(in_4.position, _e18);\n float _e20 = sun_shadow(in_4.position, _e8.normal_world, _e19);\n MaterialExt _e22 = material_ext_of(in_4.material, m_5, _e8);\n vec3 _e27 = shade_pbr(_e13, _e8.view_dir, in_4.position, in_4.clip.xy, _e20, _e22);\n if ((_e22.transmission <= 0.0)) {\n return vec4(_e27, _e13.opacity);\n }\n float f0_1 = ((_e22.ior > 0.0) ? pow(((_e22.ior - 1.0) / (_e22.ior + 1.0)), 2.0) : 0.04);\n float fresnel = (f0_1 + ((1.0 - f0_1) * pow((1.0 - max(dot(_e13.normal, _e8.view_dir), 0.0)), 5.0)));\n float _e63 = _group_0_binding_7_fs.screen.x;\n if ((_e63 > 0.5)) {\n float thick_1 = (_e22.thickness * in_4.scale);\n if ((_e22.dispersion > 0.0)) {\n float spread = (((_e22.ior - 1.0) * 0.025) * _e22.dispersion);\n vec2 _e85 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior - spread), thick_1);\n vec3 _e87 = screen_blur(_e85, _e13.roughness);\n vec2 _e93 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e95 = screen_blur(_e93, _e13.roughness);\n vec2 _e102 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior + spread), thick_1);\n vec3 _e104 = screen_blur(_e102, _e13.roughness);\n behind = vec3(_e87.x, _e95.y, _e104.z);\n } else {\n vec2 _e111 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e113 = screen_blur(_e111, _e13.roughness);\n behind = _e113;\n }\n if ((_e22.att_distance > 0.0)) {\n vec3 _e117 = behind;\n behind = (_e117 * pow(_e22.att_color, vec3((thick_1 / _e22.att_distance))));\n }\n vec3 _e124 = behind;\n return vec4((_e27 + (((_e124 * _e13.base_color) * _e22.transmission) * (1.0 - fresnel))), 1.0);\n }\n float alpha_1 = (_e13.opacity * (1.0 - (_e22.transmission * (1.0 - fresnel))));\n return vec4((_e27 / vec3(max(alpha_1, 0.02))), alpha_1);\n}\n\nvec3 srgb_encode(vec3 c_5) {\n vec3 lo_1 = (c_5 * 12.92);\n vec3 hi_1 = ((1.055 * pow(c_5, vec3(0.41666666))) - vec3(0.055));\n return mix(hi_1, lo_1, lessThanEqual(c_5, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_6 = vec3(0.0);\n float x_4 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_4 < 0.08) ? (x_4 - ((6.25 * x_4) * x_4)) : 0.04);\n c_6 = (color - vec3(offset_1));\n float _e20 = c_6.x;\n float _e22 = c_6.y;\n float _e24 = c_6.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_6;\n return _e28;\n }\n float d_3 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_3 * d_3) / ((peak + d_3) - 0.76)));\n vec3 _e37 = c_6;\n c_6 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_6;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_2) {\n return clamp(((x_2 * ((2.51 * x_2) + vec3(0.03))) / ((x_2 * ((2.43 * x_2) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nfloat alpha_cutoff(Material m_4) {\n return (((m_4.maps.x >> 26u) == 0u) ? m_4.params[1].w : 0.5);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_pbr(in_, front);\n Material _e9 = _group_0_binding_3_fs[min(in_.material, 255u)];\n float _e10 = alpha_cutoff(_e9);\n if ((_e2.w < _e10)) {\n discard;\n }\n vec4 _e14 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e14;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
8
+ export const glDrawLambertMask = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_1) {\n uvec2 tile = min(uvec2(((frag / c_1.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_1.proj.z) / c_1.proj.z)) / c_1.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_2) {\n return -(dot(c_2.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_2 = (dist / range);\n float t = clamp((1.0 - (((x_2 * x_2) * x_2) * x_2)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n_1, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n_1, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nfloat shadow_compare(vec2 uv_3, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_3, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_1 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_3 = ((uv_3 * size_1) - vec2(0.5));\n vec2 f = fract(p_3);\n vec2 base = ((floor(p_3) + vec2(0.5)) / size_1);\n vec2 dx = vec2((1.0 / size_1.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_1.y));\n float a = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_6 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a, b, f.x), mix(c_6, d, f.x), f.y);\n}\n\nfloat sun_shadow(vec3 p_2, vec3 n_2, float depth_1) {\n bool local = false;\n uint c_3 = 0u;\n float lit = 0.0;\n int y = 0;\n int x = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_3;\n c_3 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_3;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_3;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(n_2, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_3;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_2 * (0.75 + (1.5 * (1.0 - nl)))) + _e51.xyz) * _e58);\n uint _e62 = c_3;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_2 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_4 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_3;\n vec2 tile_1 = vec2(((uv_4.x + float(_e94)) / float(count_1)), uv_4.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r = int(_e110);\n y = -(r);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r)) {\n } else {\n break;\n }\n {\n x = -(r);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x;\n x = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x;\n if ((_e120 <= r)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r) + 1) * ((2 * r) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_1) {\n Surface _e3 = standard_surface(in_2, m_1);\n return _e3;\n}\n\nvec3 facing(vec3 n_3, bool front_1) {\n return (front_1 ? n_3 : -(n_3));\n}\n\nvec3 srgb_encode(vec3 c_4) {\n vec3 lo = (c_4 * 12.92);\n vec3 hi = ((1.055 * pow(c_4, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_4, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_5 = vec3(0.0);\n float x_3 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_3 < 0.08) ? (x_3 - ((6.25 * x_3) * x_3)) : 0.04);\n c_5 = (color - vec3(offset_1));\n float _e20 = c_5.x;\n float _e22 = c_5.y;\n float _e24 = c_5.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_5;\n return _e28;\n }\n float d_1 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_1 * d_1) / ((peak + d_1) - 0.76)));\n vec3 _e37 = c_5;\n c_5 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_5;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_1) {\n return clamp(((x_1 * ((2.51 * x_1) + vec3(0.03))) / ((x_1 * ((2.43 * x_1) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nfloat alpha_cutoff(Material m_2) {\n return (((m_2.maps.x >> 26u) == 0u) ? m_2.params[1].w : 0.5);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b_1 = float(_e43.x);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b_1 + d_2) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_lambert(VertexOut in_3, bool front_2) {\n SurfaceInput si = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n vec3 color_2 = vec3(0.0);\n Material m_3 = _group_0_binding_3_fs[min(in_3.material, 255u)];\n si.uv = in_3.uv;\n vec3 _e14 = facing(normalize(in_3.normal), front_2);\n si.normal_world = _e14;\n si.position_world = in_3.position;\n si.view_dir = normalize(-(in_3.position));\n si.instance_color = in_3.color;\n float _e27 = _group_0_binding_0_fs.light_dir.w;\n si.time = _e27;\n si.maps = ((m_3.maps & uvec4(67108863u)) & uvec4(4294967295u, 0u, 4294967295u, 4294967295u));\n vec2 _e41 = dFdx(in_3.uv);\n si.ddx = _e41;\n vec2 _e44 = dFdy(in_3.uv);\n si.ddy = _e44;\n SurfaceInput _e49 = si;\n Surface _e50 = material_surface((m_3.maps.x >> 26u), _e49, m_3);\n vec3 _e53 = si.normal_world;\n ClusterParams _e56 = _group_0_binding_12_fs;\n float _e57 = view_depth(in_3.position, _e56);\n float _e58 = sun_shadow(in_3.position, _e53, _e57);\n vec3 diffuse_1 = (_e50.base_color * (1.0 - (0.5 * _e50.metalness)));\n vec4 _e69 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(_e50.normal, _e69.xyz), 0.0, 1.0);\n vec4 _e78 = _group_0_binding_7_fs.sun_color;\n vec3 _e84 = sh_irradiance(_e50.normal);\n float _e91 = _group_0_binding_7_fs.sun_color.w;\n vec3 _e100 = clustered_diffuse(_e50.normal, diffuse_1, in_3.position, in_3.clip.xy);\n color_2 = (((((((diffuse_1 / vec3(3.1415927)) * _e78.xyz) * _e58) * nl_1) + (((diffuse_1 * _e84) * _e50.occlusion) * _e91)) + _e50.emissive) + _e100);\n float _e106 = _group_0_binding_7_fs.env.x;\n if ((_e106 < 0.0)) {\n vec3 _e109 = color_2;\n vec3 _e110 = bindings_anchor();\n color_2 = (_e109 + _e110);\n }\n vec3 _e112 = color_2;\n return vec4(_e112, _e50.opacity);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_lambert(in_, front);\n Material _e9 = _group_0_binding_3_fs[min(in_.material, 255u)];\n float _e10 = alpha_cutoff(_e9);\n if ((_e2.w < _e10)) {\n discard;\n }\n vec4 _e14 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e14;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
9
+ export const glDrawFlatMask = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c) {\n uvec2 tile = min(uvec2(((frag / c.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c.proj.z) / c.proj.z)) / c.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_1) {\n return -(dot(c_1.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_1 = (dist / range);\n float t = clamp((1.0 - (((x_1 * x_1) * x_1) * x_1)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nvec3 facing(vec3 n_1, bool front_1) {\n return (front_1 ? n_1 : -(n_1));\n}\n\nvec3 srgb_encode(vec3 c_2) {\n vec3 lo = (c_2 * 12.92);\n vec3 hi = ((1.055 * pow(c_2, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_2, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_3 = vec3(0.0);\n float x_2 = min(color.x, min(color.y, color.z));\n float offset = ((x_2 < 0.08) ? (x_2 - ((6.25 * x_2) * x_2)) : 0.04);\n c_3 = (color - vec3(offset));\n float _e20 = c_3.x;\n float _e22 = c_3.y;\n float _e24 = c_3.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_3;\n return _e28;\n }\n float d = (1.0 - 0.76);\n float new_peak = (1.0 - ((d * d) / ((peak + d) - 0.76)));\n vec3 _e37 = c_3;\n c_3 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_3;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x) {\n return clamp(((x * ((2.51 * x) + vec3(0.03))) / ((x * ((2.43 * x) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nfloat alpha_cutoff(Material m) {\n return (((m.maps.x >> 26u) == 0u) ? m.params[1].w : 0.5);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b = float(_e43.x);\n float d_1 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b + d_1) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_flat(VertexOut in_1, bool front_2) {\n vec3 color_2 = vec3(0.0);\n Material m_1 = _group_0_binding_3_fs[min(in_1.material, 255u)];\n vec3 base = (in_1.color * m_1.base_color.xyz);\n vec3 _e14 = facing(normalize(in_1.normal), front_2);\n vec4 _e17 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(_e14, _e17.xyz), 0.0, 1.0);\n vec4 _e24 = _group_0_binding_7_fs.sh[0];\n float _e34 = _group_0_binding_7_fs.sun_color.w;\n vec3 ambient = (max((_e24.xyz * 0.282095), vec3(0.0)) * _e34);\n vec4 _e41 = _group_0_binding_7_fs.sun_color;\n vec3 _e54 = clustered_diffuse(_e14, base, in_1.position, in_1.clip.xy);\n color_2 = ((((((base / vec3(3.1415927)) * _e41.xyz) * nl) + (base * ambient)) + m_1.params[1].xyz) + _e54);\n float _e60 = _group_0_binding_7_fs.env.x;\n if ((_e60 < 0.0)) {\n vec3 _e63 = color_2;\n vec3 _e64 = bindings_anchor();\n color_2 = (_e63 + _e64);\n }\n vec3 _e66 = color_2;\n return vec4(_e66, m_1.base_color.w);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n vec4 _e2 = frag_flat(in_, front);\n Material _e9 = _group_0_binding_3_fs[min(in_.material, 255u)];\n float _e10 = alpha_cutoff(_e9);\n if ((_e2.w < _e10)) {\n discard;\n }\n vec4 _e14 = finish(_e2.xyz, 1.0);\n _fs2p_location0 = _e14;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
10
+ export const glDrawBlend = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct MaterialExt {\n float coat;\n float coat_rough;\n float transmission;\n vec4 sheen;\n float ior;\n float thickness;\n float att_distance;\n vec3 att_color;\n float dispersion;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nstruct Brdf {\n vec3 n;\n vec3 v;\n float nv;\n float a2_;\n vec3 f0_;\n vec3 diffuse_color;\n float coat;\n float coat_a2_;\n vec3 sheen;\n float sheen_rough;\n float sheen_scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level_1 = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level_1);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level_1);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nvec3 env_brdf(vec3 f0_, float roughness, float nv) {\n vec4 c0_ = vec4(-1.0, -0.0275, -0.572, 0.022);\n vec4 c1_ = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = ((roughness * c0_) + c1_);\n float a004_ = ((min((r.x * r.x), exp2((-9.28 * nv))) * r.x) + r.y);\n vec2 ab = ((vec2(-1.04, 1.04) * a004_) + r.zw);\n return ((f0_ * ab.x) + vec3(ab.y));\n}\n\nfloat sheen_d(float rough, float nh) {\n float inv = (1.0 / max((rough * rough), 0.001));\n float sin2_ = max((1.0 - (nh * nh)), 0.0078125);\n return (((2.0 + inv) * pow(sin2_, (inv * 0.5))) / 6.2831855);\n}\n\nfloat sheen_env(float nv_1, float rough_1) {\n float r2_ = (rough_1 * rough_1);\n bool lo = (rough_1 < 0.25);\n float a = (lo ? (((-339.2 * r2_) + (161.4 * rough_1)) - 25.9) : (((-8.48 * r2_) + (14.3 * rough_1)) - 9.95));\n float b_3 = (lo ? (((44.0 * r2_) - (23.7 * rough_1)) + 3.26) : (((1.97 * r2_) - (3.27 * rough_1)) + 0.72));\n float dg = (exp(((a * nv_1) + b_3)) + (lo ? 0.0 : (0.1 * (rough_1 - 0.25))));\n return min(dg, 3.1415927);\n}\n\nvec3 direct_light(Brdf b, vec3 l, vec3 radiance) {\n vec3 c_1 = vec3(0.0);\n vec3 h = normalize((b.v + l));\n float nl = clamp(dot(b.n, l), 0.0, 1.0);\n float nh_1 = clamp(dot(b.n, h), 0.0, 1.0);\n float vh = clamp(dot(b.v, h), 0.0, 1.0);\n vec3 f = (b.f0_ + ((vec3(1.0) - b.f0_) * pow((1.0 - vh), 5.0)));\n float dd = (((nh_1 * nh_1) * (b.a2_ - 1.0)) + 1.0);\n float d = (b.a2_ / ((3.1415927 * dd) * dd));\n float vis = (0.5 / max(((nl * sqrt((((b.nv * b.nv) * (1.0 - b.a2_)) + b.a2_))) + (b.nv * sqrt((((nl * nl) * (1.0 - b.a2_)) + b.a2_)))), 1e-5));\n c_1 = ((((b.diffuse_color / vec3(3.1415927)) + ((d * vis) * f)) * radiance) * nl);\n if ((b.sheen_scale < 1.0)) {\n float sv = (1.0 / max((4.0 * ((nl + b.nv) - (nl * b.nv))), 0.0001));\n vec3 _e88 = c_1;\n float _e93 = sheen_d(b.sheen_rough, nh_1);\n c_1 = ((_e88 * b.sheen_scale) + ((b.sheen * ((_e93 * sv) * nl)) * radiance));\n }\n if ((b.coat > 0.0)) {\n float fc = ((0.04 + (0.96 * pow((1.0 - vh), 5.0))) * b.coat);\n float cd = (((nh_1 * nh_1) * (b.coat_a2_ - 1.0)) + 1.0);\n float dc = (b.coat_a2_ / ((3.1415927 * cd) * cd));\n vec3 _e124 = c_1;\n c_1 = ((_e124 * (1.0 - fc)) + (vec3(((((dc * 0.25) / max((vh * vh), 0.0001)) * fc) * nl)) * radiance));\n }\n vec3 _e139 = c_1;\n return _e139;\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_2) {\n uvec2 tile = min(uvec2(((frag / c_2.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_2.proj.z) / c_2.proj.z)) / c_2.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_3) {\n return -(dot(c_3.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_3 = (dist / range);\n float t = clamp((1.0 - (((x_3 * x_3) * x_3) * x_3)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_lights(Brdf b_1, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e6 = _group_0_binding_12_fs.screen.z;\n if ((_e6 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e12 = _group_0_binding_12_fs;\n float _e13 = view_depth(p_1, _e12);\n ClusterParams _e15 = _group_0_binding_12_fs;\n uint _e16 = cluster_index(frag_1, _e13, _e15);\n uvec4 _e21 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e16)), 0);\n uint count = _e21.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e81 = k;\n k = (_e81 + 1u);\n }\n loop_init = false;\n uint _e28 = k;\n if ((_e28 < count)) {\n } else {\n break;\n }\n {\n uint _e33 = k;\n uvec4 _e38 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e33 + 1u), _e16)), 0);\n Light light = _group_0_binding_11_fs.lights[_e38.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n float dist_1 = sqrt(dist2_);\n vec3 l_1 = (to_light / vec3(dist_1));\n float _e53 = range_window(dist_1, light.pos_range.w);\n atten = (_e53 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l_1), light.dir_outer.xyz));\n float _e65 = atten;\n atten = (_e65 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e73 = sum;\n float _e76 = atten;\n vec3 _e78 = direct_light(b_1, l_1, (light.color_kind.xyz * _e76));\n sum = (_e73 + _e78);\n }\n }\n vec3 _e83 = sum;\n return _e83;\n}\n\nvec3 shade_pbr(Surface s, vec3 v, vec3 p_2, vec2 frag_2, float sun, MaterialExt ext) {\n Brdf b_2 = Brdf(vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), vec3(0.0), 0.0, 0.0, vec3(0.0), 0.0, 0.0);\n vec3 ambient = vec3(0.0);\n float rough_2 = clamp(s.roughness, 0.045, 1.0);\n float a_1 = (rough_2 * rough_2);\n b_2.n = s.normal;\n b_2.v = v;\n b_2.nv = max(dot(s.normal, v), 0.0001);\n b_2.a2_ = (a_1 * a_1);\n float eta = ((ext.ior > 0.0) ? ((ext.ior - 1.0) / (ext.ior + 1.0)) : 0.2);\n b_2.f0_ = mix(vec3((eta * eta)), s.base_color, s.metalness);\n b_2.diffuse_color = ((s.base_color * (1.0 - s.metalness)) * (1.0 - ext.transmission));\n b_2.coat = ext.coat;\n float coat_rough = clamp(ext.coat_rough, 0.045, 1.0);\n b_2.coat_a2_ = (((coat_rough * coat_rough) * coat_rough) * coat_rough);\n b_2.sheen = ext.sheen.xyz;\n b_2.sheen_rough = max(ext.sheen.w, 0.07);\n float _e71 = b_2.sheen.x;\n float _e74 = b_2.sheen.y;\n float _e77 = b_2.sheen.z;\n b_2.sheen_scale = (1.0 - (max(_e71, max(_e74, _e77)) * 0.157));\n Brdf _e84 = b_2;\n vec4 _e87 = _group_0_binding_0_fs.light_dir;\n vec4 _e91 = _group_0_binding_7_fs.sun_color;\n vec3 _e94 = direct_light(_e84, _e87.xyz, (_e91.xyz * sun));\n Brdf _e95 = b_2;\n vec3 _e96 = clustered_lights(_e95, p_2, frag_2);\n vec3 direct = (_e94 + _e96);\n vec3 _e100 = b_2.n;\n vec3 r_1 = reflect(-(v), _e100);\n float _e107 = _group_0_binding_7_fs.env.x;\n vec4 _e111 = textureLod(_group_0_binding_8_fs, vec3(r_1), (rough_2 * (_e107 - 1.0)));\n vec3 _e114 = b_2.f0_;\n float _e116 = b_2.nv;\n vec3 _e117 = env_brdf(_e114, rough_2, _e116);\n vec3 specular_env = (_e111.xyz * _e117);\n vec3 _e120 = b_2.diffuse_color;\n vec3 _e122 = b_2.n;\n vec3 _e123 = sh_irradiance(_e122);\n ambient = ((_e120 * _e123) + specular_env);\n float _e128 = b_2.sheen_scale;\n if ((_e128 < 1.0)) {\n vec3 _e131 = ambient;\n float _e133 = b_2.sheen_scale;\n vec3 _e136 = b_2.sheen;\n vec3 _e138 = b_2.n;\n vec3 _e139 = sh_irradiance(_e138);\n float _e142 = b_2.nv;\n float _e144 = b_2.sheen_rough;\n float _e145 = sheen_env(_e142, _e144);\n ambient = ((_e131 * _e133) + ((_e136 * _e139) * _e145));\n }\n float _e149 = b_2.coat;\n if ((_e149 > 0.0)) {\n float _e153 = b_2.nv;\n float _e163 = b_2.coat;\n float fc_1 = ((0.04 + (0.96 * pow((1.0 - _e153), 5.0))) * _e163);\n float _e170 = _group_0_binding_7_fs.env.x;\n vec4 _e174 = textureLod(_group_0_binding_8_fs, vec3(r_1), (coat_rough * (_e170 - 1.0)));\n float _e179 = b_2.nv;\n vec3 _e180 = env_brdf(vec3(0.04), coat_rough, _e179);\n vec3 coat_env = (_e174.xyz * _e180);\n vec3 _e182 = ambient;\n float _e187 = b_2.coat;\n ambient = ((_e182 * (1.0 - fc_1)) + (coat_env * _e187));\n }\n vec3 _e190 = ambient;\n float _e196 = _group_0_binding_7_fs.sun_color.w;\n return ((direct + ((_e190 * s.occlusion) * _e196)) + s.emissive);\n}\n\nvec3 screen_level(vec2 uv_3, int level) {\n ivec2 size_1 = ivec2(uvec2(textureSize(_group_0_binding_19_fs, level).xy));\n vec2 p_5 = ((clamp(uv_3, vec2(0.0), vec2(1.0)) * vec2(size_1)) - vec2(0.5));\n ivec2 i = ivec2(floor(p_5));\n vec2 t_1 = (p_5 - floor(p_5));\n ivec2 hi = (size_1 - ivec2(1));\n vec4 _e26 = texelFetch(_group_0_binding_19_fs, min(max(i, ivec2(0)), hi), level);\n vec3 a_2 = _e26.xyz;\n vec4 _e36 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 0)), ivec2(0)), hi), level);\n vec3 b_4 = _e36.xyz;\n vec4 _e46 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(0, 1)), ivec2(0)), hi), level);\n vec3 c_7 = _e46.xyz;\n vec4 _e56 = texelFetch(_group_0_binding_19_fs, min(max((i + ivec2(1, 1)), ivec2(0)), hi), level);\n vec3 d_1 = _e56.xyz;\n return mix(mix(a_2, b_4, t_1.x), mix(c_7, d_1, t_1.x), t_1.y);\n}\n\nvec3 screen_blur(vec2 uv_4, float roughness_1) {\n float _e5 = _group_0_binding_7_fs.screen.w;\n float levels = max(_e5, 1.0);\n float r_2 = (((roughness_1 * roughness_1) * 0.04) * float(uvec2(textureSize(_group_0_binding_19_fs, 0).xy).y));\n float lod = clamp(log2(max(r_2, 1e-6)), 0.0, (levels - 1.0));\n float l0_ = floor(lod);\n vec3 _e25 = screen_level(uv_4, int(l0_));\n vec3 _e32 = screen_level(uv_4, int(min((l0_ + 1.0), (levels - 1.0))));\n return mix(_e25, _e32, (lod - l0_));\n}\n\nMaterialExt material_ext_of(uint id, Material m_1, SurfaceInput si) {\n MaterialExt x = MaterialExt(0.0, 0.0, 0.0, vec4(0.0), 0.0, 0.0, 0.0, vec3(0.0), 0.0);\n uint i_1 = (min(id, 255u) * 4u);\n if (((m_1.maps.x >> 26u) != 0u)) {\n MaterialExt _e14 = x;\n return _e14;\n }\n uvec4 vol = _group_0_binding_18_fs[(i_1 + 2u)];\n x.ior = uintBitsToFloat(vol.x);\n x.thickness = uintBitsToFloat(vol.y);\n x.att_distance = uintBitsToFloat(vol.z);\n uint _e30 = vol.w;\n x.att_color = (vec4(_e30 & 0xFFu, _e30 >> 8 & 0xFFu, _e30 >> 16 & 0xFFu, _e30 >> 24) / 255.0).xyz;\n uvec4 w = _group_0_binding_18_fs[i_1];\n if (all(equal(w, uvec4(0u)))) {\n MaterialExt _e40 = x;\n return _e40;\n }\n uvec4 slots = _group_0_binding_18_fs[(i_1 + 1u)];\n uint _e46 = w.w;\n vec4 sheen = (vec4(_e46 & 0xFFu, _e46 >> 8 & 0xFFu, _e46 >> 16 & 0xFFu, _e46 >> 24) / 255.0);\n vec4 _e55 = sample_linear(slots.x, si.uv, si.ddx, si.ddy);\n x.coat = (uintBitsToFloat(w.x) * _e55.x);\n vec4 _e65 = sample_linear(slots.y, si.uv, si.ddx, si.ddy);\n x.coat_rough = (uintBitsToFloat(w.y) * _e65.y);\n vec4 _e75 = sample_linear(slots.z, si.uv, si.ddx, si.ddy);\n x.transmission = (uintBitsToFloat(w.z) * _e75.x);\n uvec4 more = _group_0_binding_18_fs[(i_1 + 3u)];\n x.dispersion = uintBitsToFloat(more.x);\n float _e87 = x.thickness;\n if ((_e87 > 0.0)) {\n float _e91 = x.thickness;\n vec4 _e96 = sample_linear(more.y, si.uv, si.ddx, si.ddy);\n x.thickness = (_e91 * _e96.y);\n }\n vec4 _e105 = sample_srgb(slots.w, si.uv, si.ddx, si.ddy);\n x.sheen = vec4((sheen.xyz * _e105.xyz), sheen.w);\n MaterialExt _e110 = x;\n return _e110;\n}\n\nfloat shadow_compare(vec2 uv_5, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_5, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_2 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_6 = ((uv_5 * size_2) - vec2(0.5));\n vec2 f_1 = fract(p_6);\n vec2 base = ((floor(p_6) + vec2(0.5)) / size_2);\n vec2 dx = vec2((1.0 / size_2.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_2.y));\n float a_3 = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b_5 = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_8 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a_3, b_5, f_1.x), mix(c_8, d_2, f_1.x), f_1.y);\n}\n\nfloat sun_shadow(vec3 p_3, vec3 n_1, float depth_1) {\n bool local = false;\n uint c_4 = 0u;\n float lit = 0.0;\n int y = 0;\n int x_1 = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_4;\n c_4 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_4;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_4;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(n_1, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_4;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_1 * (0.75 + (1.5 * (1.0 - nl_1)))) + _e51.xyz) * _e58);\n uint _e62 = c_4;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_3 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_6 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_4;\n vec2 tile_1 = vec2(((uv_6.x + float(_e94)) / float(count_1)), uv_6.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r_3 = int(_e110);\n y = -(r_3);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r_3)) {\n } else {\n break;\n }\n {\n x_1 = -(r_3);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x_1;\n x_1 = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x_1;\n if ((_e120 <= r_3)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x_1;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r_3) + 1) * ((2 * r_3) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_2) {\n Surface _e3 = standard_surface(in_2, m_2);\n return _e3;\n}\n\nvec3 facing(vec3 n_2, bool front_1) {\n return (front_1 ? n_2 : -(n_2));\n}\n\nSurfaceInput surface_input(VertexOut in_3, bool front_2, Material m_3) {\n SurfaceInput si_1 = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n si_1.uv = in_3.uv;\n vec3 _e9 = facing(normalize(in_3.normal), front_2);\n si_1.normal_world = _e9;\n si_1.position_world = in_3.position;\n si_1.view_dir = normalize(-(in_3.position));\n si_1.instance_color = in_3.color;\n float _e22 = _group_0_binding_0_fs.light_dir.w;\n si_1.time = _e22;\n si_1.maps = (m_3.maps & uvec4(67108863u));\n vec2 _e30 = dFdx(in_3.uv);\n si_1.ddx = _e30;\n vec2 _e33 = dFdy(in_3.uv);\n si_1.ddy = _e33;\n vec3 dp1_ = dFdx(in_3.position);\n vec3 dp2_ = dFdy(in_3.position);\n vec3 n_4 = si_1.normal_world;\n vec3 dp2perp = cross(dp2_, n_4);\n vec3 dp1perp = cross(n_4, dp1_);\n float _e44 = si_1.ddx.x;\n float _e48 = si_1.ddy.x;\n vec3 t_2 = ((dp2perp * _e44) + (dp1perp * _e48));\n float _e53 = si_1.ddx.y;\n float _e57 = si_1.ddy.y;\n vec3 b_6 = ((dp2perp * _e53) + (dp1perp * _e57));\n float inv_1 = inversesqrt(max(max(dot(t_2, t_2), dot(b_6, b_6)), 1e-20));\n si_1.tangent = (-(t_2) * inv_1);\n si_1.bitangent = (b_6 * inv_1);\n SurfaceInput _e71 = si_1;\n return _e71;\n}\n\nvec2 refracted_uv(vec3 p_4, vec3 view_dir, vec3 n_3, float ior, float thick) {\n vec3 rd = refract(-(view_dir), n_3, (1.0 / max(ior, 1.0)));\n mat4x4 _e13 = _group_0_binding_0_fs.view_proj;\n vec4 clip = (_e13 * vec4((p_4 + (rd * thick)), 1.0));\n return (((clip.xy / vec2(max(clip.w, 0.0001))) * vec2(0.5, -0.5)) + vec2(0.5));\n}\n\nbool in_layer(uint id_1) {\n float _e4 = _group_0_binding_7_fs.screen.x;\n if ((_e4 < 0.5)) {\n return true;\n }\n uint layer_1 = _group_0_binding_18_fs[((min(id_1, 255u) * 4u) + 3u)].z;\n float _e23 = _group_0_binding_7_fs.screen.x;\n return (layer_1 == ((_e23 > 1.5) ? 1u : 0u));\n}\n\nvec4 frag_pbr(VertexOut in_4, bool front_3) {\n vec3 behind = vec3(0.0);\n Material m_4 = _group_0_binding_3_fs[min(in_4.material, 255u)];\n SurfaceInput _e8 = surface_input(in_4, front_3, m_4);\n Surface _e13 = material_surface((m_4.maps.x >> 26u), _e8, m_4);\n ClusterParams _e18 = _group_0_binding_12_fs;\n float _e19 = view_depth(in_4.position, _e18);\n float _e20 = sun_shadow(in_4.position, _e8.normal_world, _e19);\n MaterialExt _e22 = material_ext_of(in_4.material, m_4, _e8);\n vec3 _e27 = shade_pbr(_e13, _e8.view_dir, in_4.position, in_4.clip.xy, _e20, _e22);\n if ((_e22.transmission <= 0.0)) {\n return vec4(_e27, _e13.opacity);\n }\n float f0_1 = ((_e22.ior > 0.0) ? pow(((_e22.ior - 1.0) / (_e22.ior + 1.0)), 2.0) : 0.04);\n float fresnel = (f0_1 + ((1.0 - f0_1) * pow((1.0 - max(dot(_e13.normal, _e8.view_dir), 0.0)), 5.0)));\n float _e63 = _group_0_binding_7_fs.screen.x;\n if ((_e63 > 0.5)) {\n float thick_1 = (_e22.thickness * in_4.scale);\n if ((_e22.dispersion > 0.0)) {\n float spread = (((_e22.ior - 1.0) * 0.025) * _e22.dispersion);\n vec2 _e85 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior - spread), thick_1);\n vec3 _e87 = screen_blur(_e85, _e13.roughness);\n vec2 _e93 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e95 = screen_blur(_e93, _e13.roughness);\n vec2 _e102 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, (_e22.ior + spread), thick_1);\n vec3 _e104 = screen_blur(_e102, _e13.roughness);\n behind = vec3(_e87.x, _e95.y, _e104.z);\n } else {\n vec2 _e111 = refracted_uv(in_4.position, _e8.view_dir, _e13.normal, _e22.ior, thick_1);\n vec3 _e113 = screen_blur(_e111, _e13.roughness);\n behind = _e113;\n }\n if ((_e22.att_distance > 0.0)) {\n vec3 _e117 = behind;\n behind = (_e117 * pow(_e22.att_color, vec3((thick_1 / _e22.att_distance))));\n }\n vec3 _e124 = behind;\n return vec4((_e27 + (((_e124 * _e13.base_color) * _e22.transmission) * (1.0 - fresnel))), 1.0);\n }\n float alpha_1 = (_e13.opacity * (1.0 - (_e22.transmission * (1.0 - fresnel))));\n return vec4((_e27 / vec3(max(alpha_1, 0.02))), alpha_1);\n}\n\nvec3 srgb_encode(vec3 c_5) {\n vec3 lo_1 = (c_5 * 12.92);\n vec3 hi_1 = ((1.055 * pow(c_5, vec3(0.41666666))) - vec3(0.055));\n return mix(hi_1, lo_1, lessThanEqual(c_5, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_6 = vec3(0.0);\n float x_4 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_4 < 0.08) ? (x_4 - ((6.25 * x_4) * x_4)) : 0.04);\n c_6 = (color - vec3(offset_1));\n float _e20 = c_6.x;\n float _e22 = c_6.y;\n float _e24 = c_6.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_6;\n return _e28;\n }\n float d_3 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_3 * d_3) / ((peak + d_3) - 0.76)));\n vec3 _e37 = c_6;\n c_6 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_6;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_2) {\n return clamp(((x_2 * ((2.51 * x_2) + vec3(0.03))) / ((x_2 * ((2.43 * x_2) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n bool _e3 = in_layer(in_.material);\n if (!(_e3)) {\n discard;\n }\n vec4 _e5 = frag_pbr(in_, front);\n vec4 _e8 = finish(_e5.xyz, _e5.w);\n _fs2p_location0 = _e8;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
11
+ export const glDrawLambertBlend = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct SurfaceInput {\n vec2 uv;\n vec3 normal_world;\n vec3 position_world;\n vec3 view_dir;\n vec3 instance_color;\n float time;\n uvec4 maps;\n vec2 ddx;\n vec2 ddy;\n vec3 tangent;\n vec3 bitangent;\n};\nstruct Surface {\n vec3 base_color;\n float opacity;\n float metalness;\n float roughness;\n vec3 emissive;\n vec3 normal;\n float occlusion;\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec4 sample_map(highp sampler2DArray maps, highp sampler2DArray maps8_, uint slot, vec2 uv, vec2 ddx, vec2 ddy) {\n vec4 c = vec4(0.0);\n uint state = ((slot >> 24u) & 3u);\n if ((state != 1u)) {\n vec4 checker = ((((uint(floor((uv.x * 8.0))) + uint(floor((uv.y * 8.0)))) % 2u) == 0u) ? vec4(1.0, 0.0, 1.0, 1.0) : vec4(0.05, 0.05, 0.05, 1.0));\n return ((state == 2u) ? checker : vec4(1.0));\n }\n float first_mip = float(((slot >> 16u) & 31u));\n float size = float(uvec2(textureSize(maps, 0).xy).x);\n float major = (max(length(ddx), length(ddy)) * size);\n float minor = (min(length(ddx), length(ddy)) * size);\n bool near_top = (log2(max(max((major * 0.25), minor), 1e-8)) < (first_mip + 1.0));\n float level = max(log2(max(major, 1e-8)), first_mip);\n uint layer = (slot & 65535u);\n bool rgba8_ = (((slot >> 21u) & 1u) == 1u);\n if (near_top) {\n vec4 _e82 = textureLod(maps, vec3(uv, layer), level);\n vec4 _e84 = textureLod(maps8_, vec3(uv, layer), level);\n c = (rgba8_ ? _e84 : _e82);\n } else {\n if (rgba8_) {\n vec4 _e87 = textureGrad(maps8_, vec3(uv, layer), ddx, ddy);\n c = _e87;\n } else {\n vec4 _e89 = textureGrad(maps, vec3(uv, layer), ddx, ddy);\n c = _e89;\n }\n }\n vec4 _e90 = c;\n return _e90;\n}\n\nvec4 sample_srgb(uint slot_1, vec2 uv_1, vec2 ddx_1, vec2 ddy_1) {\n vec4 _e6 = sample_map(_group_0_binding_4_fs, _group_0_binding_9_fs, slot_1, uv_1, ddx_1, ddy_1);\n return _e6;\n}\n\nvec4 sample_linear(uint slot_2, vec2 uv_2, vec2 ddx_2, vec2 ddy_2) {\n vec4 _e6 = sample_map(_group_0_binding_6_fs, _group_0_binding_10_fs, slot_2, uv_2, ddx_2, ddy_2);\n return _e6;\n}\n\nSurface standard_surface(SurfaceInput in_1, Material m) {\n vec4 _e7 = sample_srgb(in_1.maps.x, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e13 = sample_linear(in_1.maps.z, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e19 = sample_srgb(in_1.maps.w, in_1.uv, in_1.ddx, in_1.ddy);\n vec4 _e25 = sample_linear(in_1.maps.y, in_1.uv, in_1.ddx, in_1.ddy);\n vec3 nm = ((_e25.xyz * 2.0) - vec3(1.0));\n vec3 tn = vec3((nm.xy * m.params[0].z), nm.z);\n vec3 mapped_1 = normalize((((in_1.tangent * tn.x) + (in_1.bitangent * tn.y)) + (in_1.normal_world * tn.z)));\n bool has_normal_map = (((in_1.maps.y >> 24u) & 3u) == 1u);\n return Surface(((in_1.instance_color * m.base_color.xyz) * _e7.xyz), (m.base_color.w * _e7.w), (m.params[0].x * _e13.z), (m.params[0].y * _e13.y), (m.params[1].xyz * _e19.xyz), (has_normal_map ? mapped_1 : in_1.normal_world), mix(1.0, _e13.x, m.params[0].w));\n}\n\nvec3 sh_irradiance(vec3 n) {\n vec4 _e4 = _group_0_binding_7_fs.sh[0];\n vec4 _e11 = _group_0_binding_7_fs.sh[1];\n vec4 _e21 = _group_0_binding_7_fs.sh[2];\n vec4 _e31 = _group_0_binding_7_fs.sh[3];\n vec4 _e41 = _group_0_binding_7_fs.sh[4];\n vec4 _e53 = _group_0_binding_7_fs.sh[5];\n vec4 _e65 = _group_0_binding_7_fs.sh[6];\n vec4 _e81 = _group_0_binding_7_fs.sh[7];\n vec4 _e93 = _group_0_binding_7_fs.sh[8];\n return max((((((((((_e4.xyz * 0.282095) + (_e11.xyz * (0.488603 * n.y))) + (_e21.xyz * (0.488603 * n.z))) + (_e31.xyz * (0.488603 * n.x))) + (_e41.xyz * ((1.092548 * n.x) * n.y))) + (_e53.xyz * ((1.092548 * n.y) * n.z))) + (_e65.xyz * (0.315392 * (((3.0 * n.z) * n.z) - 1.0)))) + (_e81.xyz * ((1.092548 * n.x) * n.z))) + (_e93.xyz * (0.546274 * ((n.x * n.x) - (n.y * n.y))))), vec3(0.0));\n}\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c_1) {\n uvec2 tile = min(uvec2(((frag / c_1.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c_1.proj.z) / c_1.proj.z)) / c_1.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_2) {\n return -(dot(c_2.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_2 = (dist / range);\n float t = clamp((1.0 - (((x_2 * x_2) * x_2) * x_2)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n_1, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n_1, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nfloat shadow_compare(vec2 uv_3, float depth_ref) {\n float _e5 = _group_0_binding_14_fs.pcf.y;\n if ((_e5 < 0.5)) {\n float _e10 = textureLod(_group_0_binding_15_fs, vec3(uv_3, depth_ref), 0.0);\n return _e10;\n }\n vec2 size_1 = vec2(uvec2(textureSize(_group_0_binding_15_fs, 0).xy));\n vec2 p_3 = ((uv_3 * size_1) - vec2(0.5));\n vec2 f = fract(p_3);\n vec2 base = ((floor(p_3) + vec2(0.5)) / size_1);\n vec2 dx = vec2((1.0 / size_1.x), 0.0);\n vec2 dy = vec2(0.0, (1.0 / size_1.y));\n float a = textureLod(_group_0_binding_15_fs, vec3(base, depth_ref), 0.0);\n float b = textureLod(_group_0_binding_15_fs, vec3((base + dx), depth_ref), 0.0);\n float c_6 = textureLod(_group_0_binding_15_fs, vec3((base + dy), depth_ref), 0.0);\n float d = textureLod(_group_0_binding_15_fs, vec3(((base + dx) + dy), depth_ref), 0.0);\n return mix(mix(a, b, f.x), mix(c_6, d, f.x), f.y);\n}\n\nfloat sun_shadow(vec3 p_2, vec3 n_2, float depth_1) {\n bool local = false;\n uint c_3 = 0u;\n float lit = 0.0;\n int y = 0;\n int x = 0;\n float _e6 = _group_0_binding_14_fs.params.x;\n uint count_1 = uint(_e6);\n if (!((count_1 == 0u))) {\n float _e16 = _group_0_binding_14_fs.params.w;\n local = (depth_1 >= _e16);\n } else {\n local = true;\n }\n bool _e19 = local;\n if (_e19) {\n return 1.0;\n }\n bool loop_init_1 = true;\n while(true) {\n if (!loop_init_1) {\n uint _e34 = c_3;\n c_3 = (_e34 + 1u);\n }\n loop_init_1 = false;\n uint _e23 = c_3;\n if (((_e23 + 1u) < count_1)) {\n } else {\n break;\n }\n {\n uint _e29 = c_3;\n float _e31 = _group_0_binding_14_fs.splits[_e29];\n if ((depth_1 < _e31)) {\n break;\n }\n }\n }\n vec4 _e38 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(n_2, _e38.xyz), 0.0, 1.0);\n vec4 _e51 = _group_0_binding_0_fs.light_dir;\n uint _e56 = c_3;\n float _e58 = _group_0_binding_14_fs.texel[_e56];\n vec3 offset = (((n_2 * (0.75 + (1.5 * (1.0 - nl)))) + _e51.xyz) * _e58);\n uint _e62 = c_3;\n mat4x4 _e64 = _group_0_binding_14_fs.view_proj[_e62];\n vec4 lp = (_e64 * vec4((p_2 + offset), 1.0));\n float texel = _group_0_binding_14_fs.params.y;\n vec2 uv_4 = clamp(vec2(((lp.x * 0.5) + 0.5), (0.5 - (lp.y * 0.5))), vec2((1.5 * texel)), vec2((1.0 - (1.5 * texel))));\n uint _e94 = c_3;\n vec2 tile_1 = vec2(((uv_4.x + float(_e94)) / float(count_1)), uv_4.y);\n vec2 tap = vec2((texel / float(count_1)), texel);\n float depth_ref_1 = min(lp.z, 1.0);\n float _e110 = _group_0_binding_14_fs.pcf.x;\n int r = int(_e110);\n y = -(r);\n bool loop_init_2 = true;\n while(true) {\n if (!loop_init_2) {\n int _e136 = y;\n y = (_e136 + 1);\n }\n loop_init_2 = false;\n int _e116 = y;\n if ((_e116 <= r)) {\n } else {\n break;\n }\n {\n x = -(r);\n bool loop_init_3 = true;\n while(true) {\n if (!loop_init_3) {\n int _e133 = x;\n x = (_e133 + 1);\n }\n loop_init_3 = false;\n int _e120 = x;\n if ((_e120 <= r)) {\n } else {\n break;\n }\n {\n float _e122 = lit;\n int _e123 = x;\n int _e125 = y;\n float _e130 = shadow_compare((tile_1 + (vec2(float(_e123), float(_e125)) * tap)), depth_ref_1);\n lit = (_e122 + _e130);\n }\n }\n }\n }\n float taps = float((((2 * r) + 1) * ((2 * r) + 1)));\n float _e151 = _group_0_binding_14_fs.params.z;\n float _e156 = _group_0_binding_14_fs.params.w;\n float _e160 = _group_0_binding_14_fs.params.z;\n float fade = clamp(((depth_1 - _e151) / max((_e156 - _e160), 0.001)), 0.0, 1.0);\n float _e166 = lit;\n return mix((_e166 / taps), 1.0, fade);\n}\n\nSurface material_surface(uint shader, SurfaceInput in_2, Material m_1) {\n Surface _e3 = standard_surface(in_2, m_1);\n return _e3;\n}\n\nvec3 facing(vec3 n_3, bool front_1) {\n return (front_1 ? n_3 : -(n_3));\n}\n\nbool in_layer(uint id) {\n float _e4 = _group_0_binding_7_fs.screen.x;\n if ((_e4 < 0.5)) {\n return true;\n }\n uint layer_1 = _group_0_binding_18_fs[((min(id, 255u) * 4u) + 3u)].z;\n float _e23 = _group_0_binding_7_fs.screen.x;\n return (layer_1 == ((_e23 > 1.5) ? 1u : 0u));\n}\n\nvec3 srgb_encode(vec3 c_4) {\n vec3 lo = (c_4 * 12.92);\n vec3 hi = ((1.055 * pow(c_4, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_4, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_5 = vec3(0.0);\n float x_3 = min(color.x, min(color.y, color.z));\n float offset_1 = ((x_3 < 0.08) ? (x_3 - ((6.25 * x_3) * x_3)) : 0.04);\n c_5 = (color - vec3(offset_1));\n float _e20 = c_5.x;\n float _e22 = c_5.y;\n float _e24 = c_5.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_5;\n return _e28;\n }\n float d_1 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_1 * d_1) / ((peak + d_1) - 0.76)));\n vec3 _e37 = c_5;\n c_5 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_5;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x_1) {\n return clamp(((x_1 * ((2.51 * x_1) + vec3(0.03))) / ((x_1 * ((2.43 * x_1) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b_1 = float(_e43.x);\n float d_2 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b_1 + d_2) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_lambert(VertexOut in_3, bool front_2) {\n SurfaceInput si = SurfaceInput(vec2(0.0), vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0), 0.0, uvec4(0u), vec2(0.0), vec2(0.0), vec3(0.0), vec3(0.0));\n vec3 color_2 = vec3(0.0);\n Material m_2 = _group_0_binding_3_fs[min(in_3.material, 255u)];\n si.uv = in_3.uv;\n vec3 _e14 = facing(normalize(in_3.normal), front_2);\n si.normal_world = _e14;\n si.position_world = in_3.position;\n si.view_dir = normalize(-(in_3.position));\n si.instance_color = in_3.color;\n float _e27 = _group_0_binding_0_fs.light_dir.w;\n si.time = _e27;\n si.maps = ((m_2.maps & uvec4(67108863u)) & uvec4(4294967295u, 0u, 4294967295u, 4294967295u));\n vec2 _e41 = dFdx(in_3.uv);\n si.ddx = _e41;\n vec2 _e44 = dFdy(in_3.uv);\n si.ddy = _e44;\n SurfaceInput _e49 = si;\n Surface _e50 = material_surface((m_2.maps.x >> 26u), _e49, m_2);\n vec3 _e53 = si.normal_world;\n ClusterParams _e56 = _group_0_binding_12_fs;\n float _e57 = view_depth(in_3.position, _e56);\n float _e58 = sun_shadow(in_3.position, _e53, _e57);\n vec3 diffuse_1 = (_e50.base_color * (1.0 - (0.5 * _e50.metalness)));\n vec4 _e69 = _group_0_binding_0_fs.light_dir;\n float nl_1 = clamp(dot(_e50.normal, _e69.xyz), 0.0, 1.0);\n vec4 _e78 = _group_0_binding_7_fs.sun_color;\n vec3 _e84 = sh_irradiance(_e50.normal);\n float _e91 = _group_0_binding_7_fs.sun_color.w;\n vec3 _e100 = clustered_diffuse(_e50.normal, diffuse_1, in_3.position, in_3.clip.xy);\n color_2 = (((((((diffuse_1 / vec3(3.1415927)) * _e78.xyz) * _e58) * nl_1) + (((diffuse_1 * _e84) * _e50.occlusion) * _e91)) + _e50.emissive) + _e100);\n float _e106 = _group_0_binding_7_fs.env.x;\n if ((_e106 < 0.0)) {\n vec3 _e109 = color_2;\n vec3 _e110 = bindings_anchor();\n color_2 = (_e109 + _e110);\n }\n vec3 _e112 = color_2;\n return vec4(_e112, _e50.opacity);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n bool _e3 = in_layer(in_.material);\n if (!(_e3)) {\n discard;\n }\n vec4 _e5 = frag_lambert(in_, front);\n vec4 _e8 = finish(_e5.xyz, _e5.w);\n _fs2p_location0 = _e8;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
12
+ export const glDrawFlatBlend = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, ids.y, 0u);\n VertexOut _e13 = shade(inst_1, position, normal, uv);\n gl_Position = _e13.clip;\n _vs2fs_location0 = _e13.normal;\n _vs2fs_location1 = _e13.color;\n _vs2fs_location2 = _e13.material;\n _vs2fs_location3 = _e13.uv;\n _vs2fs_location4 = _e13.position;\n _vs2fs_location5 = _e13.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Material {\n vec4 base_color;\n uvec4 maps;\n vec4 params[2];\n};\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Lighting {\n vec4 sun_color;\n vec4 env;\n vec4 sh[9];\n vec4 screen;\n};\nstruct Light {\n vec4 pos_range;\n vec4 color_kind;\n vec4 dir_outer;\n vec4 inner;\n};\nstruct Lights {\n Light lights[256];\n};\nstruct ClusterParams {\n vec4 view_x;\n vec4 view_y;\n vec4 view_z;\n vec4 proj;\n vec4 screen;\n};\nstruct Shadow {\n mat4x4 view_proj[4];\n vec4 splits;\n vec4 texel;\n vec4 params;\n vec4 pcf;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Fragment { Camera _group_0_binding_0_fs; };\n\nlayout(std140) uniform type_9_block_1Fragment { Material _group_0_binding_3_fs[256]; };\n\nuniform highp sampler2DArray _group_0_binding_4_fs;\n\nuniform highp sampler2DArray _group_0_binding_6_fs;\n\nlayout(std140) uniform Lighting_block_2Fragment { Lighting _group_0_binding_7_fs; };\n\nuniform highp samplerCube _group_0_binding_8_fs;\n\nuniform highp sampler2DArray _group_0_binding_9_fs;\n\nuniform highp sampler2DArray _group_0_binding_10_fs;\n\nlayout(std140) uniform Lights_block_3Fragment { Lights _group_0_binding_11_fs; };\n\nlayout(std140) uniform ClusterParams_block_4Fragment { ClusterParams _group_0_binding_12_fs; };\n\nuniform highp usampler2D _group_0_binding_13_fs;\n\nlayout(std140) uniform type_16_block_5Fragment { uvec4 _group_0_binding_18_fs[1024]; };\n\nuniform highp sampler2D _group_0_binding_19_fs;\n\nlayout(std140) uniform Shadow_block_6Fragment { Shadow _group_0_binding_14_fs; };\n\nuniform highp sampler2DShadow _group_0_binding_15_fs;\n\nsmooth in vec3 _vs2fs_location0;\nsmooth in vec3 _vs2fs_location1;\nflat in uint _vs2fs_location2;\nsmooth in vec2 _vs2fs_location3;\nsmooth in vec3 _vs2fs_location4;\nflat in float _vs2fs_location5;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nuint cluster_index(vec2 frag, float depth, ClusterParams c) {\n uvec2 tile = min(uvec2(((frag / c.screen.xy) * vec2(16.0, 9.0))), uvec2(15u, 8u));\n uint slice = uint(clamp(((log2((max(depth, c.proj.z) / c.proj.z)) / c.screen.w) * 24.0), 0.0, 23.0));\n return ((((slice * GRID_Y) + tile.y) * GRID_X) + tile.x);\n}\n\nfloat view_depth(vec3 p, ClusterParams c_1) {\n return -(dot(c_1.view_z.xyz, p));\n}\n\nfloat range_window(float dist, float range) {\n float x_1 = (dist / range);\n float t = clamp((1.0 - (((x_1 * x_1) * x_1) * x_1)), 0.0, 1.0);\n return (t * t);\n}\n\nvec3 clustered_diffuse(vec3 n, vec3 diffuse, vec3 p_1, vec2 frag_1) {\n vec3 sum = vec3(0.0);\n uint k = 0u;\n float atten = 0.0;\n float _e7 = _group_0_binding_12_fs.screen.z;\n if ((_e7 < 0.5)) {\n return vec3(0.0);\n }\n ClusterParams _e13 = _group_0_binding_12_fs;\n float _e14 = view_depth(p_1, _e13);\n ClusterParams _e16 = _group_0_binding_12_fs;\n uint _e17 = cluster_index(frag_1, _e14, _e16);\n uvec4 _e22 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u, _e17)), 0);\n uint count = _e22.x;\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e84 = k;\n k = (_e84 + 1u);\n }\n loop_init = false;\n uint _e29 = k;\n if ((_e29 < count)) {\n } else {\n break;\n }\n {\n uint _e34 = k;\n uvec4 _e39 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2((_e34 + 1u), _e17)), 0);\n Light light = _group_0_binding_11_fs.lights[_e39.x];\n vec3 to_light = (light.pos_range.xyz - p_1);\n float dist2_ = max(dot(to_light, to_light), 0.0001);\n vec3 l = (to_light * inversesqrt(dist2_));\n float _e54 = range_window(sqrt(dist2_), light.pos_range.w);\n atten = (_e54 / dist2_);\n float cone = smoothstep(light.dir_outer.w, light.inner.x, dot(-(l), light.dir_outer.xyz));\n float _e66 = atten;\n atten = (_e66 * ((light.color_kind.w > 0.5) ? cone : 1.0));\n vec3 _e74 = sum;\n float _e77 = atten;\n sum = (_e74 + (light.color_kind.xyz * (_e77 * clamp(dot(n, l), 0.0, 1.0))));\n }\n }\n vec3 _e89 = sum;\n return ((diffuse / vec3(3.1415927)) * _e89);\n}\n\nvec3 facing(vec3 n_1, bool front_1) {\n return (front_1 ? n_1 : -(n_1));\n}\n\nbool in_layer(uint id) {\n float _e4 = _group_0_binding_7_fs.screen.x;\n if ((_e4 < 0.5)) {\n return true;\n }\n uint layer = _group_0_binding_18_fs[((min(id, 255u) * 4u) + 3u)].z;\n float _e23 = _group_0_binding_7_fs.screen.x;\n return (layer == ((_e23 > 1.5) ? 1u : 0u));\n}\n\nvec3 srgb_encode(vec3 c_2) {\n vec3 lo = (c_2 * 12.92);\n vec3 hi = ((1.055 * pow(c_2, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_2, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_3 = vec3(0.0);\n float x_2 = min(color.x, min(color.y, color.z));\n float offset = ((x_2 < 0.08) ? (x_2 - ((6.25 * x_2) * x_2)) : 0.04);\n c_3 = (color - vec3(offset));\n float _e20 = c_3.x;\n float _e22 = c_3.y;\n float _e24 = c_3.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_3;\n return _e28;\n }\n float d = (1.0 - 0.76);\n float new_peak = (1.0 - ((d * d) / ((peak + d) - 0.76)));\n vec3 _e37 = c_3;\n c_3 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_3;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x) {\n return clamp(((x * ((2.51 * x) + vec3(0.03))) / ((x * ((2.43 * x) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_map(vec3 linear_in_1, uint curve_1) {\n vec3 _e2 = tone_curve(linear_in_1, curve_1);\n vec3 _e3 = srgb_encode(_e2);\n return _e3;\n}\n\nvec4 finish(vec3 color_1, float alpha) {\n float _e5 = _group_0_binding_7_fs.env.y;\n if ((_e5 > 0.5)) {\n float _e11 = _group_0_binding_7_fs.env.z;\n float _e16 = _group_0_binding_7_fs.env.w;\n vec3 _e18 = tone_map((color_1 * _e11), uint(_e16));\n return vec4(_e18, alpha);\n }\n return vec4(color_1, alpha);\n}\n\nvec3 bindings_anchor() {\n vec4 _e6 = textureLod(_group_0_binding_4_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e13 = textureLod(_group_0_binding_6_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e21 = textureLod(_group_0_binding_9_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 _e29 = textureLod(_group_0_binding_10_fs, vec3(vec2(0.0), 0), 0.0);\n vec4 t_1 = (((_e6 + _e13) + _e21) + _e29);\n vec4 e = textureLod(_group_0_binding_8_fs, vec3(vec3(0.0, 0.0, 1.0)), 0.0);\n uvec4 _e43 = texelFetch(_group_0_binding_13_fs, ivec2(uvec2(0u)), 0);\n float b = float(_e43.x);\n float d_1 = textureLod(_group_0_binding_15_fs, vec3(vec2(0.0), 0.5), 0.0);\n vec4 _e59 = _group_0_binding_11_fs.lights[0].pos_range;\n float _e66 = _group_0_binding_14_fs.params.x;\n float _e71 = _group_0_binding_12_fs.proj.x;\n float _e77 = _group_0_binding_7_fs.sh[0].x;\n uint _e82 = _group_0_binding_18_fs[0].x;\n vec4 _e89 = texelFetch(_group_0_binding_19_fs, ivec2(0), 0);\n return (((t_1.xyz + e.xyz) + _e59.xyz) + vec3(((((((b + d_1) + _e66) + _e71) + _e77) + float(_e82)) + _e89.x)));\n}\n\nvec4 frag_flat(VertexOut in_1, bool front_2) {\n vec3 color_2 = vec3(0.0);\n Material m = _group_0_binding_3_fs[min(in_1.material, 255u)];\n vec3 base = (in_1.color * m.base_color.xyz);\n vec3 _e14 = facing(normalize(in_1.normal), front_2);\n vec4 _e17 = _group_0_binding_0_fs.light_dir;\n float nl = clamp(dot(_e14, _e17.xyz), 0.0, 1.0);\n vec4 _e24 = _group_0_binding_7_fs.sh[0];\n float _e34 = _group_0_binding_7_fs.sun_color.w;\n vec3 ambient = (max((_e24.xyz * 0.282095), vec3(0.0)) * _e34);\n vec4 _e41 = _group_0_binding_7_fs.sun_color;\n vec3 _e54 = clustered_diffuse(_e14, base, in_1.position, in_1.clip.xy);\n color_2 = ((((((base / vec3(3.1415927)) * _e41.xyz) * nl) + (base * ambient)) + m.params[1].xyz) + _e54);\n float _e60 = _group_0_binding_7_fs.env.x;\n if ((_e60 < 0.0)) {\n vec3 _e63 = color_2;\n vec3 _e64 = bindings_anchor();\n color_2 = (_e63 + _e64);\n }\n vec3 _e66 = color_2;\n return vec4(_e66, m.base_color.w);\n}\n\nvoid main() {\n VertexOut in_ = VertexOut(gl_FragCoord, _vs2fs_location0, _vs2fs_location1, _vs2fs_location2, _vs2fs_location3, _vs2fs_location4, _vs2fs_location5);\n bool front = gl_FrontFacing;\n bool _e3 = in_layer(in_.material);\n if (!(_e3)) {\n discard;\n }\n vec4 _e5 = frag_flat(in_, front);\n vec4 _e8 = finish(_e5.xyz, _e5.w);\n _fs2p_location0 = _e8;\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Fragment"], [0, 3, "type_9_block_1Fragment"], [0, 7, "Lighting_block_2Fragment"], [0, 11, "Lights_block_3Fragment"], [0, 12, "ClusterParams_block_4Fragment"], [0, 14, "Shadow_block_6Fragment"], [0, 18, "type_16_block_5Fragment"]], "textures": [["_group_0_binding_10_fs", 0, 10, 0, 5], ["_group_0_binding_13_fs", 0, 13, -1, -1], ["_group_0_binding_15_fs", 0, 15, 0, 16], ["_group_0_binding_19_fs", 0, 19, -1, -1], ["_group_0_binding_4_fs", 0, 4, 0, 5], ["_group_0_binding_6_fs", 0, 6, 0, 5], ["_group_0_binding_8_fs", 0, 8, 0, 5], ["_group_0_binding_9_fs", 0, 9, 0, 5]] } };
13
+ export const glShadow = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Cascade {\n mat4x4 view_proj;\n vec4 origin;\n};\nconst uint PALETTE_WIDTH = 1024u;\n\nlayout(std140) uniform Cascade_block_0Vertex { Cascade _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nvec4 shadow_clip(vec3 pos, float scale, vec4 rot_1, vec3 position_1) {\n vec4 c = vec4(0.0);\n vec3 _e5 = quat_rotate(rot_1, (position_1 * scale));\n vec3 world = (_e5 + pos);\n mat4x4 _e9 = _group_0_binding_0_vs.view_proj;\n c = (_e9 * vec4(world, 1.0));\n float _e16 = c.z;\n c.z = min(_e16, 1.0);\n vec4 _e19 = c;\n return _e19;\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n vec4 _e5 = shadow_clip(pos_scale.xyz, pos_scale.w, rot, position);\n gl_Position = _e5;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Cascade_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\nprecision highp float;\nvoid main() {}\n", "uniforms": [], "textures": [] } };
14
+ export const glSky = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct FaceOut {\n vec4 clip;\n vec2 uv;\n};\nsmooth out vec2 _vs2fs_location0;\n\nvoid main() {\n uint i = uint(gl_VertexID);\n FaceOut out_ = FaceOut(vec4(0.0), vec2(0.0));\n vec2 p = vec2(float(((i << 1u) & 2u)), float((i & 2u)));\n out_.clip = vec4(((p * 2.0) - vec2(1.0)), 0.0, 1.0);\n out_.uv = ((p * 2.0) - vec2(1.0));\n FaceOut _e26 = out_;\n gl_Position = _e26.clip;\n _vs2fs_location0 = _e26.uv;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct SkyParams {\n vec4 sun;\n vec4 zenith;\n vec4 horizon;\n vec4 ground;\n vec4 sun_color;\n vec4 face;\n};\nstruct FaceOut {\n vec4 clip;\n vec2 uv;\n};\nlayout(std140) uniform SkyParams_block_0Fragment { SkyParams _group_0_binding_0_fs; };\n\nsmooth in vec2 _vs2fs_location0;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec3 face_dir(uint face, vec2 uv) {\n float u = uv.x;\n float v = -(uv.y);\n switch(face) {\n case 0u: {\n return normalize(vec3(1.0, -(v), -(u)));\n }\n case 1u: {\n return normalize(vec3(-1.0, -(v), u));\n }\n case 2u: {\n return normalize(vec3(u, 1.0, v));\n }\n case 3u: {\n return normalize(vec3(u, -1.0, -(v)));\n }\n case 4u: {\n return normalize(vec3(u, -(v), 1.0));\n }\n default: {\n return normalize(vec3(-(u), -(v), -1.0));\n }\n }\n}\n\nvec3 sky(vec3 d) {\n vec3 c = vec3(0.0);\n float up = d.y;\n vec4 _e4 = _group_0_binding_0_fs.horizon;\n vec4 _e8 = _group_0_binding_0_fs.zenith;\n vec3 above = mix(_e4.xyz, _e8.xyz, pow(clamp(up, 0.0, 1.0), 0.5));\n vec4 _e16 = _group_0_binding_0_fs.horizon;\n vec4 _e20 = _group_0_binding_0_fs.ground;\n vec3 below = mix(_e16.xyz, _e20.xyz, clamp((-(up) * 4.0), 0.0, 1.0));\n c = ((up >= 0.0) ? above : below);\n vec4 _e33 = _group_0_binding_0_fs.sun;\n float cos_sun = dot(d, _e33.xyz);\n vec3 _e36 = c;\n vec4 _e39 = _group_0_binding_0_fs.sun_color;\n float _e44 = _group_0_binding_0_fs.sun_color.w;\n c = (_e36 + ((_e39.xyz * smoothstep(_e44, 1.0, cos_sun)) * step(0.0, up)));\n vec3 _e52 = c;\n return _e52;\n}\n\nvoid main() {\n FaceOut in_ = FaceOut(gl_FragCoord, _vs2fs_location0);\n float _e4 = _group_0_binding_0_fs.face.x;\n vec3 _e7 = face_dir(uint(_e4), in_.uv);\n vec3 _e8 = sky(_e7);\n _fs2p_location0 = vec4(_e8, 1.0);\n return;\n}\n\n", "uniforms": [[0, 0, "SkyParams_block_0Fragment"]], "textures": [] } };
15
+ export const glPrefilter = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct FaceOut {\n vec4 clip;\n vec2 uv;\n};\nsmooth out vec2 _vs2fs_location0;\n\nvoid main() {\n uint i = uint(gl_VertexID);\n FaceOut out_ = FaceOut(vec4(0.0), vec2(0.0));\n vec2 p = vec2(float(((i << 1u) & 2u)), float((i & 2u)));\n out_.clip = vec4(((p * 2.0) - vec2(1.0)), 0.0, 1.0);\n out_.uv = ((p * 2.0) - vec2(1.0));\n FaceOut _e26 = out_;\n gl_Position = _e26.clip;\n _vs2fs_location0 = _e26.uv;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct SkyParams {\n vec4 sun;\n vec4 zenith;\n vec4 horizon;\n vec4 ground;\n vec4 sun_color;\n vec4 face;\n};\nstruct FaceOut {\n vec4 clip;\n vec2 uv;\n};\nlayout(std140) uniform SkyParams_block_0Fragment { SkyParams _group_0_binding_0_fs; };\n\nuniform highp samplerCube _group_0_binding_1_fs;\n\nsmooth in vec2 _vs2fs_location0;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec3 face_dir(uint face, vec2 uv) {\n float u = uv.x;\n float v = -(uv.y);\n switch(face) {\n case 0u: {\n return normalize(vec3(1.0, -(v), -(u)));\n }\n case 1u: {\n return normalize(vec3(-1.0, -(v), u));\n }\n case 2u: {\n return normalize(vec3(u, 1.0, v));\n }\n case 3u: {\n return normalize(vec3(u, -1.0, -(v)));\n }\n case 4u: {\n return normalize(vec3(u, -(v), 1.0));\n }\n default: {\n return normalize(vec3(-(u), -(v), -1.0));\n }\n }\n}\n\nfloat radical_inverse(uint i_1) {\n uint b = 0u;\n b = ((i_1 << 16u) | (i_1 >> 16u));\n uint _e7 = b;\n uint _e12 = b;\n b = (((_e7 & 1431655765u) << 1u) | ((_e12 & 2863311530u) >> 1u));\n uint _e18 = b;\n uint _e23 = b;\n b = (((_e18 & 858993459u) << 2u) | ((_e23 & 3435973836u) >> 2u));\n uint _e29 = b;\n uint _e34 = b;\n b = (((_e29 & 252645135u) << 4u) | ((_e34 & 4042322160u) >> 4u));\n uint _e40 = b;\n uint _e45 = b;\n b = (((_e40 & 16711935u) << 8u) | ((_e45 & 4278255360u) >> 8u));\n uint _e51 = b;\n return (float(_e51) * 2.3283064e-10);\n}\n\nvoid main() {\n FaceOut in_ = FaceOut(gl_FragCoord, _vs2fs_location0);\n vec3 sum = vec3(0.0);\n float weight = 0.0;\n uint i = 0u;\n float _e4 = _group_0_binding_0_fs.face.x;\n vec3 _e7 = face_dir(uint(_e4), in_.uv);\n float roughness = _group_0_binding_0_fs.sun.w;\n float a = (roughness * roughness);\n vec3 up = ((abs(_e7.y) < 0.999) ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0));\n vec3 tx = normalize(cross(up, _e7));\n vec3 ty = cross(_e7, tx);\n float _e33 = _group_0_binding_0_fs.face.y;\n float _e39 = _group_0_binding_0_fs.face.y;\n float texel_solid_angle = (12.566371 / ((6.0 * _e33) * _e39));\n bool loop_init = true;\n while(true) {\n if (!loop_init) {\n uint _e142 = i;\n i = (_e142 + 1u);\n }\n loop_init = false;\n uint _e50 = i;\n if ((_e50 < 128u)) {\n } else {\n break;\n }\n {\n uint _e52 = i;\n uint _e56 = i;\n float _e57 = radical_inverse(_e56);\n vec2 xi = vec2((float(_e52) / float(128u)), _e57);\n float phi = (6.2831855 * xi.x);\n float cos_t = sqrt(((1.0 - xi.y) / (1.0 + (((a * a) - 1.0) * xi.y))));\n float sin_t = sqrt((1.0 - (cos_t * cos_t)));\n vec3 h = (((tx * (sin_t * cos(phi))) + (ty * (sin_t * sin(phi)))) + (_e7 * cos_t));\n vec3 l = (((2.0 * dot(_e7, h)) * h) - _e7);\n float nl = dot(_e7, l);\n if ((nl > 0.0)) {\n float nh = clamp(dot(_e7, h), 0.0, 1.0);\n float d = ((a * a) / (3.1415927 * pow((((nh * nh) * ((a * a) - 1.0)) + 1.0), 2.0)));\n float pdf = ((d * 0.25) + 0.0001);\n float sample_solid_angle = (1.0 / (float(128u) * pdf));\n float _e127 = _group_0_binding_0_fs.face.z;\n float lod = clamp(((0.5 * log2((sample_solid_angle / texel_solid_angle))) + 1.0), 0.0, (_e127 - 1.0));\n vec3 _e132 = sum;\n vec4 _e135 = textureLod(_group_0_binding_1_fs, vec3(l), lod);\n sum = (_e132 + (_e135.xyz * nl));\n float _e139 = weight;\n weight = (_e139 + nl);\n }\n }\n }\n vec3 _e144 = sum;\n float _e145 = weight;\n _fs2p_location0 = vec4((_e144 / vec3(max(_e145, 0.0001))), 1.0);\n return;\n}\n\n", "uniforms": [[0, 0, "SkyParams_block_0Fragment"]], "textures": [["_group_0_binding_1_fs", 0, 1, 0, 2]] } };
16
+ export const glTonemap = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\n\nvoid main() {\n uint i = uint(gl_VertexID);\n vec2 p = vec2(float(((i << 1u) & 2u)), float((i & 2u)));\n gl_Position = vec4(((p * 2.0) - vec2(1.0)), 0.0, 1.0);\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct ToneParams {\n float exposure;\n uint curve;\n float bloom;\n uint grade;\n vec3 balance;\n float contrast;\n vec3 lift;\n float saturation;\n vec3 gamma;\n float pad0_;\n vec3 gain;\n float pad1_;\n};\nuniform highp sampler2D _group_0_binding_0_fs;\n\nlayout(std140) uniform ToneParams_block_0Fragment { ToneParams _group_0_binding_1_fs; };\n\nuniform highp sampler2D _group_0_binding_2_fs;\n\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvec3 srgb_encode(vec3 c_1) {\n vec3 lo = (c_1 * 12.92);\n vec3 hi = ((1.055 * pow(c_1, vec3(0.41666666))) - vec3(0.055));\n return mix(hi, lo, lessThanEqual(c_1, vec3(0.0031308)));\n}\n\nvec3 pbr_neutral(vec3 color) {\n vec3 c_2 = vec3(0.0);\n float x_1 = min(color.x, min(color.y, color.z));\n float offset = ((x_1 < 0.08) ? (x_1 - ((6.25 * x_1) * x_1)) : 0.04);\n c_2 = (color - vec3(offset));\n float _e20 = c_2.x;\n float _e22 = c_2.y;\n float _e24 = c_2.z;\n float peak = max(_e20, max(_e22, _e24));\n if ((peak < 0.76)) {\n vec3 _e28 = c_2;\n return _e28;\n }\n float d_1 = (1.0 - 0.76);\n float new_peak = (1.0 - ((d_1 * d_1) / ((peak + d_1) - 0.76)));\n vec3 _e37 = c_2;\n c_2 = (_e37 * (new_peak / peak));\n float g = (1.0 - (1.0 / ((0.15 * (peak - new_peak)) + 1.0)));\n vec3 _e48 = c_2;\n return mix(_e48, vec3(new_peak), g);\n}\n\nvec3 aces(vec3 x) {\n return clamp(((x * ((2.51 * x) + vec3(0.03))) / ((x * ((2.43 * x) + vec3(0.59))) + vec3(0.14))), vec3(0.0), vec3(1.0));\n}\n\nvec3 tone_curve(vec3 linear_in, uint curve) {\n vec3 mapped = vec3(0.0);\n vec3 linear = max(linear_in, vec3(0.0));\n switch(curve) {\n case 0u: {\n vec3 _e6 = pbr_neutral(linear);\n mapped = _e6;\n break;\n }\n case 1u: {\n vec3 _e7 = aces(linear);\n mapped = _e7;\n break;\n }\n default: {\n mapped = clamp(linear, vec3(0.0), vec3(1.0));\n break;\n }\n }\n vec3 _e9 = mapped;\n return clamp(_e9, vec3(0.0), vec3(1.0));\n}\n\nvoid main() {\n vec4 at = gl_FragCoord;\n vec3 c = vec3(0.0);\n vec3 d = vec3(0.0);\n vec4 _e5 = texelFetch(_group_0_binding_0_fs, ivec2(at.xy), 0);\n c = _e5.xyz;\n float _e10 = _group_0_binding_1_fs.bloom;\n if ((_e10 > 0.0)) {\n vec2 uv = (at.xy / vec2(uvec2(textureSize(_group_0_binding_0_fs, 0).xy)));\n vec3 _e18 = c;\n vec4 _e22 = textureLod(_group_0_binding_2_fs, vec2(uv), 0.0);\n float _e26 = _group_0_binding_1_fs.bloom;\n c = (_e18 + (_e22.xyz * _e26));\n }\n vec3 _e29 = c;\n float _e32 = _group_0_binding_1_fs.exposure;\n c = (_e29 * _e32);\n uint _e36 = _group_0_binding_1_fs.grade;\n if ((_e36 == 0u)) {\n vec3 _e39 = c;\n uint _e42 = _group_0_binding_1_fs.curve;\n vec3 _e43 = tone_curve(_e39, _e42);\n vec3 _e44 = srgb_encode(_e43);\n _fs2p_location0 = vec4(_e44, 1.0);\n return;\n }\n vec3 _e47 = c;\n vec3 _e50 = _group_0_binding_1_fs.balance;\n c = max((_e47 * _e50), vec3(0.0));\n vec3 _e55 = c;\n float _e64 = _group_0_binding_1_fs.contrast;\n c = (0.18 * pow(((_e55 / vec3(0.18)) + vec3(1e-6)), vec3(_e64)));\n vec3 _e69 = c;\n float y = dot(_e69, vec3(0.2126, 0.7152, 0.0722));\n vec3 _e76 = c;\n float _e79 = _group_0_binding_1_fs.saturation;\n c = max(mix(vec3(y), _e76, _e79), vec3(0.0));\n vec3 _e84 = c;\n uint _e87 = _group_0_binding_1_fs.curve;\n vec3 _e88 = tone_curve(_e84, _e87);\n d = _e88;\n vec3 _e92 = _group_0_binding_1_fs.gain;\n vec3 _e93 = d;\n vec3 _e96 = _group_0_binding_1_fs.lift;\n vec3 _e97 = d;\n d = clamp((_e92 * (_e93 + (_e96 * (vec3(1.0) - _e97)))), vec3(0.0), vec3(1.0));\n vec3 _e105 = d;\n vec3 _e108 = _group_0_binding_1_fs.gamma;\n d = pow(_e105, (vec3(1.0) / max(_e108, vec3(0.001))));\n vec3 _e116 = d;\n vec3 _e117 = srgb_encode(_e116);\n _fs2p_location0 = vec4(_e117, 1.0);\n return;\n}\n\n", "uniforms": [[0, 1, "ToneParams_block_0Fragment"]], "textures": [["_group_0_binding_0_fs", 0, 0, -1, -1], ["_group_0_binding_2_fs", 0, 2, 0, 3]] } };
17
+ export const glLines = { "vs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct LineOut {\n vec4 pos;\n vec4 color;\n};\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec4 _p2vs_location1;\nsmooth out vec4 _vs2fs_location0;\n\nvoid main() {\n vec3 p = _p2vs_location0;\n vec4 color = _p2vs_location1;\n LineOut o = LineOut(vec4(0.0), vec4(0.0));\n mat4x4 _e6 = _group_0_binding_0_vs.view_proj;\n o.pos = (_e6 * vec4(p, 1.0));\n float _e14 = o.pos.z;\n o.pos.z = (_e14 * 1.002);\n o.color = color;\n LineOut _e18 = o;\n gl_Position = _e18.pos;\n _vs2fs_location0 = _e18.color;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [] }, "fs": { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct LineOut {\n vec4 pos;\n vec4 color;\n};\nsmooth in vec4 _vs2fs_location0;\nlayout(location = 0) out vec4 _fs2p_location0;\n\nvoid main() {\n LineOut v = LineOut(gl_FragCoord, _vs2fs_location0);\n _fs2p_location0 = v.color;\n return;\n}\n\n", "uniforms": [], "textures": [] } };
18
+ export const glVsSkinned = { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Camera {\n mat4x4 view_proj;\n vec4 frustum[6];\n vec4 light_dir;\n vec4 origin;\n};\nstruct Instance {\n vec3 pos;\n float scale;\n vec4 rot;\n uint color;\n uint mesh;\n uint material;\n uint skin;\n};\nstruct VertexOut {\n vec4 clip;\n vec3 normal;\n vec3 color;\n uint material;\n vec2 uv;\n vec3 position;\n float scale;\n};\nstruct Skinned {\n vec3 position;\n vec3 normal;\n};\nconst uint MAX_MATERIALS = 256u;\nconst uint MAX_LIGHTS = 256u;\nconst uint PALETTE_WIDTH = 1024u;\nconst uint GRID_X = 16u;\nconst uint GRID_Y = 9u;\nconst uint GRID_Z = 24u;\n\nlayout(std140) uniform Camera_block_0Vertex { Camera _group_0_binding_0_vs; };\n\nuniform highp sampler2D _group_0_binding_17_vs;\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 1) in vec3 _p2vs_location1;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 5) in vec2 _p2vs_location5;\nlayout(location = 6) in uvec4 _p2vs_location6;\nlayout(location = 7) in vec4 _p2vs_location7;\nsmooth out vec3 _vs2fs_location0;\nsmooth out vec3 _vs2fs_location1;\nflat out uint _vs2fs_location2;\nsmooth out vec2 _vs2fs_location3;\nsmooth out vec3 _vs2fs_location4;\nflat out float _vs2fs_location5;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nVertexOut shade(Instance inst, vec3 position_1, vec3 normal_1, vec2 uv_1) {\n VertexOut out_ = VertexOut(vec4(0.0), vec3(0.0), vec3(0.0), 0u, vec2(0.0), vec3(0.0), 0.0);\n vec3 _e7 = quat_rotate(inst.rot, (position_1 * inst.scale));\n vec3 world = (_e7 + inst.pos);\n mat4x4 _e14 = _group_0_binding_0_vs.view_proj;\n out_.clip = (_e14 * vec4(world, 1.0));\n vec3 _e20 = quat_rotate(inst.rot, normal_1);\n out_.normal = _e20;\n uint _e22 = inst.color;\n out_.color = (vec4(_e22 & 0xFFu, _e22 >> 8 & 0xFFu, _e22 >> 16 & 0xFFu, _e22 >> 24) / 255.0).xyz;\n out_.material = inst.material;\n out_.uv = uv_1;\n out_.position = world;\n out_.scale = inst.scale;\n VertexOut _e31 = out_;\n return _e31;\n}\n\nvec4 palette_texel(highp sampler2D palette, uint i) {\n vec4 _e8 = texelFetch(palette, ivec2(uvec2((i % PALETTE_WIDTH), (i / PALETTE_WIDTH))), 0);\n return _e8;\n}\n\nSkinned skin_vertex(highp sampler2D palette_1, uint row, uvec4 joints_1, vec4 weights_1, vec3 position_2, vec3 normal_2) {\n bool local = false;\n if (!((row == 0u))) {\n local = (dot(weights_1, vec4(1.0)) <= 0.0);\n } else {\n local = true;\n }\n bool _e17 = local;\n if (_e17) {\n return Skinned(position_2, normal_2);\n }\n uint base = (row - 1u);\n uvec4 t_1 = ((uvec4(base) + joints_1) * 3u);\n vec4 _e27 = palette_texel(palette_1, t_1.x);\n vec4 _e31 = palette_texel(palette_1, t_1.y);\n vec4 _e36 = palette_texel(palette_1, t_1.z);\n vec4 _e41 = palette_texel(palette_1, t_1.w);\n vec4 r0_ = ((((weights_1.x * _e27) + (weights_1.y * _e31)) + (weights_1.z * _e36)) + (weights_1.w * _e41));\n vec4 _e48 = palette_texel(palette_1, (t_1.x + 1u));\n vec4 _e54 = palette_texel(palette_1, (t_1.y + 1u));\n vec4 _e61 = palette_texel(palette_1, (t_1.z + 1u));\n vec4 _e68 = palette_texel(palette_1, (t_1.w + 1u));\n vec4 r1_ = ((((weights_1.x * _e48) + (weights_1.y * _e54)) + (weights_1.z * _e61)) + (weights_1.w * _e68));\n vec4 _e75 = palette_texel(palette_1, (t_1.x + 2u));\n vec4 _e81 = palette_texel(palette_1, (t_1.y + 2u));\n vec4 _e88 = palette_texel(palette_1, (t_1.z + 2u));\n vec4 _e95 = palette_texel(palette_1, (t_1.w + 2u));\n vec4 r2_ = ((((weights_1.x * _e75) + (weights_1.y * _e81)) + (weights_1.z * _e88)) + (weights_1.w * _e95));\n vec4 p = vec4(position_2, 1.0);\n return Skinned(vec3(dot(r0_, p), dot(r1_, p), dot(r2_, p)), vec3(dot(r0_.xyz, normal_2), dot(r1_.xyz, normal_2), dot(r2_.xyz, normal_2)));\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec3 normal = _p2vs_location1;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n vec2 uv = _p2vs_location5;\n uvec4 joints = _p2vs_location6;\n vec4 weights = _p2vs_location7;\n Instance inst_1 = Instance(pos_scale.xyz, pos_scale.w, rot, ids.x, 0u, (ids.y & 255u), 0u);\n Skinned _e21 = skin_vertex(_group_0_binding_17_vs, (ids.y >> 8u), joints, weights, position, normal);\n VertexOut _e24 = shade(inst_1, _e21.position, _e21.normal, uv);\n gl_Position = _e24.clip;\n _vs2fs_location0 = _e24.normal;\n _vs2fs_location1 = _e24.color;\n _vs2fs_location2 = _e24.material;\n _vs2fs_location3 = _e24.uv;\n _vs2fs_location4 = _e24.position;\n _vs2fs_location5 = _e24.scale;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Camera_block_0Vertex"]], "textures": [["_group_0_binding_17_vs", 0, 17, -1, -1]] };
19
+ export const glVsShadowSkinned = { "glsl": "#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nstruct Cascade {\n mat4x4 view_proj;\n vec4 origin;\n};\nstruct Skinned {\n vec3 position;\n vec3 normal;\n};\nconst uint PALETTE_WIDTH = 1024u;\n\nlayout(std140) uniform Cascade_block_0Vertex { Cascade _group_0_binding_0_vs; };\n\nuniform highp sampler2D _group_0_binding_3_vs;\n\nlayout(location = 0) in vec3 _p2vs_location0;\nlayout(location = 2) in vec4 _p2vs_location2;\nlayout(location = 3) in vec4 _p2vs_location3;\nlayout(location = 4) in uvec2 _p2vs_location4;\nlayout(location = 6) in uvec4 _p2vs_location6;\nlayout(location = 7) in vec4 _p2vs_location7;\n\nvec3 quat_rotate(vec4 q, vec3 v) {\n vec3 t = (2.0 * cross(q.xyz, v));\n return ((v + (q.w * t)) + cross(q.xyz, t));\n}\n\nvec4 shadow_clip(vec3 pos, float scale, vec4 rot_1, vec3 position_1) {\n vec4 c = vec4(0.0);\n vec3 _e5 = quat_rotate(rot_1, (position_1 * scale));\n vec3 world = (_e5 + pos);\n mat4x4 _e9 = _group_0_binding_0_vs.view_proj;\n c = (_e9 * vec4(world, 1.0));\n float _e16 = c.z;\n c.z = min(_e16, 1.0);\n vec4 _e19 = c;\n return _e19;\n}\n\nvec4 palette_texel(highp sampler2D palette, uint i) {\n vec4 _e8 = texelFetch(palette, ivec2(uvec2((i % PALETTE_WIDTH), (i / PALETTE_WIDTH))), 0);\n return _e8;\n}\n\nSkinned skin_vertex(highp sampler2D palette_1, uint row, uvec4 joints_1, vec4 weights_1, vec3 position_2, vec3 normal) {\n bool local = false;\n if (!((row == 0u))) {\n local = (dot(weights_1, vec4(1.0)) <= 0.0);\n } else {\n local = true;\n }\n bool _e17 = local;\n if (_e17) {\n return Skinned(position_2, normal);\n }\n uint base = (row - 1u);\n uvec4 t_1 = ((uvec4(base) + joints_1) * 3u);\n vec4 _e27 = palette_texel(palette_1, t_1.x);\n vec4 _e31 = palette_texel(palette_1, t_1.y);\n vec4 _e36 = palette_texel(palette_1, t_1.z);\n vec4 _e41 = palette_texel(palette_1, t_1.w);\n vec4 r0_ = ((((weights_1.x * _e27) + (weights_1.y * _e31)) + (weights_1.z * _e36)) + (weights_1.w * _e41));\n vec4 _e48 = palette_texel(palette_1, (t_1.x + 1u));\n vec4 _e54 = palette_texel(palette_1, (t_1.y + 1u));\n vec4 _e61 = palette_texel(palette_1, (t_1.z + 1u));\n vec4 _e68 = palette_texel(palette_1, (t_1.w + 1u));\n vec4 r1_ = ((((weights_1.x * _e48) + (weights_1.y * _e54)) + (weights_1.z * _e61)) + (weights_1.w * _e68));\n vec4 _e75 = palette_texel(palette_1, (t_1.x + 2u));\n vec4 _e81 = palette_texel(palette_1, (t_1.y + 2u));\n vec4 _e88 = palette_texel(palette_1, (t_1.z + 2u));\n vec4 _e95 = palette_texel(palette_1, (t_1.w + 2u));\n vec4 r2_ = ((((weights_1.x * _e75) + (weights_1.y * _e81)) + (weights_1.z * _e88)) + (weights_1.w * _e95));\n vec4 p = vec4(position_2, 1.0);\n return Skinned(vec3(dot(r0_, p), dot(r1_, p), dot(r2_, p)), vec3(dot(r0_.xyz, normal), dot(r1_.xyz, normal), dot(r2_.xyz, normal)));\n}\n\nvoid main() {\n vec3 position = _p2vs_location0;\n vec4 pos_scale = _p2vs_location2;\n vec4 rot = _p2vs_location3;\n uvec2 ids = _p2vs_location4;\n uvec4 joints = _p2vs_location6;\n vec4 weights = _p2vs_location7;\n Skinned _e14 = skin_vertex(_group_0_binding_3_vs, (ids.y >> 8u), joints, weights, position, vec3(0.0, 1.0, 0.0));\n vec4 _e18 = shadow_clip(pos_scale.xyz, pos_scale.w, rot, _e14.position);\n gl_Position = _e18;\n gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);\n return;\n}\n\n", "uniforms": [[0, 0, "Cascade_block_0Vertex"]], "textures": [["_group_0_binding_3_vs", 0, 3, -1, -1]] };
20
+ //# sourceMappingURL=shaders.glsl.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shaders.glsl.gen.js","sourceRoot":"","sources":["../../src/webgl2/shaders.glsl.gen.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import type { TextureBackend } from '../textures.ts';
2
+ /** The texture families this context samples (the GL equivalent of `texture-compression-*` features). */
3
+ export declare function glFamilies(gl: WebGL2RenderingContext): Set<string>;
4
+ /**
5
+ * The WebGL2 texture backend of `TextureStore` (ADR-0070): immutable `TEXTURE_2D_ARRAY`s
6
+ * (`texStorage3D`), levels written with `texSubImage3D` or, compressed, with
7
+ * `compressedTexSubImage3D`. WebGL2 has no texture-to-texture copy, so an array that grows
8
+ * is copied through a read framebuffer, layer by layer and level by level (uncompressed
9
+ * arrays; a compressed array's layers are uploaded again from the store's data instead).
10
+ */
11
+ export declare function glTextureBackend(gl: WebGL2RenderingContext): TextureBackend;