@pinkaphant/kolmo 0.4.6 → 0.5.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 (477) hide show
  1. package/README.md +39 -100
  2. package/dist/engine/actor.d.ts +13 -0
  3. package/dist/engine/gltfLoader.d.ts +19 -0
  4. package/dist/engine/index.d.ts +8 -13
  5. package/dist/engine/index.js +1270 -22
  6. package/dist/engine/index.js.map +1 -1
  7. package/dist/engine/{kolmoInput.d.ts → input.d.ts} +7 -6
  8. package/dist/engine/surface.d.ts +19 -0
  9. package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +18 -47
  10. package/dist/engine/vehicle.d.ts +20 -0
  11. package/dist/engine/world.d.ts +76 -0
  12. package/dist/index.d.ts +12 -18
  13. package/dist/index.js +14 -104
  14. package/dist/physics/index.d.ts +4 -1
  15. package/dist/physics/index.js +1 -105
  16. package/dist/physics/nBodyGravity.d.ts +42 -0
  17. package/dist/physics-FhWvTBfH.js +424 -0
  18. package/dist/physics-FhWvTBfH.js.map +1 -0
  19. package/dist/vite/index.d.ts +2 -12
  20. package/dist/vite/index.js +8 -77
  21. package/dist/vite/index.js.map +1 -1
  22. package/package.json +33 -87
  23. package/AGENTS.md +0 -29
  24. package/CLAUDE.md +0 -8
  25. package/bin/kolmo.mjs +0 -560
  26. package/dist/engine/causewayBridge.d.ts +0 -14
  27. package/dist/engine/causewayBridge.js +0 -166
  28. package/dist/engine/causewayBridge.js.map +0 -1
  29. package/dist/engine/islandSettlementMesh.d.ts +0 -26
  30. package/dist/engine/islandSettlementMesh.js +0 -166
  31. package/dist/engine/islandSettlementMesh.js.map +0 -1
  32. package/dist/engine/kolmoActions.d.ts +0 -23
  33. package/dist/engine/kolmoActions.js +0 -179
  34. package/dist/engine/kolmoActions.js.map +0 -1
  35. package/dist/engine/kolmoActor.d.ts +0 -13
  36. package/dist/engine/kolmoActor.js +0 -263
  37. package/dist/engine/kolmoActor.js.map +0 -1
  38. package/dist/engine/kolmoActorHelpers.d.ts +0 -24
  39. package/dist/engine/kolmoActorHelpers.js +0 -64
  40. package/dist/engine/kolmoActorHelpers.js.map +0 -1
  41. package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
  42. package/dist/engine/kolmoFloatingOrigin.js +0 -98
  43. package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
  44. package/dist/engine/kolmoGame.d.ts +0 -27
  45. package/dist/engine/kolmoGame.js +0 -83
  46. package/dist/engine/kolmoGame.js.map +0 -1
  47. package/dist/engine/kolmoHud.d.ts +0 -23
  48. package/dist/engine/kolmoHud.js +0 -214
  49. package/dist/engine/kolmoHud.js.map +0 -1
  50. package/dist/engine/kolmoInput.js +0 -163
  51. package/dist/engine/kolmoInput.js.map +0 -1
  52. package/dist/engine/kolmoIsland.d.ts +0 -14
  53. package/dist/engine/kolmoIsland.js +0 -243
  54. package/dist/engine/kolmoIsland.js.map +0 -1
  55. package/dist/engine/kolmoLongDrive.d.ts +0 -12
  56. package/dist/engine/kolmoLongDrive.js +0 -160
  57. package/dist/engine/kolmoLongDrive.js.map +0 -1
  58. package/dist/engine/kolmoPilotMesh.d.ts +0 -2
  59. package/dist/engine/kolmoPilotMesh.js +0 -205
  60. package/dist/engine/kolmoPilotMesh.js.map +0 -1
  61. package/dist/engine/kolmoProcedural.d.ts +0 -13
  62. package/dist/engine/kolmoProcedural.js +0 -101
  63. package/dist/engine/kolmoProcedural.js.map +0 -1
  64. package/dist/engine/kolmoRigs.d.ts +0 -13
  65. package/dist/engine/kolmoRigs.js +0 -100
  66. package/dist/engine/kolmoRigs.js.map +0 -1
  67. package/dist/engine/kolmoStore.d.ts +0 -3
  68. package/dist/engine/kolmoStore.js +0 -4
  69. package/dist/engine/kolmoStore.js.map +0 -1
  70. package/dist/engine/kolmoSurface.d.ts +0 -18
  71. package/dist/engine/kolmoSurface.js +0 -198
  72. package/dist/engine/kolmoSurface.js.map +0 -1
  73. package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
  74. package/dist/engine/kolmoTouchOverlay.js +0 -326
  75. package/dist/engine/kolmoTouchOverlay.js.map +0 -1
  76. package/dist/engine/kolmoTouchState.d.ts +0 -50
  77. package/dist/engine/kolmoTouchState.js +0 -210
  78. package/dist/engine/kolmoTouchState.js.map +0 -1
  79. package/dist/engine/kolmoTraits.js +0 -140
  80. package/dist/engine/kolmoTraits.js.map +0 -1
  81. package/dist/engine/kolmoVehicle.d.ts +0 -4
  82. package/dist/engine/kolmoVehicle.js +0 -80
  83. package/dist/engine/kolmoVehicle.js.map +0 -1
  84. package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -10
  85. package/dist/engine/kolmoVehicleAutoCompile.js +0 -78
  86. package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
  87. package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
  88. package/dist/engine/kolmoVehicleConfig.js +0 -84
  89. package/dist/engine/kolmoVehicleConfig.js.map +0 -1
  90. package/dist/engine/kolmoVehicleDriver.d.ts +0 -38
  91. package/dist/engine/kolmoVehicleDriver.js +0 -139
  92. package/dist/engine/kolmoVehicleDriver.js.map +0 -1
  93. package/dist/engine/kolmoVehicleInner.d.ts +0 -7
  94. package/dist/engine/kolmoVehicleInner.js +0 -291
  95. package/dist/engine/kolmoVehicleInner.js.map +0 -1
  96. package/dist/engine/kolmoWorld.d.ts +0 -45
  97. package/dist/engine/kolmoWorld.js +0 -161
  98. package/dist/engine/kolmoWorld.js.map +0 -1
  99. package/dist/engine/longDriveKit.d.ts +0 -19
  100. package/dist/engine/longDriveKit.js +0 -145
  101. package/dist/engine/longDriveKit.js.map +0 -1
  102. package/dist/engine/longDriveRoadside.d.ts +0 -16
  103. package/dist/engine/longDriveRoadside.js +0 -171
  104. package/dist/engine/longDriveRoadside.js.map +0 -1
  105. package/dist/engine/macroCellBuilder.d.ts +0 -44
  106. package/dist/engine/macroCellBuilder.js +0 -228
  107. package/dist/engine/macroCellBuilder.js.map +0 -1
  108. package/dist/engine/mainlandMacroCell.d.ts +0 -15
  109. package/dist/engine/mainlandMacroCell.js +0 -168
  110. package/dist/engine/mainlandMacroCell.js.map +0 -1
  111. package/dist/engine/shiftedFixedBody.d.ts +0 -13
  112. package/dist/engine/shiftedFixedBody.js +0 -75
  113. package/dist/engine/shiftedFixedBody.js.map +0 -1
  114. package/dist/importer/ChopShopPanel.d.ts +0 -52
  115. package/dist/importer/ChopShopPanel.js +0 -409
  116. package/dist/importer/ChopShopPanel.js.map +0 -1
  117. package/dist/importer/DomainWorkshopPanel.d.ts +0 -23
  118. package/dist/importer/DomainWorkshopPanel.js +0 -418
  119. package/dist/importer/DomainWorkshopPanel.js.map +0 -1
  120. package/dist/importer/GateHudBar.d.ts +0 -39
  121. package/dist/importer/GateHudBar.js +0 -401
  122. package/dist/importer/GateHudBar.js.map +0 -1
  123. package/dist/importer/GlbImportGate.d.ts +0 -8
  124. package/dist/importer/GlbImportGate.js +0 -291
  125. package/dist/importer/GlbImportGate.js.map +0 -1
  126. package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
  127. package/dist/importer/ImperativeVehicleRig.js +0 -273
  128. package/dist/importer/ImperativeVehicleRig.js.map +0 -1
  129. package/dist/importer/LiveDrivePads.d.ts +0 -20
  130. package/dist/importer/LiveDrivePads.js +0 -171
  131. package/dist/importer/LiveDrivePads.js.map +0 -1
  132. package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
  133. package/dist/importer/PaperShellDebrisRig.js +0 -143
  134. package/dist/importer/PaperShellDebrisRig.js.map +0 -1
  135. package/dist/importer/R2VaultDrawer.d.ts +0 -12
  136. package/dist/importer/R2VaultDrawer.js +0 -90
  137. package/dist/importer/R2VaultDrawer.js.map +0 -1
  138. package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
  139. package/dist/importer/Step1CalibrationPlinth.js +0 -204
  140. package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
  141. package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
  142. package/dist/importer/Step1ExplodedIslands.js +0 -144
  143. package/dist/importer/Step1ExplodedIslands.js.map +0 -1
  144. package/dist/importer/Step2UniversalPad.d.ts +0 -18
  145. package/dist/importer/Step2UniversalPad.js +0 -123
  146. package/dist/importer/Step2UniversalPad.js.map +0 -1
  147. package/dist/importer/VfxEmitterPool.d.ts +0 -8
  148. package/dist/importer/VfxEmitterPool.js +0 -64
  149. package/dist/importer/VfxEmitterPool.js.map +0 -1
  150. package/dist/importer/WheelRingHandles3D.d.ts +0 -11
  151. package/dist/importer/WheelRingHandles3D.js +0 -319
  152. package/dist/importer/WheelRingHandles3D.js.map +0 -1
  153. package/dist/importer/archLinerGeom.d.ts +0 -2
  154. package/dist/importer/archLinerGeom.js +0 -51
  155. package/dist/importer/archLinerGeom.js.map +0 -1
  156. package/dist/importer/chopHingeHelpers.d.ts +0 -15
  157. package/dist/importer/chopHingeHelpers.js +0 -193
  158. package/dist/importer/chopHingeHelpers.js.map +0 -1
  159. package/dist/importer/chopShopActions.d.ts +0 -58
  160. package/dist/importer/chopShopActions.js +0 -165
  161. package/dist/importer/chopShopActions.js.map +0 -1
  162. package/dist/importer/chopShopHandlers.d.ts +0 -26
  163. package/dist/importer/chopShopHandlers.js +0 -283
  164. package/dist/importer/chopShopHandlers.js.map +0 -1
  165. package/dist/importer/chopShopIoActions.d.ts +0 -20
  166. package/dist/importer/chopShopIoActions.js +0 -192
  167. package/dist/importer/chopShopIoActions.js.map +0 -1
  168. package/dist/importer/chopShopMcpAction.d.ts +0 -18
  169. package/dist/importer/chopShopMcpAction.js +0 -58
  170. package/dist/importer/chopShopMcpAction.js.map +0 -1
  171. package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
  172. package/dist/importer/cylinderBooleanSlice.js +0 -110
  173. package/dist/importer/cylinderBooleanSlice.js.map +0 -1
  174. package/dist/importer/cylinderSliceMath.d.ts +0 -14
  175. package/dist/importer/cylinderSliceMath.js +0 -251
  176. package/dist/importer/cylinderSliceMath.js.map +0 -1
  177. package/dist/importer/fusedWheelDetect.d.ts +0 -4
  178. package/dist/importer/fusedWheelDetect.js +0 -297
  179. package/dist/importer/fusedWheelDetect.js.map +0 -1
  180. package/dist/importer/fusedWheelFit.d.ts +0 -19
  181. package/dist/importer/fusedWheelFit.js +0 -219
  182. package/dist/importer/fusedWheelFit.js.map +0 -1
  183. package/dist/importer/gateStore.d.ts +0 -73
  184. package/dist/importer/gateStore.js +0 -102
  185. package/dist/importer/gateStore.js.map +0 -1
  186. package/dist/importer/glbNormalizer.d.ts +0 -22
  187. package/dist/importer/glbNormalizer.js +0 -177
  188. package/dist/importer/glbNormalizer.js.map +0 -1
  189. package/dist/importer/importerWebMcp.d.ts +0 -49
  190. package/dist/importer/importerWebMcp.js +0 -48
  191. package/dist/importer/importerWebMcp.js.map +0 -1
  192. package/dist/importer/importerWebMcpTools.d.ts +0 -2
  193. package/dist/importer/importerWebMcpTools.js +0 -341
  194. package/dist/importer/importerWebMcpTools.js.map +0 -1
  195. package/dist/importer/index.d.ts +0 -23
  196. package/dist/importer/index.js +0 -36
  197. package/dist/importer/index.js.map +0 -1
  198. package/dist/importer/khrCarGeometryMass.d.ts +0 -20
  199. package/dist/importer/khrCarGeometryMass.js +0 -125
  200. package/dist/importer/khrCarGeometryMass.js.map +0 -1
  201. package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
  202. package/dist/importer/khrCarPlanHelpers.js +0 -300
  203. package/dist/importer/khrCarPlanHelpers.js.map +0 -1
  204. package/dist/importer/khrCarPlanner.d.ts +0 -8
  205. package/dist/importer/khrCarPlanner.js +0 -283
  206. package/dist/importer/khrCarPlanner.js.map +0 -1
  207. package/dist/importer/khrCompiler.d.ts +0 -5
  208. package/dist/importer/khrCompiler.js +0 -87
  209. package/dist/importer/khrCompiler.js.map +0 -1
  210. package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
  211. package/dist/importer/khrCraftPropCompiler.js +0 -263
  212. package/dist/importer/khrCraftPropCompiler.js.map +0 -1
  213. package/dist/importer/khrNodeNameGuard.d.ts +0 -20
  214. package/dist/importer/khrNodeNameGuard.js +0 -139
  215. package/dist/importer/khrNodeNameGuard.js.map +0 -1
  216. package/dist/importer/launcherBake.d.ts +0 -15
  217. package/dist/importer/launcherBake.js +0 -117
  218. package/dist/importer/launcherBake.js.map +0 -1
  219. package/dist/importer/launcherCadGeometry.d.ts +0 -22
  220. package/dist/importer/launcherCadGeometry.js +0 -185
  221. package/dist/importer/launcherCadGeometry.js.map +0 -1
  222. package/dist/importer/meshIslands.d.ts +0 -17
  223. package/dist/importer/meshIslands.js +0 -102
  224. package/dist/importer/meshIslands.js.map +0 -1
  225. package/dist/importer/meshSliceBuffers.d.ts +0 -15
  226. package/dist/importer/meshSliceBuffers.js +0 -159
  227. package/dist/importer/meshSliceBuffers.js.map +0 -1
  228. package/dist/importer/polygonEarClipYZ.d.ts +0 -3
  229. package/dist/importer/polygonEarClipYZ.js +0 -67
  230. package/dist/importer/polygonEarClipYZ.js.map +0 -1
  231. package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
  232. package/dist/importer/proceduralC12AndCraft.js +0 -302
  233. package/dist/importer/proceduralC12AndCraft.js.map +0 -1
  234. package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
  235. package/dist/importer/proceduralDomainBuilders.js +0 -346
  236. package/dist/importer/proceduralDomainBuilders.js.map +0 -1
  237. package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
  238. package/dist/importer/proceduralPersonAndProp.js +0 -303
  239. package/dist/importer/proceduralPersonAndProp.js.map +0 -1
  240. package/dist/importer/sceneSiNormalize.d.ts +0 -19
  241. package/dist/importer/sceneSiNormalize.js +0 -145
  242. package/dist/importer/sceneSiNormalize.js.map +0 -1
  243. package/dist/importer/starterScene.d.ts +0 -5
  244. package/dist/importer/starterScene.js +0 -139
  245. package/dist/importer/starterScene.js.map +0 -1
  246. package/dist/importer/surfaceCutter.d.ts +0 -16
  247. package/dist/importer/surfaceCutter.js +0 -83
  248. package/dist/importer/surfaceCutter.js.map +0 -1
  249. package/dist/importer/surfaceGeodesic.d.ts +0 -7
  250. package/dist/importer/surfaceGeodesic.js +0 -130
  251. package/dist/importer/surfaceGeodesic.js.map +0 -1
  252. package/dist/importer/surfaceLoopRefine.d.ts +0 -6
  253. package/dist/importer/surfaceLoopRefine.js +0 -171
  254. package/dist/importer/surfaceLoopRefine.js.map +0 -1
  255. package/dist/importer/surfacePeel.d.ts +0 -11
  256. package/dist/importer/surfacePeel.js +0 -119
  257. package/dist/importer/surfacePeel.js.map +0 -1
  258. package/dist/importer/surfaceTopology.d.ts +0 -36
  259. package/dist/importer/surfaceTopology.js +0 -143
  260. package/dist/importer/surfaceTopology.js.map +0 -1
  261. package/dist/importer/universalGateBake.d.ts +0 -45
  262. package/dist/importer/universalGateBake.js +0 -203
  263. package/dist/importer/universalGateBake.js.map +0 -1
  264. package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
  265. package/dist/importer/usdPhysicsSpecs.js +0 -245
  266. package/dist/importer/usdPhysicsSpecs.js.map +0 -1
  267. package/dist/importer/usdTextParse.d.ts +0 -12
  268. package/dist/importer/usdTextParse.js +0 -118
  269. package/dist/importer/usdTextParse.js.map +0 -1
  270. package/dist/importer/usdToGlb.d.ts +0 -12
  271. package/dist/importer/usdToGlb.js +0 -94
  272. package/dist/importer/usdToGlb.js.map +0 -1
  273. package/dist/importer/useChopShopController.d.ts +0 -108
  274. package/dist/importer/useChopShopController.js +0 -201
  275. package/dist/importer/useChopShopController.js.map +0 -1
  276. package/dist/importer/useChopShopState.d.ts +0 -103
  277. package/dist/importer/useChopShopState.js +0 -350
  278. package/dist/importer/useChopShopState.js.map +0 -1
  279. package/dist/importer/useWasdKeyRef.d.ts +0 -9
  280. package/dist/importer/useWasdKeyRef.js +0 -35
  281. package/dist/importer/useWasdKeyRef.js.map +0 -1
  282. package/dist/importer/vehiclePartSplit.d.ts +0 -33
  283. package/dist/importer/vehiclePartSplit.js +0 -183
  284. package/dist/importer/vehiclePartSplit.js.map +0 -1
  285. package/dist/importer/wheelAxlePairing.d.ts +0 -21
  286. package/dist/importer/wheelAxlePairing.js +0 -157
  287. package/dist/importer/wheelAxlePairing.js.map +0 -1
  288. package/dist/importer/wheelCutterHelpers.d.ts +0 -45
  289. package/dist/importer/wheelCutterHelpers.js +0 -208
  290. package/dist/importer/wheelCutterHelpers.js.map +0 -1
  291. package/dist/importer/wheelRingHandleMath.d.ts +0 -20
  292. package/dist/importer/wheelRingHandleMath.js +0 -66
  293. package/dist/importer/wheelRingHandleMath.js.map +0 -1
  294. package/dist/index.js.map +0 -1
  295. package/dist/junk/DestructibleTarget.d.ts +0 -18
  296. package/dist/junk/DestructibleTarget.js +0 -223
  297. package/dist/junk/DestructibleTarget.js.map +0 -1
  298. package/dist/junk/KolmoJunk.d.ts +0 -14
  299. package/dist/junk/KolmoJunk.js +0 -76
  300. package/dist/junk/KolmoJunk.js.map +0 -1
  301. package/dist/junk/ShardPieces.d.ts +0 -13
  302. package/dist/junk/ShardPieces.js +0 -101
  303. package/dist/junk/ShardPieces.js.map +0 -1
  304. package/dist/junk/TargetDecals.d.ts +0 -9
  305. package/dist/junk/TargetDecals.js +0 -77
  306. package/dist/junk/TargetDecals.js.map +0 -1
  307. package/dist/junk/bvhShatter.d.ts +0 -3
  308. package/dist/junk/bvhShatter.js +0 -101
  309. package/dist/junk/bvhShatter.js.map +0 -1
  310. package/dist/junk/bvhTriCollector.d.ts +0 -16
  311. package/dist/junk/bvhTriCollector.js +0 -127
  312. package/dist/junk/bvhTriCollector.js.map +0 -1
  313. package/dist/junk/index.d.ts +0 -13
  314. package/dist/junk/index.js +0 -12
  315. package/dist/junk/index.js.map +0 -1
  316. package/dist/junk/junkGeometry.d.ts +0 -13
  317. package/dist/junk/junkGeometry.js +0 -87
  318. package/dist/junk/junkGeometry.js.map +0 -1
  319. package/dist/junk/junkImportSanitize.d.ts +0 -5
  320. package/dist/junk/junkImportSanitize.js +0 -74
  321. package/dist/junk/junkImportSanitize.js.map +0 -1
  322. package/dist/junk/junkImporter.d.ts +0 -14
  323. package/dist/junk/junkImporter.js +0 -124
  324. package/dist/junk/junkImporter.js.map +0 -1
  325. package/dist/junk/junkLabelCanvas.d.ts +0 -2
  326. package/dist/junk/junkLabelCanvas.js +0 -185
  327. package/dist/junk/junkLabelCanvas.js.map +0 -1
  328. package/dist/junk/junkLabels.d.ts +0 -9
  329. package/dist/junk/junkLabels.js +0 -49
  330. package/dist/junk/junkLabels.js.map +0 -1
  331. package/dist/junk/junkProceduralScenes.d.ts +0 -12
  332. package/dist/junk/junkProceduralScenes.js +0 -220
  333. package/dist/junk/junkProceduralScenes.js.map +0 -1
  334. package/dist/junk/junkTypes.d.ts +0 -48
  335. package/dist/junk/junkTypes.js +0 -0
  336. package/dist/junk/junkTypes.js.map +0 -1
  337. package/dist/junk/targetHelpers.d.ts +0 -55
  338. package/dist/junk/targetHelpers.js +0 -157
  339. package/dist/junk/targetHelpers.js.map +0 -1
  340. package/dist/junk/targetHitLogic.d.ts +0 -30
  341. package/dist/junk/targetHitLogic.js +0 -163
  342. package/dist/junk/targetHitLogic.js.map +0 -1
  343. package/dist/junk/useTargetAssets.d.ts +0 -19
  344. package/dist/junk/useTargetAssets.js +0 -130
  345. package/dist/junk/useTargetAssets.js.map +0 -1
  346. package/dist/physics/index.js.map +0 -1
  347. package/dist/sand3d/KolmoSand3D.d.ts +0 -19
  348. package/dist/sand3d/KolmoSand3D.js +0 -92
  349. package/dist/sand3d/KolmoSand3D.js.map +0 -1
  350. package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
  351. package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
  352. package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
  353. package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
  354. package/dist/sand3d/gateBakeHelpers.js +0 -225
  355. package/dist/sand3d/gateBakeHelpers.js.map +0 -1
  356. package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
  357. package/dist/sand3d/gateDoorwayBake.js +0 -203
  358. package/dist/sand3d/gateDoorwayBake.js.map +0 -1
  359. package/dist/sand3d/index.d.ts +0 -3
  360. package/dist/sand3d/index.js +0 -4
  361. package/dist/sand3d/index.js.map +0 -1
  362. package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
  363. package/dist/sand3d/sand3dAssetLoader.js +0 -177
  364. package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
  365. package/dist/schema/kolmoSchema.d.ts +0 -9
  366. package/dist/schema/kolmoSchema.js +0 -110
  367. package/dist/schema/kolmoSchema.js.map +0 -1
  368. package/dist/schema/kolmoStamp.d.ts +0 -11
  369. package/dist/schema/kolmoStamp.js +0 -119
  370. package/dist/schema/kolmoStamp.js.map +0 -1
  371. package/dist/schema/kolmoTypes.d.ts +0 -63
  372. package/dist/schema/kolmoTypes.js +0 -66
  373. package/dist/schema/kolmoTypes.js.map +0 -1
  374. package/dist/shaders/celestialBackdrop.d.ts +0 -14
  375. package/dist/shaders/celestialBackdrop.js +0 -181
  376. package/dist/shaders/celestialBackdrop.js.map +0 -1
  377. package/dist/shaders/emitterShaders.d.ts +0 -9
  378. package/dist/shaders/emitterShaders.js +0 -114
  379. package/dist/shaders/emitterShaders.js.map +0 -1
  380. package/dist/shaders/index.d.ts +0 -5
  381. package/dist/shaders/index.js +0 -12
  382. package/dist/shaders/index.js.map +0 -1
  383. package/dist/shaders/plumeAndSparkle.d.ts +0 -12
  384. package/dist/shaders/plumeAndSparkle.js +0 -233
  385. package/dist/shaders/plumeAndSparkle.js.map +0 -1
  386. package/dist/shaders/ps2GlslShared.d.ts +0 -20
  387. package/dist/shaders/ps2GlslShared.js +0 -30
  388. package/dist/shaders/ps2GlslShared.js.map +0 -1
  389. package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
  390. package/dist/shaders/ps2MaterialsTSL.js +0 -146
  391. package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
  392. package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
  393. package/dist/shaders/ps2MaterialsWebGL.js +0 -57
  394. package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
  395. package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
  396. package/dist/shaders/ps2RoadWebGL.js +0 -138
  397. package/dist/shaders/ps2RoadWebGL.js.map +0 -1
  398. package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
  399. package/dist/shaders/ps2TerrainWebGL.js +0 -131
  400. package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
  401. package/dist/shaders/ps2Textures.d.ts +0 -22
  402. package/dist/shaders/ps2Textures.js +0 -299
  403. package/dist/shaders/ps2Textures.js.map +0 -1
  404. package/dist/shaders/retroPalettes.d.ts +0 -24
  405. package/dist/shaders/retroPalettes.js +0 -221
  406. package/dist/shaders/retroPalettes.js.map +0 -1
  407. package/dist/shaders/retroShader.d.ts +0 -13
  408. package/dist/shaders/retroShader.js +0 -110
  409. package/dist/shaders/retroShader.js.map +0 -1
  410. package/dist/shaders/retroUniforms.d.ts +0 -60
  411. package/dist/shaders/retroUniforms.js +0 -215
  412. package/dist/shaders/retroUniforms.js.map +0 -1
  413. package/dist/shaders/skyboxShaders.d.ts +0 -16
  414. package/dist/shaders/skyboxShaders.js +0 -266
  415. package/dist/shaders/skyboxShaders.js.map +0 -1
  416. package/dist/shaders/tsl.d.ts +0 -1
  417. package/dist/shaders/tsl.js +0 -1
  418. package/dist/shaders/tsl.js.map +0 -1
  419. package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
  420. package/dist/suika/KolmoSuikaOrb.js +0 -375
  421. package/dist/suika/KolmoSuikaOrb.js.map +0 -1
  422. package/dist/suika/index.d.ts +0 -4
  423. package/dist/suika/index.js +0 -5
  424. package/dist/suika/index.js.map +0 -1
  425. package/dist/suika/suikaArbiter.d.ts +0 -60
  426. package/dist/suika/suikaArbiter.js +0 -265
  427. package/dist/suika/suikaArbiter.js.map +0 -1
  428. package/dist/suika/suikaGeometry.d.ts +0 -10
  429. package/dist/suika/suikaGeometry.js +0 -251
  430. package/dist/suika/suikaGeometry.js.map +0 -1
  431. package/dist/suika/suikaTypes.d.ts +0 -74
  432. package/dist/suika/suikaTypes.js +0 -196
  433. package/dist/suika/suikaTypes.js.map +0 -1
  434. package/dist/world/frontage.d.ts +0 -26
  435. package/dist/world/frontage.js +0 -36
  436. package/dist/world/frontage.js.map +0 -1
  437. package/dist/world/index.d.ts +0 -9
  438. package/dist/world/index.js +0 -12
  439. package/dist/world/index.js.map +0 -1
  440. package/dist/world/infiniteWorld2D.d.ts +0 -19
  441. package/dist/world/infiniteWorld2D.js +0 -219
  442. package/dist/world/infiniteWorld2D.js.map +0 -1
  443. package/dist/world/island.d.ts +0 -29
  444. package/dist/world/island.js +0 -116
  445. package/dist/world/island.js.map +0 -1
  446. package/dist/world/islandPathing.d.ts +0 -6
  447. package/dist/world/islandPathing.js +0 -166
  448. package/dist/world/islandPathing.js.map +0 -1
  449. package/dist/world/macroCellSchema.d.ts +0 -72
  450. package/dist/world/macroCellSchema.js +0 -34
  451. package/dist/world/macroCellSchema.js.map +0 -1
  452. package/dist/world/macroKnightAStar.d.ts +0 -11
  453. package/dist/world/macroKnightAStar.js +0 -240
  454. package/dist/world/macroKnightAStar.js.map +0 -1
  455. package/dist/world/macroSettlementZones.d.ts +0 -9
  456. package/dist/world/macroSettlementZones.js +0 -108
  457. package/dist/world/macroSettlementZones.js.map +0 -1
  458. package/dist/world/random.d.ts +0 -23
  459. package/dist/world/random.js +0 -59
  460. package/dist/world/random.js.map +0 -1
  461. package/dist/world/road.d.ts +0 -37
  462. package/dist/world/road.js +0 -198
  463. package/dist/world/road.js.map +0 -1
  464. package/dist/world/roadRibbon.d.ts +0 -29
  465. package/dist/world/roadRibbon.js +0 -166
  466. package/dist/world/roadRibbon.js.map +0 -1
  467. package/dist/world/terrain.d.ts +0 -62
  468. package/dist/world/terrain.js +0 -133
  469. package/dist/world/terrain.js.map +0 -1
  470. package/dist/world/terrainGeometry.d.ts +0 -14
  471. package/dist/world/terrainGeometry.js +0 -76
  472. package/dist/world/terrainGeometry.js.map +0 -1
  473. package/dist/world/worldTypes.d.ts +0 -43
  474. package/dist/world/worldTypes.js +0 -197
  475. package/dist/world/worldTypes.js.map +0 -1
  476. package/docs/api-reference.md +0 -148
  477. package/skills/kolmo-engine/SKILL.md +0 -111
@@ -1,185 +0,0 @@
1
- import * as THREE from "three";
2
- // src/importer/launcherCadGeometry.ts
3
- function finalizeCadGeometry(geo) {
4
- const nonIdx = geo.index ? geo.toNonIndexed() : geo;
5
- if (nonIdx !== geo) geo.dispose();
6
- nonIdx.computeVertexNormals();
7
- nonIdx.computeBoundingBox();
8
- nonIdx.computeBoundingSphere();
9
- return nonIdx;
10
- }
11
- /**
12
- * Extrudes a 2D YZ side profile ([z, y]) along X centered on X = 0 with crisp faceted normals.
13
- */
14
- function extrudeCadSideProfile(pointsZY, widthX, holesZY = []) {
15
- const shape = new THREE.Shape();
16
- pointsZY.forEach(([z, y], idx) => idx === 0 ? shape.moveTo(z, y) : shape.lineTo(z, y));
17
- shape.closePath();
18
- for (const holePts of holesZY) {
19
- if (holePts.length < 3) continue;
20
- const hole = new THREE.Path();
21
- holePts.forEach(([z, y], idx) => idx === 0 ? hole.moveTo(z, y) : hole.lineTo(z, y));
22
- hole.closePath();
23
- shape.holes.push(hole);
24
- }
25
- const depth = Math.max(.001, widthX);
26
- const geo = new THREE.ExtrudeGeometry(shape, {
27
- depth,
28
- steps: 1,
29
- curveSegments: 4,
30
- bevelEnabled: false
31
- });
32
- geo.translate(0, 0, -depth * .5);
33
- geo.rotateY(-Math.PI / 2);
34
- return finalizeCadGeometry(geo);
35
- }
36
- /**
37
- * Extrudes a 2D XY cross-section along Z centered on Z = 0.
38
- */
39
- function extrudeCadFrontProfile(pointsXY, lengthZ) {
40
- const shape = new THREE.Shape();
41
- pointsXY.forEach(([x, y], idx) => idx === 0 ? shape.moveTo(x, y) : shape.lineTo(x, y));
42
- shape.closePath();
43
- const depth = Math.max(.001, lengthZ);
44
- const geo = new THREE.ExtrudeGeometry(shape, {
45
- depth,
46
- steps: 1,
47
- curveSegments: 4,
48
- bevelEnabled: false
49
- });
50
- geo.translate(0, 0, -depth * .5);
51
- return finalizeCadGeometry(geo);
52
- }
53
- /**
54
- * Builds a genuinely HOLLOW faceted octagonal tube (outer wall + front crown + inner bore + rear face)
55
- * aligned along +Z centered on Z = 0 (`8` radial segments = 64 crisp triangles total).
56
- */
57
- function buildHollowBoreTubeZ(outerRadius, innerRadius, lengthZ, radialSegments = 8) {
58
- const segs = Math.min(12, Math.max(6, radialSegments));
59
- const or = Math.max(.002, outerRadius);
60
- const ir = Math.min(Math.max(8e-4, innerRadius), or - 8e-4);
61
- const hz = Math.max(.002, lengthZ * .5);
62
- const pts = [
63
- [ir, -hz],
64
- [or, -hz],
65
- [or, hz],
66
- [ir, hz],
67
- [ir, -hz]
68
- ];
69
- const geo = new THREE.LatheGeometry(pts.map(([r, z]) => new THREE.Vector2(r, z)), segs);
70
- geo.rotateX(Math.PI / 2);
71
- return finalizeCadGeometry(geo);
72
- }
73
- /**
74
- * Outward-facing faceted LatheGeometry aligned along +Z centered on Z = 0.
75
- */
76
- function buildCadLatheZ(pointsRZ, radialSegments = 8) {
77
- const vecs = pointsRZ.map(([r, z]) => new THREE.Vector2(Math.max(1e-4, r), z));
78
- const geo = new THREE.LatheGeometry(vecs, radialSegments);
79
- geo.rotateX(Math.PI / 2);
80
- return finalizeCadGeometry(geo);
81
- }
82
- /**
83
- * Builds a role-specific CAD BufferGeometry sized to `[sx, sy, sz]` (derived from threejs-khr-armory's CAD kernel).
84
- */
85
- function buildLauncherPartCadGeometry(role, size, recipeId = "") {
86
- const [sx, sy, sz] = size;
87
- const hx = sx * .5;
88
- const hy = sy * .5;
89
- const hz = sz * .5;
90
- if (role === "barrel") {
91
- const outerR = Math.max(sx, sy) * .5;
92
- if (recipeId.includes("rpg")) return buildCadLatheZ([
93
- [outerR * .78, -hz],
94
- [outerR * 1.15, -hz],
95
- [outerR * .85, -hz * .55],
96
- [outerR, -hz * .2],
97
- [outerR, hz * .85],
98
- [outerR * 1.18, hz],
99
- [outerR * .74, hz],
100
- [outerR * .74, -hz]
101
- ], 8);
102
- return buildHollowBoreTubeZ(outerR, outerR * .62, sz, 8);
103
- }
104
- if (role === "pump") {
105
- const rMax = Math.max(sx, sy) * .5;
106
- const rEnd = rMax * .62;
107
- return buildCadLatheZ([
108
- [rEnd, -hz],
109
- [rMax, -hz * .82],
110
- [rMax, hz * .82],
111
- [rEnd, hz]
112
- ], 8);
113
- }
114
- if (role === "bolt") {
115
- const wall = Math.max(.0025, sx * .22);
116
- const roof = Math.max(.003, sy * .28);
117
- return extrudeCadFrontProfile([
118
- [-hx, -hy],
119
- [-hx + wall, -hy],
120
- [-hx + wall, hy - roof],
121
- [hx - wall, hy - roof],
122
- [hx - wall, -hy],
123
- [hx, -hy],
124
- [hx, hy * .68],
125
- [hx * .72, hy],
126
- [-hx * .72, hy],
127
- [-hx, hy * .68]
128
- ], sz);
129
- }
130
- if (role === "trigger") return extrudeCadSideProfile([
131
- [-hz * .35, hy],
132
- [hz * .45, hy],
133
- [hz * .2, 0],
134
- [hz * .55, -hy * .78],
135
- [hz * .15, -hy],
136
- [-hz * .45, -hy * .62],
137
- [-hz * .2, 0]
138
- ], sx);
139
- if (role === "magazine") {
140
- const rake = sz * .22;
141
- return extrudeCadSideProfile([
142
- [-hz + rake, -hy],
143
- [hz + rake, -hy],
144
- [hz, hy],
145
- [-hz, hy]
146
- ], sx);
147
- }
148
- if (role === "stock") return extrudeCadSideProfile([
149
- [hz, hy * .62],
150
- [hz, -hy * .18],
151
- [hz * .75, -hy * .36],
152
- [-hz, -hy],
153
- [-hz, hy * .28],
154
- [-hz * .15, hy * .46]
155
- ], sx);
156
- if (role === "screen_rect") return extrudeCadFrontProfile([
157
- [-hx, -hy],
158
- [hx, -hy],
159
- [hx, hy],
160
- [-hx, hy]
161
- ], sz);
162
- const guardHole = [
163
- [-hz * .08, -hy * .82],
164
- [hz * .28, -hy * .82],
165
- [hz * .24, -hy * .32],
166
- [-hz * .08, -hy * .32]
167
- ];
168
- return extrudeCadSideProfile([
169
- [-hz, -hy * .25],
170
- [-hz * .82, -hy],
171
- [-hz * .36, -hy],
172
- [-hz * .18, -hy * .35],
173
- [-hz * .12, -hy * .92],
174
- [hz * .34, -hy * .92],
175
- [hz * .42, -hy * .28],
176
- [hz, -hy * .28],
177
- [hz, hy * .74],
178
- [hz * .88, hy],
179
- [-hz * .86, hy],
180
- [-hz, hy * .65]
181
- ], sx, [guardHole]);
182
- }
183
- export { buildCadLatheZ, buildHollowBoreTubeZ, buildLauncherPartCadGeometry, extrudeCadFrontProfile, extrudeCadSideProfile };
184
-
185
- //# sourceMappingURL=launcherCadGeometry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"launcherCadGeometry.js","names":[],"sources":["../../src/importer/launcherCadGeometry.ts"],"sourcesContent":["import * as THREE from \"three\";\n\nfunction finalizeCadGeometry(geo: THREE.BufferGeometry): THREE.BufferGeometry {\n const nonIdx = geo.index ? geo.toNonIndexed() : geo;\n if (nonIdx !== geo) geo.dispose();\n nonIdx.computeVertexNormals();\n nonIdx.computeBoundingBox();\n nonIdx.computeBoundingSphere();\n return nonIdx;\n}\n\n/**\n * Extrudes a 2D YZ side profile ([z, y]) along X centered on X = 0 with crisp faceted normals.\n */\nexport function extrudeCadSideProfile(\n pointsZY: readonly [number, number][],\n widthX: number,\n holesZY: readonly (readonly [number, number][])[] = [],\n): THREE.BufferGeometry {\n const shape = new THREE.Shape();\n pointsZY.forEach(([z, y], idx) => (idx === 0 ? shape.moveTo(z, y) : shape.lineTo(z, y)));\n shape.closePath();\n\n for (const holePts of holesZY) {\n if (holePts.length < 3) continue;\n const hole = new THREE.Path();\n holePts.forEach(([z, y], idx) => (idx === 0 ? hole.moveTo(z, y) : hole.lineTo(z, y)));\n hole.closePath();\n shape.holes.push(hole);\n }\n\n const depth = Math.max(0.001, widthX);\n const geo = new THREE.ExtrudeGeometry(shape, { depth, steps: 1, curveSegments: 4, bevelEnabled: false });\n geo.translate(0, 0, -depth * 0.5);\n geo.rotateY(-Math.PI / 2);\n return finalizeCadGeometry(geo);\n}\n\n/**\n * Extrudes a 2D XY cross-section along Z centered on Z = 0.\n */\nexport function extrudeCadFrontProfile(\n pointsXY: readonly [number, number][],\n lengthZ: number,\n): THREE.BufferGeometry {\n const shape = new THREE.Shape();\n pointsXY.forEach(([x, y], idx) => (idx === 0 ? shape.moveTo(x, y) : shape.lineTo(x, y)));\n shape.closePath();\n const depth = Math.max(0.001, lengthZ);\n const geo = new THREE.ExtrudeGeometry(shape, { depth, steps: 1, curveSegments: 4, bevelEnabled: false });\n geo.translate(0, 0, -depth * 0.5);\n return finalizeCadGeometry(geo);\n}\n\n/**\n * Builds a genuinely HOLLOW faceted octagonal tube (outer wall + front crown + inner bore + rear face)\n * aligned along +Z centered on Z = 0 (`8` radial segments = 64 crisp triangles total).\n */\nexport function buildHollowBoreTubeZ(\n outerRadius: number,\n innerRadius: number,\n lengthZ: number,\n radialSegments = 8,\n): THREE.BufferGeometry {\n const segs = Math.min(12, Math.max(6, radialSegments));\n const or = Math.max(0.002, outerRadius);\n const ir = Math.min(Math.max(0.0008, innerRadius), or - 0.0008);\n const hz = Math.max(0.002, lengthZ * 0.5);\n const pts: [number, number][] = [\n [ir, -hz],\n [or, -hz],\n [or, hz],\n [ir, hz],\n [ir, -hz],\n ];\n const geo = new THREE.LatheGeometry(pts.map(([r, z]) => new THREE.Vector2(r, z)), segs);\n geo.rotateX(Math.PI / 2);\n return finalizeCadGeometry(geo);\n}\n\n/**\n * Outward-facing faceted LatheGeometry aligned along +Z centered on Z = 0.\n */\nexport function buildCadLatheZ(\n pointsRZ: readonly [number, number][],\n radialSegments = 8,\n): THREE.BufferGeometry {\n const vecs = pointsRZ.map(([r, z]) => new THREE.Vector2(Math.max(0.0001, r), z));\n const geo = new THREE.LatheGeometry(vecs, radialSegments);\n geo.rotateX(Math.PI / 2);\n return finalizeCadGeometry(geo);\n}\n\n/**\n * Builds a role-specific CAD BufferGeometry sized to `[sx, sy, sz]` (derived from threejs-khr-armory's CAD kernel).\n */\nexport function buildLauncherPartCadGeometry(\n role: string,\n size: readonly [number, number, number],\n recipeId = \"\",\n): THREE.BufferGeometry {\n const [sx, sy, sz] = size;\n const hx = sx * 0.5;\n const hy = sy * 0.5;\n const hz = sz * 0.5;\n\n if (role === \"barrel\") {\n const outerR = Math.max(sx, sy) * 0.5;\n if (recipeId.includes(\"rpg\")) {\n return buildCadLatheZ(\n [\n [outerR * 0.78, -hz], [outerR * 1.15, -hz], [outerR * 0.85, -hz * 0.55], [outerR, -hz * 0.2],\n [outerR, hz * 0.85], [outerR * 1.18, hz], [outerR * 0.74, hz], [outerR * 0.74, -hz],\n ],\n 8,\n );\n }\n return buildHollowBoreTubeZ(outerR, outerR * 0.62, sz, 8);\n }\n\n if (role === \"pump\") {\n const rMax = Math.max(sx, sy) * 0.5;\n const rEnd = rMax * 0.62;\n return buildCadLatheZ([[rEnd, -hz], [rMax, -hz * 0.82], [rMax, hz * 0.82], [rEnd, hz]], 8);\n }\n\n if (role === \"bolt\") {\n const wall = Math.max(0.0025, sx * 0.22);\n const roof = Math.max(0.003, sy * 0.28);\n return extrudeCadFrontProfile(\n [\n [-hx, -hy], [-hx + wall, -hy], [-hx + wall, hy - roof], [hx - wall, hy - roof], [hx - wall, -hy],\n [hx, -hy], [hx, hy * 0.68], [hx * 0.72, hy], [-hx * 0.72, hy], [-hx, hy * 0.68],\n ],\n sz,\n );\n }\n\n if (role === \"trigger\") {\n return extrudeCadSideProfile(\n [\n [-hz * 0.35, hy], [hz * 0.45, hy], [hz * 0.2, 0], [hz * 0.55, -hy * 0.78],\n [hz * 0.15, -hy], [-hz * 0.45, -hy * 0.62], [-hz * 0.2, 0],\n ],\n sx,\n );\n }\n\n if (role === \"magazine\") {\n const rake = sz * 0.22;\n return extrudeCadSideProfile([[-hz + rake, -hy], [hz + rake, -hy], [hz, hy], [-hz, hy]], sx);\n }\n\n if (role === \"stock\") {\n return extrudeCadSideProfile(\n [\n [hz, hy * 0.62], [hz, -hy * 0.18], [hz * 0.75, -hy * 0.36],\n [-hz, -hy], [-hz, hy * 0.28], [-hz * 0.15, hy * 0.46],\n ],\n sx,\n );\n }\n\n if (role === \"screen_rect\") {\n return extrudeCadFrontProfile([[-hx, -hy], [hx, -hy], [hx, hy], [-hx, hy]], sz);\n }\n\n // Default `receiver`: monolithic receiver silhouette with integral trigger guard window & raked grip tang\n const guardHole: [number, number][] = [\n [-hz * 0.08, -hy * 0.82], [hz * 0.28, -hy * 0.82], [hz * 0.24, -hy * 0.32], [-hz * 0.08, -hy * 0.32],\n ];\n return extrudeCadSideProfile(\n [\n [-hz, -hy * 0.25], [-hz * 0.82, -hy], [-hz * 0.36, -hy], [-hz * 0.18, -hy * 0.35],\n [-hz * 0.12, -hy * 0.92], [hz * 0.34, -hy * 0.92], [hz * 0.42, -hy * 0.28], [hz, -hy * 0.28],\n [hz, hy * 0.74], [hz * 0.88, hy], [-hz * 0.86, hy], [-hz, hy * 0.65],\n ],\n sx,\n [guardHole],\n );\n}\n"],"mappings":";;AAEA,SAAS,oBAAoB,KAAiD;CAC1E,MAAM,SAAS,IAAI,QAAQ,IAAI,aAAa,IAAI;CAChD,IAAI,WAAW,KAAK,IAAI,QAAQ;CAChC,OAAO,qBAAqB;CAC5B,OAAO,mBAAmB;CAC1B,OAAO,sBAAsB;CAC7B,OAAO;AACX;;;;AAKA,SAAgB,sBACZ,UACA,QACA,UAAoD,CAAC,GACjC;CACpB,MAAM,QAAQ,IAAI,MAAM,MAAM;CAC9B,SAAS,SAAS,CAAC,GAAG,IAAI,QAAS,QAAQ,IAAI,MAAM,OAAO,GAAG,CAAC,IAAI,MAAM,OAAO,GAAG,CAAC,CAAE;CACvF,MAAM,UAAU;CAEhB,KAAK,MAAM,WAAW,SAAS;EAC3B,IAAI,QAAQ,SAAS,GAAG;EACxB,MAAM,OAAO,IAAI,MAAM,KAAK;EAC5B,QAAQ,S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import { normalizeSceneToSi, sliceMeshTriangles, type NormalizedSiScene, type OrientTurns, type QuarterTurn, type ScaleAxis } from "./sceneSiNormalize.js";
3
- import { separateVehicleMeshes, type SeparatedPanelMesh, type SeparatedVehicleMeshes, type SeparatedWheelMesh } from "./vehiclePartSplit.js";
4
- import { measureSelection, suggestCarAxles, toggleIslandSelection, type SelectionBounds, type WheelAxle } from "./wheelAxlePairing.js";
5
- export interface MeshIsland {
6
- id: number;
7
- mesh: THREE.Mesh;
8
- geometry: THREE.BufferGeometry;
9
- material: THREE.Material;
10
- triangleIndices: Uint32Array;
11
- min: [number, number, number];
12
- max: [number, number, number];
13
- center: [number, number, number];
14
- size: [number, number, number];
15
- }
16
- export { measureSelection, normalizeSceneToSi, separateVehicleMeshes, sliceMeshTriangles, suggestCarAxles, toggleIslandSelection, type NormalizedSiScene, type OrientTurns, type QuarterTurn, type ScaleAxis, type SelectionBounds, type SeparatedPanelMesh, type SeparatedVehicleMeshes, type SeparatedWheelMesh, type WheelAxle, };
17
- export declare function extractMeshIslands(normalizedScene: THREE.Object3D, weldTolerance?: number): MeshIsland[];
@@ -1,102 +0,0 @@
1
- import { bakeGeometryTransform, isMeshObject, normalizeSceneToSi, primaryMatOf, sliceMeshTriangles } from "./sceneSiNormalize.js";
2
- import { separateVehicleMeshes } from "./vehiclePartSplit.js";
3
- import { measureSelection, suggestCarAxles, toggleIslandSelection } from "./wheelAxlePairing.js";
4
- import * as THREE from "three";
5
- // src/importer/meshIslands.ts
6
- var UnionFind = class {
7
- p;
8
- constructor(n) {
9
- this.p = new Int32Array(n);
10
- for (let i = 0; i < n; i++) this.p[i] = i;
11
- }
12
- find(x) {
13
- let root = x;
14
- while (this.p[root] !== root) root = this.p[root];
15
- for (let cur = x; cur !== root;) {
16
- const next = this.p[cur];
17
- this.p[cur] = root;
18
- cur = next;
19
- }
20
- return root;
21
- }
22
- union(a, b) {
23
- const ra = this.find(a), rb = this.find(b);
24
- if (ra !== rb) this.p[rb] = ra;
25
- }
26
- };
27
- function extractMeshIslands(normalizedScene, weldTolerance = 1e-4) {
28
- const invTol = 1 / Math.max(1e-7, weldTolerance);
29
- normalizedScene.updateMatrixWorld(true);
30
- const invRoot = new THREE.Matrix4().copy(normalizedScene.matrixWorld).invert();
31
- const relMat = new THREE.Matrix4();
32
- const islands = [];
33
- let nextId = 0;
34
- normalizedScene.traverse((obj) => {
35
- if (!isMeshObject(obj)) return;
36
- const pos = obj.geometry.getAttribute("position");
37
- if (!pos || pos.count < 3) return;
38
- const baked = bakeGeometryTransform(obj.geometry, relMat.multiplyMatrices(invRoot, obj.matrixWorld));
39
- const bPos = baked.getAttribute("position");
40
- const index = baked.getIndex();
41
- const triCount = Math.floor((index ? index.count : bPos.count) / 3);
42
- if (triCount === 0) return;
43
- const uf = new UnionFind(triCount);
44
- const vertToTri = /* @__PURE__ */ new Map();
45
- for (let t = 0; t < triCount; t++) for (let c = 0; c < 3; c++) {
46
- const vi = index ? index.getX(t * 3 + c) : t * 3 + c;
47
- const vKey = `${Math.round(bPos.getX(vi) * invTol)},${Math.round(bPos.getY(vi) * invTol)},${Math.round(bPos.getZ(vi) * invTol)}`;
48
- const prevTri = vertToTri.get(vKey);
49
- if (prevTri === void 0) vertToTri.set(vKey, t);
50
- else uf.union(t, prevTri);
51
- }
52
- const groups = /* @__PURE__ */ new Map();
53
- for (let t = 0; t < triCount; t++) {
54
- const root = uf.find(t);
55
- let list = groups.get(root);
56
- if (!list) {
57
- list = [];
58
- groups.set(root, list);
59
- }
60
- list.push(t);
61
- }
62
- const mat = primaryMatOf(obj);
63
- for (const triList of groups.values()) {
64
- const triIndices = new Uint32Array(triList);
65
- const subGeo = sliceMeshTriangles(baked, triIndices);
66
- const bb = subGeo.boundingBox;
67
- const min = [
68
- bb.min.x,
69
- bb.min.y,
70
- bb.min.z
71
- ];
72
- const max = [
73
- bb.max.x,
74
- bb.max.y,
75
- bb.max.z
76
- ];
77
- islands.push({
78
- id: nextId++,
79
- mesh: obj,
80
- geometry: subGeo,
81
- material: mat,
82
- triangleIndices: triIndices,
83
- min,
84
- max,
85
- size: [
86
- max[0] - min[0],
87
- max[1] - min[1],
88
- max[2] - min[2]
89
- ],
90
- center: [
91
- (min[0] + max[0]) * .5,
92
- (min[1] + max[1]) * .5,
93
- (min[2] + max[2]) * .5
94
- ]
95
- });
96
- }
97
- });
98
- return islands;
99
- }
100
- export { extractMeshIslands, measureSelection, normalizeSceneToSi, separateVehicleMeshes, sliceMeshTriangles, suggestCarAxles, toggleIslandSelection };
101
-
102
- //# sourceMappingURL=meshIslands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meshIslands.js","names":[],"sources":["../../src/importer/meshIslands.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport {\n bakeGeometryTransform,\n isMeshObject,\n normalizeSceneToSi,\n primaryMatOf,\n sliceMeshTriangles,\n type NormalizedSiScene,\n type OrientTurns,\n type QuarterTurn,\n type ScaleAxis,\n} from \"./sceneSiNormalize.js\";\nimport {\n separateVehicleMeshes,\n type SeparatedPanelMesh,\n type SeparatedVehicleMeshes,\n type SeparatedWheelMesh,\n} from \"./vehiclePartSplit.js\";\nimport {\n measureSelection,\n suggestCarAxles,\n toggleIslandSelection,\n type SelectionBounds,\n type WheelAxle,\n} from \"./wheelAxlePairing.js\";\n\nexport interface MeshIsland {\n id: number;\n mesh: THREE.Mesh;\n geometry: THREE.BufferGeometry;\n material: THREE.Material;\n triangleIndices: Uint32Array;\n min: [number, number, number];\n max: [number, number, number];\n center: [number, number, number];\n size: [number, number, number];\n}\n\nexport {\n measureSelection,\n normalizeSceneToSi,\n separateVehicleMeshes,\n sliceMeshTriangles,\n suggestCarAxles,\n toggleIslandSelection,\n type NormalizedSiScene,\n type OrientTurns,\n type QuarterTurn,\n type ScaleAxis,\n type SelectionBounds,\n type SeparatedPanelMesh,\n type SeparatedVehicleMeshes,\n type SeparatedWheelMesh,\n type WheelAxle,\n};\n\nclass UnionFind {\n private readonly p: Int32Array;\n constructor(n: number) {\n this.p = new Int32Array(n);\n for (let i = 0; i < n; i++) this.p[i] = i;\n }\n find(x: number): number {\n let root = x;\n while (this.p[root] !== root) root = this.p[root];\n for (let cur = x; cur !== root; ) { const next = this.p[cur]; this.p[cur] = root; cur = next; }\n return root;\n }\n union(a: number, b: number): void {\n const ra = this.find(a), rb = this.find(b);\n if (ra !== rb) this.p[rb] = ra;\n }\n}\n\nexport function extractMeshIslands(normalizedScene: THREE.Object3D, weldTolerance = 1e-4): MeshIsland[] {\n const invTol = 1 / Math.max(1e-7, weldTolerance);\n normalizedScene.updateMatrixWorld(true);\n const invRoot = new THREE.Matrix4().copy(normalizedScene.matrixWorld).invert();\n const relMat = new THREE.Matrix4();\n const islands: MeshIsland[] = [];\n let nextId = 0;\n\n normalizedScene.traverse((obj) => {\n if (!isMeshObject(obj)) return;\n const pos = obj.geometry.getAttribute(\"position\");\n if (!pos || pos.count < 3) return;\n\n const baked = bakeGeometryTransform(obj.geometry, relMat.multiplyMatrices(invRoot, obj.matrixWorld));\n const bPos = baked.getAttribute(\"position\");\n const index = baked.getIndex();\n const triCount = Math.floor((index ? index.count : bPos.count) / 3);\n if (triCount === 0) return;\n\n const uf = new UnionFind(triCount);\n const vertToTri = new Map<string, number>();\n for (let t = 0; t < triCount; t++) {\n for (let c = 0; c < 3; c++) {\n const vi = index ? index.getX(t * 3 + c) : t * 3 + c;\n const vKey = `${Math.round(bPos.getX(vi) * invTol)},${Math.round(bPos.getY(vi) * invTol)},${Math.round(bPos.getZ(vi) * invTol)}`;\n const prevTri = vertToTri.get(vKey);\n if (prevTri === undefined) vertToTri.set(vKey, t);\n else uf.union(t, prevTri);\n }\n }\n\n const groups = new Map<number, number[]>();\n for (let t = 0; t < triCount; t++) {\n const root = uf.find(t);\n let list = groups.get(root);\n if (!list) { list = []; groups.set(root, list); }\n list.push(t);\n }\n\n const mat = primaryMatOf(obj);\n for (const triList of groups.values()) {\n const triIndices = new Uint32Array(triList);\n const subGeo = sliceMeshTriangles(baked, triIndices);\n const bb = subGeo.boundingBox!;\n const min: [number, number, number] = [bb.min.x, bb.min.y, bb.min.z];\n const max: [number, number, number] = [bb.max.x, bb.max.y, bb.max.z];\n islands.push({\n id: nextId++, mesh: obj, geometry: subGeo, material: mat, triangleIndices: triIndices,\n min, max,\n size: [max[0] - min[0], max[1] - min[1], max[2] - min[2]],\n center: [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5, (min[2] + max[2]) * 0.5],\n });\n }\n });\n\n return islands;\n}\n"],"mappings":";;;;;AAwDA,IAAM,YAAN,MAAgB;CACZ;CACA,YAAY,GAAW;EACnB,KAAK,IAAI,IAAI,WAAW,CAAC;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK,EAAE,KAAK;CAC5C;CACA,KAAK,GAAmB;EACpB,IAAI,OAAO;EACX,OAAO,KAAK,EAAE,UAAU,MAAM,OAAO,KAAK,EAAE;EAC5C,KAAK,IAAI,MAAM,GAAG,QAAQ,OAAQ;GAAE,MAAM,OAAO,KAAK,EAAE;GAAM,KAAK,EAAE,OAAO;GAAM,MAAM;EAAM;EAC9F,OAAO;CACX;CACA,MAAM,GAAW,GAAiB;EAC9B,MAAM,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,KAAK,KAAK,CAAC;EACzC,IAAI,OAAO,IAAI,KAAK,EAAE,MAAM;CAChC;AACJ;AAEA,SAAgB,mBAAmB,iBAAiC,gBAAgB,MAAoB;CACpG,MAAM,SAAS,IAAI,KAAK,IAAI,MAAM,aAAa;CAC/C,gBAAgB,kBAAkB,IAAI;CACtC,MAAM,UAAU,IAAI,MAAM,QAAQ,CAAC,CAAC,KAAK,gBAAgB,WAAW,CAAC,CAAC,OAAO;CAC7E,MAAM,SAAS,IAAI,MAAM,QAAQ;CACjC,MAAM,UAAwB,CAAC;CAC/B,IAAI,SAAS;CAEb,gBAAgB,UAAU,QAAQ;EAC9B,IAAI,CAAC,aAAa,GAAG,GAAG;EACxB,MAAM,MAAM,IAAI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SAAS,mBAAmB,OAAO,UAAU;GACnD,MAAM,KAAK,OAAO;GAClB,MAAM,MAAgC;IAAC,GAAG,IAAI;IAAG,GAAG,IAAI;IAAG,GAAG,IAAI;GAAC;GACnE,MAAM,MAAgC;IAAC,GAAG,IAAI;IAAG,GAAG,IAAI;IAAG,GAAG,IAAI;GAAC;GACnE,QAAQ,KAAK;IACT,IAAI;IAAU,MAAM;IAAK,UAAU;IAAQ,UAAU;IAAK,iBAAiB;IAC3E;IAAK;IACL,MAAM;KAAC,IAAI,KAAK,IAAI;KAAI,IAAI,KAAK,IAAI;KAAI,IAAI,KAAK,IAAI;IAAE;IACxD,QAAQ;MAAE,IAAI,KAAK,IAAI,MAAM;MAAM,IAAI,KAAK,IAAI,MAAM;MAAM,IAAI,KAAK,IAAI,MAAM;IAAG;GACtF,CAAC;EACL;CACJ,CAAC;CAED,OAAO;AACX"}
@@ -1,15 +0,0 @@
1
- import * as THREE from "three";
2
- import { type SliceTri } from "./cylinderSliceMath.js";
3
- export interface MaterialBucket {
4
- material: THREE.Material;
5
- tris: SliceTri[];
6
- extras: Array<{
7
- name: string;
8
- itemSize: number;
9
- }>;
10
- }
11
- export declare function collectMeshBuckets(root: THREE.Object3D): MaterialBucket[];
12
- export declare function buildGeometryFromTris(tris: readonly SliceTri[], extras: ReadonlyArray<{
13
- name: string;
14
- itemSize: number;
15
- }>, offset?: readonly [number, number, number]): THREE.BufferGeometry;
@@ -1,159 +0,0 @@
1
- import { triArea2 } from "./cylinderSliceMath.js";
2
- import { isMeshObject } from "./sceneSiNormalize.js";
3
- import * as THREE from "three";
4
- // src/importer/meshSliceBuffers.ts
5
- function flipGeoWinding(geo) {
6
- const idx = geo.getIndex();
7
- if (idx) {
8
- for (let i = 0; i + 2 < idx.count; i += 3) {
9
- const tmp = idx.getX(i + 1);
10
- idx.setX(i + 1, idx.getX(i + 2));
11
- idx.setX(i + 2, tmp);
12
- }
13
- idx.needsUpdate = true;
14
- return;
15
- }
16
- const count = geo.getAttribute("position")?.count ?? 0;
17
- const arr = new Uint32Array(count);
18
- for (let i = 0; i + 2 < count; i += 3) {
19
- arr[i] = i;
20
- arr[i + 1] = i + 2;
21
- arr[i + 2] = i + 1;
22
- }
23
- geo.setIndex(new THREE.BufferAttribute(arr, 1));
24
- }
25
- function collectMeshBuckets(root) {
26
- root.updateMatrixWorld(true);
27
- const invRoot = new THREE.Matrix4().copy(root.matrixWorld).invert();
28
- const relMat = new THREE.Matrix4();
29
- const buckets = [];
30
- root.traverse((obj) => {
31
- if (!isMeshObject(obj)) return;
32
- const rawPos = obj.geometry.getAttribute("position");
33
- if (!rawPos || rawPos.count < 3) return;
34
- relMat.multiplyMatrices(invRoot, obj.matrixWorld);
35
- const geo = obj.geometry.clone();
36
- const flip = relMat.determinant() < 0;
37
- geo.applyMatrix4(relMat);
38
- if (flip) flipGeoWinding(geo);
39
- if (!geo.getAttribute("normal")) geo.computeVertexNormals();
40
- geo.computeBoundingBox();
41
- const pos = geo.getAttribute("position"), nrm = geo.getAttribute("normal"), uv = geo.getAttribute("uv");
42
- const bb = geo.boundingBox;
43
- const spanX = Math.max(1e-4, bb.max.x - bb.min.x), spanZ = Math.max(1e-4, bb.max.z - bb.min.z);
44
- const extraMetas = [];
45
- let extraLen = 0;
46
- for (const name of Object.keys(geo.attributes)) {
47
- if (name === "position" || name === "normal" || name === "uv") continue;
48
- const attr = geo.getAttribute(name);
49
- if (attr && attr.itemSize >= 1 && attr.itemSize <= 4) {
50
- extraMetas.push({
51
- name,
52
- itemSize: attr.itemSize,
53
- attr
54
- });
55
- extraLen += attr.itemSize;
56
- }
57
- }
58
- const stride = 8 + extraLen;
59
- const readVert = (vi) => {
60
- const v = new Float64Array(stride);
61
- const px = pos.getX(vi), py = pos.getY(vi), pz = pos.getZ(vi);
62
- v[0] = Number.isFinite(px) ? px : 0;
63
- v[1] = Number.isFinite(py) ? py : 0;
64
- v[2] = Number.isFinite(pz) ? pz : 0;
65
- const nx = nrm?.getX(vi) ?? 0, ny = nrm?.getY(vi) ?? 1, nz = nrm?.getZ(vi) ?? 0;
66
- const nl = Math.hypot(nx, ny, nz);
67
- if (Number.isFinite(nl) && nl > 1e-8) {
68
- v[3] = nx / nl;
69
- v[4] = ny / nl;
70
- v[5] = nz / nl;
71
- } else {
72
- v[3] = 0;
73
- v[4] = 1;
74
- v[5] = 0;
75
- }
76
- const u0 = uv?.getX(vi), v0 = uv?.getY(vi);
77
- v[6] = u0 !== void 0 && Number.isFinite(u0) ? u0 : (v[0] - bb.min.x) / spanX;
78
- v[7] = v0 !== void 0 && Number.isFinite(v0) ? v0 : (v[2] - bb.min.z) / spanZ;
79
- let off = 8;
80
- for (const em of extraMetas) for (let k = 0; k < em.itemSize; k++) {
81
- const val = em.attr.getComponent(vi, k);
82
- v[off++] = Number.isFinite(val) ? val : 0;
83
- }
84
- return v;
85
- };
86
- const idx = geo.getIndex();
87
- const totalTris = Math.floor((idx ? idx.count : pos.count) / 3);
88
- const mats = Array.isArray(obj.material) ? obj.material : [obj.material ?? new THREE.MeshStandardMaterial({ color: "#cbd5e1" })];
89
- const groups = geo.groups.length > 0 && Array.isArray(obj.material) ? geo.groups : [{
90
- start: 0,
91
- count: totalTris * 3,
92
- materialIndex: 0
93
- }];
94
- for (const grp of groups) {
95
- const mat = mats[grp.materialIndex ?? 0] ?? mats[0];
96
- const startTri = Math.floor(grp.start / 3);
97
- const endTri = Math.min(totalTris, startTri + Math.floor(grp.count / 3));
98
- const tris = [];
99
- for (let t = startTri; t < endTri; t++) {
100
- const a = readVert(idx ? idx.getX(t * 3) : t * 3);
101
- const b = readVert(idx ? idx.getX(t * 3 + 1) : t * 3 + 1);
102
- const c = readVert(idx ? idx.getX(t * 3 + 2) : t * 3 + 2);
103
- if (triArea2(a, b, c) > 1e-14) tris.push([
104
- a,
105
- b,
106
- c
107
- ]);
108
- }
109
- if (tris.length > 0) buckets.push({
110
- material: mat,
111
- tris,
112
- extras: extraMetas.map((e) => ({
113
- name: e.name,
114
- itemSize: e.itemSize
115
- }))
116
- });
117
- }
118
- geo.dispose();
119
- });
120
- return buckets;
121
- }
122
- function buildGeometryFromTris(tris, extras, offset = [
123
- 0,
124
- 0,
125
- 0
126
- ]) {
127
- const n = tris.length * 3;
128
- const pos = new Float32Array(n * 3), nrm = new Float32Array(n * 3), uv = new Float32Array(n * 2);
129
- const exArrs = extras.map((e) => ({
130
- ...e,
131
- data: new Float32Array(n * e.itemSize)
132
- }));
133
- let vi = 0;
134
- for (const tri of tris) for (let c = 0; c < 3; c++) {
135
- const v = tri[c];
136
- pos[vi * 3] = v[0] + offset[0];
137
- pos[vi * 3 + 1] = v[1] + offset[1];
138
- pos[vi * 3 + 2] = v[2] + offset[2];
139
- nrm[vi * 3] = v[3];
140
- nrm[vi * 3 + 1] = v[4];
141
- nrm[vi * 3 + 2] = v[5];
142
- uv[vi * 2] = v[6];
143
- uv[vi * 2 + 1] = v[7];
144
- let off = 8;
145
- for (const ex of exArrs) for (let k = 0; k < ex.itemSize; k++) ex.data[vi * ex.itemSize + k] = v[off++];
146
- vi++;
147
- }
148
- const geo = new THREE.BufferGeometry();
149
- geo.setAttribute("position", new THREE.BufferAttribute(pos, 3));
150
- geo.setAttribute("normal", new THREE.BufferAttribute(nrm, 3));
151
- geo.setAttribute("uv", new THREE.BufferAttribute(uv, 2));
152
- for (const ex of exArrs) geo.setAttribute(ex.name, new THREE.BufferAttribute(ex.data, ex.itemSize));
153
- geo.computeBoundingBox();
154
- geo.computeBoundingSphere();
155
- return geo;
156
- }
157
- export { buildGeometryFromTris, collectMeshBuckets };
158
-
159
- //# sourceMappingURL=meshSliceBuffers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meshSliceBuffers.js","names":[],"sources":["../../src/importer/meshSliceBuffers.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { triArea2, type SliceTri, type SliceVert } from \"./cylinderSliceMath.js\";\nimport { isMeshObject } from \"./sceneSiNormalize.js\";\n\nexport interface MaterialBucket {\n material: THREE.Material;\n tris: SliceTri[];\n extras: Array<{ name: string; itemSize: number }>;\n}\n\nfunction flipGeoWinding(geo: THREE.BufferGeometry): void {\n const idx = geo.getIndex();\n if (idx) {\n for (let i = 0; i + 2 < idx.count; i += 3) {\n const tmp = idx.getX(i + 1);\n idx.setX(i + 1, idx.getX(i + 2));\n idx.setX(i + 2, tmp);\n }\n idx.needsUpdate = true;\n return;\n }\n const count = geo.getAttribute(\"position\")?.count ?? 0;\n const arr = new Uint32Array(count);\n for (let i = 0; i + 2 < count; i += 3) {\n arr[i] = i;\n arr[i + 1] = i + 2;\n arr[i + 2] = i + 1;\n }\n geo.setIndex(new THREE.BufferAttribute(arr, 1));\n}\n\nexport function collectMeshBuckets(root: THREE.Object3D): MaterialBucket[] {\n root.updateMatrixWorld(true);\n const invRoot = new THREE.Matrix4().copy(root.matrixWorld).invert();\n const relMat = new THREE.Matrix4();\n const buckets: MaterialBucket[] = [];\n\n root.traverse((obj) => {\n if (!isMeshObject(obj)) return;\n const rawPos = obj.geometry.getAttribute(\"position\");\n if (!rawPos || rawPos.count < 3) return;\n relMat.multiplyMatrices(invRoot, obj.matrixWorld);\n const geo = obj.geometry.clone();\n const flip = relMat.determinant() < 0;\n geo.applyMatrix4(relMat);\n if (flip) flipGeoWinding(geo);\n if (!geo.getAttribute(\"normal\")) geo.computeVertexNormals();\n geo.computeBoundingBox();\n\n const pos = geo.getAttribute(\"position\"), nrm = geo.getAttribute(\"normal\"), uv = geo.getAttribute(\"uv\");\n const bb = geo.boundingBox!;\n const spanX = Math.max(1e-4, bb.max.x - bb.min.x), spanZ = Math.max(1e-4, bb.max.z - bb.min.z);\n const extraMetas: Array<{ name: string; itemSize: number; attr: THREE.BufferAttribute | THREE.InterleavedBufferAttribute }> = [];\n let extraLen = 0;\n for (const name of Object.keys(geo.attributes)) {\n if (name === \"position\" || name === \"normal\" || name === \"uv\") continue;\n const attr = geo.getAttribute(name);\n if (attr && attr.itemSize >= 1 && attr.itemSize <= 4) {\n extraMetas.push({ name, itemSize: attr.itemSize, attr });\n extraLen += attr.itemSize;\n }\n }\n const stride = 8 + extraLen;\n const readVert = (vi: number): SliceVert => {\n const v = new Float64Array(stride);\n const px = pos.getX(vi), py = pos.getY(vi), pz = pos.getZ(vi);\n v[0] = Number.isFinite(px) ? px : 0;\n v[1] = Number.isFinite(py) ? py : 0;\n v[2] = Number.isFinite(pz) ? pz : 0;\n const nx = nrm?.getX(vi) ?? 0, ny = nrm?.getY(vi) ?? 1, nz = nrm?.getZ(vi) ?? 0;\n const nl = Math.hypot(nx, ny, nz);\n if (Number.isFinite(nl) && nl > 1e-8) { v[3] = nx / nl; v[4] = ny / nl; v[5] = nz / nl; }\n else { v[3] = 0; v[4] = 1; v[5] = 0; }\n const u0 = uv?.getX(vi), v0 = uv?.getY(vi);\n v[6] = u0 !== undefined && Number.isFinite(u0) ? u0 : (v[0] - bb.min.x) / spanX;\n v[7] = v0 !== undefined && Number.isFinite(v0) ? v0 : (v[2] - bb.min.z) / spanZ;\n let off = 8;\n for (const em of extraMetas) {\n for (let k = 0; k < em.itemSize; k++) {\n const val = em.attr.getComponent(vi, k);\n v[off++] = Number.isFinite(val) ? val : 0;\n }\n }\n return v;\n };\n\n const idx = geo.getIndex();\n const totalTris = Math.floor((idx ? idx.count : pos.count) / 3);\n const mats = Array.isArray(obj.material)\n ? obj.material\n : [obj.material ?? new THREE.MeshStandardMaterial({ color: \"#cbd5e1\" })];\n const groups = geo.groups.length > 0 && Array.isArray(obj.material)\n ? geo.groups\n : [{ start: 0, count: totalTris * 3, materialIndex: 0 }];\n\n for (const grp of groups) {\n const mat = mats[grp.materialIndex ?? 0] ?? mats[0];\n const startTri = Math.floor(grp.start / 3);\n const endTri = Math.min(totalTris, startTri + Math.floor(grp.count / 3));\n const tris: SliceTri[] = [];\n for (let t = startTri; t < endTri; t++) {\n const a = readVert(idx ? idx.getX(t * 3) : t * 3);\n const b = readVert(idx ? idx.getX(t * 3 + 1) : t * 3 + 1);\n const c = readVert(idx ? idx.getX(t * 3 + 2) : t * 3 + 2);\n if (triArea2(a, b, c) > 1e-14) tris.push([a, b, c]);\n }\n if (tris.length > 0)\n buckets.push({ material: mat, tris, extras: extraMetas.map((e) => ({ name: e.name, itemSize: e.itemSize })) });\n }\n geo.dispose();\n });\n\n return buckets;\n}\n\nexport function buildGeometryFromTris(\n tris: readonly SliceTri[],\n extras: ReadonlyArray<{ name: string; itemSize: number }>,\n offset: readonly [number, number, number] = [0, 0, 0],\n): THREE.BufferGeometry {\n const n = tris.length * 3;\n const pos = new Float32Array(n * 3), nrm = new Float32Array(n * 3), uv = new Float32Array(n * 2);\n const exArrs = extras.map((e) => ({ ...e, data: new Float32Array(n * e.itemSize) }));\n let vi = 0;\n for (const tri of tris) {\n for (let c = 0; c < 3; c++) {\n const v = tri[c];\n pos[vi * 3] = v[0] + offset[0]; pos[vi * 3 + 1] = v[1] + offset[1]; pos[vi * 3 + 2] = v[2] + offset[2];\n nrm[vi * 3] = v[3]; nrm[vi * 3 + 1] = v[4]; nrm[vi * 3 + 2] = v[5];\n uv[vi * 2] = v[6]; uv[vi * 2 + 1] = v[7];\n let off = 8;\n for (const ex of exArrs) {\n for (let k = 0; k < ex.itemSize; k++) ex.data[vi * ex.itemSize + k] = v[off++];\n }\n vi++;\n }\n }\n const geo = new THREE.BufferGeometry();\n geo.setAttribute(\"position\", new THREE.BufferAttribute(pos, 3));\n geo.setAttribute(\"normal\", new THREE.BufferAttribute(nrm, 3));\n geo.setAttribute(\"uv\", new THREE.BufferAttribute(uv, 2));\n for (const ex of exArrs) geo.setAttribute(ex.name, new THREE.BufferAttribute(ex.data, ex.itemSize));\n geo.computeBoundingBox();\n geo.computeBoundingSphere();\n return geo;\n}\n"],"mappings":";;;;AAUA,SAAS,eAAe,KAAiC;CACrD,MAAM,MAAM,IAAI,SAAS;CACzB,IAAI,KAAK;EACL,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,KAAK,GAAG;GACvC,MAAM,MAAM,IAAI,KAAK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AI,aAAa,YAAY,IAAI,MAAM,gBAAgB,KAAK,CAAC,CAAC;CAC9D,IAAI,aAAa,UAAU,IAAI,MAAM,gBAAgB,KAAK,CAAC,CAAC;CAC5D,IAAI,aAAa,MAAM,IAAI,MAAM,gBAAgB,IAAI,CAAC,CAAC;CACvD,KAAK,MAAM,MAAM,QAAQ,IAAI,aAAa,GAAG,MAAM,IAAI,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;CAClG,IAAI,mBAAmB;CACvB,IAAI,sBAAsB;CAC1B,OAAO;AACX"}
@@ -1,3 +0,0 @@
1
- import { type SliceTri, type SliceVert } from "./cylinderSliceMath.js";
2
- export declare function triAreaYZ(a: SliceVert, b: SliceVert, c: SliceVert): number;
3
- export declare function earClipYZ(rawPoly: readonly SliceVert[], parentAreaYZ: number, outside: SliceTri[]): void;
@@ -1,67 +0,0 @@
1
- import { triArea2 } from "./cylinderSliceMath.js";
2
- // src/importer/polygonEarClipYZ.ts
3
- var EPS_AREA2 = 1e-14;
4
- function triAreaYZ(a, b, c) {
5
- return (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);
6
- }
7
- function pushValid(list, a, b, c) {
8
- if (triArea2(a, b, c) > EPS_AREA2) list.push([
9
- a,
10
- b,
11
- c
12
- ]);
13
- }
14
- function earClipYZ(rawPoly, parentAreaYZ, outside) {
15
- const poly = [];
16
- for (const v of rawPoly) {
17
- const prev = poly[poly.length - 1];
18
- if (!prev || (v[0] - prev[0]) ** 2 + (v[1] - prev[1]) ** 2 + (v[2] - prev[2]) ** 2 > 1e-14) poly.push(v);
19
- }
20
- if (poly.length > 2) {
21
- const f = poly[0], l = poly[poly.length - 1];
22
- if ((f[0] - l[0]) ** 2 + (f[1] - l[1]) ** 2 + (f[2] - l[2]) ** 2 <= 1e-14) poly.pop();
23
- }
24
- if (poly.length < 3) return;
25
- if (Math.abs(parentAreaYZ) <= 1e-12) {
26
- for (let k = 1; k + 1 < poly.length; k++) pushValid(outside, poly[0], poly[k], poly[k + 1]);
27
- return;
28
- }
29
- const sign = parentAreaYZ > 0 ? 1 : -1;
30
- let guard = poly.length * poly.length + 4;
31
- while (poly.length > 3 && guard-- > 0) {
32
- const n = poly.length;
33
- let clipped = false;
34
- for (let pass = 0; pass < 2 && !clipped; pass++) {
35
- const minArea = pass === 0 ? 1e-14 : -1e-12;
36
- const ptTol = pass === 0 ? -1e-11 : 1e-11;
37
- for (let i = 0; i < n; i++) {
38
- const pi = (i + n - 1) % n, ni = (i + 1) % n;
39
- const prev = poly[pi], curr = poly[i], next = poly[ni];
40
- const area = triAreaYZ(prev, curr, next) * sign;
41
- if (area < minArea) continue;
42
- let hasInside = false;
43
- for (let j = 0; j < n; j++) {
44
- if (j === pi || j === i || j === ni) continue;
45
- const pt = poly[j];
46
- if (triAreaYZ(prev, curr, pt) * sign >= ptTol && triAreaYZ(curr, next, pt) * sign >= ptTol && triAreaYZ(next, prev, pt) * sign >= ptTol) {
47
- hasInside = true;
48
- break;
49
- }
50
- }
51
- if (hasInside) continue;
52
- if (area > 1e-14) pushValid(outside, prev, curr, next);
53
- poly.splice(i, 1);
54
- clipped = true;
55
- break;
56
- }
57
- }
58
- if (!clipped) break;
59
- }
60
- if (poly.length === 3 && triAreaYZ(poly[0], poly[1], poly[2]) * sign >= -1e-14) pushValid(outside, poly[0], poly[1], poly[2]);
61
- else if (poly.length > 3) {
62
- for (let k = 1; k + 1 < poly.length; k++) if (triAreaYZ(poly[0], poly[k], poly[k + 1]) * sign > 0) pushValid(outside, poly[0], poly[k], poly[k + 1]);
63
- }
64
- }
65
- export { earClipYZ, triAreaYZ };
66
-
67
- //# sourceMappingURL=polygonEarClipYZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polygonEarClipYZ.js","names":[],"sources":["../../src/importer/polygonEarClipYZ.ts"],"sourcesContent":["import { triArea2, type SliceTri, type SliceVert } from \"./cylinderSliceMath.js\";\n\nconst EPS_AREA2 = 1e-14;\n\nexport function triAreaYZ(a: SliceVert, b: SliceVert, c: SliceVert): number {\n return (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);\n}\n\nfunction pushValid(list: SliceTri[], a: SliceVert, b: SliceVert, c: SliceVert): void {\n if (triArea2(a, b, c) > EPS_AREA2) list.push([a, b, c]);\n}\n\nexport function earClipYZ(rawPoly: readonly SliceVert[], parentAreaYZ: number, outside: SliceTri[]): void {\n const poly: SliceVert[] = [];\n for (const v of rawPoly) {\n const prev = poly[poly.length - 1];\n if (!prev || (v[0] - prev[0]) ** 2 + (v[1] - prev[1]) ** 2 + (v[2] - prev[2]) ** 2 > 1e-14) poly.push(v);\n }\n if (poly.length > 2) {\n const f = poly[0], l = poly[poly.length - 1];\n if ((f[0] - l[0]) ** 2 + (f[1] - l[1]) ** 2 + (f[2] - l[2]) ** 2 <= 1e-14) poly.pop();\n }\n if (poly.length < 3) return;\n if (Math.abs(parentAreaYZ) <= 1e-12) {\n for (let k = 1; k + 1 < poly.length; k++) pushValid(outside, poly[0], poly[k], poly[k + 1]);\n return;\n }\n const sign = parentAreaYZ > 0 ? 1 : -1;\n let guard = poly.length * poly.length + 4;\n while (poly.length > 3 && guard-- > 0) {\n const n = poly.length;\n let clipped = false;\n for (let pass = 0; pass < 2 && !clipped; pass++) {\n const minArea = pass === 0 ? 1e-14 : -1e-12;\n const ptTol = pass === 0 ? -1e-11 : 1e-11;\n for (let i = 0; i < n; i++) {\n const pi = (i + n - 1) % n, ni = (i + 1) % n;\n const prev = poly[pi], curr = poly[i], next = poly[ni];\n const area = triAreaYZ(prev, curr, next) * sign;\n if (area < minArea) continue;\n let hasInside = false;\n for (let j = 0; j < n; j++) {\n if (j === pi || j === i || j === ni) continue;\n const pt = poly[j];\n if (\n triAreaYZ(prev, curr, pt) * sign >= ptTol &&\n triAreaYZ(curr, next, pt) * sign >= ptTol &&\n triAreaYZ(next, prev, pt) * sign >= ptTol\n ) { hasInside = true; break; }\n }\n if (hasInside) continue;\n if (area > 1e-14) pushValid(outside, prev, curr, next);\n poly.splice(i, 1);\n clipped = true;\n break;\n }\n }\n if (!clipped) break;\n }\n if (poly.length === 3 && triAreaYZ(poly[0], poly[1], poly[2]) * sign >= -1e-14) {\n pushValid(outside, poly[0], poly[1], poly[2]);\n } else if (poly.length > 3) {\n for (let k = 1; k + 1 < poly.length; k++) {\n if (triAreaYZ(poly[0], poly[k], poly[k + 1]) * sign > 0) pushValid(outside, poly[0], poly[k], poly[k + 1]);\n }\n }\n}\n"],"mappings":";;AAEA,IAAM,YAAY;AAElB,SAAgB,UAAU,GAAc,GAAc,GAAsB;CACxE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;AACrE;AAEA,SAAS,UAAU,MAAkB,GAAc,GAAc,GAAoB;CACjF,IAAI,SAAS,GAAG,GAAG,CAAC,IAAI,WAAW,KAAK,KAAK;EAAC;EAAG;EAAG;CAAC,CAAC;AAC1D;AAEA,SAAgB,UAAU,SAA+B,cAAsB,SAA2B;CACtG,MAAM,OAAoB,CAAC;CAC3B,KAAK,MAAM,KAAK,SAAS;EACrB,MAAM,OAAO,KAAK,KAAK,SAAS;EAChC,IAAI,CAAC,SAAS,EAAE,KAAK,KAAK,OAAO,KAAK,EAAE,KAAK,KAAK,OAAO,KAAK,EAAE,KAAK,KAAK,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC;CAC3G;CACA,IAAI,KAAK,SAAS,GAAG;EACjB,MAAM,IAAI,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;EAC1C,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,KAAK,IAAI;CACxF;CACA,IAAI,KAAK,SAAS,GAAG;CACrB,IAAI,KAAK,IAAI,YAAY,KAAK,OAAO;EACjC,KAAK,IAAI,IAAI,GAAG,IA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AK,EAAE;MACzC,IAAI,KAAK,SAAS,GAChB;OAAA,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,QAAQ,KACjC,IAAI,UAAU,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,IAAI,OAAO,GAAG,UAAU,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE;CAAA;AAGrH"}
@@ -1,18 +0,0 @@
1
- import * as THREE from "three";
2
- import { type KolmoNodeExtension, type KolmoSocketRole } from "../schema/kolmoSchema.js";
3
- export interface ProceduralRecipeSpec<TId extends string = string> {
4
- readonly id: TId;
5
- readonly label: string;
6
- readonly domain: "c12" | "craft" | "person" | "prop" | "junk";
7
- readonly targetMeters: number;
8
- readonly massKg: number;
9
- readonly powerOrThrust?: number;
10
- readonly color: string;
11
- }
12
- export type C12ProceduralRecipeId = "c12_doorway_wall" | "c12_window_wall" | "c12_floor_corbel" | "c12_stair_flight" | "c12_gable_roof" | "c12_hex_wing";
13
- export declare const C12_PROCEDURAL_RECIPES: readonly ProceduralRecipeSpec<C12ProceduralRecipeId>[];
14
- export declare function makeFlatMat(color: string, roughness?: number, metalness?: number, emissive?: string): THREE.MeshStandardMaterial;
15
- export declare function addPartBox(p: THREE.Object3D, name: string, sx: number, sy: number, sz: number, x: number, y: number, z: number, mat: THREE.Material): THREE.Mesh;
16
- export declare function addKolmoSocket(parent: THREE.Object3D, name: string, pos: [number, number, number], role: KolmoSocketRole, emitter?: Omit<KolmoNodeExtension, "socket">, rotEuler?: [number, number, number]): THREE.Object3D;
17
- export declare function buildDoorLeafMesh(w: number, h: number, t: number, leafHex: number, handleHex: number): THREE.Mesh;
18
- export declare function buildProceduralC12Scene(recipeOrId?: C12ProceduralRecipeId | ProceduralRecipeSpec | string): THREE.Group;