melonjs 19.9.1 → 20.0.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 (274) hide show
  1. package/README.md +25 -14
  2. package/build/application/application.d.ts +70 -16
  3. package/build/application/application.d.ts.map +1 -1
  4. package/build/application/defaultApplicationSettings.d.ts +2 -2
  5. package/build/application/settings.d.ts +150 -53
  6. package/build/application/settings.d.ts.map +1 -1
  7. package/build/camera/camera2d.d.ts +1 -1
  8. package/build/camera/camera2d.d.ts.map +1 -1
  9. package/build/camera/camera3d.d.ts +13 -11
  10. package/build/camera/camera3d.d.ts.map +1 -1
  11. package/build/const.d.ts +55 -26
  12. package/build/const.d.ts.map +1 -1
  13. package/build/geometries/box3d.d.ts +156 -0
  14. package/build/geometries/box3d.d.ts.map +1 -0
  15. package/build/index.d.ts +33 -23
  16. package/build/index.d.ts.map +1 -1
  17. package/build/index.js +21839 -8025
  18. package/build/index.js.map +4 -4
  19. package/build/lang/deprecated.d.ts +4 -4
  20. package/build/lang/deprecated.d.ts.map +1 -1
  21. package/build/level/gltf/GLTFModel.d.ts +4 -0
  22. package/build/level/gltf/GLTFModel.d.ts.map +1 -1
  23. package/build/level/gltf/GLTFScene.d.ts +42 -6
  24. package/build/level/gltf/GLTFScene.d.ts.map +1 -1
  25. package/build/level/gltf/srgb.d.ts +20 -0
  26. package/build/level/gltf/srgb.d.ts.map +1 -0
  27. package/build/level/level.d.ts +21 -2
  28. package/build/level/level.d.ts.map +1 -1
  29. package/build/lighting/light3d.d.ts +61 -13
  30. package/build/lighting/light3d.d.ts.map +1 -1
  31. package/build/loader/loader.d.ts +49 -21
  32. package/build/loader/loader.d.ts.map +1 -1
  33. package/build/loader/parsers/gltf.d.ts.map +1 -1
  34. package/build/loader/parsers/mtl.d.ts +18 -0
  35. package/build/loader/parsers/mtl.d.ts.map +1 -1
  36. package/build/loader/parsers/obj.d.ts +49 -0
  37. package/build/loader/parsers/obj.d.ts.map +1 -1
  38. package/build/loader/parsers/pbr.d.ts +63 -0
  39. package/build/loader/parsers/pbr.d.ts.map +1 -0
  40. package/build/loader/parsers/shader.d.ts +32 -24
  41. package/build/loader/parsers/shader.d.ts.map +1 -1
  42. package/build/physics/adapter.d.ts +12 -1
  43. package/build/physics/adapter.d.ts.map +1 -1
  44. package/build/physics/broadphase/octree.d.ts +35 -0
  45. package/build/physics/broadphase/octree.d.ts.map +1 -1
  46. package/build/physics/builtin/body.d.ts +123 -6
  47. package/build/physics/builtin/body.d.ts.map +1 -1
  48. package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
  49. package/build/physics/builtin/detector.d.ts +12 -0
  50. package/build/physics/builtin/detector.d.ts.map +1 -1
  51. package/build/physics/builtin/raycast.d.ts.map +1 -1
  52. package/build/physics/builtin/sat3d.d.ts +59 -0
  53. package/build/physics/builtin/sat3d.d.ts.map +1 -0
  54. package/build/physics/response.d.ts +32 -0
  55. package/build/physics/response.d.ts.map +1 -1
  56. package/build/physics/world.d.ts +1 -0
  57. package/build/physics/world.d.ts.map +1 -1
  58. package/build/renderable/container.d.ts +1 -0
  59. package/build/renderable/container.d.ts.map +1 -1
  60. package/build/renderable/groundshadow.d.ts +92 -0
  61. package/build/renderable/groundshadow.d.ts.map +1 -0
  62. package/build/renderable/instanced_mesh.d.ts +286 -0
  63. package/build/renderable/instanced_mesh.d.ts.map +1 -0
  64. package/build/renderable/mesh.d.ts +242 -23
  65. package/build/renderable/mesh.d.ts.map +1 -1
  66. package/build/renderable/renderable.d.ts +6 -4
  67. package/build/renderable/renderable.d.ts.map +1 -1
  68. package/build/renderable/sprite3d.d.ts +17 -6
  69. package/build/renderable/sprite3d.d.ts.map +1 -1
  70. package/build/renderable/text/text.d.ts.map +1 -1
  71. package/build/system/device.d.ts +11 -40
  72. package/build/system/device.d.ts.map +1 -1
  73. package/build/system/platform.d.ts +0 -16
  74. package/build/system/platform.d.ts.map +1 -1
  75. package/build/utils/utils.d.ts +2 -0
  76. package/build/utils/utils.d.ts.map +1 -1
  77. package/build/video/canvas/canvas_renderer.d.ts +22 -16
  78. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  79. package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
  80. package/build/video/effects/blur.d.ts.map +1 -0
  81. package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
  82. package/build/video/effects/chromaticAberration.d.ts.map +1 -0
  83. package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
  84. package/build/video/effects/colorMatrix.d.ts.map +1 -0
  85. package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
  86. package/build/video/effects/desaturate.d.ts.map +1 -0
  87. package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
  88. package/build/video/effects/dissolve.d.ts.map +1 -0
  89. package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
  90. package/build/video/effects/dropShadow.d.ts.map +1 -0
  91. package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
  92. package/build/video/effects/flash.d.ts.map +1 -0
  93. package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
  94. package/build/video/effects/glow.d.ts.map +1 -0
  95. package/build/video/effects/glsl_realization.d.ts +18 -0
  96. package/build/video/effects/glsl_realization.d.ts.map +1 -0
  97. package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
  98. package/build/video/effects/hologram.d.ts.map +1 -0
  99. package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
  100. package/build/video/effects/invert.d.ts.map +1 -0
  101. package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
  102. package/build/video/effects/outline.d.ts.map +1 -0
  103. package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
  104. package/build/video/effects/pixelate.d.ts.map +1 -0
  105. package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
  106. package/build/video/effects/radialGradient.d.ts.map +1 -0
  107. package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
  108. package/build/video/effects/scanline.d.ts.map +1 -0
  109. package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
  110. package/build/video/effects/sepia.d.ts.map +1 -0
  111. package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
  112. package/build/video/effects/shadereffect.d.ts.map +1 -0
  113. package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
  114. package/build/video/effects/shine.d.ts.map +1 -0
  115. package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
  116. package/build/video/effects/tintPulse.d.ts.map +1 -0
  117. package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
  118. package/build/video/effects/vignette.d.ts.map +1 -0
  119. package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
  120. package/build/video/effects/wave.d.ts.map +1 -0
  121. package/build/video/effects/wgsl/layout.d.ts +28 -0
  122. package/build/video/effects/wgsl/layout.d.ts.map +1 -0
  123. package/build/video/effects/wgsl/parse.d.ts +9 -0
  124. package/build/video/effects/wgsl/parse.d.ts.map +1 -0
  125. package/build/video/effects/wgsl/scaffold.d.ts +43 -0
  126. package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
  127. package/build/video/effects/wgsl_realization.d.ts +83 -0
  128. package/build/video/effects/wgsl_realization.d.ts.map +1 -0
  129. package/build/video/gpu/batcher.d.ts +71 -0
  130. package/build/video/gpu/batcher.d.ts.map +1 -0
  131. package/build/video/gpu/instancerecord.d.ts +164 -0
  132. package/build/video/gpu/instancerecord.d.ts.map +1 -0
  133. package/build/video/gpu/meshchunk.d.ts +49 -0
  134. package/build/video/gpu/meshchunk.d.ts.map +1 -0
  135. package/build/video/gpu/meshvertex.d.ts +54 -0
  136. package/build/video/gpu/meshvertex.d.ts.map +1 -0
  137. package/build/video/gpu/primitives.d.ts +60 -0
  138. package/build/video/gpu/primitives.d.ts.map +1 -0
  139. package/build/video/gpu/quadcorners.d.ts +11 -0
  140. package/build/video/gpu/quadcorners.d.ts.map +1 -0
  141. package/build/video/gpu/textureslots.d.ts +122 -0
  142. package/build/video/gpu/textureslots.d.ts.map +1 -0
  143. package/build/video/gpu/texturestore.d.ts +139 -0
  144. package/build/video/gpu/texturestore.d.ts.map +1 -0
  145. package/build/video/gpu/topology.d.ts +43 -0
  146. package/build/video/gpu/topology.d.ts.map +1 -0
  147. package/build/video/gpu/vertexformat.d.ts +72 -0
  148. package/build/video/gpu/vertexformat.d.ts.map +1 -0
  149. package/build/video/gradient.d.ts +14 -5
  150. package/build/video/gradient.d.ts.map +1 -1
  151. package/build/video/renderer.d.ts +153 -8
  152. package/build/video/renderer.d.ts.map +1 -1
  153. package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
  154. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  155. package/build/video/rendertarget/render_target_pool.d.ts +2 -2
  156. package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
  157. package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
  158. package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
  159. package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
  160. package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
  161. package/build/video/texture/atlas.d.ts.map +1 -1
  162. package/build/video/texture/cache.d.ts +20 -2
  163. package/build/video/texture/cache.d.ts.map +1 -1
  164. package/build/video/texture/noise_texture2d.d.ts +2 -2
  165. package/build/video/utils/autodetect.d.ts.map +1 -1
  166. package/build/video/video.d.ts +1 -55
  167. package/build/video/video.d.ts.map +1 -1
  168. package/build/video/webgl/batchers/batcher.d.ts +132 -35
  169. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  170. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
  171. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
  172. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
  173. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  174. package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
  175. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  176. package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
  177. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  178. package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
  179. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
  180. package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
  181. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  182. package/build/video/webgl/buffer/index.d.ts +1 -1
  183. package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
  184. package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
  185. package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
  186. package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
  187. package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
  188. package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
  189. package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
  190. package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
  191. package/build/video/webgl/glshader.d.ts +101 -8
  192. package/build/video/webgl/glshader.d.ts.map +1 -1
  193. package/build/video/webgl/lighting/constants.d.ts +20 -8
  194. package/build/video/webgl/lighting/constants.d.ts.map +1 -1
  195. package/build/video/webgl/lighting/pack.d.ts +1 -1
  196. package/build/video/webgl/lighting/pack3d.d.ts +27 -11
  197. package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
  198. package/build/video/webgl/lighting/std140.d.ts +110 -0
  199. package/build/video/webgl/lighting/std140.d.ts.map +1 -0
  200. package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
  201. package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
  202. package/build/video/webgl/texture/store.d.ts +52 -0
  203. package/build/video/webgl/texture/store.d.ts.map +1 -0
  204. package/build/video/webgl/utils/maxtextures.d.ts +37 -0
  205. package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
  206. package/build/video/webgl/utils/samplercache.d.ts +69 -0
  207. package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
  208. package/build/video/webgl/utils/string.d.ts +16 -0
  209. package/build/video/webgl/utils/string.d.ts.map +1 -1
  210. package/build/video/webgl/utils/topology.d.ts +24 -0
  211. package/build/video/webgl/utils/topology.d.ts.map +1 -0
  212. package/build/video/webgl/utils/vertexformat.d.ts +27 -0
  213. package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
  214. package/build/video/webgl/webgl_renderer.d.ts +148 -30
  215. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  216. package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
  217. package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
  218. package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
  219. package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
  220. package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
  221. package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
  222. package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
  223. package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
  224. package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
  225. package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
  226. package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
  227. package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
  228. package/build/video/webgpu/buffer/arena.d.ts +64 -0
  229. package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
  230. package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
  231. package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
  232. package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
  233. package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
  234. package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
  235. package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
  236. package/build/video/webgpu/effect_binding.d.ts +17 -0
  237. package/build/video/webgpu/effect_binding.d.ts.map +1 -0
  238. package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
  239. package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
  240. package/build/video/webgpu/pipeline/cache.d.ts +173 -0
  241. package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
  242. package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
  243. package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
  244. package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
  245. package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
  246. package/build/video/webgpu/texture/compressed.d.ts +33 -0
  247. package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
  248. package/build/video/webgpu/texture/frametexture.d.ts +65 -0
  249. package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
  250. package/build/video/webgpu/texture/store.d.ts +149 -0
  251. package/build/video/webgpu/texture/store.d.ts.map +1 -0
  252. package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
  253. package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
  254. package/package.json +2 -2
  255. package/build/video/webgl/effects/blur.d.ts.map +0 -1
  256. package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
  257. package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
  258. package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
  259. package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
  260. package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
  261. package/build/video/webgl/effects/flash.d.ts.map +0 -1
  262. package/build/video/webgl/effects/glow.d.ts.map +0 -1
  263. package/build/video/webgl/effects/hologram.d.ts.map +0 -1
  264. package/build/video/webgl/effects/invert.d.ts.map +0 -1
  265. package/build/video/webgl/effects/outline.d.ts.map +0 -1
  266. package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
  267. package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
  268. package/build/video/webgl/effects/scanline.d.ts.map +0 -1
  269. package/build/video/webgl/effects/sepia.d.ts.map +0 -1
  270. package/build/video/webgl/effects/shine.d.ts.map +0 -1
  271. package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
  272. package/build/video/webgl/effects/vignette.d.ts.map +0 -1
  273. package/build/video/webgl/effects/wave.d.ts.map +0 -1
  274. package/build/video/webgl/shadereffect.d.ts.map +0 -1
@@ -47,7 +47,7 @@ export default class ShineEffect extends ShaderEffect {
47
47
  * @param {number} [options.pulseDepth=0.0] - subtle base-brightness pulse amplitude (0 disables the pulse)
48
48
  * @param {number} [options.pulseSpeed=3.0] - pulse oscillation rate (radians/second)
49
49
  */
50
- constructor(renderer: import("../webgl_renderer.js").default, options?: {
50
+ constructor(renderer: any, options?: {
51
51
  color?: number[] | undefined;
52
52
  speed?: number | undefined;
53
53
  width?: number | undefined;
@@ -78,5 +78,5 @@ export default class ShineEffect extends ShaderEffect {
78
78
  */
79
79
  setBands(value: number): void;
80
80
  }
81
- import ShaderEffect from "../shadereffect.js";
81
+ import ShaderEffect from "./shadereffect.js";
82
82
  //# sourceMappingURL=shine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shine.d.ts","sourceRoot":"","sources":["../../../src/video/effects/shine.js"],"names":[],"mappings":"AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IACC;;;;;;;;;;;OAWG;IACH,qCATG;QAA2B,KAAK;QACP,KAAK;QACL,KAAK;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,UAAU;QACV,UAAU;KACrC,EAgEA;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAIlB;IAED;;;OAGG;IACH,gBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,oBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,QAIhB;CACD;yBA5LwB,mBAAmB"}
@@ -23,7 +23,7 @@ export default class TintPulseEffect extends ShaderEffect {
23
23
  * @param {number} [options.speed=2.0] - pulse speed (oscillations per second)
24
24
  * @param {number} [options.intensity=0.3] - maximum tint strength (0.0–1.0)
25
25
  */
26
- constructor(renderer: import("../webgl_renderer.js").default, options?: {
26
+ constructor(renderer: any, options?: {
27
27
  color?: number[] | undefined;
28
28
  speed?: number | undefined;
29
29
  intensity?: number | undefined;
@@ -39,5 +39,5 @@ export default class TintPulseEffect extends ShaderEffect {
39
39
  */
40
40
  setColor(color: number[]): void;
41
41
  }
42
- import ShaderEffect from "../shadereffect.js";
42
+ import ShaderEffect from "./shadereffect.js";
43
43
  //# sourceMappingURL=tintPulse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tintPulse.d.ts","sourceRoot":"","sources":["../../../src/video/effects/tintPulse.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;GAgBG;AACH;IACC;;;;;;OAMG;IACH,qCAJG;QAA2B,KAAK;QACP,KAAK;QACL,SAAS;KACpC,EAqBA;IAED;;;OAGG;IACH,cAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAIlB;CACD;yBAjFwB,mBAAmB"}
@@ -21,7 +21,7 @@ export default class VignetteEffect extends ShaderEffect {
21
21
  * @param {number} [options.strength=0.15] - edge darkening power (lower = stronger darkening, higher = softer falloff)
22
22
  * @param {number} [options.size=25.0] - vignette spread multiplier (higher = smaller dark area)
23
23
  */
24
- constructor(renderer: import("../webgl_renderer.js").default, options?: {
24
+ constructor(renderer: any, options?: {
25
25
  strength?: number | undefined;
26
26
  size?: number | undefined;
27
27
  });
@@ -38,5 +38,5 @@ export default class VignetteEffect extends ShaderEffect {
38
38
  */
39
39
  setSize(size: number): void;
40
40
  }
41
- import ShaderEffect from "../shadereffect.js";
41
+ import ShaderEffect from "./shadereffect.js";
42
42
  //# sourceMappingURL=vignette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vignette.d.ts","sourceRoot":"","sources":["../../../src/video/effects/vignette.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;GAeG;AACH;IACC;;;;;OAKG;IACH,qCAHG;QAAyB,QAAQ;QACR,IAAI;KAC/B,EASA;IALA,iBAAwC;IACxC,aAAgC;IAMjC;;;OAGG;IACH,sBAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,cAFW,MAAM,QAKhB;CACD;yBA/EwB,mBAAmB"}
@@ -18,7 +18,7 @@ export default class WaveEffect extends ShaderEffect {
18
18
  * @param {number} [options.frequency=10.0] - number of waves across the sprite
19
19
  * @param {number} [options.speed=2.0] - wave animation speed
20
20
  */
21
- constructor(renderer: import("../webgl_renderer.js").default, options?: {
21
+ constructor(renderer: any, options?: {
22
22
  amplitude?: number | undefined;
23
23
  frequency?: number | undefined;
24
24
  speed?: number | undefined;
@@ -39,5 +39,5 @@ export default class WaveEffect extends ShaderEffect {
39
39
  */
40
40
  setFrequency(frequency: number): void;
41
41
  }
42
- import ShaderEffect from "../shadereffect.js";
42
+ import ShaderEffect from "./shadereffect.js";
43
43
  //# sourceMappingURL=wave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave.d.ts","sourceRoot":"","sources":["../../../src/video/effects/wave.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH;IACC;;;;;;OAMG;IACH,qCAJG;QAAyB,SAAS;QACT,SAAS;QACT,KAAK;KAChC,EAqBA;IAED;;;OAGG;IACH,cAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAIhB;CACD;yBArFwB,mBAAmB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * normalize the `vecN<f32>` / `matCxR<f32>` spellings onto the short forms
3
+ * used as TYPE_LAYOUT keys
4
+ * @param {string} type - a WGSL type token
5
+ * @returns {string} the canonical spelling
6
+ * @ignore
7
+ */
8
+ export function normalizeWGSLType(type: string): string;
9
+ /**
10
+ * Compute the uniform-buffer layout for a parsed struct member list.
11
+ * @param {Array<{name: string, type: string}>} members - struct members in declaration order
12
+ * @returns {{map: Map<string, {offset: number, size: number, type: string}>, size: number}|null}
13
+ * the name → placement map and the total (16-byte-rounded) struct size,
14
+ * or `null` when a member type is unsupported
15
+ * @ignore
16
+ */
17
+ export function computeUniformLayout(members: Array<{
18
+ name: string;
19
+ type: string;
20
+ }>): {
21
+ map: Map<string, {
22
+ offset: number;
23
+ size: number;
24
+ type: string;
25
+ }>;
26
+ size: number;
27
+ } | null;
28
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/video/effects/wgsl/layout.js"],"names":[],"mappings":"AAqCA;;;;;;GAMG;AACH,wCAJW,MAAM,GACJ,MAAM,CAQlB;AAUD;;;;;;;GAOG;AACH,8CANW,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,GACjC;IAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAC,IAAI,CAuB/F"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Parse a WGSL effect body's declarations.
3
+ * @param {string} body - the user WGSL body
4
+ * @returns {object} `{ok: true, layout, structSize, uniformVar, textures, builtins, maxUserBinding}`
5
+ * or `{ok: false, error}`
6
+ * @ignore
7
+ */
8
+ export function parseWGSLBody(body: string): object;
9
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/video/effects/wgsl/parse.js"],"names":[],"mappings":"AAoHA;;;;;;GAMG;AACH,oCALW,MAAM,GACJ,MAAM,CAqKlB"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * WGSL module assembly for a ShaderEffect body — the WGSL counterpart of
3
+ * `glsl_realization.js`'s source templating. The user body is embedded
4
+ * VERBATIM (WGSL module-scope declarations are order-independent); the
5
+ * scaffold contributes the vertex/fragment entry points over the frozen
6
+ * 28-byte quad layout, the frame-globals and material groups, and the
7
+ * builtin declarations the parser detected.
8
+ *
9
+ * Frozen conventions carried over from the core quad shader:
10
+ * - clip-z remap `(z + w) * 0.5` (GL-convention [-w, w] → WebGPU [0, w])
11
+ * - packed-ARGB attribute read as (B,G,R,A) → `.bgr * .a` premultiply
12
+ * - `screen_uv` is y-down (`0.5 - ndc.y * 0.5`): WebGPU texture row 0 is
13
+ * the top, so the capture is sampled without any flip
14
+ * @ignore
15
+ */
16
+ /**
17
+ * builtin group-3 bindings are assigned ABOVE the highest user binding so
18
+ * they can never collide: ME uniform first, then the capture texture and
19
+ * its sampler variants
20
+ * @param {object} parsed - the parseWGSLBody result
21
+ * @returns {{me: number, screenTexture: number, screenSamplerClamp: number, screenSamplerRepeat: number}}
22
+ * assigned binding indices (-1 when the builtin is unused)
23
+ * @ignore
24
+ */
25
+ export function assignBuiltinBindings(parsed: object): {
26
+ me: number;
27
+ screenTexture: number;
28
+ screenSamplerClamp: number;
29
+ screenSamplerRepeat: number;
30
+ };
31
+ /**
32
+ * Assemble the complete WGSL module for an effect body.
33
+ * @param {string} body - the user WGSL body (embedded verbatim)
34
+ * @param {object} parsed - the parseWGSLBody result
35
+ * @returns {{code: string, bindings: object}} the module text and the
36
+ * builtin binding assignment (consumed when building the bind group)
37
+ * @ignore
38
+ */
39
+ export function buildWGSLModule(body: string, parsed: object): {
40
+ code: string;
41
+ bindings: object;
42
+ };
43
+ //# sourceMappingURL=scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../../src/video/effects/wgsl/scaffold.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,8CALW,MAAM,GACJ;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAC,CA0BxG;AAED;;;;;;;GAOG;AACH,sCANW,MAAM,UACN,MAAM,GACJ;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAyG5C"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The WGSL realization of a ShaderEffect — the WebGPU counterpart of the
3
+ * GLShader the GLSL branch compiles.
4
+ *
5
+ * WebGPU has no uniform reflection, so this object carries everything the
6
+ * backend needs to drive the effect: the parsed uniform layout (name →
7
+ * byte placement), a CPU-side mirror of the uniform block that
8
+ * `setUniform` writes into, the texture binding table, and the assembled
9
+ * module text. GPU objects (shader module, bind group layout, bind group)
10
+ * are built lazily by the renderer's effect path — uniform VALUES are
11
+ * snapshotted from the mirror into a per-frame arena at every bind, so a
12
+ * shared effect bound twice in a frame with different values stays
13
+ * correct under WebGPU's queue-write-before-draws ordering.
14
+ * @ignore
15
+ */
16
+ export default class WGSLEffectRealization {
17
+ /**
18
+ * Parse + assemble; on any parse failure `valid` is false and `error`
19
+ * carries the reason (the effect then warns and stays disabled).
20
+ * @param {string} body - the user WGSL body
21
+ */
22
+ constructor(body: string);
23
+ /**
24
+ * whether the body parsed into a realizable shape
25
+ * @type {boolean}
26
+ */
27
+ valid: boolean;
28
+ /** @type {string|null} */
29
+ error: string | null;
30
+ /** name → {offset, size, type} placement in the uniform block */
31
+ layout: any;
32
+ /** total uniform block byte size (0 = no uniform struct) */
33
+ structSize: any;
34
+ /** user texture/sampler pairs (binding table) */
35
+ textures: any;
36
+ /** builtin usage flags */
37
+ builtins: any;
38
+ /** the complete assembled WGSL module text */
39
+ code: string | undefined;
40
+ /** builtin binding assignment (ME / capture texture / samplers) */
41
+ builtinBindings: object | undefined;
42
+ cpu: ArrayBuffer | undefined;
43
+ f32: Float32Array<ArrayBuffer> | undefined;
44
+ i32: Int32Array<ArrayBuffer> | undefined;
45
+ u32: Uint32Array<ArrayBuffer> | undefined;
46
+ meMirror: Float32Array<ArrayBuffer> | undefined;
47
+ /**
48
+ * last user-set value per uniform name — the clone-replay source
49
+ * (exact values, not mirror read-back)
50
+ * @type {Map<string, number|number[]>}
51
+ */
52
+ values: Map<string, number | number[]>;
53
+ warned: Set<any> | undefined;
54
+ /**
55
+ * device-scoped GPU state, built lazily by the renderer's effect
56
+ * path and invalidated via the pipeline-cache epoch (device loss)
57
+ * @type {object|null}
58
+ */
59
+ gpu: object | null;
60
+ /**
61
+ * Write a uniform value into the CPU mirror.
62
+ * @param {string} name - a struct member name of the body's uniform block
63
+ * @param {number|number[]|Float32Array|{val: Float32Array}} value - the value
64
+ * (objects exposing `.val` — Matrix2d/3d, ColorMatrix — are unwrapped)
65
+ * @returns {boolean} true when the name exists and the value was written
66
+ */
67
+ setUniform(name: string, value: number | number[] | Float32Array | {
68
+ val: Float32Array;
69
+ }): boolean;
70
+ /**
71
+ * whether the uniform block declares the given member (the WGSL
72
+ * counterpart of the GLSL active-uniform check `setTime` relies on)
73
+ * @param {string} name - member name
74
+ * @returns {boolean} true when present
75
+ */
76
+ hasUniform(name: string): boolean;
77
+ /**
78
+ * drop device-scoped state (device loss / destroy) — the CPU mirror
79
+ * and values survive, so nothing needs replaying on restore
80
+ */
81
+ releaseGPU(): void;
82
+ }
83
+ //# sourceMappingURL=wgsl_realization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wgsl_realization.d.ts","sourceRoot":"","sources":["../../../src/video/effects/wgsl_realization.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH;IACC;;;;OAIG;IACH,kBAFW,MAAM,EA2DhB;IAtDA;;;OAGG;IACH,OAFU,OAAO,CAEc;IAC/B,0BAA0B;IAC1B,OADW,MAAM,GAAC,IAAI,CAC+B;IAMrD,iEAAiE;IACjE,YAA2B;IAC3B,4DAA4D;IAC5D,gBAAmC;IACnC,iDAAiD;IACjD,cAA+B;IAC/B,0BAA0B;IAC1B,cAA+B;IAG/B,8CAA8C;IAC9C,yBAAuB;IACvB,mEAAmE;IACnE,oCAAsC;IAGtC,6BAAwD;IACxD,2CAAqC;IACrC,yCAAmC;IACnC,0CAAoC;IAIpC,gDAAmC;IAEnC;;;;OAIG;IACH,QAFU,GAAG,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,EAAE,CAAC,CAEf;IAIvB,6BAAuB;IAEvB;;;;OAIG;IACH,KAFU,MAAM,GAAC,IAAI,CAEN;IAGhB;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,GAAC,YAAY,GAAC;QAAC,GAAG,EAAE,YAAY,CAAA;KAAC,GAE9C,OAAO,CAwDnB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,mBAEC;CACD"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * additional import for TypeScript
3
+ * @import Renderer from "../renderer.js";
4
+ */
5
+ /**
6
+ * Default maximum number of vertices per batch.
7
+ * At 4096 vertices (1024 quads), the vertex buffer is ~80 KB (5 floats × 4 bytes × 4096),
8
+ * which balances draw call reduction with safe buffer upload sizes on mobile tile-based GPUs.
9
+ * Within the Uint16 index limit (65,535) — a deliberate capacity choice
10
+ * (smaller index uploads), not an API constraint.
11
+ * @ignore
12
+ */
13
+ export const DEFAULT_MAX_VERTICES: 4096;
14
+ /**
15
+ * Backend-neutral base class for renderer batchers.
16
+ *
17
+ * A batcher accumulates vertices into a CPU staging buffer and turns them
18
+ * into GPU work in batches — one draw call for many shapes/sprites. This
19
+ * class defines the lifecycle contract shared by every backend:
20
+ *
21
+ * - `init(renderer, settings)` — build (or rebuild after a context/device
22
+ * loss) the batcher's GPU-facing state; called by the constructor
23
+ * - `bind()` / `unbind()` — the renderer switches the active batcher
24
+ * - `flush()` — turn the pending vertices into GPU work
25
+ * - `reset()` — drop transient state (game reset / context restore)
26
+ * - `destroy()` — release every GPU resource the batcher owns
27
+ *
28
+ * Custom batchers extend the class matching the renderer they target —
29
+ * {@link WebGLBatcher} for the WebGL renderer, `WebGPUBatcher` for the
30
+ * WebGPU renderer — and are registered through `renderer.addBatcher()`,
31
+ * which accepts any Batcher subclass.
32
+ * @category Rendering
33
+ */
34
+ export class Batcher {
35
+ /**
36
+ * Initialize (or re-initialize after a context/device loss) this batcher.
37
+ * Derived classes override this with their full `(renderer, settings)`
38
+ * signature and own the whole body; the base implementation only stores
39
+ * the renderer reference.
40
+ * @param {Renderer} renderer - the owning renderer
41
+ */
42
+ init(renderer: Renderer): void;
43
+ /**
44
+ * the renderer this batcher is bound to
45
+ * @type {Renderer}
46
+ */
47
+ renderer: Renderer | undefined;
48
+ /**
49
+ * called by the renderer when this batcher becomes the current one
50
+ */
51
+ bind(): void;
52
+ /**
53
+ * called by the renderer when this batcher is being replaced by another
54
+ */
55
+ unbind(): void;
56
+ /**
57
+ * turn the pending vertices into GPU work
58
+ */
59
+ flush(): void;
60
+ /**
61
+ * reset the batcher's transient state (game reset / context restore)
62
+ */
63
+ reset(): void;
64
+ /**
65
+ * release every GPU resource this batcher owns
66
+ */
67
+ destroy(): void;
68
+ }
69
+ export default Batcher;
70
+ import type Renderer from "../renderer.js";
71
+ //# sourceMappingURL=batcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/batcher.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,mCAAoC,IAAI,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAMC;;;;;;OAMG;IACH,eAFW,QAAQ,QAQlB;IALA;;;OAGG;IACH,+BAAwB;IAGzB;;OAEG;IACH,aAAS;IAET;;OAEG;IACH,eAAW;IAEX;;OAEG;IACH,cAAU;IAEV;;OAEG;IACH,cAAU;IAEV;;OAEG;IACH,gBAAY;CACZ;;0BA9EwB,gBAAgB"}
@@ -0,0 +1,164 @@
1
+ import type { Matrix3d } from "../../math/matrix3d.ts";
2
+ /**
3
+ * The per-instance record shared by both GPU backends (#1508).
4
+ *
5
+ * An instance carries a **row-major 3×4 affine transform** — three `vec4`
6
+ * rows — rather than a full 4×4: the bottom row of an affine matrix is
7
+ * always `(0, 0, 0, 1)`, so storing it would waste 16 bytes and a fourth
8
+ * attribute slot per instance. Two further slots are opt-in, declared once
9
+ * per instanced mesh:
10
+ *
11
+ * The transform occupies 12 floats (48 bytes); a colour slot adds 4 more
12
+ * (16 bytes) when `instanceColors` is declared, and a custom-data slot
13
+ * another 4 when `instanceData` is.
14
+ *
15
+ * Colour is four floats rather than four packed bytes for the same reason
16
+ * `aColor` is on the mesh vertex layout: a packed 4-byte slot can form a
17
+ * NaN bit pattern that Apple's Metal-backed driver canonicalizes on upload,
18
+ * zeroing the bytes the shader reads.
19
+ *
20
+ * The custom slot is deliberately **opaque** — the stock lit shader reads
21
+ * its `rgb` as emissive, while a custom mesh shader is free to read it as a
22
+ * wind phase, an atlas offset or a random seed.
23
+ * @ignore
24
+ */
25
+ /**
26
+ * floats occupied by the 3×4 transform
27
+ * @ignore
28
+ */
29
+ export declare const TRANSFORM_FLOATS = 12;
30
+ /**
31
+ * floats occupied by an optional `vec4` slot
32
+ * @ignore
33
+ */
34
+ export declare const SLOT_FLOATS = 4;
35
+ /**
36
+ * Describes one instanced mesh's record: how wide it is and where each
37
+ * optional slot begins. Offsets are in floats; multiply by 4 for bytes.
38
+ * @ignore
39
+ */
40
+ export interface InstanceRecordLayout {
41
+ /** floats per instance */
42
+ floats: number;
43
+ /** bytes per instance (the vertex-buffer `arrayStride`) */
44
+ stride: number;
45
+ /** float offset of the colour slot, or -1 when absent */
46
+ colorOffset: number;
47
+ /** float offset of the custom-data slot, or -1 when absent */
48
+ dataOffset: number;
49
+ /** whether the colour slot is present */
50
+ hasColor: boolean;
51
+ /** whether the custom-data slot is present */
52
+ hasData: boolean;
53
+ }
54
+ /**
55
+ * Build the record layout for the given opt-in slots.
56
+ * @param hasColor - whether a per-instance colour slot is present
57
+ * @param hasData - whether a per-instance custom `vec4` slot is present
58
+ * @returns the resolved layout
59
+ * @ignore
60
+ */
61
+ export declare function instanceRecordLayout(hasColor: boolean, hasData: boolean): InstanceRecordLayout;
62
+ /**
63
+ * Write a matrix into an instance record as three row-major `vec4` rows.
64
+ *
65
+ * `Matrix3d` stores its values **column-major** (the GL convention —
66
+ * translation lives at `val[12..14]`), so this transposes the upper 3×4 on
67
+ * the way in. The shader transposes back when it rebuilds a `mat4`.
68
+ * @param target - the CPU-side instance buffer
69
+ * @param offset - float offset of this instance's record
70
+ * @param matrix - the transform to write
71
+ * @ignore
72
+ */
73
+ export declare function writeInstanceTransform(target: Float32Array, offset: number, matrix: Matrix3d): void;
74
+ /**
75
+ * Write a translation / rotation / scale triple into an instance record.
76
+ *
77
+ * This is the shape authored instancing arrives in: glTF's
78
+ * `EXT_mesh_gpu_instancing` stores per-instance `TRANSLATION`, `ROTATION`
79
+ * (a quaternion) and `SCALE` accessors rather than matrices. Composing them
80
+ * straight into the record avoids building a `Matrix3d` per instance —
81
+ * a forest of five thousand trees would otherwise allocate five thousand
82
+ * throwaway matrices at load.
83
+ *
84
+ * The rotation is applied first, then scale, then translation (glTF's
85
+ * `T * R * S` convention), and the result is transposed into the record's
86
+ * row-major rows.
87
+ * @param target - the CPU-side instance buffer
88
+ * @param offset - float offset of this instance's record
89
+ * @param tx - translation x
90
+ * @param ty - translation y
91
+ * @param tz - translation z
92
+ * @param qx - rotation quaternion x
93
+ * @param qy - rotation quaternion y
94
+ * @param qz - rotation quaternion z
95
+ * @param qw - rotation quaternion w
96
+ * @param sx - scale x
97
+ * @param sy - scale y
98
+ * @param sz - scale z
99
+ * @ignore
100
+ */
101
+ export declare function writeInstanceTRS(target: Float32Array, offset: number, tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number): void;
102
+ /**
103
+ * Write an identity transform into an instance record — what a freshly
104
+ * grown slot holds until the caller places it, so an unplaced instance
105
+ * renders at the group origin rather than collapsing onto a zero matrix.
106
+ * @param target - the CPU-side instance buffer
107
+ * @param offset - float offset of this instance's record
108
+ * @ignore
109
+ */
110
+ export declare function writeIdentityTransform(target: Float32Array, offset: number): void;
111
+ /**
112
+ * Read an instance's transform back into a `Matrix3d`, undoing the
113
+ * row-major packing.
114
+ * @param source - the CPU-side instance buffer
115
+ * @param offset - float offset of this instance's record
116
+ * @param out - the matrix to write into
117
+ * @returns `out`
118
+ * @ignore
119
+ */
120
+ export declare function readInstanceTransform(source: Float32Array, offset: number, out: Matrix3d): Matrix3d;
121
+ /**
122
+ * The attribute names an instanced shader declares, in record order. Shared
123
+ * by both backends so the GL attribute records and the WGSL vertex layout
124
+ * describe the same thing.
125
+ * @ignore
126
+ */
127
+ export declare const INSTANCE_ATTRIBUTE_NAMES: {
128
+ readonly rows: readonly ["aInstanceRow0", "aInstanceRow1", "aInstanceRow2"];
129
+ readonly color: "aInstanceColor";
130
+ readonly data: "aInstanceData";
131
+ };
132
+ /**
133
+ * Shader locations for the instance slots, counted from the first location
134
+ * after a tier's geometry attributes.
135
+ *
136
+ * These are **fixed per slot rather than sequential**, so a variant that
137
+ * omits the colour slot does not shift the data slot down. On WebGPU that is
138
+ * what lets one WGSL module text serve every variant — WGSL has no
139
+ * preprocessor to renumber `@location` with — and on WebGL it keeps the two
140
+ * backends describing the same thing.
141
+ * @ignore
142
+ */
143
+ export declare const INSTANCE_SLOT_OFFSETS: {
144
+ readonly rows: readonly [0, 1, 2];
145
+ readonly color: 3;
146
+ readonly data: 4;
147
+ };
148
+ /**
149
+ * Backend-neutral attribute descriptors for an instance record, in the
150
+ * `{name, format, offset}` vocabulary both backends consume.
151
+ * @param layout - the record layout
152
+ * @param baseLocation - first shader location for this record (the location
153
+ * after the tier's geometry attributes). Omit on WebGL, whose attribute
154
+ * locations come from the shader's own declaration order.
155
+ * @returns attribute descriptors covering the whole record
156
+ * @ignore
157
+ */
158
+ export declare function instanceAttributes(layout: InstanceRecordLayout, baseLocation?: number): {
159
+ name: string;
160
+ format: string;
161
+ offset: number;
162
+ shaderLocation?: number;
163
+ }[];
164
+ //# sourceMappingURL=instancerecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instancerecord.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/instancerecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,QAAQ,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,GACd,oBAAoB,CAkBtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,GACd,IAAI,CAiBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACR,IAAI,CA8BN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,GACZ,IAAI,CAaN;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,QAAQ,GACX,QAAQ,CAoBV;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;CAI3B,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,oBAAoB,EAC5B,YAAY,CAAC,EAAE,MAAM;UASd,MAAM;YACJ,MAAM;YACN,MAAM;qBACG,MAAM;IAsCxB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The versioned-remap vertex dedup shared by the mesh batchers of both
3
+ * backends — pure CPU code, no GPU references (the `lighting/` modules set
4
+ * the precedent for cross-backend sharing).
5
+ *
6
+ * The accumulated mesh path re-indexes each chunk's triangles against a
7
+ * chunk-local vertex range. Dedup uses a "versioned" typed-array remap
8
+ * rather than a `Map`: a `Map` here churned the GC badly, because V8's
9
+ * `Map.clear()` drops the backing table, so re-filling it each chunk
10
+ * reallocated as it grew — and the cost scaled with vertex count (a dense
11
+ * mesh = MBs/sec of garbage). Instead, `remapSlot[orig]` holds the local
12
+ * index assigned to original-vertex `orig` THIS chunk, valid only when
13
+ * `remapStamp[orig] === stamp`. Bumping `stamp` per chunk invalidates every
14
+ * entry in O(1) — no clearing, no allocation. The arrays grow lazily (to a
15
+ * power of two ≥ the largest mesh's vertex count) and are reused.
16
+ *
17
+ * Module-level sharing is safe because a chunk is built synchronously and
18
+ * never re-enters — only one `addMesh` runs at a time, whichever backend
19
+ * (or coexisting renderer) drives it, and no remap state persists across
20
+ * chunks.
21
+ * @ignore
22
+ */
23
+ /**
24
+ * Ensure the versioned-remap scratch arrays can index every vertex of a
25
+ * mesh with `vertexCount` vertices. Grows to the next power of two and
26
+ * reuses thereafter (one-time cost when a larger mesh first appears).
27
+ * @ignore
28
+ */
29
+ export declare function ensureRemapCapacity(vertexCount: number): void;
30
+ /**
31
+ * Start a new chunk: invalidate the whole remap in O(1) and hand back the
32
+ * shared (emptied) chunk-index list. The stamp resets before int32 overflow
33
+ * (~weeks of continuous rendering away), keeping stored stamps valid.
34
+ * @returns the shared chunk-index array, emptied
35
+ * @ignore
36
+ */
37
+ export declare function beginChunk(): number[];
38
+ /**
39
+ * The local index assigned to `origIdx` this chunk, or -1 when the vertex
40
+ * has not been emitted yet.
41
+ * @ignore
42
+ */
43
+ export declare function remapIndex(origIdx: number): number;
44
+ /**
45
+ * Record the local index assigned to `origIdx` for the rest of this chunk.
46
+ * @ignore
47
+ */
48
+ export declare function assignIndex(origIdx: number, localIdx: number): void;
49
+ //# sourceMappingURL=meshchunk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshchunk.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/meshchunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAQ7D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAQrC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGnE"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Retained mesh vertex-data assembly shared by the mesh batchers of both
3
+ * backends — pure CPU code, no GPU references (the `meshchunk.ts` /
4
+ * `lighting/` precedent). Kept in ONE place because the two layouts exist
5
+ * in an unlit and a lit variant on each backend, and the subtle parts —
6
+ * the ARGB unpack order and the lit path's zero-length-normal guard —
7
+ * must never drift between the four call sites.
8
+ *
9
+ * The data deliberately carries no placement, camera or tint information —
10
+ * those are uniforms — so it stays valid for the lifetime of the geometry.
11
+ * @ignore
12
+ */
13
+ /** the minimal mesh surface this module reads — `@ignore` */
14
+ interface RetainedMeshSource {
15
+ originalVertices: Float32Array;
16
+ originalNormals?: Float32Array | null;
17
+ uvs: Float32Array;
18
+ vertexColors?: Uint32Array | null;
19
+ vertexCount: number;
20
+ }
21
+ /**
22
+ * a reusable Float32Array of at least `floatCount` floats
23
+ * @ignore
24
+ */
25
+ export declare function retainedScratch(floatCount: number): Float32Array;
26
+ /**
27
+ * Write one mesh's model-space geometry into `out` in the unlit mesh
28
+ * layout — `x, y, z, u, v, r, g, b, a` — striding by `vertexSize`.
29
+ * @param mesh - the mesh to read geometry from
30
+ * @param out - destination scratch, at least `vertexCount × vertexSize` long
31
+ * @param vertexSize - floats per vertex in the hosting batcher's layout
32
+ * @returns number of floats written
33
+ * @ignore
34
+ */
35
+ export declare function buildMeshVertexData(mesh: RetainedMeshSource, out: Float32Array, vertexSize: number): number;
36
+ /**
37
+ * The lit variant: the unlit layout plus the model-space normal —
38
+ * `…, nx, ny, nz` — so lighting can be evaluated after the shader rotates
39
+ * it into world space.
40
+ *
41
+ * A zero-length normal must not reach the shader: it does
42
+ * `normalize(vNormal)`, and normalizing a zero vector is NaN — every
43
+ * fragment touching that vertex goes black or garbage. Degenerate
44
+ * triangles in OBJ/glTF assets produce these, so substitute a unit
45
+ * vector, matching what the CPU projection path does.
46
+ * @param mesh - the mesh to read geometry from
47
+ * @param out - destination scratch, at least `vertexCount × vertexSize` long
48
+ * @param vertexSize - floats per vertex in the hosting batcher's layout
49
+ * @returns number of floats written
50
+ * @ignore
51
+ */
52
+ export declare function buildLitMeshVertexData(mesh: RetainedMeshSource, out: Float32Array, vertexSize: number): number;
53
+ export {};
54
+ //# sourceMappingURL=meshvertex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshvertex.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/meshvertex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,6DAA6D;AAC7D,UAAU,kBAAkB;IAC3B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,eAAe,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,GAAG,EAAE,YAAY,CAAC;IAClB,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;CACpB;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAKhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,MAAM,GAChB,MAAM,CAsBR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,MAAM,GAChB,MAAM,CAmCR"}