@holoscript/core 7.0.0 → 8.0.1

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