@holoscript/core 6.0.4 → 7.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 (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +3 -2
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/index.d.ts +501 -19
  7. package/dist/paper-0c-spike/index.d.ts +29 -0
  8. package/dist/reconstruction/index.d.ts +78 -0
  9. package/dist/tools/index.d.ts +22 -1
  10. package/dist/traitDocs/traitDocs.d.ts +69 -0
  11. package/dist/traits/index.d.ts +61 -0
  12. package/package.json +105 -57
  13. package/dist/GLTFPipeline-DEN36VNK.js +0 -12
  14. package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
  15. package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
  16. package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
  17. package/dist/USDZExporter-NTMBNTDB.js +0 -707
  18. package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
  19. package/dist/chunk-27LWW5FU.cjs +0 -410
  20. package/dist/chunk-2CWOLHTE.js +0 -69
  21. package/dist/chunk-33LSUQDD.cjs +0 -835
  22. package/dist/chunk-3FJCK5XA.js +0 -2232
  23. package/dist/chunk-3FXV5S25.cjs +0 -633
  24. package/dist/chunk-3FYZOR7S.cjs +0 -69
  25. package/dist/chunk-3SAK5KFL.cjs +0 -83
  26. package/dist/chunk-4XSNJCLC.cjs +0 -1859
  27. package/dist/chunk-54FHG2MX.js +0 -655
  28. package/dist/chunk-56IF4NTA.js +0 -56
  29. package/dist/chunk-5BGSECRJ.cjs +0 -2237
  30. package/dist/chunk-5GLCTO44.js +0 -161
  31. package/dist/chunk-5O6TQC6M.cjs +0 -1871
  32. package/dist/chunk-5OEOHAAW.cjs +0 -682
  33. package/dist/chunk-5TOFIR6L.js +0 -407
  34. package/dist/chunk-5WUNN6ZN.cjs +0 -428
  35. package/dist/chunk-6TZPZCOJ.cjs +0 -1404
  36. package/dist/chunk-6UEHYZ7V.cjs +0 -773
  37. package/dist/chunk-6XSERL6L.js +0 -5678
  38. package/dist/chunk-72EQECGT.cjs +0 -908
  39. package/dist/chunk-7AGYRWKW.cjs +0 -507
  40. package/dist/chunk-7LCYLPW2.cjs +0 -663
  41. package/dist/chunk-A7PIMZGU.js +0 -263
  42. package/dist/chunk-ATSKSYVE.cjs +0 -51683
  43. package/dist/chunk-B5TCIAPQ.cjs +0 -117
  44. package/dist/chunk-BF2235SI.cjs +0 -5714
  45. package/dist/chunk-BKIGPPVM.js +0 -629
  46. package/dist/chunk-BND3ST2K.cjs +0 -662
  47. package/dist/chunk-BU7VWW2K.js +0 -2522
  48. package/dist/chunk-BWFJEM5A.js +0 -5419
  49. package/dist/chunk-CAUCGUEA.cjs +0 -130
  50. package/dist/chunk-CBJSLA2E.cjs +0 -5423
  51. package/dist/chunk-CDPGV4DN.js +0 -114
  52. package/dist/chunk-CLYEIWA5.cjs +0 -408
  53. package/dist/chunk-CS2EMTGF.js +0 -1966
  54. package/dist/chunk-DMG7C4H2.js +0 -975
  55. package/dist/chunk-DXJQDCFL.js +0 -468
  56. package/dist/chunk-E3FWRT3Z.js +0 -608
  57. package/dist/chunk-E3UALNFA.js +0 -421
  58. package/dist/chunk-EONILVMF.js +0 -762
  59. package/dist/chunk-EQV4R3EV.cjs +0 -769
  60. package/dist/chunk-F3HH56EB.cjs +0 -5538
  61. package/dist/chunk-F4IULT7N.js +0 -1488
  62. package/dist/chunk-FF3Q7ADR.js +0 -380
  63. package/dist/chunk-FFKU7BTK.cjs +0 -1046
  64. package/dist/chunk-FHQVYCH2.js +0 -70
  65. package/dist/chunk-FSF7EQVA.cjs +0 -1974
  66. package/dist/chunk-G4VZTCIB.js +0 -659
  67. package/dist/chunk-G7CT3EMP.cjs +0 -1002
  68. package/dist/chunk-GGHSW2NN.js +0 -51334
  69. package/dist/chunk-GVUR45UF.cjs +0 -777
  70. package/dist/chunk-H5Z7NASB.js +0 -9662
  71. package/dist/chunk-HE7ULERA.cjs +0 -697
  72. package/dist/chunk-HJJLD366.js +0 -1169
  73. package/dist/chunk-HPS76H7Q.js +0 -309
  74. package/dist/chunk-HQUEA5R6.cjs +0 -424
  75. package/dist/chunk-HYNTS5CP.js +0 -422
  76. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  77. package/dist/chunk-IBDG74G2.cjs +0 -1219
  78. package/dist/chunk-IFNQFCTM.js +0 -3098
  79. package/dist/chunk-IHOUYQIA.js +0 -406
  80. package/dist/chunk-ILRBGFVD.cjs +0 -72
  81. package/dist/chunk-IWI6J7FX.js +0 -421
  82. package/dist/chunk-K3JDKWGI.cjs +0 -270
  83. package/dist/chunk-K6EKD26I.js +0 -630
  84. package/dist/chunk-KCQ5NDYC.cjs +0 -3172
  85. package/dist/chunk-KED34ILP.js +0 -832
  86. package/dist/chunk-KSGXLT74.cjs +0 -457
  87. package/dist/chunk-L4G4RLXX.js +0 -767
  88. package/dist/chunk-LDP5OK6G.js +0 -1216
  89. package/dist/chunk-LGGRPKTV.cjs +0 -735
  90. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  91. package/dist/chunk-LSW7P7ML.js +0 -3675
  92. package/dist/chunk-LXJ4667L.cjs +0 -3874
  93. package/dist/chunk-LZ266PCM.cjs +0 -4499
  94. package/dist/chunk-MD6KDHVE.cjs +0 -237
  95. package/dist/chunk-MEASWI2Y.js +0 -126
  96. package/dist/chunk-MPXBVFHQ.js +0 -768
  97. package/dist/chunk-N5FTS757.cjs +0 -415
  98. package/dist/chunk-NCUKG4SK.cjs +0 -3075
  99. package/dist/chunk-NDQNIJEH.js +0 -1715
  100. package/dist/chunk-NOZZ46QU.js +0 -168
  101. package/dist/chunk-OFKWH2IP.js +0 -449
  102. package/dist/chunk-PHENW4MQ.js +0 -65
  103. package/dist/chunk-PMGODDJA.cjs +0 -319
  104. package/dist/chunk-Q4QX3AET.cjs +0 -1505
  105. package/dist/chunk-Q56TT7IL.js +0 -483
  106. package/dist/chunk-Q5JT3YML.cjs +0 -129
  107. package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
  108. package/dist/chunk-QGKNANZ3.js +0 -3071
  109. package/dist/chunk-QLEAOI3Q.cjs +0 -424
  110. package/dist/chunk-R7MA7QWV.js +0 -732
  111. package/dist/chunk-RVYPEYPX.js +0 -678
  112. package/dist/chunk-S2N5TNMA.js +0 -1855
  113. package/dist/chunk-S565K7NK.js +0 -752
  114. package/dist/chunk-SDAMZIRE.js +0 -765
  115. package/dist/chunk-T36DDXSF.js +0 -4250
  116. package/dist/chunk-T4NKMBDL.js +0 -5474
  117. package/dist/chunk-T7LEXZUZ.cjs +0 -2526
  118. package/dist/chunk-TEWCN33Y.js +0 -694
  119. package/dist/chunk-TQSZUOW5.cjs +0 -793
  120. package/dist/chunk-TSH3MSQU.cjs +0 -129
  121. package/dist/chunk-UERJ3YJV.js +0 -504
  122. package/dist/chunk-UPJBDCVF.js +0 -1395
  123. package/dist/chunk-V3NN3HPP.js +0 -4462
  124. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  125. package/dist/chunk-WB4Z63GG.js +0 -229
  126. package/dist/chunk-WDW67DZB.cjs +0 -9728
  127. package/dist/chunk-WGMEAYBG.js +0 -126
  128. package/dist/chunk-X4ZF6CNE.cjs +0 -473
  129. package/dist/chunk-X6SEAXAX.cjs +0 -3681
  130. package/dist/chunk-XCWFGZAA.js +0 -1043
  131. package/dist/chunk-XD6IYDUX.js +0 -903
  132. package/dist/chunk-XG23EUQX.cjs +0 -1717
  133. package/dist/chunk-XRKWN5PL.cjs +0 -173
  134. package/dist/chunk-XUILI4KB.cjs +0 -430
  135. package/dist/chunk-XUTX5CBW.js +0 -126
  136. package/dist/chunk-XWPNTWDN.cjs +0 -755
  137. package/dist/chunk-XXINBTZK.cjs +0 -633
  138. package/dist/chunk-YCXFCXDS.js +0 -1868
  139. package/dist/chunk-YQK5JNFK.js +0 -3725
  140. package/dist/chunk-YYXH45E2.js +0 -426
  141. package/dist/chunk-Z34RLXRA.cjs +0 -612
  142. package/dist/chunk-ZP4D3CSX.cjs +0 -72
  143. package/dist/cli/holoscript-runner.cjs +0 -2259
  144. package/dist/cli/holoscript-runner.js +0 -2234
  145. package/dist/codebase/index.cjs +0 -336
  146. package/dist/codebase/index.js +0 -331
  147. package/dist/compiler/agent-inference.cjs +0 -28
  148. package/dist/compiler/agent-inference.js +0 -5
  149. package/dist/compiler/android-xr.cjs +0 -19
  150. package/dist/compiler/android-xr.js +0 -9
  151. package/dist/compiler/android.cjs +0 -20
  152. package/dist/compiler/android.js +0 -10
  153. package/dist/compiler/ar.cjs +0 -20
  154. package/dist/compiler/ar.js +0 -8
  155. package/dist/compiler/babylon.cjs +0 -17
  156. package/dist/compiler/babylon.js +0 -11
  157. package/dist/compiler/coco.cjs +0 -27
  158. package/dist/compiler/coco.js +0 -4
  159. package/dist/compiler/domain-block-utils.cjs +0 -602
  160. package/dist/compiler/domain-block-utils.js +0 -8
  161. package/dist/compiler/dtdl.cjs +0 -24
  162. package/dist/compiler/dtdl.js +0 -8
  163. package/dist/compiler/gltf-pipeline.cjs +0 -39
  164. package/dist/compiler/gltf-pipeline.js +0 -4
  165. package/dist/compiler/godot.cjs +0 -15
  166. package/dist/compiler/godot.js +0 -9
  167. package/dist/compiler/incremental.cjs +0 -29
  168. package/dist/compiler/incremental.js +0 -4
  169. package/dist/compiler/index.cjs +0 -2578
  170. package/dist/compiler/index.js +0 -2383
  171. package/dist/compiler/ios.cjs +0 -20
  172. package/dist/compiler/ios.js +0 -10
  173. package/dist/compiler/multi-layer.cjs +0 -20
  174. package/dist/compiler/multi-layer.js +0 -11
  175. package/dist/compiler/nodetoy.cjs +0 -23
  176. package/dist/compiler/nodetoy.js +0 -4
  177. package/dist/compiler/openxr.cjs +0 -15
  178. package/dist/compiler/openxr.js +0 -9
  179. package/dist/compiler/playcanvas.cjs +0 -16
  180. package/dist/compiler/playcanvas.js +0 -10
  181. package/dist/compiler/r3f.cjs +0 -34
  182. package/dist/compiler/r3f.js +0 -12
  183. package/dist/compiler/remotion.cjs +0 -23
  184. package/dist/compiler/remotion.js +0 -4
  185. package/dist/compiler/reproducibility.cjs +0 -39
  186. package/dist/compiler/reproducibility.js +0 -4
  187. package/dist/compiler/sdf.cjs +0 -21
  188. package/dist/compiler/sdf.js +0 -9
  189. package/dist/compiler/semantic-scene.cjs +0 -31
  190. package/dist/compiler/semantic-scene.js +0 -4
  191. package/dist/compiler/state.cjs +0 -17
  192. package/dist/compiler/state.js +0 -7
  193. package/dist/compiler/trait-composition.cjs +0 -26
  194. package/dist/compiler/trait-composition.js +0 -5
  195. package/dist/compiler/unity.cjs +0 -15
  196. package/dist/compiler/unity.js +0 -9
  197. package/dist/compiler/unreal.cjs +0 -19
  198. package/dist/compiler/unreal.js +0 -9
  199. package/dist/compiler/urdf.cjs +0 -45
  200. package/dist/compiler/urdf.js +0 -9
  201. package/dist/compiler/usd-physics.cjs +0 -23
  202. package/dist/compiler/usd-physics.js +0 -6
  203. package/dist/compiler/visionos.cjs +0 -15
  204. package/dist/compiler/visionos.js +0 -9
  205. package/dist/compiler/vrchat.cjs +0 -19
  206. package/dist/compiler/vrchat.js +0 -9
  207. package/dist/compiler/vrr.cjs +0 -21
  208. package/dist/compiler/vrr.js +0 -9
  209. package/dist/compiler/wasm.cjs +0 -33
  210. package/dist/compiler/wasm.js +0 -9
  211. package/dist/compiler/webgpu.cjs +0 -15
  212. package/dist/compiler/webgpu.js +0 -9
  213. package/dist/debugger.cjs +0 -21
  214. package/dist/debugger.js +0 -8
  215. package/dist/entries/interop.cjs +0 -62
  216. package/dist/entries/interop.js +0 -5
  217. package/dist/entries/scripting.cjs +0 -68
  218. package/dist/entries/scripting.js +0 -11
  219. package/dist/index.cjs +0 -40921
  220. package/dist/index.js +0 -37763
  221. package/dist/math/vec3.cjs +0 -57
  222. package/dist/math/vec3.js +0 -4
  223. package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
  224. package/dist/ml-dsa-WYLJHJO6.js +0 -1178
  225. package/dist/parser.cjs +0 -27
  226. package/dist/parser.js +0 -10
  227. package/dist/playwright-5OSAPTNH.js +0 -98660
  228. package/dist/playwright-RL6GY4F7.cjs +0 -98673
  229. package/dist/runtime.cjs +0 -16
  230. package/dist/runtime.js +0 -7
  231. package/dist/storage/index.cjs +0 -37
  232. package/dist/storage/index.js +0 -4
  233. package/dist/traits/index.cjs +0 -14649
  234. package/dist/traits/index.js +0 -12243
  235. package/dist/type-checker.cjs +0 -18
  236. package/dist/type-checker.js +0 -5
@@ -1,1173 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk3FYZOR7S_cjs = require('./chunk-3FYZOR7S.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 = chunk3FYZOR7S_cjs.vec3SubArray(pathPoints[1], pathPoints[0]);
317
- } else if (ring === totalRings - 1) {
318
- tangent = chunk3FYZOR7S_cjs.vec3SubArray(pathPoints[totalRings - 1], pathPoints[totalRings - 2]);
319
- } else {
320
- tangent = chunk3FYZOR7S_cjs.vec3SubArray(pathPoints[ring + 1], pathPoints[ring - 1]);
321
- }
322
- chunk3FYZOR7S_cjs.vec3NormalizeInPlace(tangent);
323
- let normal;
324
- let binormal;
325
- if (ring === 0) {
326
- if (Math.abs(tangent[0]) < 0.9) {
327
- normal = chunk3FYZOR7S_cjs.vec3CrossArray(tangent, [1, 0, 0]);
328
- } else {
329
- normal = chunk3FYZOR7S_cjs.vec3CrossArray(tangent, [0, 1, 0]);
330
- }
331
- chunk3FYZOR7S_cjs.vec3NormalizeInPlace(normal);
332
- binormal = chunk3FYZOR7S_cjs.vec3CrossArray(tangent, normal);
333
- chunk3FYZOR7S_cjs.vec3NormalizeInPlace(binormal);
334
- } else {
335
- normal = chunk3FYZOR7S_cjs.vec3SubArray(
336
- prevNormal,
337
- chunk3FYZOR7S_cjs.vec3ScaleArray(
338
- tangent,
339
- prevNormal[0] * tangent[0] + prevNormal[1] * tangent[1] + prevNormal[2] * tangent[2]
340
- )
341
- );
342
- const nLen = chunk3FYZOR7S_cjs.vec3NormalizeInPlace(normal);
343
- if (nLen < 1e-6) normal = [...prevNormal];
344
- binormal = chunk3FYZOR7S_cjs.vec3CrossArray(tangent, normal);
345
- chunk3FYZOR7S_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 = chunk3FYZOR7S_cjs.vec3SubArray(pathPoints[1], pathPoints[0]);
373
- chunk3FYZOR7S_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 = chunk3FYZOR7S_cjs.vec3SubArray(pathPoints[totalRings - 1], pathPoints[totalRings - 2]);
383
- chunk3FYZOR7S_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
- chunk3FYZOR7S_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 = chunk3FYZOR7S_cjs.vec3SubArray(a, center);
1098
- const cb = chunk3FYZOR7S_cjs.vec3SubArray(b, center);
1099
- const cross = chunk3FYZOR7S_cjs.vec3CrossArray(ca, cb);
1100
- memNormal[0] += cross[0];
1101
- memNormal[1] += cross[1];
1102
- memNormal[2] += cross[2];
1103
- }
1104
- chunk3FYZOR7S_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
- chunk3FYZOR7S_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-LK5IAVH6.cjs.map
1173
- //# sourceMappingURL=chunk-LK5IAVH6.cjs.map