@margoengine/cad 0.1.0 → 1.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 (797) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +14 -4
  3. package/README.md +88 -22
  4. package/dist/cad-NjBidwwm.js +589 -0
  5. package/dist/cad-async-kUFSo7gb.js +541 -0
  6. package/dist/cad-async.d.ts +77 -0
  7. package/dist/cad-async.js +1 -0
  8. package/dist/cad-parser.d.ts +14 -0
  9. package/dist/cad-runtime.worker.d.ts +1 -0
  10. package/dist/cad.d.ts +109 -0
  11. package/dist/closed-Db7gO_Gy.js +19 -0
  12. package/dist/closed.d.ts +6 -0
  13. package/dist/closed.js +1 -0
  14. package/dist/index.d.ts +4 -2
  15. package/dist/index.js +3 -3
  16. package/dist/internal/buffers.d.ts +16 -0
  17. package/dist/internal/format.d.ts +2 -0
  18. package/dist/pack.d.ts +72 -0
  19. package/dist/stage.d.ts +33 -1
  20. package/dist/stage.js +85 -2
  21. package/dist/workers/brep-read.d.ts +40 -0
  22. package/dist/workers/cad-runtime.js +56 -0
  23. package/package.json +74 -1616
  24. package/dist/brep.d.ts +0 -1
  25. package/dist/brep.js +0 -2
  26. package/dist/bvh/alpha-triangles.d.ts +0 -1
  27. package/dist/bvh/alpha-triangles.js +0 -2
  28. package/dist/bvh/alpha.d.ts +0 -1
  29. package/dist/bvh/alpha.js +0 -2
  30. package/dist/bvh/bake.d.ts +0 -1
  31. package/dist/bvh/bake.js +0 -2
  32. package/dist/bvh/gpu-build.d.ts +0 -1
  33. package/dist/bvh/gpu-build.js +0 -2
  34. package/dist/bvh/gpu-scene.d.ts +0 -1
  35. package/dist/bvh/gpu-scene.js +0 -2
  36. package/dist/bvh/gpu.d.ts +0 -1
  37. package/dist/bvh/gpu.js +0 -2
  38. package/dist/bvh/inside.d.ts +0 -1
  39. package/dist/bvh/inside.js +0 -2
  40. package/dist/bvh/lines.d.ts +0 -1
  41. package/dist/bvh/lines.js +0 -2
  42. package/dist/bvh/parallel.d.ts +0 -1
  43. package/dist/bvh/parallel.js +0 -2
  44. package/dist/bvh/points.d.ts +0 -1
  45. package/dist/bvh/points.js +0 -2
  46. package/dist/bvh/scene.d.ts +0 -1
  47. package/dist/bvh/scene.js +0 -2
  48. package/dist/bvh/sdf.d.ts +0 -1
  49. package/dist/bvh/sdf.js +0 -2
  50. package/dist/bvh/tree.d.ts +0 -1
  51. package/dist/bvh/tree.js +0 -2
  52. package/dist/bvh.d.ts +0 -1
  53. package/dist/bvh.js +0 -2
  54. package/dist/cache/bundles.d.ts +0 -1
  55. package/dist/cache/bundles.js +0 -2
  56. package/dist/cache/decoded.d.ts +0 -1
  57. package/dist/cache/decoded.js +0 -2
  58. package/dist/cache/eviction.d.ts +0 -1
  59. package/dist/cache/eviction.js +0 -2
  60. package/dist/cache/hashed.d.ts +0 -1
  61. package/dist/cache/hashed.js +0 -2
  62. package/dist/cache/manager.d.ts +0 -1
  63. package/dist/cache/manager.js +0 -2
  64. package/dist/cache/prefetch.d.ts +0 -1
  65. package/dist/cache/prefetch.js +0 -2
  66. package/dist/cache/ranges.d.ts +0 -1
  67. package/dist/cache/ranges.js +0 -2
  68. package/dist/cache/stream.d.ts +0 -1
  69. package/dist/cache/stream.js +0 -2
  70. package/dist/cache/vary.d.ts +0 -1
  71. package/dist/cache/vary.js +0 -2
  72. package/dist/cache.d.ts +0 -1
  73. package/dist/cache.js +0 -2
  74. package/dist/cad-import/cad-async.d.ts +0 -1
  75. package/dist/cad-import/cad-async.js +0 -2
  76. package/dist/cad-import/closed.d.ts +0 -1
  77. package/dist/cad-import/closed.js +0 -2
  78. package/dist/cad-import/stage.d.ts +0 -1
  79. package/dist/cad-import/stage.js +0 -2
  80. package/dist/cad-import.d.ts +0 -1
  81. package/dist/cad-import.js +0 -2
  82. package/dist/cameras/hologram.d.ts +0 -1
  83. package/dist/cameras/hologram.js +0 -2
  84. package/dist/cameras/layers.d.ts +0 -1
  85. package/dist/cameras/layers.js +0 -2
  86. package/dist/cameras/offaxis.d.ts +0 -1
  87. package/dist/cameras/offaxis.js +0 -2
  88. package/dist/cameras/origin.d.ts +0 -1
  89. package/dist/cameras/origin.js +0 -2
  90. package/dist/cameras/panini.d.ts +0 -1
  91. package/dist/cameras/panini.js +0 -2
  92. package/dist/cameras/panorama.d.ts +0 -1
  93. package/dist/cameras/panorama.js +0 -2
  94. package/dist/cameras/physical.d.ts +0 -1
  95. package/dist/cameras/physical.js +0 -2
  96. package/dist/cameras/stereo.d.ts +0 -1
  97. package/dist/cameras/stereo.js +0 -2
  98. package/dist/cameras/wide-cube.d.ts +0 -1
  99. package/dist/cameras/wide-cube.js +0 -2
  100. package/dist/cameras.d.ts +0 -1
  101. package/dist/cameras.js +0 -2
  102. package/dist/controls/arcball.d.ts +0 -1
  103. package/dist/controls/arcball.js +0 -2
  104. package/dist/controls/behaviors.d.ts +0 -1
  105. package/dist/controls/behaviors.js +0 -2
  106. package/dist/controls/box-gizmo.d.ts +0 -1
  107. package/dist/controls/box-gizmo.js +0 -2
  108. package/dist/controls/collide.d.ts +0 -1
  109. package/dist/controls/collide.js +0 -2
  110. package/dist/controls/device-orientation.d.ts +0 -1
  111. package/dist/controls/device-orientation.js +0 -2
  112. package/dist/controls/drag.d.ts +0 -1
  113. package/dist/controls/drag.js +0 -2
  114. package/dist/controls/first-person.d.ts +0 -1
  115. package/dist/controls/first-person.js +0 -2
  116. package/dist/controls/fly.d.ts +0 -1
  117. package/dist/controls/fly.js +0 -2
  118. package/dist/controls/geoid.d.ts +0 -1
  119. package/dist/controls/geoid.js +0 -2
  120. package/dist/controls/geospatial.d.ts +0 -1
  121. package/dist/controls/geospatial.js +0 -2
  122. package/dist/controls/globe.d.ts +0 -1
  123. package/dist/controls/globe.js +0 -2
  124. package/dist/controls/orbit.d.ts +0 -1
  125. package/dist/controls/orbit.js +0 -2
  126. package/dist/controls/presentation.d.ts +0 -1
  127. package/dist/controls/presentation.js +0 -2
  128. package/dist/controls/profiles.d.ts +0 -1
  129. package/dist/controls/profiles.js +0 -2
  130. package/dist/controls/third-person.d.ts +0 -1
  131. package/dist/controls/third-person.js +0 -2
  132. package/dist/controls/trackball.d.ts +0 -1
  133. package/dist/controls/trackball.js +0 -2
  134. package/dist/controls/transform.d.ts +0 -1
  135. package/dist/controls/transform.js +0 -2
  136. package/dist/controls/transitions.d.ts +0 -1
  137. package/dist/controls/transitions.js +0 -2
  138. package/dist/controls/walk.d.ts +0 -1
  139. package/dist/controls/walk.js +0 -2
  140. package/dist/controls.d.ts +0 -1
  141. package/dist/controls.js +0 -2
  142. package/dist/core/extension.d.ts +0 -1
  143. package/dist/core/extension.js +0 -2
  144. package/dist/core.d.ts +0 -1
  145. package/dist/core.js +0 -2
  146. package/dist/culling/bounds.d.ts +0 -1
  147. package/dist/culling/bounds.js +0 -2
  148. package/dist/culling/depth.d.ts +0 -1
  149. package/dist/culling/depth.js +0 -2
  150. package/dist/culling/dynamic.d.ts +0 -1
  151. package/dist/culling/dynamic.js +0 -2
  152. package/dist/culling/lod.d.ts +0 -1
  153. package/dist/culling/lod.js +0 -2
  154. package/dist/culling/meshlets.d.ts +0 -1
  155. package/dist/culling/meshlets.js +0 -2
  156. package/dist/culling/models.d.ts +0 -1
  157. package/dist/culling/models.js +0 -2
  158. package/dist/culling/occlusion.d.ts +0 -1
  159. package/dist/culling/occlusion.js +0 -2
  160. package/dist/culling/parts.d.ts +0 -1
  161. package/dist/culling/parts.js +0 -2
  162. package/dist/culling/shadows.d.ts +0 -1
  163. package/dist/culling/shadows.js +0 -2
  164. package/dist/culling/sort.d.ts +0 -1
  165. package/dist/culling/sort.js +0 -2
  166. package/dist/culling/webgl2.d.ts +0 -1
  167. package/dist/culling/webgl2.js +0 -2
  168. package/dist/culling.d.ts +0 -1
  169. package/dist/culling.js +0 -2
  170. package/dist/decoders/avif.d.ts +0 -1
  171. package/dist/decoders/avif.js +0 -2
  172. package/dist/decoders/bc.d.ts +0 -1
  173. package/dist/decoders/bc.js +0 -2
  174. package/dist/decoders/bmp.d.ts +0 -1
  175. package/dist/decoders/bmp.js +0 -2
  176. package/dist/decoders/brotli.d.ts +0 -1
  177. package/dist/decoders/brotli.js +0 -2
  178. package/dist/decoders/bzip2.d.ts +0 -1
  179. package/dist/decoders/bzip2.js +0 -2
  180. package/dist/decoders/dds.d.ts +0 -1
  181. package/dist/decoders/dds.js +0 -2
  182. package/dist/decoders/draco-native.d.ts +0 -1
  183. package/dist/decoders/draco-native.js +0 -2
  184. package/dist/decoders/draco-points.d.ts +0 -1
  185. package/dist/decoders/draco-points.js +0 -2
  186. package/dist/decoders/geotiff.d.ts +0 -1
  187. package/dist/decoders/geotiff.js +0 -2
  188. package/dist/decoders/image.d.ts +0 -1
  189. package/dist/decoders/image.js +0 -2
  190. package/dist/decoders/jpeg.d.ts +0 -1
  191. package/dist/decoders/jpeg.js +0 -2
  192. package/dist/decoders/jxl.d.ts +0 -1
  193. package/dist/decoders/jxl.js +0 -2
  194. package/dist/decoders/ktx.d.ts +0 -1
  195. package/dist/decoders/ktx.js +0 -2
  196. package/dist/decoders/ktx2-gpu.d.ts +0 -1
  197. package/dist/decoders/ktx2-gpu.js +0 -2
  198. package/dist/decoders/ktx2-hdr.d.ts +0 -1
  199. package/dist/decoders/ktx2-hdr.js +0 -2
  200. package/dist/decoders/ktx2-hdr6.d.ts +0 -1
  201. package/dist/decoders/ktx2-hdr6.js +0 -2
  202. package/dist/decoders/ktx2-layers.d.ts +0 -1
  203. package/dist/decoders/ktx2-layers.js +0 -2
  204. package/dist/decoders/ktx2-stream.d.ts +0 -1
  205. package/dist/decoders/ktx2-stream.js +0 -2
  206. package/dist/decoders/lz4.d.ts +0 -1
  207. package/dist/decoders/lz4.js +0 -2
  208. package/dist/decoders/lzfse.d.ts +0 -1
  209. package/dist/decoders/lzfse.js +0 -2
  210. package/dist/decoders/meshopt-simd.d.ts +0 -1
  211. package/dist/decoders/meshopt-simd.js +0 -2
  212. package/dist/decoders/meshopt.d.ts +0 -1
  213. package/dist/decoders/meshopt.js +0 -2
  214. package/dist/decoders/pcx.d.ts +0 -1
  215. package/dist/decoders/pcx.js +0 -2
  216. package/dist/decoders/png.d.ts +0 -1
  217. package/dist/decoders/png.js +0 -2
  218. package/dist/decoders/pvr.d.ts +0 -1
  219. package/dist/decoders/pvr.js +0 -2
  220. package/dist/decoders/snappy.d.ts +0 -1
  221. package/dist/decoders/snappy.js +0 -2
  222. package/dist/decoders/texture-rgba.d.ts +0 -1
  223. package/dist/decoders/texture-rgba.js +0 -2
  224. package/dist/decoders/texture.d.ts +0 -1
  225. package/dist/decoders/texture.js +0 -2
  226. package/dist/decoders/tga.d.ts +0 -1
  227. package/dist/decoders/tga.js +0 -2
  228. package/dist/decoders/tiff-codecs.d.ts +0 -1
  229. package/dist/decoders/tiff-codecs.js +0 -2
  230. package/dist/decoders/tiff.d.ts +0 -1
  231. package/dist/decoders/tiff.js +0 -2
  232. package/dist/decoders/webp-lossless.d.ts +0 -1
  233. package/dist/decoders/webp-lossless.js +0 -2
  234. package/dist/decoders/webp.d.ts +0 -1
  235. package/dist/decoders/webp.js +0 -2
  236. package/dist/decoders/xz.d.ts +0 -1
  237. package/dist/decoders/xz.js +0 -2
  238. package/dist/decoders/zstd.d.ts +0 -1
  239. package/dist/decoders/zstd.js +0 -2
  240. package/dist/decoders.d.ts +0 -1
  241. package/dist/decoders.js +0 -2
  242. package/dist/environment/blend.d.ts +0 -1
  243. package/dist/environment/blend.js +0 -2
  244. package/dist/environment/cube-camera.d.ts +0 -1
  245. package/dist/environment/cube-camera.js +0 -2
  246. package/dist/environment/density-volume.d.ts +0 -1
  247. package/dist/environment/density-volume.js +0 -2
  248. package/dist/environment/encoded-hdr.d.ts +0 -1
  249. package/dist/environment/encoded-hdr.js +0 -2
  250. package/dist/environment/exr-codecs.d.ts +0 -1
  251. package/dist/environment/exr-codecs.js +0 -2
  252. package/dist/environment/exr-tiled.d.ts +0 -1
  253. package/dist/environment/exr-tiled.js +0 -2
  254. package/dist/environment/exr-write.d.ts +0 -1
  255. package/dist/environment/exr-write.js +0 -2
  256. package/dist/environment/fog-volumes.d.ts +0 -1
  257. package/dist/environment/fog-volumes.js +0 -2
  258. package/dist/environment/gi.d.ts +0 -1
  259. package/dist/environment/gi.js +0 -2
  260. package/dist/environment/ground.d.ts +0 -1
  261. package/dist/environment/ground.js +0 -2
  262. package/dist/environment/lightformer.d.ts +0 -1
  263. package/dist/environment/lightformer.js +0 -2
  264. package/dist/environment/load.d.ts +0 -1
  265. package/dist/environment/load.js +0 -2
  266. package/dist/environment/loaders.d.ts +0 -1
  267. package/dist/environment/loaders.js +0 -2
  268. package/dist/environment/main.d.ts +0 -1
  269. package/dist/environment/main.js +0 -2
  270. package/dist/environment/prefiltered.d.ts +0 -1
  271. package/dist/environment/prefiltered.js +0 -2
  272. package/dist/environment/probes.d.ts +0 -1
  273. package/dist/environment/probes.js +0 -2
  274. package/dist/environment/reflector-pbr.d.ts +0 -1
  275. package/dist/environment/reflector-pbr.js +0 -2
  276. package/dist/environment/reflector.d.ts +0 -1
  277. package/dist/environment/reflector.js +0 -2
  278. package/dist/environment/refractor.d.ts +0 -1
  279. package/dist/environment/refractor.js +0 -2
  280. package/dist/environment/settings.d.ts +0 -1
  281. package/dist/environment/settings.js +0 -2
  282. package/dist/environment/studio.d.ts +0 -1
  283. package/dist/environment/studio.js +0 -2
  284. package/dist/environment/volumetric.d.ts +0 -1
  285. package/dist/environment/volumetric.js +0 -2
  286. package/dist/environment.d.ts +0 -1
  287. package/dist/environment.js +0 -2
  288. package/dist/geometry/delaunay.d.ts +0 -1
  289. package/dist/geometry/delaunay.js +0 -2
  290. package/dist/geometry/extras.d.ts +0 -1
  291. package/dist/geometry/extras.js +0 -2
  292. package/dist/geometry/extrude.d.ts +0 -1
  293. package/dist/geometry/extrude.js +0 -2
  294. package/dist/geometry/flow.d.ts +0 -1
  295. package/dist/geometry/flow.js +0 -2
  296. package/dist/geometry/gpu.d.ts +0 -1
  297. package/dist/geometry/gpu.js +0 -2
  298. package/dist/geometry/hull.d.ts +0 -1
  299. package/dist/geometry/hull.js +0 -2
  300. package/dist/geometry/node-graph.d.ts +0 -1
  301. package/dist/geometry/node-graph.js +0 -2
  302. package/dist/geometry/nurbs-edit.d.ts +0 -1
  303. package/dist/geometry/nurbs-edit.js +0 -2
  304. package/dist/geometry/nurbs.d.ts +0 -1
  305. package/dist/geometry/nurbs.js +0 -2
  306. package/dist/geometry/optimize.d.ts +0 -1
  307. package/dist/geometry/optimize.js +0 -2
  308. package/dist/geometry/polygon.d.ts +0 -1
  309. package/dist/geometry/polygon.js +0 -2
  310. package/dist/geometry/primitives.d.ts +0 -1
  311. package/dist/geometry/primitives.js +0 -2
  312. package/dist/geometry/sample.d.ts +0 -1
  313. package/dist/geometry/sample.js +0 -2
  314. package/dist/geometry/shapes.d.ts +0 -1
  315. package/dist/geometry/shapes.js +0 -2
  316. package/dist/geometry/sweep.d.ts +0 -1
  317. package/dist/geometry/sweep.js +0 -2
  318. package/dist/geometry/teapot.d.ts +0 -1
  319. package/dist/geometry/teapot.js +0 -2
  320. package/dist/geometry/tessellate.d.ts +0 -1
  321. package/dist/geometry/tessellate.js +0 -2
  322. package/dist/geometry/triangulate.d.ts +0 -1
  323. package/dist/geometry/triangulate.js +0 -2
  324. package/dist/geometry/utils.d.ts +0 -1
  325. package/dist/geometry/utils.js +0 -2
  326. package/dist/geometry.d.ts +0 -1
  327. package/dist/geometry.js +0 -2
  328. package/dist/gltf/asset.d.ts +0 -1
  329. package/dist/gltf/asset.js +0 -2
  330. package/dist/gltf/audio.d.ts +0 -1
  331. package/dist/gltf/audio.js +0 -2
  332. package/dist/gltf/auto.d.ts +0 -1
  333. package/dist/gltf/auto.js +0 -2
  334. package/dist/gltf/dds.d.ts +0 -1
  335. package/dist/gltf/dds.js +0 -2
  336. package/dist/gltf/extended-materials.d.ts +0 -1
  337. package/dist/gltf/extended-materials.js +0 -2
  338. package/dist/gltf/instancing.d.ts +0 -1
  339. package/dist/gltf/instancing.js +0 -2
  340. package/dist/gltf/interactivity.d.ts +0 -1
  341. package/dist/gltf/interactivity.js +0 -2
  342. package/dist/gltf/lights.d.ts +0 -1
  343. package/dist/gltf/lights.js +0 -2
  344. package/dist/gltf/material-draw.d.ts +0 -1
  345. package/dist/gltf/material-draw.js +0 -2
  346. package/dist/gltf/meshopt.d.ts +0 -1
  347. package/dist/gltf/meshopt.js +0 -2
  348. package/dist/gltf/metadata.d.ts +0 -1
  349. package/dist/gltf/metadata.js +0 -2
  350. package/dist/gltf/pbr-instancing.d.ts +0 -1
  351. package/dist/gltf/pbr-instancing.js +0 -2
  352. package/dist/gltf/pbr-model.d.ts +0 -1
  353. package/dist/gltf/pbr-model.js +0 -2
  354. package/dist/gltf/pbr.d.ts +0 -1
  355. package/dist/gltf/pbr.js +0 -2
  356. package/dist/gltf/physics.d.ts +0 -1
  357. package/dist/gltf/physics.js +0 -2
  358. package/dist/gltf/prepare.d.ts +0 -1
  359. package/dist/gltf/prepare.js +0 -2
  360. package/dist/gltf/progressive.d.ts +0 -1
  361. package/dist/gltf/progressive.js +0 -2
  362. package/dist/gltf/quantized.d.ts +0 -1
  363. package/dist/gltf/quantized.js +0 -2
  364. package/dist/gltf/report.d.ts +0 -1
  365. package/dist/gltf/report.js +0 -2
  366. package/dist/gltf/scene-data.d.ts +0 -1
  367. package/dist/gltf/scene-data.js +0 -2
  368. package/dist/gltf/scene.d.ts +0 -1
  369. package/dist/gltf/scene.js +0 -2
  370. package/dist/gltf/soft-mesh.d.ts +0 -1
  371. package/dist/gltf/soft-mesh.js +0 -2
  372. package/dist/gltf/spec-gloss.d.ts +0 -1
  373. package/dist/gltf/spec-gloss.js +0 -2
  374. package/dist/gltf/splats.d.ts +0 -1
  375. package/dist/gltf/splats.js +0 -2
  376. package/dist/gltf/texture-coordinates.d.ts +0 -1
  377. package/dist/gltf/texture-coordinates.js +0 -2
  378. package/dist/gltf/textured.d.ts +0 -1
  379. package/dist/gltf/textured.js +0 -2
  380. package/dist/gltf/worker.d.ts +0 -1
  381. package/dist/gltf/worker.js +0 -2
  382. package/dist/gltf.d.ts +0 -1
  383. package/dist/gltf.js +0 -2
  384. package/dist/loaders/3dm.d.ts +0 -1
  385. package/dist/loaders/3dm.js +0 -2
  386. package/dist/loaders/3ds.d.ts +0 -1
  387. package/dist/loaders/3ds.js +0 -2
  388. package/dist/loaders/amf.d.ts +0 -1
  389. package/dist/loaders/amf.js +0 -2
  390. package/dist/loaders/babylon.d.ts +0 -1
  391. package/dist/loaders/babylon.js +0 -2
  392. package/dist/loaders/common.d.ts +0 -1
  393. package/dist/loaders/common.js +0 -2
  394. package/dist/loaders/font-opentype.d.ts +0 -1
  395. package/dist/loaders/font-opentype.js +0 -2
  396. package/dist/loaders/font-woff.d.ts +0 -1
  397. package/dist/loaders/font-woff.js +0 -2
  398. package/dist/loaders/font.d.ts +0 -1
  399. package/dist/loaders/font.js +0 -2
  400. package/dist/loaders/gcode.d.ts +0 -1
  401. package/dist/loaders/gcode.js +0 -2
  402. package/dist/loaders/geo.d.ts +0 -1
  403. package/dist/loaders/geo.js +0 -2
  404. package/dist/loaders/kmz.d.ts +0 -1
  405. package/dist/loaders/kmz.js +0 -2
  406. package/dist/loaders/las.d.ts +0 -1
  407. package/dist/loaders/las.js +0 -2
  408. package/dist/loaders/ldraw.d.ts +0 -1
  409. package/dist/loaders/ldraw.js +0 -2
  410. package/dist/loaders/lottie.d.ts +0 -1
  411. package/dist/loaders/lottie.js +0 -2
  412. package/dist/loaders/lwo.d.ts +0 -1
  413. package/dist/loaders/lwo.js +0 -2
  414. package/dist/loaders/materialx.d.ts +0 -1
  415. package/dist/loaders/materialx.js +0 -2
  416. package/dist/loaders/md2.d.ts +0 -1
  417. package/dist/loaders/md2.js +0 -2
  418. package/dist/loaders/mmcif.d.ts +0 -1
  419. package/dist/loaders/mmcif.js +0 -2
  420. package/dist/loaders/mmd.d.ts +0 -1
  421. package/dist/loaders/mmd.js +0 -2
  422. package/dist/loaders/mocap.d.ts +0 -1
  423. package/dist/loaders/mocap.js +0 -2
  424. package/dist/loaders/mtl.d.ts +0 -1
  425. package/dist/loaders/mtl.js +0 -2
  426. package/dist/loaders/nrrd.d.ts +0 -1
  427. package/dist/loaders/nrrd.js +0 -2
  428. package/dist/loaders/nurbs.d.ts +0 -1
  429. package/dist/loaders/nurbs.js +0 -2
  430. package/dist/loaders/off.d.ts +0 -1
  431. package/dist/loaders/off.js +0 -2
  432. package/dist/loaders/pdb.d.ts +0 -1
  433. package/dist/loaders/pdb.js +0 -2
  434. package/dist/loaders/ply.d.ts +0 -1
  435. package/dist/loaders/ply.js +0 -2
  436. package/dist/loaders/prwm.d.ts +0 -1
  437. package/dist/loaders/prwm.js +0 -2
  438. package/dist/loaders/render.d.ts +0 -1
  439. package/dist/loaders/render.js +0 -2
  440. package/dist/loaders/svg.d.ts +0 -1
  441. package/dist/loaders/svg.js +0 -2
  442. package/dist/loaders/tds.d.ts +0 -1
  443. package/dist/loaders/tds.js +0 -2
  444. package/dist/loaders/textures.d.ts +0 -1
  445. package/dist/loaders/textures.js +0 -2
  446. package/dist/loaders/threemf-lattice.d.ts +0 -1
  447. package/dist/loaders/threemf-lattice.js +0 -2
  448. package/dist/loaders/threemf-materials.d.ts +0 -1
  449. package/dist/loaders/threemf-materials.js +0 -2
  450. package/dist/loaders/threemf-mesh.d.ts +0 -1
  451. package/dist/loaders/threemf-mesh.js +0 -2
  452. package/dist/loaders/tilt.d.ts +0 -1
  453. package/dist/loaders/tilt.js +0 -2
  454. package/dist/loaders/usd.d.ts +0 -1
  455. package/dist/loaders/usd.js +0 -2
  456. package/dist/loaders/vdb.d.ts +0 -1
  457. package/dist/loaders/vdb.js +0 -2
  458. package/dist/loaders/vrml.d.ts +0 -1
  459. package/dist/loaders/vrml.js +0 -2
  460. package/dist/loaders/vtk-legacy.d.ts +0 -1
  461. package/dist/loaders/vtk-legacy.js +0 -2
  462. package/dist/loaders/vtk-xml.d.ts +0 -1
  463. package/dist/loaders/vtk-xml.js +0 -2
  464. package/dist/loaders/worker.d.ts +0 -1
  465. package/dist/loaders/worker.js +0 -2
  466. package/dist/loaders/xfile.d.ts +0 -1
  467. package/dist/loaders/xfile.js +0 -2
  468. package/dist/loaders/xml.d.ts +0 -1
  469. package/dist/loaders/xml.js +0 -2
  470. package/dist/loaders.d.ts +0 -1
  471. package/dist/loaders.js +0 -2
  472. package/dist/lod/auto.d.ts +0 -1
  473. package/dist/lod/auto.js +0 -2
  474. package/dist/lod/clusters.d.ts +0 -1
  475. package/dist/lod/clusters.js +0 -2
  476. package/dist/lod/fade.d.ts +0 -1
  477. package/dist/lod/fade.js +0 -2
  478. package/dist/lod/msft.d.ts +0 -1
  479. package/dist/lod/msft.js +0 -2
  480. package/dist/lod/occluder-fade.d.ts +0 -1
  481. package/dist/lod/occluder-fade.js +0 -2
  482. package/dist/lod/stream.d.ts +0 -1
  483. package/dist/lod/stream.js +0 -2
  484. package/dist/lod.d.ts +0 -1
  485. package/dist/lod.js +0 -2
  486. package/dist/materials/alpha-hash.d.ts +0 -1
  487. package/dist/materials/alpha-hash.js +0 -2
  488. package/dist/materials/atlas.d.ts +0 -1
  489. package/dist/materials/atlas.js +0 -2
  490. package/dist/materials/batched-lod.d.ts +0 -1
  491. package/dist/materials/batched-lod.js +0 -2
  492. package/dist/materials/batched.d.ts +0 -1
  493. package/dist/materials/batched.js +0 -2
  494. package/dist/materials/eye.d.ts +0 -1
  495. package/dist/materials/eye.js +0 -2
  496. package/dist/materials/fake-shadows.d.ts +0 -1
  497. package/dist/materials/fake-shadows.js +0 -2
  498. package/dist/materials/fur.d.ts +0 -1
  499. package/dist/materials/fur.js +0 -2
  500. package/dist/materials/hair.d.ts +0 -1
  501. package/dist/materials/hair.js +0 -2
  502. package/dist/materials/instance-attributes.d.ts +0 -1
  503. package/dist/materials/instance-attributes.js +0 -2
  504. package/dist/materials/layered.d.ts +0 -1
  505. package/dist/materials/layered.js +0 -2
  506. package/dist/materials/mips.d.ts +0 -1
  507. package/dist/materials/mips.js +0 -2
  508. package/dist/materials/object-normal.d.ts +0 -1
  509. package/dist/materials/object-normal.js +0 -2
  510. package/dist/materials/plugins.d.ts +0 -1
  511. package/dist/materials/plugins.js +0 -2
  512. package/dist/materials/portal.d.ts +0 -1
  513. package/dist/materials/portal.js +0 -2
  514. package/dist/materials/prefilter.d.ts +0 -1
  515. package/dist/materials/prefilter.js +0 -2
  516. package/dist/materials/presets.d.ts +0 -1
  517. package/dist/materials/presets.js +0 -2
  518. package/dist/materials/retroreflection.d.ts +0 -1
  519. package/dist/materials/retroreflection.js +0 -2
  520. package/dist/materials/serialization.d.ts +0 -1
  521. package/dist/materials/serialization.js +0 -2
  522. package/dist/materials/settings.d.ts +0 -1
  523. package/dist/materials/settings.js +0 -2
  524. package/dist/materials/skin.d.ts +0 -1
  525. package/dist/materials/skin.js +0 -2
  526. package/dist/materials/soot.d.ts +0 -1
  527. package/dist/materials/soot.js +0 -2
  528. package/dist/materials/stochastic.d.ts +0 -1
  529. package/dist/materials/stochastic.js +0 -2
  530. package/dist/materials/texture.d.ts +0 -1
  531. package/dist/materials/texture.js +0 -2
  532. package/dist/materials/transmission-layers.d.ts +0 -1
  533. package/dist/materials/transmission-layers.js +0 -2
  534. package/dist/materials/transmission.d.ts +0 -1
  535. package/dist/materials/transmission.js +0 -2
  536. package/dist/materials.d.ts +0 -1
  537. package/dist/materials.js +0 -2
  538. package/dist/oit/depth.d.ts +0 -1
  539. package/dist/oit/depth.js +0 -2
  540. package/dist/oit/exact.d.ts +0 -1
  541. package/dist/oit/exact.js +0 -2
  542. package/dist/oit/meshes.d.ts +0 -1
  543. package/dist/oit/meshes.js +0 -2
  544. package/dist/oit/moments.d.ts +0 -1
  545. package/dist/oit/moments.js +0 -2
  546. package/dist/oit/peel.d.ts +0 -1
  547. package/dist/oit/peel.js +0 -2
  548. package/dist/oit/precise.d.ts +0 -1
  549. package/dist/oit/precise.js +0 -2
  550. package/dist/oit/vfx.d.ts +0 -1
  551. package/dist/oit/vfx.js +0 -2
  552. package/dist/oit.d.ts +0 -1
  553. package/dist/oit.js +0 -2
  554. package/dist/post/accumulate.d.ts +0 -1
  555. package/dist/post/accumulate.js +0 -2
  556. package/dist/post/afterimage.d.ts +0 -1
  557. package/dist/post/afterimage.js +0 -2
  558. package/dist/post/anamorphic.d.ts +0 -1
  559. package/dist/post/anamorphic.js +0 -2
  560. package/dist/post/ascii.d.ts +0 -1
  561. package/dist/post/ascii.js +0 -2
  562. package/dist/post/bloom.d.ts +0 -1
  563. package/dist/post/bloom.js +0 -2
  564. package/dist/post/blur.d.ts +0 -1
  565. package/dist/post/blur.js +0 -2
  566. package/dist/post/caustics.d.ts +0 -1
  567. package/dist/post/caustics.js +0 -2
  568. package/dist/post/color-average.d.ts +0 -1
  569. package/dist/post/color-average.js +0 -2
  570. package/dist/post/contact-shadows.d.ts +0 -1
  571. package/dist/post/contact-shadows.js +0 -2
  572. package/dist/post/curvature.d.ts +0 -1
  573. package/dist/post/curvature.js +0 -2
  574. package/dist/post/decals.d.ts +0 -1
  575. package/dist/post/decals.js +0 -2
  576. package/dist/post/depth-downsample.d.ts +0 -1
  577. package/dist/post/depth-downsample.js +0 -2
  578. package/dist/post/depth.d.ts +0 -1
  579. package/dist/post/depth.js +0 -2
  580. package/dist/post/filter-graph.d.ts +0 -1
  581. package/dist/post/filter-graph.js +0 -2
  582. package/dist/post/fxaa.d.ts +0 -1
  583. package/dist/post/fxaa.js +0 -2
  584. package/dist/post/glitch.d.ts +0 -1
  585. package/dist/post/glitch.js +0 -2
  586. package/dist/post/gtao.d.ts +0 -1
  587. package/dist/post/gtao.js +0 -2
  588. package/dist/post/halftone.d.ts +0 -1
  589. package/dist/post/halftone.js +0 -2
  590. package/dist/post/heat-haze.d.ts +0 -1
  591. package/dist/post/heat-haze.js +0 -2
  592. package/dist/post/image.d.ts +0 -1
  593. package/dist/post/image.js +0 -2
  594. package/dist/post/kawase-blur.d.ts +0 -1
  595. package/dist/post/kawase-blur.js +0 -2
  596. package/dist/post/lens-flare.d.ts +0 -1
  597. package/dist/post/lens-flare.js +0 -2
  598. package/dist/post/lens.d.ts +0 -1
  599. package/dist/post/lens.js +0 -2
  600. package/dist/post/lut1d.d.ts +0 -1
  601. package/dist/post/lut1d.js +0 -2
  602. package/dist/post/mask.d.ts +0 -1
  603. package/dist/post/mask.js +0 -2
  604. package/dist/post/material-decals.d.ts +0 -1
  605. package/dist/post/material-decals.js +0 -2
  606. package/dist/post/mesh-blend.d.ts +0 -1
  607. package/dist/post/mesh-blend.js +0 -2
  608. package/dist/post/motion-blur.d.ts +0 -1
  609. package/dist/post/motion-blur.js +0 -2
  610. package/dist/post/mrt.d.ts +0 -1
  611. package/dist/post/mrt.js +0 -2
  612. package/dist/post/outline.d.ts +0 -1
  613. package/dist/post/outline.js +0 -2
  614. package/dist/post/overlays.d.ts +0 -1
  615. package/dist/post/overlays.js +0 -2
  616. package/dist/post/pixelate.d.ts +0 -1
  617. package/dist/post/pixelate.js +0 -2
  618. package/dist/post/render-graph.d.ts +0 -1
  619. package/dist/post/render-graph.js +0 -2
  620. package/dist/post/rt-gi.d.ts +0 -1
  621. package/dist/post/rt-gi.js +0 -2
  622. package/dist/post/rt-reflections.d.ts +0 -1
  623. package/dist/post/rt-reflections.js +0 -2
  624. package/dist/post/scene-fade.d.ts +0 -1
  625. package/dist/post/scene-fade.js +0 -2
  626. package/dist/post/selective-bloom.d.ts +0 -1
  627. package/dist/post/selective-bloom.js +0 -2
  628. package/dist/post/settings.d.ts +0 -1
  629. package/dist/post/settings.js +0 -2
  630. package/dist/post/smaa.d.ts +0 -1
  631. package/dist/post/smaa.js +0 -2
  632. package/dist/post/ssao.d.ts +0 -1
  633. package/dist/post/ssao.js +0 -2
  634. package/dist/post/ssgi.d.ts +0 -1
  635. package/dist/post/ssgi.js +0 -2
  636. package/dist/post/ssr.d.ts +0 -1
  637. package/dist/post/ssr.js +0 -2
  638. package/dist/post/sss.d.ts +0 -1
  639. package/dist/post/sss.js +0 -2
  640. package/dist/post/stack.d.ts +0 -1
  641. package/dist/post/stack.js +0 -2
  642. package/dist/post/stylize.d.ts +0 -1
  643. package/dist/post/stylize.js +0 -2
  644. package/dist/post/trail.d.ts +0 -1
  645. package/dist/post/trail.js +0 -2
  646. package/dist/post/upscale.d.ts +0 -1
  647. package/dist/post/upscale.js +0 -2
  648. package/dist/post.d.ts +0 -1
  649. package/dist/post.js +0 -2
  650. package/dist/scene/asset-pools.d.ts +0 -1
  651. package/dist/scene/asset-pools.js +0 -2
  652. package/dist/scene/assets.d.ts +0 -1
  653. package/dist/scene/assets.js +0 -2
  654. package/dist/scene/bulk.d.ts +0 -1
  655. package/dist/scene/bulk.js +0 -2
  656. package/dist/scene/clone.d.ts +0 -1
  657. package/dist/scene/clone.js +0 -2
  658. package/dist/scene/container.d.ts +0 -1
  659. package/dist/scene/container.js +0 -2
  660. package/dist/scene/emitter.d.ts +0 -1
  661. package/dist/scene/emitter.js +0 -2
  662. package/dist/scene/graph.d.ts +0 -1
  663. package/dist/scene/graph.js +0 -2
  664. package/dist/scene/helpers.d.ts +0 -1
  665. package/dist/scene/helpers.js +0 -2
  666. package/dist/scene/mesh.d.ts +0 -1
  667. package/dist/scene/mesh.js +0 -2
  668. package/dist/scene/tags.d.ts +0 -1
  669. package/dist/scene/tags.js +0 -2
  670. package/dist/scene.d.ts +0 -1
  671. package/dist/scene.js +0 -2
  672. package/dist/selection/actions.d.ts +0 -1
  673. package/dist/selection/actions.js +0 -2
  674. package/dist/selection/area.d.ts +0 -1
  675. package/dist/selection/area.js +0 -2
  676. package/dist/selection/highlight.d.ts +0 -1
  677. package/dist/selection/highlight.js +0 -2
  678. package/dist/selection/hit-details.d.ts +0 -1
  679. package/dist/selection/hit-details.js +0 -2
  680. package/dist/selection/spatial.d.ts +0 -1
  681. package/dist/selection/spatial.js +0 -2
  682. package/dist/selection/xray.d.ts +0 -1
  683. package/dist/selection/xray.js +0 -2
  684. package/dist/selection.d.ts +0 -1
  685. package/dist/selection.js +0 -2
  686. package/dist/stage/effects.d.ts +0 -1
  687. package/dist/stage/effects.js +0 -2
  688. package/dist/stage/environment.d.ts +0 -1
  689. package/dist/stage/environment.js +0 -2
  690. package/dist/stage/gltf.d.ts +0 -1
  691. package/dist/stage/gltf.js +0 -2
  692. package/dist/stage/lights.d.ts +0 -1
  693. package/dist/stage/lights.js +0 -2
  694. package/dist/stage/particles.d.ts +0 -1
  695. package/dist/stage/particles.js +0 -2
  696. package/dist/stage/physics.d.ts +0 -1
  697. package/dist/stage/physics.js +0 -2
  698. package/dist/stage/scene.d.ts +0 -1
  699. package/dist/stage/scene.js +0 -2
  700. package/dist/stage/shadows.d.ts +0 -1
  701. package/dist/stage/shadows.js +0 -2
  702. package/dist/stage/sky.d.ts +0 -1
  703. package/dist/stage/sky.js +0 -2
  704. package/dist/stage/viewer-extras.d.ts +0 -1
  705. package/dist/stage/viewer-extras.js +0 -2
  706. package/dist/stage/viewer.d.ts +0 -1
  707. package/dist/stage/viewer.js +0 -2
  708. package/dist/stage/xr.d.ts +0 -1
  709. package/dist/stage/xr.js +0 -2
  710. package/dist/stats/beacon.d.ts +0 -1
  711. package/dist/stats/beacon.js +0 -2
  712. package/dist/stats/compile.d.ts +0 -1
  713. package/dist/stats/compile.js +0 -2
  714. package/dist/stats/geometry.d.ts +0 -1
  715. package/dist/stats/geometry.js +0 -2
  716. package/dist/stats/gl.d.ts +0 -1
  717. package/dist/stats/gl.js +0 -2
  718. package/dist/stats/leaks.d.ts +0 -1
  719. package/dist/stats/leaks.js +0 -2
  720. package/dist/stats/panels.d.ts +0 -1
  721. package/dist/stats/panels.js +0 -2
  722. package/dist/stats/phases.d.ts +0 -1
  723. package/dist/stats/phases.js +0 -2
  724. package/dist/stats/report.d.ts +0 -1
  725. package/dist/stats/report.js +0 -2
  726. package/dist/stats.d.ts +0 -1
  727. package/dist/stats.js +0 -2
  728. package/dist/text/animate.d.ts +0 -1
  729. package/dist/text/animate.js +0 -2
  730. package/dist/text/captions.d.ts +0 -1
  731. package/dist/text/captions.js +0 -2
  732. package/dist/text/curve.d.ts +0 -1
  733. package/dist/text/curve.js +0 -2
  734. package/dist/text/extrude.d.ts +0 -1
  735. package/dist/text/extrude.js +0 -2
  736. package/dist/text/fit.d.ts +0 -1
  737. package/dist/text/fit.js +0 -2
  738. package/dist/text/msdf.d.ts +0 -1
  739. package/dist/text/msdf.js +0 -2
  740. package/dist/text/outline.d.ts +0 -1
  741. package/dist/text/outline.js +0 -2
  742. package/dist/text/rich.d.ts +0 -1
  743. package/dist/text/rich.js +0 -2
  744. package/dist/text/selection.d.ts +0 -1
  745. package/dist/text/selection.js +0 -2
  746. package/dist/text/vector.d.ts +0 -1
  747. package/dist/text/vector.js +0 -2
  748. package/dist/text.d.ts +0 -1
  749. package/dist/text.js +0 -2
  750. package/dist/tonemap/3dl.d.ts +0 -1
  751. package/dist/tonemap/3dl.js +0 -2
  752. package/dist/tonemap/custom.d.ts +0 -1
  753. package/dist/tonemap/custom.js +0 -2
  754. package/dist/tonemap/enhance.d.ts +0 -1
  755. package/dist/tonemap/enhance.js +0 -2
  756. package/dist/tonemap/export-cube.d.ts +0 -1
  757. package/dist/tonemap/export-cube.js +0 -2
  758. package/dist/tonemap/grade.d.ts +0 -1
  759. package/dist/tonemap/grade.js +0 -2
  760. package/dist/tonemap/hue.d.ts +0 -1
  761. package/dist/tonemap/hue.js +0 -2
  762. package/dist/tonemap/local.d.ts +0 -1
  763. package/dist/tonemap/local.js +0 -2
  764. package/dist/tonemap/settings.d.ts +0 -1
  765. package/dist/tonemap/settings.js +0 -2
  766. package/dist/tonemap.d.ts +0 -1
  767. package/dist/tonemap.js +0 -2
  768. package/dist/tween/async.d.ts +0 -1
  769. package/dist/tween/async.js +0 -2
  770. package/dist/tween/control.d.ts +0 -1
  771. package/dist/tween/control.js +0 -2
  772. package/dist/tween/custom-ease.d.ts +0 -1
  773. package/dist/tween/custom-ease.js +0 -2
  774. package/dist/tween/inertia.d.ts +0 -1
  775. package/dist/tween/inertia.js +0 -2
  776. package/dist/tween/motion-path.d.ts +0 -1
  777. package/dist/tween/motion-path.js +0 -2
  778. package/dist/tween/props.d.ts +0 -1
  779. package/dist/tween/props.js +0 -2
  780. package/dist/tween/scroll-pin.d.ts +0 -1
  781. package/dist/tween/scroll-pin.js +0 -2
  782. package/dist/tween/scroll.d.ts +0 -1
  783. package/dist/tween/scroll.js +0 -2
  784. package/dist/tween/stagger.d.ts +0 -1
  785. package/dist/tween/stagger.js +0 -2
  786. package/dist/tween/timeline.d.ts +0 -1
  787. package/dist/tween/timeline.js +0 -2
  788. package/dist/tween.d.ts +0 -1
  789. package/dist/tween.js +0 -2
  790. package/dist/worker/auto.d.ts +0 -1
  791. package/dist/worker/auto.js +0 -2
  792. package/dist/worker/canvas.d.ts +0 -1
  793. package/dist/worker/canvas.js +0 -2
  794. package/dist/worker/rpc.d.ts +0 -1
  795. package/dist/worker/rpc.js +0 -2
  796. package/dist/worker.d.ts +0 -1
  797. package/dist/worker.js +0 -2
package/dist/cad.d.ts ADDED
@@ -0,0 +1,109 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
2
+ import type { EngineKernel, Mesh as MeshHandle } from '@margoengine/core';
3
+ import { type Engine, type EnginePlugin, type FrameGraph } from '@margoengine/core/extension';
4
+ import { type CADFormat, type CADImportOptions } from './cad-async.js';
5
+ import { type PackShadowPrimitive } from './pack.js';
6
+ export type { PackShadowPrimitive } from './pack.js';
7
+ /** A loaded CAD file: one `root` mesh over one child mesh per part. `dispose()` removes all of them (also via `using`). */
8
+ export interface CADModel {
9
+ /** Parent of every part; hidden until the whole file has loaded. */
10
+ root: MeshHandle;
11
+ /** One mesh per part, in file order. */
12
+ meshes: readonly MeshHandle[];
13
+ /** Disposes the root and every part. */
14
+ dispose(): void;
15
+ /**
16
+ * B-rep formats read by the bundled kernel worker: faces the kernel could not mesh, each left out of its part (0 when
17
+ * every face meshed). Not set for STL and OBJ, nor by a custom `importer` unless it sets it.
18
+ */
19
+ failedFaces?: number;
20
+ /**
21
+ * B-rep formats read by the bundled kernel worker: what the reader left out or assumed (an entity it skipped, a
22
+ * conversion it could not make). Not set for STL and OBJ, nor by a custom `importer` unless it sets it.
23
+ */
24
+ warnings?: readonly string[];
25
+ }
26
+ /**
27
+ * Makes meshes with identical triangles share one geometry, so they upload and draw from one buffer pair. Returns how many
28
+ * parts it saw and how many were unique. Meshes without geometry are skipped; an input with none at all throws.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const { parts, unique } = deduplicateParts(model.meshes);
33
+ * ```
34
+ */
35
+ export declare function deduplicateParts(meshes: Iterable<MeshHandle>): {
36
+ parts: number;
37
+ unique: number;
38
+ };
39
+ /**
40
+ * Reads STL or OBJ text or bytes into meshes under one root, synchronously. Units stay as in the file. For the B-rep
41
+ * formats (STEP, IGES, SAT, XT, JT), or to keep the main thread free, use {@link loadCAD} or `parseCADAsync`.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const model = parseCAD(engine, await (await fetch('/part.stl')).arrayBuffer(), 'stl');
46
+ * ```
47
+ */
48
+ export declare function parseCAD(instance: EngineKernel, input: string | ArrayBuffer | ArrayBufferView, format: 'stl' | 'obj', { maxParts }?: Pick<CADImportOptions, 'maxParts'>): CADModel;
49
+ /**
50
+ * Downloads a CAD file and imports it: STL, OBJ, STEP, IGES, SAT, XT or JT, chosen by the `format` option or the file
51
+ * extension (.stp, .igs, .x_t, .x_b and .xmt_txt too). Pass `signal` to cancel the download and the import. The B-rep
52
+ * formats run in a worker (meters); see {@link CADImportOptions} for every option and its default.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const model = await loadCAD(engine, '/part.step', { signal: AbortSignal.timeout(30_000) });
57
+ * ```
58
+ */
59
+ export declare function loadCAD(engine: EngineKernel, url: string | URL, { format, signal, fetch: get, ...options }?: CADImportOptions & {
60
+ format?: CADFormat;
61
+ fetch?: typeof fetch;
62
+ }): Promise<CADModel>;
63
+ /** Options for {@link PartInstancer}. */
64
+ export interface PartInstancerOptions {
65
+ /** Draw small static closed parts that share a material and root from shared GPU buffers (WebGPU). Default true. */
66
+ pack?: boolean;
67
+ /** Parts with more vertices than this keep their own draw. Default 4,096. */
68
+ partVertices?: number;
69
+ /** Most vertices in one pack buffer. Default 262,144 (at least `partVertices`). */
70
+ packVertices?: number;
71
+ }
72
+ /**
73
+ * Deduplicates identical parts on attach, then packs small static parts into shared buffers. Packed parts stay
74
+ * ordinary visible meshes (names, picks, sections and exports address them); core skips their claimed batches and the
75
+ * plugin draws each pack once inside every core draw, with that draw's pipeline and bindings. A part returns to its own
76
+ * draw when it moves, hides, changes material or geometry, or another visible mesh shares its geometry. Parts loaded
77
+ * after attaching are packed by {@link PartInstancer.refresh}. For directional shadows, pass the plugin to
78
+ * `shadows.add` (it is a ShadowSource for its packs) instead of each packed part.
79
+ */
80
+ export declare class PartInstancer implements EnginePlugin {
81
+ /** Same as `engine.use(new PartInstancer(options))`; returns the plugin. */
82
+ static attach(instance: EngineKernel, options?: PartInstancerOptions): PartInstancer;
83
+ readonly name = "part-instancer";
84
+ /** `parts`/`unique` from deduplication on attach; `packs` buffers and `packed` parts drawn from them now. */
85
+ readonly stats: {
86
+ parts: number;
87
+ unique: number;
88
+ packs: number;
89
+ packed: number;
90
+ };
91
+ /** Pack while true; false hands every part back to its own draw on the next frame. */
92
+ pack: boolean;
93
+ private readonly packs;
94
+ private removed;
95
+ private engine?;
96
+ constructor(options?: PartInstancerOptions);
97
+ /** Pack buffers as directional shadow casters, clipped by sections like core casters. */
98
+ get shadowPrimitives(): readonly PackShadowPrimitive[];
99
+ /** True once the plugin is removed or disposed. */
100
+ get disposed(): boolean;
101
+ setup(engine: Engine): void;
102
+ /** Unpacks every part and packs the engine's current meshes again on the next frame. */
103
+ refresh(): void;
104
+ registerPasses(graph: FrameGraph): void;
105
+ onDeviceRestored(): void;
106
+ /** Hands every part back to its own draw, frees the pack buffers and leaves the plugin's scene. Safe to call twice. */
107
+ dispose(): void;
108
+ [Symbol.dispose]: () => void;
109
+ }
@@ -0,0 +1,19 @@
1
+ import { edgesGeometry as e } from "@margoengine/geometry/utils";
2
+ //#region ../shared/geometry-edges.js
3
+ function t(t, n) {
4
+ let r = t.vertices, i = new Float32Array(r.length / 2);
5
+ for (let e = 0, t = 0; e < r.length; e += 6, t += 3) i[t] = r[e], i[t + 1] = r[e + 1], i[t + 2] = r[e + 2];
6
+ return e({
7
+ positions: i,
8
+ normals: i,
9
+ uvs: /* @__PURE__ */ new Float32Array(),
10
+ indices: t.indices
11
+ }, n);
12
+ }
13
+ //#endregion
14
+ //#region src/closed.ts
15
+ function n(e) {
16
+ return t(e, 180).length === 0;
17
+ }
18
+ //#endregion
19
+ export { n as t };
@@ -0,0 +1,6 @@
1
+ import type { Geometry } from '@margoengine/core/extension';
2
+ /**
3
+ * Whether a geometry is a closed solid: no edge that is not shared by exactly two consistently wound triangles
4
+ * (positions welded as `edgesGeometry` welds them). The same test sections cap by.
5
+ */
6
+ export declare function capsAsSolid(geometry: Geometry): boolean;
package/dist/closed.js ADDED
@@ -0,0 +1 @@
1
+ export { t as capsAsSolid } from "./closed-Db7gO_Gy.js";
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export { createStage, Stage } from '@margoengine/stage';
2
- export * from '@margoengine/cad-import';
1
+ export { parseCAD, loadCAD, deduplicateParts, PartInstancer } from './cad.js';
2
+ export type { CADModel, PartInstancerOptions, PackShadowPrimitive } from './cad.js';
3
+ export { parseCADAsync } from './cad-async.js';
4
+ export type { CADFormat, CADImportOptions } from './cad-async.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- // Generated by scripts/umbrella.mjs; do not edit.
2
- export { createStage, Stage } from '@margoengine/stage';
3
- export * from '@margoengine/cad-import';
1
+ import { i as e, n as t, r as n, t as r } from "./cad-NjBidwwm.js";
2
+ import { t as i } from "./cad-async-kUFSo7gb.js";
3
+ export { r as PartInstancer, t as deduplicateParts, n as loadCAD, e as parseCAD, i as parseCADAsync };
@@ -0,0 +1,16 @@
1
+ /** One mesh's buffers in the layout core's Geometry stores: per vertex xyz then normal, uint32 triangle indices, and
2
+ * the bounding sphere (float32 centre, radius rounded up so the kernel's cull never drops a stored vertex). */
3
+ export interface MeshBuffers {
4
+ readonly vertices: Float32Array;
5
+ readonly indices: Uint32Array;
6
+ readonly bounds: Float32Array;
7
+ }
8
+ /** Builds one mesh from flat positions, normals and triangle indices: core's Geometry on the page, {@link meshBuffers}
9
+ * in the worker. */
10
+ export type MakeMesh<G extends MeshBuffers> = (positions: ArrayLike<number>, normals: ArrayLike<number>, indices: ArrayLike<number>) => G;
11
+ /**
12
+ * The worker's mesh: the buffers `new Geometry(positions, normals, indices)` makes, with the same checks, as a plain
13
+ * object. The page wraps them in a Geometry without copying (cad-async.ts), so the worker bundles none of core: core's
14
+ * build declares its class fields, which every other worker of the shared tsconfig keeps out (tests/class-fields.test.js).
15
+ */
16
+ export declare function meshBuffers(positions: ArrayLike<number>, normals: ArrayLike<number>, indices: ArrayLike<number>): MeshBuffers;
@@ -0,0 +1,2 @@
1
+ /** The format named by `format`, else by the URL path's extension; undefined when neither names one. */
2
+ export declare function cadFormatOf(pathname: string, format?: string): "iges" | "jt" | "obj" | "sat" | "step" | "stl" | "xt" | undefined;
package/dist/pack.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import type { Engine, Mesh, PassContext } from '@margoengine/core/extension';
2
+ type Context = Extract<PassContext, {
3
+ backend: 'webgpu';
4
+ }>;
5
+ /** One pack as a `@margoengine/shadows` caster: root-space position + normal vertices drawn with `node`'s matrix. */
6
+ export interface PackShadowPrimitive {
7
+ node: Mesh;
8
+ vertex: GPUBuffer;
9
+ index: GPUBuffer;
10
+ count: number;
11
+ stride: 24;
12
+ }
13
+ /**
14
+ * Packs small static parts that share a material into root-space GPU buffers and draws each pack once inside every
15
+ * core `context.draw` call (same pipeline and bindings), so section clips, caps, bloom and SSAO see packed triangles as
16
+ * core triangles. Packed parts stay ordinary visible meshes; only their batches are claimed. A part leaves its pack for
17
+ * good when it moves, hides, changes material or geometry, or another visible mesh starts sharing its geometry.
18
+ */
19
+ export declare class PartPacks {
20
+ private readonly partVertices;
21
+ private readonly packVertices;
22
+ readonly stats: {
23
+ packs: number;
24
+ packed: number;
25
+ };
26
+ shadowPrimitives: readonly PackShadowPrimitive[];
27
+ private engine?;
28
+ private packs;
29
+ private built;
30
+ private frame?;
31
+ private readonly frameData;
32
+ private readonly closed;
33
+ private readonly variants;
34
+ private readonly groups;
35
+ private readonly colors;
36
+ private readonly depth;
37
+ private readonly pass;
38
+ private readonly inverse;
39
+ private readonly relative;
40
+ private readonly partInverse;
41
+ private readonly workspace;
42
+ constructor(partVertices: number, packVertices: number);
43
+ setup(engine: Engine): void;
44
+ /** Rebuilds from the current meshes on the next frame. */
45
+ refresh(): void;
46
+ /** One frame: build once, release changed parts, refresh instances and wrap `draw`. WebGPU only. */
47
+ execute(c: Context, enabled: boolean): void;
48
+ /** Unclaims every packed batch and frees the pack buffers. The next enabled frame builds again. */
49
+ release(): void;
50
+ dispose(): void;
51
+ /** GPU resources belong to the lost device; the batches survive and are claimed again by the rebuild. */
52
+ onDeviceRestored(): void;
53
+ private build;
54
+ /** The closed-solid test of capsAsSolid (./closed.ts): open shells keep their own draw. */
55
+ private isClosed;
56
+ private bake;
57
+ /** Releases parts whose pose, visibility, material, geometry or sharing changed. Returns true when nothing changed. */
58
+ private validate;
59
+ /** Hands one part back to core's draw and collapses its triangles in the pack. */
60
+ private unpack;
61
+ private drop;
62
+ /** Uploads every part's instance again when the root matrix changed. */
63
+ private instances;
64
+ /** Draws every pack after core's draw of the same call, with that call's pipeline, bindings and targets. */
65
+ private draw;
66
+ private sameMaterial;
67
+ /** Core's variant for the frame shader: same descriptor, shader and target format as its own draw. */
68
+ private variant;
69
+ private group;
70
+ private invalidateShadows;
71
+ }
72
+ export {};
package/dist/stage.d.ts CHANGED
@@ -1 +1,33 @@
1
- export * from '@margoengine/stage';
1
+ // @ts-ignore optional peer: its types apply when it is installed
2
+ import type { LoadedModel, Stage } from '@margoengine/stage';
3
+ // @ts-ignore optional peer: its types apply when it is installed
4
+ export type { LoadedModel } from '@margoengine/stage';
5
+ /** Options for `addCAD`. Format and framing belong to the stage; the rest are forwarded to `loadCAD`. */
6
+ export interface AddCADOptions {
7
+ /** Cancels the import; the stage's disposal cancels it too. */
8
+ signal?: AbortSignal;
9
+ onProgress?: (percent: number) => void;
10
+ smoothing?: boolean;
11
+ /** Most parts (OBJ objects and groups, B-rep placements) the file may have, each one a core mesh (default 100,000; up to core's 8,388,608 entities). */
12
+ maxParts?: number;
13
+ /**
14
+ * The worker is terminated and the import rejects after this many milliseconds (default 120,000). A very large or
15
+ * malformed B-rep file can take minutes to mesh; a worker that never answers is never waited on.
16
+ */
17
+ timeoutMs?: number;
18
+ /**
19
+ * File format; default from the URL extension ('stp' is STEP, 'igs' IGES, 'x_t', 'x_b' and 'xmt_txt' XT). An unknown
20
+ * format rejects with a TypeError.
21
+ */
22
+ format?: 'stl' | 'obj' | 'step' | 'iges' | 'sat' | 'xt' | 'jt';
23
+ /** Fit the camera to the loaded model. Default true. */
24
+ fit?: boolean;
25
+ }
26
+ /**
27
+ * Imports an STL, OBJ, STEP, IGES, SAT, XT or JT file with `loadCAD` (the B-rep formats through Margo's own kernel
28
+ * in a worker), adds it to the stage and fits the camera to it. The B-rep kernel loads in its worker on the first
29
+ * B-rep import. Rejects with
30
+ * AbortError, adding nothing, when `signal` aborts or the stage is disposed first.
31
+ * @example const part = await addCAD(stage, '/bracket.step');
32
+ */
33
+ export declare function addCAD(stage: Stage, url: string | URL, _arg0?: AddCADOptions): Promise<LoadedModel>;
package/dist/stage.js CHANGED
@@ -1,2 +1,85 @@
1
- // Generated by scripts/umbrella.mjs; do not edit.
2
- export * from '@margoengine/stage';
1
+ import { a as e, c as t, o as n, r, s as i } from "./cad-NjBidwwm.js";
2
+ //#region ../shared/stage-model.js
3
+ function a(e, r, a, o = !1) {
4
+ let s = e;
5
+ if (s.disposed) throw i("disposed", "Engine disposed");
6
+ s.store.tick(!1), a.fill(Infinity, 0, 3), a.fill(-Infinity, 3);
7
+ let c = (e, t, n) => {
8
+ for (let r = 0; r < e.length; r += t) {
9
+ let t = e[r], i = e[r + 1], o = e[r + 2];
10
+ for (let e = 0; e < 3; e++) {
11
+ let r = n[e] * t + n[4 + e] * i + n[8 + e] * o + n[12 + e];
12
+ a[e] = Math.min(a[e], r), a[e + 3] = Math.max(a[e + 3], r);
13
+ }
14
+ }
15
+ };
16
+ for (let e of r) {
17
+ if (e.check(), e.engine !== s) throw t("Foreign mesh", "hierarchy");
18
+ if (o && !s.store.visible[e.id]) continue;
19
+ let r = n(e);
20
+ if (r?.kind === "core") c(r.geometry.vertices, 6, e.matrix);
21
+ else if (r?.kind === "pbr") for (let e of r.source.primitives) c(e.vertices, 20, e.node.matrix);
22
+ }
23
+ if (!Number.isFinite(a[0])) throw i("state", "No geometry", "geometry");
24
+ return a;
25
+ }
26
+ function o(e, r) {
27
+ let i = /* @__PURE__ */ new Float32Array(6);
28
+ return {
29
+ root: r.root,
30
+ meshes: r.meshes,
31
+ position: r.root.position,
32
+ rotation: r.root.rotation,
33
+ scale: r.root.scale,
34
+ get visible() {
35
+ return r.root.visible;
36
+ },
37
+ set visible(e) {
38
+ r.root.visible = e;
39
+ },
40
+ get bounds() {
41
+ return r.root.check(), a(e, r.meshes, i);
42
+ },
43
+ get raw() {
44
+ if (r.root.check(), e.backend !== "webgpu") return null;
45
+ let i = /* @__PURE__ */ new Set(), a = [], o = /* @__PURE__ */ new Set();
46
+ for (let s of r.meshes) {
47
+ if (s.check(), s.engine !== e) throw t("Foreign mesh", "hierarchy");
48
+ if (o.has(s)) continue;
49
+ o.add(s);
50
+ let r = n(s);
51
+ if (r?.kind === "core") i.add(e.geometryBuffers(r.geometry));
52
+ else if (r?.kind === "pbr") for (let e of r.source.draws) a.push(e);
53
+ }
54
+ return [...i, ...a];
55
+ },
56
+ destroy() {
57
+ r.dispose();
58
+ }
59
+ };
60
+ }
61
+ function s(e, n) {
62
+ if (typeof n != "boolean") throw t("Invalid fit: expected a boolean; use true to fit the camera or false to keep its view", "arguments");
63
+ return new URL(e, globalThis.location?.href);
64
+ }
65
+ function c(e, t, n, r) {
66
+ try {
67
+ return r.throwIfAborted(), n && e.fit(t.meshes), o(e.engine, t);
68
+ } catch (e) {
69
+ throw t.dispose(), e;
70
+ }
71
+ }
72
+ //#endregion
73
+ //#region src/stage.ts
74
+ async function l(n, i, { format: a, fit: o = !0, signal: l, ...u } = {}) {
75
+ let d = s(i, o), f = e(d.pathname, a);
76
+ if (!f) throw t("Specify format", "install");
77
+ let p = l ? AbortSignal.any([l, n.signal]) : n.signal;
78
+ return p.throwIfAborted(), c(n, await r(n.engine, d, {
79
+ ...u,
80
+ format: f,
81
+ signal: p
82
+ }), o, p);
83
+ }
84
+ //#endregion
85
+ export { l as addCAD };
@@ -0,0 +1,40 @@
1
+ import { type MeshBuffers } from '../internal/buffers.js';
2
+ /** A B-rep format the kernel reads. */
3
+ export type BRepFormat = 'step' | 'iges' | 'sat' | 'xt' | 'jt';
4
+ /** One mesh of a placed body: its geometry (index into `geometries`), name, colour and transform. */
5
+ export interface BRepPlacement {
6
+ geometry: number;
7
+ name: string;
8
+ color: string | null;
9
+ position: [number, number, number];
10
+ rotation: [number, number, number, number];
11
+ scale: [number, number, number];
12
+ }
13
+ /** What {@link readBRep} made. */
14
+ export interface BRepRead {
15
+ /** One geometry per body and colour, in the body's own frame in metres; shared by every placement of the body. */
16
+ geometries: MeshBuffers[];
17
+ /** Every placed mesh, in file order. */
18
+ placements: BRepPlacement[];
19
+ /** Faces the kernel could not mesh (each left out of its body). */
20
+ failedFaces: number;
21
+ /** What the reader left out or assumed. */
22
+ warnings: string[];
23
+ }
24
+ export interface BRepReadOptions {
25
+ /** Largest chord distance from the true surface, in metres (default: the kernel's, 0.001 of each body's size). */
26
+ deflection?: number;
27
+ /** Exact surface normals (true) or one flat normal per triangle (false). */
28
+ smoothing: boolean;
29
+ /** Called with 0 to 1 as bodies are meshed. */
30
+ progress(fraction: number): void;
31
+ /** Throws once the placed meshes pass the caller's cap. */
32
+ checkParts(count: number): void;
33
+ /** Throws once the distinct triangles pass the caller's cap. */
34
+ checkIndices(count: number): void;
35
+ }
36
+ /**
37
+ * Reads a B-rep file and meshes it: each placed body once (one geometry per colour), placed by a transform per use.
38
+ * Bodies the kernel cannot mesh count all their faces as failed and leave the rest of the file standing.
39
+ */
40
+ export declare function readBRep(buffer: ArrayBuffer, format: BRepFormat, options: BRepReadOptions): BRepRead;