@holoscript/core 7.0.0 → 8.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 (345) hide show
  1. package/README.md +2 -2
  2. package/bin/holoscript.cjs +3 -0
  3. package/dist/GLTFPipeline-276GE64O.js +16 -0
  4. package/dist/GLTFPipeline-M7WSSJED.cjs +37 -0
  5. package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
  6. package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
  7. package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
  8. package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
  9. package/dist/HoloScriptRuntime-3URVTKPJ.js +10 -0
  10. package/dist/HoloScriptRuntime-SXEAEU2N.cjs +19 -0
  11. package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
  12. package/dist/USDZExporter-D2HQLQYK.js +1035 -0
  13. package/dist/agents/index.cjs +19 -0
  14. package/dist/agents/index.d.ts +100 -0
  15. package/dist/agents/index.js +17 -0
  16. package/dist/chunk-23J755AR.js +1046 -0
  17. package/dist/chunk-253GBQZY.cjs +627 -0
  18. package/dist/chunk-25IQCHTO.cjs +781 -0
  19. package/dist/chunk-2BSMSUCE.js +1941 -0
  20. package/dist/chunk-2M2DPHKB.js +762 -0
  21. package/dist/chunk-2YSNA2F2.cjs +1274 -0
  22. package/dist/chunk-3AO425MZ.cjs +886 -0
  23. package/dist/chunk-3FOKASKO.cjs +348 -0
  24. package/dist/chunk-3HYYMEXI.cjs +56578 -0
  25. package/dist/chunk-3NFFOWGG.js +4287 -0
  26. package/dist/chunk-3WZEJHUQ.cjs +116 -0
  27. package/dist/chunk-4C57PR42.js +468 -0
  28. package/dist/chunk-4N4SXXWF.js +769 -0
  29. package/dist/chunk-4PDEPEQW.cjs +41 -0
  30. package/dist/chunk-4R6SBXDB.js +45 -0
  31. package/dist/chunk-4V2E7U7Q.cjs +2015 -0
  32. package/dist/chunk-5FSKKMR7.cjs +2092 -0
  33. package/dist/chunk-5GLCTO44.js +161 -0
  34. package/dist/chunk-5JEU52DW.js +382 -0
  35. package/dist/chunk-5S7RKFGR.cjs +446 -0
  36. package/dist/chunk-5WUNN6ZN.cjs +428 -0
  37. package/dist/chunk-62FBK3B7.js +70 -0
  38. package/dist/chunk-6CTRH7HT.cjs +1985 -0
  39. package/dist/chunk-6DPSFNJB.cjs +847 -0
  40. package/dist/chunk-6EX3I5P4.cjs +130 -0
  41. package/dist/chunk-73FELZVJ.cjs +611 -0
  42. package/dist/chunk-7CUEMLDZ.cjs +6445 -0
  43. package/dist/chunk-7HIASF7S.cjs +814 -0
  44. package/dist/chunk-A6KINLZJ.js +236 -0
  45. package/dist/chunk-AIA52I7T.cjs +543 -0
  46. package/dist/chunk-ANXZFVY2.js +113 -0
  47. package/dist/chunk-AYBXB26F.js +2176 -0
  48. package/dist/chunk-B4TFTDG4.js +449 -0
  49. package/dist/chunk-BE4UJCQT.js +623 -0
  50. package/dist/chunk-BRQJKJGT.cjs +20 -0
  51. package/dist/chunk-C2A5DUMF.cjs +689 -0
  52. package/dist/chunk-C37BHB7N.cjs +636 -0
  53. package/dist/chunk-CBJY23VL.js +126 -0
  54. package/dist/chunk-CIWWXYHZ.cjs +50 -0
  55. package/dist/chunk-CXFDRBQU.cjs +672 -0
  56. package/dist/chunk-D54CNIAJ.cjs +413 -0
  57. package/dist/chunk-DAJXW4KX.js +725 -0
  58. package/dist/chunk-DTGBOSEM.cjs +319 -0
  59. package/dist/chunk-E7JP3BS3.cjs +61 -0
  60. package/dist/chunk-EKBKLK7P.js +1169 -0
  61. package/dist/chunk-EKYL4PE3.cjs +404 -0
  62. package/dist/chunk-EUDQTK7N.cjs +4310 -0
  63. package/dist/chunk-EXKSFGSX.cjs +274 -0
  64. package/dist/chunk-EXUP2BUM.cjs +1173 -0
  65. package/dist/chunk-F43YAA34.js +623 -0
  66. package/dist/chunk-FDSGHPAK.js +130 -0
  67. package/dist/chunk-FEWUHQNM.cjs +144 -0
  68. package/dist/chunk-FGGJQRLZ.js +270 -0
  69. package/dist/chunk-FHP6LXJS.js +415 -0
  70. package/dist/chunk-FJPADH77.cjs +666 -0
  71. package/dist/chunk-FYSPZT4V.cjs +169 -0
  72. package/dist/chunk-GIOYPNTH.js +5575 -0
  73. package/dist/chunk-GJNCFRJU.cjs +125 -0
  74. package/dist/chunk-GMP623FG.cjs +1508 -0
  75. package/dist/chunk-GQHQOPXZ.cjs +5580 -0
  76. package/dist/chunk-GQT4TYKY.cjs +4381 -0
  77. package/dist/chunk-GTU2Z2WW.cjs +262 -0
  78. package/dist/chunk-GYZE55MO.js +2007 -0
  79. package/dist/chunk-GZG4KA4E.js +529 -0
  80. package/dist/chunk-H652NHX5.js +600 -0
  81. package/dist/chunk-HCCQLAA4.cjs +74 -0
  82. package/dist/chunk-HINXWAOD.cjs +1049 -0
  83. package/dist/chunk-HYNTS5CP.js +422 -0
  84. package/dist/chunk-HZSPDCXV.cjs +457 -0
  85. package/dist/chunk-HZTDET3N.js +1399 -0
  86. package/dist/chunk-I6XZ5DZF.cjs +488 -0
  87. package/dist/chunk-ILRBGFVD.cjs +72 -0
  88. package/dist/chunk-IPWSXCCN.js +1183 -0
  89. package/dist/chunk-IUTY5WQ2.cjs +424 -0
  90. package/dist/chunk-IVSZDECV.js +882 -0
  91. package/dist/chunk-IVY74O6C.js +247 -0
  92. package/dist/chunk-IZM5VQZD.js +714 -0
  93. package/dist/chunk-J32ZJZJH.js +554 -0
  94. package/dist/chunk-J6M4FPK5.js +421 -0
  95. package/dist/chunk-JC5YBPSF.cjs +984 -0
  96. package/dist/chunk-JCLBKPMX.js +3813 -0
  97. package/dist/chunk-JD7CIZ33.js +1949 -0
  98. package/dist/chunk-JIYN45TV.cjs +2525 -0
  99. package/dist/chunk-JJBE3TIH.cjs +1189 -0
  100. package/dist/chunk-JX7YL6ZE.js +2252 -0
  101. package/dist/chunk-K4VVR7CN.cjs +2433 -0
  102. package/dist/chunk-KEFNV2WM.cjs +2257 -0
  103. package/dist/chunk-KH4CNH66.cjs +424 -0
  104. package/dist/chunk-KJLB4OPV.js +5731 -0
  105. package/dist/chunk-KKFZ3B6J.cjs +557 -0
  106. package/dist/chunk-KKP7JKN4.cjs +6002 -0
  107. package/dist/chunk-KPJL34Y7.cjs +186 -0
  108. package/dist/chunk-KQCN6AKJ.cjs +3042 -0
  109. package/dist/chunk-KVRSTFNH.cjs +72 -0
  110. package/dist/chunk-LICPB5HZ.cjs +1409 -0
  111. package/dist/chunk-LM2VU56C.cjs +37 -0
  112. package/dist/chunk-M56JSP4A.js +400 -0
  113. package/dist/chunk-MBOOR7X4.js +18 -0
  114. package/dist/chunk-MGE5Z4GS.js +608 -0
  115. package/dist/chunk-MXFUTKCO.js +56 -0
  116. package/dist/chunk-MYY4PMWX.cjs +264 -0
  117. package/dist/chunk-N75IH2HY.js +258 -0
  118. package/dist/chunk-NBMHU6SW.js +669 -0
  119. package/dist/chunk-NG77ATEW.cjs +778 -0
  120. package/dist/chunk-NGKREZ36.js +6384 -0
  121. package/dist/chunk-NHWSN2SD.cjs +718 -0
  122. package/dist/chunk-NV4VMVXU.js +421 -0
  123. package/dist/chunk-NW5G5FBQ.js +215 -0
  124. package/dist/chunk-NXZFOPVD.cjs +5737 -0
  125. package/dist/chunk-OBIYPYYS.cjs +1993 -0
  126. package/dist/chunk-OIQYIIO3.cjs +473 -0
  127. package/dist/chunk-OL46QLBJ.js +61 -0
  128. package/dist/chunk-OMXII44L.js +5386 -0
  129. package/dist/chunk-OR4Q2BGL.cjs +759 -0
  130. package/dist/chunk-OSYNRVOV.cjs +243 -0
  131. package/dist/chunk-PGANYCAG.cjs +220 -0
  132. package/dist/chunk-PHENW4MQ.js +65 -0
  133. package/dist/chunk-PHVRG4I2.js +844 -0
  134. package/dist/chunk-Q56TT7IL.js +483 -0
  135. package/dist/chunk-QPOQ7VPI.js +1491 -0
  136. package/dist/chunk-QPSKHBJP.js +5963 -0
  137. package/dist/chunk-QXH7QDSZ.js +1989 -0
  138. package/dist/chunk-R75BSDH7.cjs +50 -0
  139. package/dist/chunk-RARB3MBR.js +207 -0
  140. package/dist/chunk-RVBHAXFG.js +56160 -0
  141. package/dist/chunk-S3MDHNKB.cjs +490 -0
  142. package/dist/chunk-S4W6Z2MN.js +2426 -0
  143. package/dist/chunk-S6YWHCKV.cjs +410 -0
  144. package/dist/chunk-SIEXCILW.js +229 -0
  145. package/dist/chunk-SJBGLS25.cjs +2196 -0
  146. package/dist/chunk-SLU6UPJI.cjs +410 -0
  147. package/dist/chunk-SMIWS6DE.cjs +212 -0
  148. package/dist/chunk-T2QCTZMO.js +811 -0
  149. package/dist/chunk-T5J7ZKP3.cjs +4885 -0
  150. package/dist/chunk-TDCNJHWO.js +341 -0
  151. package/dist/chunk-TG7O4WBC.js +406 -0
  152. package/dist/chunk-THCK6ECW.js +2085 -0
  153. package/dist/chunk-TJHVSBP2.js +439 -0
  154. package/dist/chunk-TVHSPJ4N.cjs +606 -0
  155. package/dist/chunk-U44IKGG7.cjs +5390 -0
  156. package/dist/chunk-UJXISJBN.js +487 -0
  157. package/dist/chunk-UM6C3CGK.js +4375 -0
  158. package/dist/chunk-UMABK6SI.js +686 -0
  159. package/dist/chunk-UOIGFQXC.cjs +9750 -0
  160. package/dist/chunk-URG2SJLK.js +2521 -0
  161. package/dist/chunk-V6MKC2FZ.js +979 -0
  162. package/dist/chunk-VECQYRXL.js +474 -0
  163. package/dist/chunk-VJ3L7CHT.cjs +169 -0
  164. package/dist/chunk-VMLKSV26.js +1216 -0
  165. package/dist/chunk-VVKVQZI6.js +55 -0
  166. package/dist/chunk-W6RW64BB.cjs +1219 -0
  167. package/dist/chunk-W7VDOASB.cjs +639 -0
  168. package/dist/chunk-WDT3JTGM.cjs +483 -0
  169. package/dist/chunk-WJIHFLMJ.js +404 -0
  170. package/dist/chunk-WKX5AMOY.js +309 -0
  171. package/dist/chunk-WNNE3PO3.js +34 -0
  172. package/dist/chunk-WRKUDAZJ.js +3038 -0
  173. package/dist/chunk-WRLUBRKS.cjs +1943 -0
  174. package/dist/chunk-WRNEH5MO.js +3169 -0
  175. package/dist/chunk-WRWEX5ZF.js +658 -0
  176. package/dist/chunk-X3GJPRVK.cjs +3246 -0
  177. package/dist/chunk-XHIV6326.cjs +793 -0
  178. package/dist/chunk-XIVIE43A.cjs +729 -0
  179. package/dist/chunk-XJAN7CZG.cjs +432 -0
  180. package/dist/chunk-XKTPFXGA.js +164 -0
  181. package/dist/chunk-XL6INWKT.js +121 -0
  182. package/dist/chunk-XSFNHP2E.js +632 -0
  183. package/dist/chunk-XT6JY5W5.js +9684 -0
  184. package/dist/chunk-XUILI4KB.cjs +430 -0
  185. package/dist/chunk-XUUVDHIF.cjs +3962 -0
  186. package/dist/chunk-YF2I3MV3.js +46 -0
  187. package/dist/chunk-YIMN575O.js +4847 -0
  188. package/dist/chunk-YIVFJNYV.js +176 -0
  189. package/dist/chunk-YKGPCZEE.cjs +237 -0
  190. package/dist/chunk-YN6V7R3L.cjs +327 -0
  191. package/dist/chunk-YQELFNJV.js +39 -0
  192. package/dist/chunk-YYXH45E2.js +426 -0
  193. package/dist/chunk-ZBQXLH2L.js +756 -0
  194. package/dist/chunk-ZDSYWBIE.cjs +69 -0
  195. package/dist/chunk-ZU7NIRT6.js +325 -0
  196. package/dist/chunk-ZZ7RO2UQ.js +1243 -0
  197. package/dist/chunk-ZZEI7MV4.js +778 -0
  198. package/dist/cli/holoscript-runner.cjs +2255 -0
  199. package/dist/cli/holoscript-runner.js +2230 -0
  200. package/dist/codebase/index.cjs +336 -0
  201. package/dist/codebase/index.js +331 -0
  202. package/dist/compiler/agent-inference.cjs +31 -0
  203. package/dist/compiler/agent-inference.js +8 -0
  204. package/dist/compiler/android-xr.cjs +24 -0
  205. package/dist/compiler/android-xr.js +14 -0
  206. package/dist/compiler/android.cjs +24 -0
  207. package/dist/compiler/android.js +14 -0
  208. package/dist/compiler/ar.cjs +23 -0
  209. package/dist/compiler/ar.js +11 -0
  210. package/dist/compiler/babylon.cjs +21 -0
  211. package/dist/compiler/babylon.js +15 -0
  212. package/dist/compiler/business-quest.cjs +43 -0
  213. package/dist/compiler/business-quest.js +4 -0
  214. package/dist/compiler/coco.cjs +27 -0
  215. package/dist/compiler/coco.js +4 -0
  216. package/dist/compiler/context.cjs +25 -0
  217. package/dist/compiler/context.d.ts +28 -0
  218. package/dist/compiler/context.js +8 -0
  219. package/dist/compiler/domain-block-utils.cjs +605 -0
  220. package/dist/compiler/domain-block-utils.js +11 -0
  221. package/dist/compiler/dtdl.cjs +27 -0
  222. package/dist/compiler/dtdl.js +11 -0
  223. package/dist/compiler/gltf-pipeline.cjs +39 -0
  224. package/dist/compiler/gltf-pipeline.js +4 -0
  225. package/dist/compiler/godot.cjs +18 -0
  226. package/dist/compiler/godot.js +12 -0
  227. package/dist/compiler/incremental.cjs +34 -0
  228. package/dist/compiler/incremental.js +9 -0
  229. package/dist/compiler/index.cjs +5860 -0
  230. package/dist/compiler/index.d.ts +322 -21
  231. package/dist/compiler/index.js +5525 -0
  232. package/dist/compiler/ios.cjs +23 -0
  233. package/dist/compiler/ios.js +13 -0
  234. package/dist/compiler/llm-provider-capabilities.cjs +25 -0
  235. package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
  236. package/dist/compiler/llm-provider-capabilities.js +8 -0
  237. package/dist/compiler/multi-layer.cjs +24 -0
  238. package/dist/compiler/multi-layer.js +15 -0
  239. package/dist/compiler/nodetoy.cjs +23 -0
  240. package/dist/compiler/nodetoy.js +4 -0
  241. package/dist/compiler/openxr.cjs +19 -0
  242. package/dist/compiler/openxr.js +13 -0
  243. package/dist/compiler/playcanvas.cjs +19 -0
  244. package/dist/compiler/playcanvas.js +13 -0
  245. package/dist/compiler/r3f.cjs +38 -0
  246. package/dist/compiler/r3f.d.ts +22 -0
  247. package/dist/compiler/r3f.js +16 -0
  248. package/dist/compiler/remotion.cjs +23 -0
  249. package/dist/compiler/remotion.js +4 -0
  250. package/dist/compiler/reproducibility.cjs +39 -0
  251. package/dist/compiler/reproducibility.js +4 -0
  252. package/dist/compiler/sdf.cjs +24 -0
  253. package/dist/compiler/sdf.js +12 -0
  254. package/dist/compiler/semantic-scene.cjs +31 -0
  255. package/dist/compiler/semantic-scene.js +4 -0
  256. package/dist/compiler/state.cjs +21 -0
  257. package/dist/compiler/state.js +11 -0
  258. package/dist/compiler/trait-composition.cjs +30 -0
  259. package/dist/compiler/trait-composition.js +9 -0
  260. package/dist/compiler/unity.cjs +19 -0
  261. package/dist/compiler/unity.js +13 -0
  262. package/dist/compiler/unreal.cjs +23 -0
  263. package/dist/compiler/unreal.js +13 -0
  264. package/dist/compiler/urdf.cjs +52 -0
  265. package/dist/compiler/urdf.js +12 -0
  266. package/dist/compiler/usd-physics.cjs +26 -0
  267. package/dist/compiler/usd-physics.js +9 -0
  268. package/dist/compiler/visionos.cjs +19 -0
  269. package/dist/compiler/visionos.js +13 -0
  270. package/dist/compiler/vrchat.cjs +22 -0
  271. package/dist/compiler/vrchat.js +12 -0
  272. package/dist/compiler/vrr.cjs +24 -0
  273. package/dist/compiler/vrr.js +12 -0
  274. package/dist/compiler/wasm.cjs +36 -0
  275. package/dist/compiler/wasm.js +12 -0
  276. package/dist/compiler/webgpu.cjs +18 -0
  277. package/dist/compiler/webgpu.js +12 -0
  278. package/dist/coordinators/index.cjs +1266 -0
  279. package/dist/coordinators/index.d.ts +72 -1
  280. package/dist/coordinators/index.js +1259 -0
  281. package/dist/debugger.cjs +24 -0
  282. package/dist/debugger.js +11 -0
  283. package/dist/entries/interop.cjs +64 -0
  284. package/dist/entries/interop.js +7 -0
  285. package/dist/entries/scripting.cjs +55 -0
  286. package/dist/entries/scripting.js +10 -0
  287. package/dist/hololand/index.cjs +146 -0
  288. package/dist/hololand/index.d.ts +70 -0
  289. package/dist/hololand/index.js +5 -0
  290. package/dist/index.cjs +43233 -0
  291. package/dist/index.d.ts +976 -21
  292. package/dist/index.js +39995 -0
  293. package/dist/math/tropical-spmv.cjs +45 -0
  294. package/dist/math/tropical-spmv.js +4 -0
  295. package/dist/math/vec3.cjs +57 -0
  296. package/dist/math/vec3.js +4 -0
  297. package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
  298. package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
  299. package/dist/paper-0c-spike/index.cjs +150 -0
  300. package/dist/paper-0c-spike/index.js +141 -0
  301. package/dist/parser.cjs +61 -0
  302. package/dist/parser.d.ts +11 -0
  303. package/dist/parser.js +12 -0
  304. package/dist/playwright-3AT3AKTV.cjs +98673 -0
  305. package/dist/playwright-VZPDVUEQ.js +98660 -0
  306. package/dist/reconstruction/index.cjs +153 -0
  307. package/dist/reconstruction/index.d.ts +29 -2
  308. package/dist/reconstruction/index.js +8 -0
  309. package/dist/runtime.cjs +316 -0
  310. package/dist/runtime.d.ts +61 -0
  311. package/dist/runtime.js +31 -0
  312. package/dist/self-improvement/index.cjs +563 -0
  313. package/dist/self-improvement/index.js +545 -0
  314. package/dist/storage/index.cjs +38 -0
  315. package/dist/storage/index.js +5 -0
  316. package/dist/testing.cjs +25 -0
  317. package/dist/testing.d.ts +70 -0
  318. package/dist/testing.js +4 -0
  319. package/dist/traitDocs/traitDocs.cjs +33 -0
  320. package/dist/traitDocs/traitDocs.js +7 -0
  321. package/dist/traits/botanical-lotus.cjs +41 -0
  322. package/dist/traits/botanical-lotus.d.ts +172 -0
  323. package/dist/traits/botanical-lotus.js +4 -0
  324. package/dist/traits/engines/index.cjs +520 -0
  325. package/dist/traits/engines/index.js +380 -0
  326. package/dist/traits/index.cjs +24409 -0
  327. package/dist/traits/index.d.ts +171 -35
  328. package/dist/traits/index.js +21634 -0
  329. package/dist/traits/simulation-solver-factory.cjs +13 -0
  330. package/dist/traits/simulation-solver-factory.d.ts +23 -0
  331. package/dist/traits/simulation-solver-factory.js +4 -0
  332. package/dist/traits/webcam-gaze.cjs +35 -0
  333. package/dist/traits/webcam-gaze.d.ts +17 -0
  334. package/dist/traits/webcam-gaze.js +4 -0
  335. package/dist/type-checker.cjs +19 -0
  336. package/dist/type-checker.js +6 -0
  337. package/dist/world/index.cjs +947 -0
  338. package/dist/world/index.d.ts +147 -0
  339. package/dist/world/index.js +939 -0
  340. package/dist/world-model/index.cjs +1446 -0
  341. package/dist/world-model/index.d.ts +119 -0
  342. package/dist/world-model/index.js +1414 -0
  343. package/dist/wot/index.cjs +29 -0
  344. package/dist/wot/index.js +4 -0
  345. package/package.json +93 -49
@@ -0,0 +1,1173 @@
1
+ 'use strict';
2
+
3
+ var chunkZDSYWBIE_cjs = require('./chunk-ZDSYWBIE.cjs');
4
+
5
+ // src/compiler/ProceduralGeometry.ts
6
+ var LOD_PRESETS = {
7
+ low: {
8
+ hull: { resolution: 12, boundsPadding: 1.2 },
9
+ spline: { radialSegments: 8, lengthSteps: 4 },
10
+ membrane: { subdivisions: 3 }
11
+ },
12
+ medium: {
13
+ hull: { resolution: 24, boundsPadding: 1.3 },
14
+ spline: { radialSegments: 32, lengthSteps: 12 },
15
+ membrane: { subdivisions: 8 }
16
+ },
17
+ high: {
18
+ hull: { resolution: 48, boundsPadding: 1.4 },
19
+ spline: { radialSegments: 64, lengthSteps: 24 },
20
+ membrane: { subdivisions: 16 }
21
+ }
22
+ };
23
+ function catmullRom(p0, p1, p2, p3, t) {
24
+ const t2 = t * t;
25
+ const t3 = t2 * t;
26
+ const result = [];
27
+ for (let i = 0; i < p0.length; i++) {
28
+ result.push(
29
+ 0.5 * (2 * p1[i] + (-p0[i] + p2[i]) * t + (2 * p0[i] - 5 * p1[i] + 4 * p2[i] - p3[i]) * t2 + (-p0[i] + 3 * p1[i] - 3 * p2[i] + p3[i]) * t3)
30
+ );
31
+ }
32
+ return result;
33
+ }
34
+ function fallbackBox() {
35
+ const s = 0.5;
36
+ const positions = new Float32Array([
37
+ // Front
38
+ -s,
39
+ -s,
40
+ s,
41
+ s,
42
+ -s,
43
+ s,
44
+ s,
45
+ s,
46
+ s,
47
+ -s,
48
+ s,
49
+ s,
50
+ // Back
51
+ s,
52
+ -s,
53
+ -s,
54
+ -s,
55
+ -s,
56
+ -s,
57
+ -s,
58
+ s,
59
+ -s,
60
+ s,
61
+ s,
62
+ -s,
63
+ // Top
64
+ -s,
65
+ s,
66
+ s,
67
+ s,
68
+ s,
69
+ s,
70
+ s,
71
+ s,
72
+ -s,
73
+ -s,
74
+ s,
75
+ -s,
76
+ // Bottom
77
+ -s,
78
+ -s,
79
+ -s,
80
+ s,
81
+ -s,
82
+ -s,
83
+ s,
84
+ -s,
85
+ s,
86
+ -s,
87
+ -s,
88
+ s,
89
+ // Right
90
+ s,
91
+ -s,
92
+ s,
93
+ s,
94
+ -s,
95
+ -s,
96
+ s,
97
+ s,
98
+ -s,
99
+ s,
100
+ s,
101
+ s,
102
+ // Left
103
+ -s,
104
+ -s,
105
+ -s,
106
+ -s,
107
+ -s,
108
+ s,
109
+ -s,
110
+ s,
111
+ s,
112
+ -s,
113
+ s,
114
+ -s
115
+ ]);
116
+ const normals = new Float32Array([
117
+ 0,
118
+ 0,
119
+ 1,
120
+ 0,
121
+ 0,
122
+ 1,
123
+ 0,
124
+ 0,
125
+ 1,
126
+ 0,
127
+ 0,
128
+ 1,
129
+ 0,
130
+ 0,
131
+ -1,
132
+ 0,
133
+ 0,
134
+ -1,
135
+ 0,
136
+ 0,
137
+ -1,
138
+ 0,
139
+ 0,
140
+ -1,
141
+ 0,
142
+ 1,
143
+ 0,
144
+ 0,
145
+ 1,
146
+ 0,
147
+ 0,
148
+ 1,
149
+ 0,
150
+ 0,
151
+ 1,
152
+ 0,
153
+ 0,
154
+ -1,
155
+ 0,
156
+ 0,
157
+ -1,
158
+ 0,
159
+ 0,
160
+ -1,
161
+ 0,
162
+ 0,
163
+ -1,
164
+ 0,
165
+ 1,
166
+ 0,
167
+ 0,
168
+ 1,
169
+ 0,
170
+ 0,
171
+ 1,
172
+ 0,
173
+ 0,
174
+ 1,
175
+ 0,
176
+ 0,
177
+ -1,
178
+ 0,
179
+ 0,
180
+ -1,
181
+ 0,
182
+ 0,
183
+ -1,
184
+ 0,
185
+ 0,
186
+ -1,
187
+ 0,
188
+ 0
189
+ ]);
190
+ const uvs = new Float32Array([
191
+ 0,
192
+ 0,
193
+ 1,
194
+ 0,
195
+ 1,
196
+ 1,
197
+ 0,
198
+ 1,
199
+ 0,
200
+ 0,
201
+ 1,
202
+ 0,
203
+ 1,
204
+ 1,
205
+ 0,
206
+ 1,
207
+ 0,
208
+ 0,
209
+ 1,
210
+ 0,
211
+ 1,
212
+ 1,
213
+ 0,
214
+ 1,
215
+ 0,
216
+ 0,
217
+ 1,
218
+ 0,
219
+ 1,
220
+ 1,
221
+ 0,
222
+ 1,
223
+ 0,
224
+ 0,
225
+ 1,
226
+ 0,
227
+ 1,
228
+ 1,
229
+ 0,
230
+ 1,
231
+ 0,
232
+ 0,
233
+ 1,
234
+ 0,
235
+ 1,
236
+ 1,
237
+ 0,
238
+ 1
239
+ ]);
240
+ const indices = new Uint16Array([
241
+ 0,
242
+ 1,
243
+ 2,
244
+ 0,
245
+ 2,
246
+ 3,
247
+ 4,
248
+ 5,
249
+ 6,
250
+ 4,
251
+ 6,
252
+ 7,
253
+ 8,
254
+ 9,
255
+ 10,
256
+ 8,
257
+ 10,
258
+ 11,
259
+ 12,
260
+ 13,
261
+ 14,
262
+ 12,
263
+ 14,
264
+ 15,
265
+ 16,
266
+ 17,
267
+ 18,
268
+ 16,
269
+ 18,
270
+ 19,
271
+ 20,
272
+ 21,
273
+ 22,
274
+ 20,
275
+ 22,
276
+ 23
277
+ ]);
278
+ return { positions, normals, uvs, indices };
279
+ }
280
+ function generateSplineGeometry(points, radii, radialSegments = 32, lengthSteps = 12, lod) {
281
+ if (lod) {
282
+ const preset = LOD_PRESETS[lod].spline;
283
+ radialSegments = preset.radialSegments;
284
+ lengthSteps = preset.lengthSteps;
285
+ }
286
+ if (points.length < 2) return fallbackBox();
287
+ const positions = [];
288
+ const normals = [];
289
+ const uvs = [];
290
+ const indices = [];
291
+ const pathPoints = [];
292
+ const pathRadii = [];
293
+ const numSegments = points.length - 1;
294
+ for (let seg = 0; seg < numSegments; seg++) {
295
+ const p0 = points[Math.max(0, seg - 1)];
296
+ const p1 = points[seg];
297
+ const p2 = points[Math.min(points.length - 1, seg + 1)];
298
+ const p3 = points[Math.min(points.length - 1, seg + 2)];
299
+ const r1 = radii[seg] ?? radii[radii.length - 1] ?? 0.1;
300
+ const r2 = radii[seg + 1] ?? radii[radii.length - 1] ?? 0.1;
301
+ const steps = seg === numSegments - 1 ? lengthSteps + 1 : lengthSteps;
302
+ for (let i = 0; i < steps; i++) {
303
+ const t = i / lengthSteps;
304
+ pathPoints.push(catmullRom(p0, p1, p2, p3, t));
305
+ pathRadii.push(r1 + (r2 - r1) * t);
306
+ }
307
+ }
308
+ const totalRings = pathPoints.length;
309
+ let prevNormal = [0, 0, 0];
310
+ for (let ring = 0; ring < totalRings; ring++) {
311
+ const p = pathPoints[ring];
312
+ const radius = pathRadii[ring];
313
+ const v = ring / (totalRings - 1);
314
+ let tangent;
315
+ if (ring === 0) {
316
+ tangent = chunkZDSYWBIE_cjs.vec3SubArray(pathPoints[1], pathPoints[0]);
317
+ } else if (ring === totalRings - 1) {
318
+ tangent = chunkZDSYWBIE_cjs.vec3SubArray(pathPoints[totalRings - 1], pathPoints[totalRings - 2]);
319
+ } else {
320
+ tangent = chunkZDSYWBIE_cjs.vec3SubArray(pathPoints[ring + 1], pathPoints[ring - 1]);
321
+ }
322
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(tangent);
323
+ let normal;
324
+ let binormal;
325
+ if (ring === 0) {
326
+ if (Math.abs(tangent[0]) < 0.9) {
327
+ normal = chunkZDSYWBIE_cjs.vec3CrossArray(tangent, [1, 0, 0]);
328
+ } else {
329
+ normal = chunkZDSYWBIE_cjs.vec3CrossArray(tangent, [0, 1, 0]);
330
+ }
331
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(normal);
332
+ binormal = chunkZDSYWBIE_cjs.vec3CrossArray(tangent, normal);
333
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(binormal);
334
+ } else {
335
+ normal = chunkZDSYWBIE_cjs.vec3SubArray(
336
+ prevNormal,
337
+ chunkZDSYWBIE_cjs.vec3ScaleArray(
338
+ tangent,
339
+ prevNormal[0] * tangent[0] + prevNormal[1] * tangent[1] + prevNormal[2] * tangent[2]
340
+ )
341
+ );
342
+ const nLen = chunkZDSYWBIE_cjs.vec3NormalizeInPlace(normal);
343
+ if (nLen < 1e-6) normal = [...prevNormal];
344
+ binormal = chunkZDSYWBIE_cjs.vec3CrossArray(tangent, normal);
345
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(binormal);
346
+ }
347
+ prevNormal = normal;
348
+ for (let i = 0; i <= radialSegments; i++) {
349
+ const u = i / radialSegments;
350
+ const theta = u * Math.PI * 2;
351
+ const cosT = Math.cos(theta);
352
+ const sinT = Math.sin(theta);
353
+ const nx = normal[0] * cosT + binormal[0] * sinT;
354
+ const ny = normal[1] * cosT + binormal[1] * sinT;
355
+ const nz = normal[2] * cosT + binormal[2] * sinT;
356
+ positions.push(p[0] + nx * radius, p[1] + ny * radius, p[2] + nz * radius);
357
+ normals.push(nx, ny, nz);
358
+ uvs.push(u, v);
359
+ }
360
+ }
361
+ const ringVerts = radialSegments + 1;
362
+ for (let ring = 0; ring < totalRings - 1; ring++) {
363
+ for (let i = 0; i < radialSegments; i++) {
364
+ const a = ring * ringVerts + i;
365
+ const b = a + ringVerts;
366
+ indices.push(a, b, a + 1);
367
+ indices.push(b, b + 1, a + 1);
368
+ }
369
+ }
370
+ const startCenter = positions.length / 3;
371
+ const sp = pathPoints[0];
372
+ const startTangent = chunkZDSYWBIE_cjs.vec3SubArray(pathPoints[1], pathPoints[0]);
373
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(startTangent);
374
+ positions.push(sp[0], sp[1], sp[2]);
375
+ normals.push(-startTangent[0], -startTangent[1], -startTangent[2]);
376
+ uvs.push(0.5, 0);
377
+ for (let i = 0; i < radialSegments; i++) {
378
+ indices.push(startCenter, i + 1, i);
379
+ }
380
+ const endCenter = positions.length / 3;
381
+ const ep = pathPoints[totalRings - 1];
382
+ const endTangent = chunkZDSYWBIE_cjs.vec3SubArray(pathPoints[totalRings - 1], pathPoints[totalRings - 2]);
383
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(endTangent);
384
+ positions.push(ep[0], ep[1], ep[2]);
385
+ normals.push(endTangent[0], endTangent[1], endTangent[2]);
386
+ uvs.push(0.5, 1);
387
+ const lastRingStart = (totalRings - 1) * ringVerts;
388
+ for (let i = 0; i < radialSegments; i++) {
389
+ indices.push(endCenter, lastRingStart + i, lastRingStart + i + 1);
390
+ }
391
+ const vertexCount = positions.length / 3;
392
+ const IndexArrayType = vertexCount > 65535 ? Uint32Array : Uint16Array;
393
+ return {
394
+ positions: new Float32Array(positions),
395
+ normals: new Float32Array(normals),
396
+ uvs: new Float32Array(uvs),
397
+ indices: new IndexArrayType(indices)
398
+ };
399
+ }
400
+ var MC_EDGE_TABLE = [
401
+ 0,
402
+ 265,
403
+ 515,
404
+ 778,
405
+ 1030,
406
+ 1295,
407
+ 1541,
408
+ 1804,
409
+ 2060,
410
+ 2309,
411
+ 2575,
412
+ 2822,
413
+ 3082,
414
+ 3331,
415
+ 3593,
416
+ 3840,
417
+ 400,
418
+ 153,
419
+ 915,
420
+ 666,
421
+ 1430,
422
+ 1183,
423
+ 1941,
424
+ 1692,
425
+ 2460,
426
+ 2197,
427
+ 2975,
428
+ 2710,
429
+ 3482,
430
+ 3219,
431
+ 3993,
432
+ 3728,
433
+ 560,
434
+ 825,
435
+ 51,
436
+ 314,
437
+ 1590,
438
+ 1855,
439
+ 1077,
440
+ 1340,
441
+ 2620,
442
+ 2869,
443
+ 2111,
444
+ 2358,
445
+ 3642,
446
+ 3891,
447
+ 3129,
448
+ 3376,
449
+ 928,
450
+ 681,
451
+ 419,
452
+ 170,
453
+ 1958,
454
+ 1711,
455
+ 1445,
456
+ 1196,
457
+ 2988,
458
+ 2725,
459
+ 2479,
460
+ 2214,
461
+ 4010,
462
+ 3747,
463
+ 3497,
464
+ 3232,
465
+ 1120,
466
+ 1385,
467
+ 1635,
468
+ 1898,
469
+ 102,
470
+ 367,
471
+ 613,
472
+ 876,
473
+ 3180,
474
+ 3429,
475
+ 3695,
476
+ 3942,
477
+ 2154,
478
+ 2403,
479
+ 2665,
480
+ 2912,
481
+ 1520,
482
+ 1273,
483
+ 2035,
484
+ 1786,
485
+ 502,
486
+ 255,
487
+ 1013,
488
+ 764,
489
+ 3580,
490
+ 3317,
491
+ 4095,
492
+ 3830,
493
+ 2554,
494
+ 2291,
495
+ 3065,
496
+ 2800,
497
+ 1616,
498
+ 1881,
499
+ 1107,
500
+ 1370,
501
+ 598,
502
+ 863,
503
+ 85,
504
+ 348,
505
+ 3676,
506
+ 3925,
507
+ 3167,
508
+ 3414,
509
+ 2650,
510
+ 2899,
511
+ 2137,
512
+ 2384,
513
+ 1984,
514
+ 1737,
515
+ 1475,
516
+ 1226,
517
+ 966,
518
+ 719,
519
+ 453,
520
+ 204,
521
+ 4044,
522
+ 3781,
523
+ 3535,
524
+ 3270,
525
+ 3018,
526
+ 2755,
527
+ 2505,
528
+ 2240,
529
+ 2240,
530
+ 2505,
531
+ 2755,
532
+ 3018,
533
+ 3270,
534
+ 3535,
535
+ 3781,
536
+ 4044,
537
+ 204,
538
+ 453,
539
+ 719,
540
+ 966,
541
+ 1226,
542
+ 1475,
543
+ 1737,
544
+ 1984,
545
+ 2384,
546
+ 2137,
547
+ 2899,
548
+ 2650,
549
+ 3414,
550
+ 3167,
551
+ 3925,
552
+ 3676,
553
+ 348,
554
+ 85,
555
+ 863,
556
+ 598,
557
+ 1370,
558
+ 1107,
559
+ 1881,
560
+ 1616,
561
+ 2800,
562
+ 3065,
563
+ 2291,
564
+ 2554,
565
+ 3830,
566
+ 4095,
567
+ 3317,
568
+ 3580,
569
+ 764,
570
+ 1013,
571
+ 255,
572
+ 502,
573
+ 1786,
574
+ 2035,
575
+ 1273,
576
+ 1520,
577
+ 2912,
578
+ 2665,
579
+ 2403,
580
+ 2154,
581
+ 3942,
582
+ 3695,
583
+ 3429,
584
+ 3180,
585
+ 876,
586
+ 613,
587
+ 367,
588
+ 102,
589
+ 1898,
590
+ 1635,
591
+ 1385,
592
+ 1120,
593
+ 3232,
594
+ 3497,
595
+ 3747,
596
+ 4010,
597
+ 2214,
598
+ 2479,
599
+ 2725,
600
+ 2988,
601
+ 1196,
602
+ 1445,
603
+ 1711,
604
+ 1958,
605
+ 170,
606
+ 419,
607
+ 681,
608
+ 928,
609
+ 3376,
610
+ 3129,
611
+ 3891,
612
+ 3642,
613
+ 2358,
614
+ 2111,
615
+ 2869,
616
+ 2620,
617
+ 1340,
618
+ 1077,
619
+ 1855,
620
+ 1590,
621
+ 314,
622
+ 51,
623
+ 825,
624
+ 560,
625
+ 3728,
626
+ 3993,
627
+ 3219,
628
+ 3482,
629
+ 2710,
630
+ 2975,
631
+ 2197,
632
+ 2460,
633
+ 1692,
634
+ 1941,
635
+ 1183,
636
+ 1430,
637
+ 666,
638
+ 915,
639
+ 153,
640
+ 400,
641
+ 3840,
642
+ 3593,
643
+ 3331,
644
+ 3082,
645
+ 2822,
646
+ 2575,
647
+ 2309,
648
+ 2060,
649
+ 1804,
650
+ 1541,
651
+ 1295,
652
+ 1030,
653
+ 778,
654
+ 515,
655
+ 265,
656
+ 0
657
+ ];
658
+ var MC_TRI_TABLE = [
659
+ [-1],
660
+ [0, 8, 3, -1],
661
+ [0, 1, 9, -1],
662
+ [1, 8, 3, 9, 8, 1, -1],
663
+ [1, 2, 10, -1],
664
+ [0, 8, 3, 1, 2, 10, -1],
665
+ [9, 2, 10, 0, 2, 9, -1],
666
+ [2, 8, 3, 2, 10, 8, 10, 9, 8, -1],
667
+ [3, 11, 2, -1],
668
+ [0, 11, 2, 8, 11, 0, -1],
669
+ [1, 9, 0, 2, 3, 11, -1],
670
+ [1, 11, 2, 1, 9, 11, 9, 8, 11, -1],
671
+ [3, 10, 1, 11, 10, 3, -1],
672
+ [0, 10, 1, 0, 8, 10, 8, 11, 10, -1],
673
+ [3, 9, 0, 3, 11, 9, 11, 10, 9, -1],
674
+ [9, 8, 10, 10, 8, 11, -1],
675
+ [4, 7, 8, -1],
676
+ [4, 3, 0, 7, 3, 4, -1],
677
+ [0, 1, 9, 8, 4, 7, -1],
678
+ [4, 1, 9, 4, 7, 1, 7, 3, 1, -1],
679
+ [1, 2, 10, 8, 4, 7, -1],
680
+ [3, 4, 7, 3, 0, 4, 1, 2, 10, -1],
681
+ [9, 2, 10, 9, 0, 2, 8, 4, 7, -1],
682
+ [2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1],
683
+ [8, 4, 7, 3, 11, 2, -1],
684
+ [11, 4, 7, 11, 2, 4, 2, 0, 4, -1],
685
+ [9, 0, 1, 8, 4, 7, 2, 3, 11, -1],
686
+ [4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1],
687
+ [3, 10, 1, 3, 11, 10, 7, 8, 4, -1],
688
+ [1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1],
689
+ [4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1],
690
+ [4, 7, 11, 4, 11, 9, 9, 11, 10, -1],
691
+ [9, 5, 4, -1],
692
+ [9, 5, 4, 0, 8, 3, -1],
693
+ [0, 5, 4, 1, 5, 0, -1],
694
+ [8, 5, 4, 8, 3, 5, 3, 1, 5, -1],
695
+ [1, 2, 10, 9, 5, 4, -1],
696
+ [3, 0, 8, 1, 2, 10, 4, 9, 5, -1],
697
+ [5, 2, 10, 5, 4, 2, 4, 0, 2, -1],
698
+ [2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1],
699
+ [9, 5, 4, 2, 3, 11, -1],
700
+ [0, 11, 2, 0, 8, 11, 4, 9, 5, -1],
701
+ [0, 5, 4, 0, 1, 5, 2, 3, 11, -1],
702
+ [2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1],
703
+ [10, 3, 11, 10, 1, 3, 9, 5, 4, -1],
704
+ [4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1],
705
+ [5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1],
706
+ [5, 4, 8, 5, 8, 10, 10, 8, 11, -1],
707
+ [9, 7, 8, 5, 7, 9, -1],
708
+ [9, 3, 0, 9, 5, 3, 5, 7, 3, -1],
709
+ [0, 7, 8, 0, 1, 7, 1, 5, 7, -1],
710
+ [1, 5, 3, 3, 5, 7, -1],
711
+ [9, 7, 8, 9, 5, 7, 10, 1, 2, -1],
712
+ [10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1],
713
+ [8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1],
714
+ [2, 10, 5, 2, 5, 3, 3, 5, 7, -1],
715
+ [7, 9, 5, 7, 8, 9, 3, 11, 2, -1],
716
+ [9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1],
717
+ [2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1],
718
+ [11, 2, 1, 11, 1, 7, 7, 1, 5, -1],
719
+ [9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1],
720
+ [5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1],
721
+ [11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1],
722
+ [11, 10, 5, 7, 11, 5, -1],
723
+ [10, 6, 5, -1],
724
+ [0, 8, 3, 5, 10, 6, -1],
725
+ [9, 0, 1, 5, 10, 6, -1],
726
+ [1, 8, 3, 1, 9, 8, 5, 10, 6, -1],
727
+ [1, 6, 5, 2, 6, 1, -1],
728
+ [1, 6, 5, 1, 2, 6, 3, 0, 8, -1],
729
+ [9, 6, 5, 9, 0, 6, 0, 2, 6, -1],
730
+ [5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1],
731
+ [2, 3, 11, 10, 6, 5, -1],
732
+ [11, 0, 8, 11, 2, 0, 10, 6, 5, -1],
733
+ [0, 1, 9, 2, 3, 11, 5, 10, 6, -1],
734
+ [5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1],
735
+ [6, 3, 11, 6, 5, 3, 5, 1, 3, -1],
736
+ [0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1],
737
+ [3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1],
738
+ [6, 5, 9, 6, 9, 11, 11, 9, 8, -1],
739
+ [5, 10, 6, 4, 7, 8, -1],
740
+ [4, 3, 0, 4, 7, 3, 6, 5, 10, -1],
741
+ [1, 9, 0, 5, 10, 6, 8, 4, 7, -1],
742
+ [10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1],
743
+ [6, 1, 2, 6, 5, 1, 4, 7, 8, -1],
744
+ [1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1],
745
+ [8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1],
746
+ [7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1],
747
+ [3, 11, 2, 7, 8, 4, 10, 6, 5, -1],
748
+ [5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1],
749
+ [0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1],
750
+ [9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1],
751
+ [8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1],
752
+ [5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1],
753
+ [0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1],
754
+ [6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1],
755
+ [10, 4, 9, 6, 4, 10, -1],
756
+ [4, 10, 6, 4, 9, 10, 0, 8, 3, -1],
757
+ [10, 0, 1, 10, 6, 0, 6, 4, 0, -1],
758
+ [8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1],
759
+ [1, 4, 9, 1, 2, 4, 2, 6, 4, -1],
760
+ [3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1],
761
+ [0, 2, 4, 4, 2, 6, -1],
762
+ [8, 3, 2, 8, 2, 4, 4, 2, 6, -1],
763
+ [10, 4, 9, 10, 6, 4, 11, 2, 3, -1],
764
+ [0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1],
765
+ [3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1],
766
+ [6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1],
767
+ [9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1],
768
+ [8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1],
769
+ [3, 11, 6, 3, 6, 0, 0, 6, 4, -1],
770
+ [6, 4, 8, 11, 6, 8, -1],
771
+ [7, 10, 6, 7, 8, 10, 8, 9, 10, -1],
772
+ [0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1],
773
+ [10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1],
774
+ [10, 6, 7, 10, 7, 1, 1, 7, 3, -1],
775
+ [1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1],
776
+ [2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1],
777
+ [7, 8, 0, 7, 0, 6, 6, 0, 2, -1],
778
+ [7, 3, 2, 6, 7, 2, -1],
779
+ [2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1],
780
+ [2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1],
781
+ [1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1],
782
+ [11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1],
783
+ [8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1],
784
+ [0, 9, 1, 11, 6, 7, -1],
785
+ [7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1],
786
+ [7, 11, 6, -1],
787
+ [7, 6, 11, -1],
788
+ [3, 0, 8, 11, 7, 6, -1],
789
+ [0, 1, 9, 11, 7, 6, -1],
790
+ [8, 1, 9, 8, 3, 1, 11, 7, 6, -1],
791
+ [10, 1, 2, 6, 11, 7, -1],
792
+ [1, 2, 10, 3, 0, 8, 6, 11, 7, -1],
793
+ [2, 9, 0, 2, 10, 9, 6, 11, 7, -1],
794
+ [6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1],
795
+ [7, 2, 3, 6, 2, 7, -1],
796
+ [7, 0, 8, 7, 6, 0, 6, 2, 0, -1],
797
+ [2, 7, 6, 2, 3, 7, 0, 1, 9, -1],
798
+ [1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1],
799
+ [10, 7, 6, 10, 1, 7, 1, 3, 7, -1],
800
+ [10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1],
801
+ [0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1],
802
+ [7, 6, 10, 7, 10, 8, 8, 10, 9, -1],
803
+ [6, 8, 4, 11, 8, 6, -1],
804
+ [3, 6, 11, 3, 0, 6, 0, 4, 6, -1],
805
+ [8, 6, 11, 8, 4, 6, 9, 0, 1, -1],
806
+ [9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1],
807
+ [6, 8, 4, 6, 11, 8, 2, 10, 1, -1],
808
+ [1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1],
809
+ [4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1],
810
+ [10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1],
811
+ [8, 2, 3, 8, 4, 2, 4, 6, 2, -1],
812
+ [0, 4, 2, 4, 6, 2, -1],
813
+ [1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1],
814
+ [1, 9, 4, 1, 4, 2, 2, 4, 6, -1],
815
+ [8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1],
816
+ [10, 1, 0, 10, 0, 6, 6, 0, 4, -1],
817
+ [4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1],
818
+ [10, 9, 4, 6, 10, 4, -1],
819
+ [4, 9, 5, 7, 6, 11, -1],
820
+ [0, 8, 3, 4, 9, 5, 11, 7, 6, -1],
821
+ [5, 0, 1, 5, 4, 0, 7, 6, 11, -1],
822
+ [11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1],
823
+ [9, 5, 4, 10, 1, 2, 7, 6, 11, -1],
824
+ [6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1],
825
+ [7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1],
826
+ [3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1],
827
+ [7, 2, 3, 7, 6, 2, 5, 4, 9, -1],
828
+ [9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1],
829
+ [3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1],
830
+ [6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1],
831
+ [9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1],
832
+ [1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1],
833
+ [4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1],
834
+ [7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1],
835
+ [6, 9, 5, 6, 11, 9, 11, 8, 9, -1],
836
+ [3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1],
837
+ [0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1],
838
+ [6, 11, 3, 6, 3, 5, 5, 3, 1, -1],
839
+ [1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1],
840
+ [0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1],
841
+ [11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1],
842
+ [6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1],
843
+ [5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1],
844
+ [9, 5, 6, 9, 6, 0, 0, 6, 2, -1],
845
+ [1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1],
846
+ [1, 5, 6, 2, 1, 6, -1],
847
+ [1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1],
848
+ [10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1],
849
+ [0, 3, 8, 5, 6, 10, -1],
850
+ [10, 5, 6, -1],
851
+ [11, 5, 10, 7, 5, 11, -1],
852
+ [11, 5, 10, 11, 7, 5, 8, 3, 0, -1],
853
+ [5, 11, 7, 5, 10, 11, 1, 9, 0, -1],
854
+ [10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1],
855
+ [11, 1, 2, 11, 7, 1, 7, 5, 1, -1],
856
+ [0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1],
857
+ [9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1],
858
+ [7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1],
859
+ [2, 5, 10, 2, 3, 5, 3, 7, 5, -1],
860
+ [8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1],
861
+ [9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1],
862
+ [9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1],
863
+ [1, 3, 5, 3, 7, 5, -1],
864
+ [0, 8, 7, 0, 7, 1, 1, 7, 5, -1],
865
+ [9, 0, 3, 9, 3, 5, 5, 3, 7, -1],
866
+ [9, 8, 7, 5, 9, 7, -1],
867
+ [5, 8, 4, 5, 10, 8, 10, 11, 8, -1],
868
+ [5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1],
869
+ [0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1],
870
+ [10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1],
871
+ [2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1],
872
+ [0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1],
873
+ [0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1],
874
+ [9, 4, 5, 2, 11, 3, -1],
875
+ [2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1],
876
+ [5, 10, 2, 5, 2, 4, 4, 2, 0, -1],
877
+ [3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1],
878
+ [5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1],
879
+ [8, 4, 5, 8, 5, 3, 3, 5, 1, -1],
880
+ [0, 4, 5, 1, 0, 5, -1],
881
+ [8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1],
882
+ [9, 4, 5, -1],
883
+ [4, 11, 7, 4, 9, 11, 9, 10, 11, -1],
884
+ [0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1],
885
+ [1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1],
886
+ [3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1],
887
+ [4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1],
888
+ [9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1],
889
+ [11, 7, 4, 11, 4, 2, 2, 4, 0, -1],
890
+ [11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1],
891
+ [2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1],
892
+ [9, 10, 7, 9, 7, 4, 10, 2, 7, 0, 7, 8, 2, 8, 7, -1],
893
+ [3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1],
894
+ [1, 10, 2, 8, 7, 4, -1],
895
+ [4, 9, 1, 4, 1, 7, 7, 1, 3, -1],
896
+ [4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1],
897
+ [4, 0, 3, 7, 4, 3, -1],
898
+ [4, 8, 7, -1],
899
+ [9, 10, 8, 10, 11, 8, -1],
900
+ [3, 0, 9, 3, 9, 11, 11, 9, 10, -1],
901
+ [0, 1, 10, 0, 10, 8, 8, 10, 11, -1],
902
+ [3, 1, 10, 11, 3, 10, -1],
903
+ [1, 2, 11, 1, 11, 9, 9, 11, 8, -1],
904
+ [3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1],
905
+ [0, 2, 11, 8, 0, 11, -1],
906
+ [3, 2, 11, -1],
907
+ [2, 3, 8, 2, 8, 10, 10, 8, 9, -1],
908
+ [9, 10, 2, 0, 9, 2, -1],
909
+ [2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1],
910
+ [1, 10, 2, -1],
911
+ [1, 3, 8, 9, 1, 8, -1],
912
+ [0, 9, 1, -1],
913
+ [0, 3, 8, -1],
914
+ [-1]
915
+ ];
916
+ function generateHullGeometry(blobs, resolution = 24, threshold = 1, lod) {
917
+ if (blobs.length === 0) return fallbackBox();
918
+ const boundsPadding = lod ? LOD_PRESETS[lod].hull.boundsPadding : 1.3;
919
+ if (lod) {
920
+ const preset = LOD_PRESETS[lod].hull;
921
+ resolution = preset.resolution;
922
+ }
923
+ let minX = Infinity, minY = Infinity, minZ = Infinity;
924
+ let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
925
+ for (const b of blobs) {
926
+ minX = Math.min(minX, b.center[0] - b.radius[0] * boundsPadding);
927
+ minY = Math.min(minY, b.center[1] - b.radius[1] * boundsPadding);
928
+ minZ = Math.min(minZ, b.center[2] - b.radius[2] * boundsPadding);
929
+ maxX = Math.max(maxX, b.center[0] + b.radius[0] * boundsPadding);
930
+ maxY = Math.max(maxY, b.center[1] + b.radius[1] * boundsPadding);
931
+ maxZ = Math.max(maxZ, b.center[2] + b.radius[2] * boundsPadding);
932
+ }
933
+ const positions = [];
934
+ const normals = [];
935
+ const uvs = [];
936
+ const indices = [];
937
+ function evalField(x, y, z) {
938
+ let sum = 0;
939
+ for (const b of blobs) {
940
+ const dx2 = (x - b.center[0]) / b.radius[0];
941
+ const dy2 = (y - b.center[1]) / b.radius[1];
942
+ const dz2 = (z - b.center[2]) / b.radius[2];
943
+ const d2 = dx2 * dx2 + dy2 * dy2 + dz2 * dz2;
944
+ if (d2 > 1e-3) sum += 1 / d2;
945
+ }
946
+ return sum;
947
+ }
948
+ function evalGradient(x, y, z, eps = 0.01) {
949
+ return [
950
+ evalField(x + eps, y, z) - evalField(x - eps, y, z),
951
+ evalField(x, y + eps, z) - evalField(x, y - eps, z),
952
+ evalField(x, y, z + eps) - evalField(x, y, z - eps)
953
+ ];
954
+ }
955
+ const nx = resolution, ny = resolution, nz = resolution;
956
+ const dx = (maxX - minX) / nx;
957
+ const dy = (maxY - minY) / ny;
958
+ const dz = (maxZ - minZ) / nz;
959
+ const field = new Float32Array((nx + 1) * (ny + 1) * (nz + 1));
960
+ const idx3 = (ix, iy, iz) => ix + (nx + 1) * (iy + (ny + 1) * iz);
961
+ for (let iz = 0; iz <= nz; iz++) {
962
+ for (let iy = 0; iy <= ny; iy++) {
963
+ for (let ix = 0; ix <= nx; ix++) {
964
+ field[idx3(ix, iy, iz)] = evalField(minX + ix * dx, minY + iy * dy, minZ + iz * dz);
965
+ }
966
+ }
967
+ }
968
+ const vertexMap = /* @__PURE__ */ new Map();
969
+ const gridStride = nx + 1;
970
+ const gridSlice = gridStride * (ny + 1);
971
+ function interpVertex(ix1, iy1, iz1, v1, ix2, iy2, iz2, v2) {
972
+ const k1 = ix1 + iy1 * gridStride + iz1 * gridSlice;
973
+ const k2 = ix2 + iy2 * gridStride + iz2 * gridSlice;
974
+ const key = k1 < k2 ? `${k1}_${k2}` : `${k2}_${k1}`;
975
+ if (vertexMap.has(key)) return vertexMap.get(key);
976
+ const dv = v2 - v1;
977
+ const t = Math.abs(dv) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (threshold - v1) / dv));
978
+ const x = minX + (ix1 + t * (ix2 - ix1)) * dx;
979
+ const y = minY + (iy1 + t * (iy2 - iy1)) * dy;
980
+ const z = minZ + (iz1 + t * (iz2 - iz1)) * dz;
981
+ const gradEps = Math.min(dx, dy, dz) * 0.5;
982
+ const grad = evalGradient(x, y, z, gradEps);
983
+ const n = [-grad[0], -grad[1], -grad[2]];
984
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(n);
985
+ const vertIdx = positions.length / 3;
986
+ positions.push(x, y, z);
987
+ normals.push(n[0], n[1], n[2]);
988
+ uvs.push(
989
+ 0.5 + Math.atan2(n[2], n[0]) / (2 * Math.PI),
990
+ 0.5 - Math.asin(Math.max(-1, Math.min(1, n[1]))) / Math.PI
991
+ );
992
+ vertexMap.set(key, vertIdx);
993
+ return vertIdx;
994
+ }
995
+ const edgeVerts = [
996
+ [0, 1],
997
+ [1, 2],
998
+ [2, 3],
999
+ [3, 0],
1000
+ [4, 5],
1001
+ [5, 6],
1002
+ [6, 7],
1003
+ [7, 4],
1004
+ [0, 4],
1005
+ [1, 5],
1006
+ [2, 6],
1007
+ [3, 7]
1008
+ ];
1009
+ const cornerOffsets = [
1010
+ [0, 0, 0],
1011
+ [1, 0, 0],
1012
+ [1, 1, 0],
1013
+ [0, 1, 0],
1014
+ [0, 0, 1],
1015
+ [1, 0, 1],
1016
+ [1, 1, 1],
1017
+ [0, 1, 1]
1018
+ ];
1019
+ for (let iz = 0; iz < nz; iz++) {
1020
+ for (let iy = 0; iy < ny; iy++) {
1021
+ for (let ix = 0; ix < nx; ix++) {
1022
+ const cornerVals = [];
1023
+ const cornerCoords = [];
1024
+ let cubeIndex = 0;
1025
+ for (let c = 0; c < 8; c++) {
1026
+ const cx = ix + cornerOffsets[c][0];
1027
+ const cy = iy + cornerOffsets[c][1];
1028
+ const cz = iz + cornerOffsets[c][2];
1029
+ const val = field[idx3(cx, cy, cz)];
1030
+ cornerVals.push(val);
1031
+ cornerCoords.push([cx, cy, cz]);
1032
+ if (val >= threshold) cubeIndex |= 1 << c;
1033
+ }
1034
+ const edges = MC_EDGE_TABLE[cubeIndex];
1035
+ if (edges === 0 || edges === void 0) continue;
1036
+ const edgeVertices = new Array(12).fill(-1);
1037
+ for (let e = 0; e < 12; e++) {
1038
+ if (edges & 1 << e) {
1039
+ const [c1, c2] = edgeVerts[e];
1040
+ edgeVertices[e] = interpVertex(
1041
+ cornerCoords[c1][0],
1042
+ cornerCoords[c1][1],
1043
+ cornerCoords[c1][2],
1044
+ cornerVals[c1],
1045
+ cornerCoords[c2][0],
1046
+ cornerCoords[c2][1],
1047
+ cornerCoords[c2][2],
1048
+ cornerVals[c2]
1049
+ );
1050
+ }
1051
+ }
1052
+ const triRow = MC_TRI_TABLE[cubeIndex];
1053
+ if (triRow) {
1054
+ for (let t = 0; t < triRow.length; t += 3) {
1055
+ const e0 = triRow[t], e1 = triRow[t + 1], e2 = triRow[t + 2];
1056
+ if (e0 === -1) break;
1057
+ if (edgeVertices[e0] >= 0 && edgeVertices[e1] >= 0 && edgeVertices[e2] >= 0) {
1058
+ indices.push(edgeVertices[e0], edgeVertices[e1], edgeVertices[e2]);
1059
+ }
1060
+ }
1061
+ }
1062
+ }
1063
+ }
1064
+ }
1065
+ if (positions.length === 0) return fallbackBox();
1066
+ const vertexCount = positions.length / 3;
1067
+ const IndexArrayType = vertexCount > 65535 ? Uint32Array : Uint16Array;
1068
+ return {
1069
+ positions: new Float32Array(positions),
1070
+ normals: new Float32Array(normals),
1071
+ uvs: new Float32Array(uvs),
1072
+ indices: new IndexArrayType(indices)
1073
+ };
1074
+ }
1075
+ function generateMembraneGeometry(anchors, subdivisions = 8, bulge = 0.15, lod) {
1076
+ if (lod) {
1077
+ subdivisions = LOD_PRESETS[lod].membrane.subdivisions;
1078
+ }
1079
+ if (anchors.length < 3) return fallbackBox();
1080
+ const positions = [];
1081
+ const normals = [];
1082
+ const uvs = [];
1083
+ const indices = [];
1084
+ const center = [0, 0, 0];
1085
+ for (const a of anchors) {
1086
+ center[0] += a[0];
1087
+ center[1] += a[1];
1088
+ center[2] += a[2];
1089
+ }
1090
+ center[0] /= anchors.length;
1091
+ center[1] /= anchors.length;
1092
+ center[2] /= anchors.length;
1093
+ const memNormal = [0, 0, 0];
1094
+ for (let i = 0; i < anchors.length; i++) {
1095
+ const a = anchors[i];
1096
+ const b = anchors[(i + 1) % anchors.length];
1097
+ const ca = chunkZDSYWBIE_cjs.vec3SubArray(a, center);
1098
+ const cb = chunkZDSYWBIE_cjs.vec3SubArray(b, center);
1099
+ const cross = chunkZDSYWBIE_cjs.vec3CrossArray(ca, cb);
1100
+ memNormal[0] += cross[0];
1101
+ memNormal[1] += cross[1];
1102
+ memNormal[2] += cross[2];
1103
+ }
1104
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(memNormal);
1105
+ const numAnchors = anchors.length;
1106
+ const centerIdx = 0;
1107
+ positions.push(
1108
+ center[0] + memNormal[0] * bulge,
1109
+ center[1] + memNormal[1] * bulge,
1110
+ center[2] + memNormal[2] * bulge
1111
+ );
1112
+ normals.push(memNormal[0], memNormal[1], memNormal[2]);
1113
+ uvs.push(0.5, 0.5);
1114
+ for (let ring = 1; ring <= subdivisions; ring++) {
1115
+ const t = ring / subdivisions;
1116
+ const ringBulge = bulge * (1 - t * t);
1117
+ for (let seg = 0; seg < numAnchors; seg++) {
1118
+ const a0 = anchors[seg];
1119
+ anchors[(seg + 1) % numAnchors];
1120
+ const px = center[0] + (a0[0] - center[0]) * t;
1121
+ const py = center[1] + (a0[1] - center[1]) * t;
1122
+ const pz = center[2] + (a0[2] - center[2]) * t;
1123
+ positions.push(
1124
+ px + memNormal[0] * ringBulge,
1125
+ py + memNormal[1] * ringBulge,
1126
+ pz + memNormal[2] * ringBulge
1127
+ );
1128
+ const dx = px - center[0];
1129
+ const dy = py - center[1];
1130
+ const dz = pz - center[2];
1131
+ const n = [
1132
+ memNormal[0] + dx * bulge * 0.5,
1133
+ memNormal[1] + dy * bulge * 0.5,
1134
+ memNormal[2] + dz * bulge * 0.5
1135
+ ];
1136
+ chunkZDSYWBIE_cjs.vec3NormalizeInPlace(n);
1137
+ normals.push(n[0], n[1], n[2]);
1138
+ const angle = seg / numAnchors * Math.PI * 2;
1139
+ uvs.push(0.5 + t * 0.5 * Math.cos(angle), 0.5 + t * 0.5 * Math.sin(angle));
1140
+ }
1141
+ }
1142
+ for (let i = 0; i < numAnchors; i++) {
1143
+ const next = (i + 1) % numAnchors;
1144
+ indices.push(centerIdx, 1 + i, 1 + next);
1145
+ }
1146
+ for (let ring = 1; ring < subdivisions; ring++) {
1147
+ const ringStart = 1 + (ring - 1) * numAnchors;
1148
+ const nextRingStart = 1 + ring * numAnchors;
1149
+ for (let i = 0; i < numAnchors; i++) {
1150
+ const next = (i + 1) % numAnchors;
1151
+ indices.push(ringStart + i, nextRingStart + i, nextRingStart + next);
1152
+ indices.push(ringStart + i, nextRingStart + next, ringStart + next);
1153
+ }
1154
+ }
1155
+ const triCount = indices.length;
1156
+ for (let i = 0; i < triCount; i += 3) {
1157
+ indices.push(indices[i], indices[i + 2], indices[i + 1]);
1158
+ }
1159
+ const vertexCount = positions.length / 3;
1160
+ const IndexArrayType = vertexCount > 65535 ? Uint32Array : Uint16Array;
1161
+ return {
1162
+ positions: new Float32Array(positions),
1163
+ normals: new Float32Array(normals),
1164
+ uvs: new Float32Array(uvs),
1165
+ indices: new IndexArrayType(indices)
1166
+ };
1167
+ }
1168
+
1169
+ exports.generateHullGeometry = generateHullGeometry;
1170
+ exports.generateMembraneGeometry = generateMembraneGeometry;
1171
+ exports.generateSplineGeometry = generateSplineGeometry;
1172
+ //# sourceMappingURL=chunk-EXUP2BUM.cjs.map
1173
+ //# sourceMappingURL=chunk-EXUP2BUM.cjs.map