@pinkaphant/kolmo 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -36
  3. package/bin/kolmo.mjs +11 -8
  4. package/dist/engine/causewayBridge.d.ts +14 -0
  5. package/dist/engine/causewayBridge.js +166 -0
  6. package/dist/engine/causewayBridge.js.map +1 -0
  7. package/dist/engine/index.d.ts +6 -4
  8. package/dist/engine/index.js +19 -12
  9. package/dist/engine/index.js.map +1 -0
  10. package/dist/engine/islandSettlementMesh.d.ts +26 -0
  11. package/dist/engine/islandSettlementMesh.js +166 -0
  12. package/dist/engine/islandSettlementMesh.js.map +1 -0
  13. package/dist/engine/kolmoActions.d.ts +23 -0
  14. package/dist/engine/kolmoActions.js +164 -0
  15. package/dist/engine/kolmoActions.js.map +1 -0
  16. package/dist/engine/kolmoActor.js +241 -206
  17. package/dist/engine/kolmoActor.js.map +1 -0
  18. package/dist/engine/kolmoFloatingOrigin.d.ts +17 -0
  19. package/dist/engine/kolmoFloatingOrigin.js +98 -0
  20. package/dist/engine/kolmoFloatingOrigin.js.map +1 -0
  21. package/dist/engine/kolmoGame.d.ts +27 -0
  22. package/dist/engine/kolmoGame.js +80 -0
  23. package/dist/engine/kolmoGame.js.map +1 -0
  24. package/dist/engine/kolmoHud.d.ts +23 -0
  25. package/dist/engine/kolmoHud.js +195 -0
  26. package/dist/engine/kolmoHud.js.map +1 -0
  27. package/dist/engine/kolmoInput.d.ts +1 -1
  28. package/dist/engine/kolmoInput.js +57 -30
  29. package/dist/engine/kolmoInput.js.map +1 -0
  30. package/dist/engine/kolmoIsland.d.ts +5 -10
  31. package/dist/engine/kolmoIsland.js +182 -250
  32. package/dist/engine/kolmoIsland.js.map +1 -0
  33. package/dist/engine/kolmoLongDrive.d.ts +3 -4
  34. package/dist/engine/kolmoLongDrive.js +139 -249
  35. package/dist/engine/kolmoLongDrive.js.map +1 -0
  36. package/dist/engine/kolmoPilotMesh.d.ts +2 -0
  37. package/dist/engine/kolmoPilotMesh.js +64 -0
  38. package/dist/engine/kolmoPilotMesh.js.map +1 -0
  39. package/dist/engine/kolmoProcedural.d.ts +13 -0
  40. package/dist/engine/kolmoProcedural.js +101 -0
  41. package/dist/engine/kolmoProcedural.js.map +1 -0
  42. package/dist/engine/kolmoRigs.d.ts +1 -1
  43. package/dist/engine/kolmoRigs.js +88 -47
  44. package/dist/engine/kolmoRigs.js.map +1 -0
  45. package/dist/engine/kolmoStore.d.ts +3 -101
  46. package/dist/engine/kolmoSurface.d.ts +2 -2
  47. package/dist/engine/kolmoSurface.js +150 -134
  48. package/dist/engine/kolmoSurface.js.map +1 -0
  49. package/dist/engine/kolmoTraits.d.ts +128 -0
  50. package/dist/engine/kolmoTraits.js +140 -0
  51. package/dist/engine/kolmoTraits.js.map +1 -0
  52. package/dist/engine/kolmoVehicle.d.ts +3 -33
  53. package/dist/engine/kolmoVehicle.js +66 -253
  54. package/dist/engine/kolmoVehicle.js.map +1 -0
  55. package/dist/engine/kolmoVehicleConfig.d.ts +54 -0
  56. package/dist/engine/kolmoVehicleConfig.js +80 -0
  57. package/dist/engine/kolmoVehicleConfig.js.map +1 -0
  58. package/dist/engine/kolmoVehicleDriver.d.ts +8 -13
  59. package/dist/engine/kolmoVehicleDriver.js +125 -42
  60. package/dist/engine/kolmoVehicleDriver.js.map +1 -0
  61. package/dist/engine/kolmoVehicleInner.d.ts +7 -0
  62. package/dist/engine/kolmoVehicleInner.js +261 -0
  63. package/dist/engine/kolmoVehicleInner.js.map +1 -0
  64. package/dist/engine/kolmoWorld.d.ts +6 -4
  65. package/dist/engine/kolmoWorld.js +134 -136
  66. package/dist/engine/kolmoWorld.js.map +1 -0
  67. package/dist/engine/longDriveKit.d.ts +5 -12
  68. package/dist/engine/longDriveKit.js +121 -233
  69. package/dist/engine/longDriveKit.js.map +1 -0
  70. package/dist/engine/longDriveRoadside.d.ts +16 -0
  71. package/dist/engine/longDriveRoadside.js +171 -0
  72. package/dist/engine/longDriveRoadside.js.map +1 -0
  73. package/dist/engine/macroCellBuilder.d.ts +34 -0
  74. package/dist/engine/macroCellBuilder.js +145 -0
  75. package/dist/engine/macroCellBuilder.js.map +1 -0
  76. package/dist/engine/mainlandMacroCell.d.ts +2 -2
  77. package/dist/engine/mainlandMacroCell.js +77 -165
  78. package/dist/engine/mainlandMacroCell.js.map +1 -0
  79. package/dist/engine/shiftedFixedBody.d.ts +1 -1
  80. package/dist/engine/shiftedFixedBody.js +55 -28
  81. package/dist/engine/shiftedFixedBody.js.map +1 -0
  82. package/dist/importer/ChopShopPanel.d.ts +10 -32
  83. package/dist/importer/ChopShopPanel.js +320 -470
  84. package/dist/importer/ChopShopPanel.js.map +1 -0
  85. package/dist/importer/DomainWorkshopPanel.d.ts +2 -1
  86. package/dist/importer/DomainWorkshopPanel.js +172 -242
  87. package/dist/importer/DomainWorkshopPanel.js.map +1 -0
  88. package/dist/importer/GateHudBar.d.ts +8 -3
  89. package/dist/importer/GateHudBar.js +289 -284
  90. package/dist/importer/GateHudBar.js.map +1 -0
  91. package/dist/importer/GlbImportGate.d.ts +2 -1
  92. package/dist/importer/GlbImportGate.js +254 -262
  93. package/dist/importer/GlbImportGate.js.map +1 -0
  94. package/dist/importer/ImperativeVehicleRig.d.ts +2 -2
  95. package/dist/importer/ImperativeVehicleRig.js +223 -284
  96. package/dist/importer/ImperativeVehicleRig.js.map +1 -0
  97. package/dist/importer/LiveDrivePads.d.ts +20 -0
  98. package/dist/importer/LiveDrivePads.js +169 -0
  99. package/dist/importer/LiveDrivePads.js.map +1 -0
  100. package/dist/importer/PaperShellDebrisRig.d.ts +25 -0
  101. package/dist/importer/PaperShellDebrisRig.js +143 -0
  102. package/dist/importer/PaperShellDebrisRig.js.map +1 -0
  103. package/dist/importer/R2VaultDrawer.d.ts +12 -0
  104. package/dist/importer/R2VaultDrawer.js +90 -0
  105. package/dist/importer/R2VaultDrawer.js.map +1 -0
  106. package/dist/importer/Step1CalibrationPlinth.d.ts +23 -15
  107. package/dist/importer/Step1CalibrationPlinth.js +180 -313
  108. package/dist/importer/Step1CalibrationPlinth.js.map +1 -0
  109. package/dist/importer/Step1ExplodedIslands.d.ts +31 -0
  110. package/dist/importer/Step1ExplodedIslands.js +144 -0
  111. package/dist/importer/Step1ExplodedIslands.js.map +1 -0
  112. package/dist/importer/Step2UniversalPad.d.ts +7 -14
  113. package/dist/importer/Step2UniversalPad.js +54 -197
  114. package/dist/importer/Step2UniversalPad.js.map +1 -0
  115. package/dist/importer/VfxEmitterPool.js +59 -86
  116. package/dist/importer/VfxEmitterPool.js.map +1 -0
  117. package/dist/importer/WheelRingHandles3D.d.ts +11 -0
  118. package/dist/importer/WheelRingHandles3D.js +318 -0
  119. package/dist/importer/WheelRingHandles3D.js.map +1 -0
  120. package/dist/importer/archLinerGeom.d.ts +2 -0
  121. package/dist/importer/archLinerGeom.js +51 -0
  122. package/dist/importer/archLinerGeom.js.map +1 -0
  123. package/dist/importer/{vehiclePanelAnim.d.ts → chopHingeHelpers.d.ts} +0 -10
  124. package/dist/importer/chopHingeHelpers.js +193 -0
  125. package/dist/importer/chopHingeHelpers.js.map +1 -0
  126. package/dist/importer/chopShopActions.d.ts +20 -32
  127. package/dist/importer/chopShopActions.js +142 -238
  128. package/dist/importer/chopShopActions.js.map +1 -0
  129. package/dist/importer/chopShopHandlers.d.ts +26 -0
  130. package/dist/importer/chopShopHandlers.js +276 -0
  131. package/dist/importer/chopShopHandlers.js.map +1 -0
  132. package/dist/importer/chopShopIoActions.d.ts +18 -0
  133. package/dist/importer/chopShopIoActions.js +161 -0
  134. package/dist/importer/chopShopIoActions.js.map +1 -0
  135. package/dist/importer/chopShopMcpAction.d.ts +18 -0
  136. package/dist/importer/chopShopMcpAction.js +58 -0
  137. package/dist/importer/chopShopMcpAction.js.map +1 -0
  138. package/dist/importer/cylinderBooleanSlice.d.ts +14 -0
  139. package/dist/importer/cylinderBooleanSlice.js +110 -0
  140. package/dist/importer/cylinderBooleanSlice.js.map +1 -0
  141. package/dist/importer/cylinderSliceMath.d.ts +14 -0
  142. package/dist/importer/cylinderSliceMath.js +251 -0
  143. package/dist/importer/cylinderSliceMath.js.map +1 -0
  144. package/dist/importer/fusedWheelDetect.d.ts +4 -0
  145. package/dist/importer/fusedWheelDetect.js +176 -0
  146. package/dist/importer/fusedWheelDetect.js.map +1 -0
  147. package/dist/importer/fusedWheelFit.d.ts +13 -0
  148. package/dist/importer/fusedWheelFit.js +138 -0
  149. package/dist/importer/fusedWheelFit.js.map +1 -0
  150. package/dist/importer/gateStore.d.ts +3 -6
  151. package/dist/importer/gateStore.js +36 -30
  152. package/dist/importer/gateStore.js.map +1 -0
  153. package/dist/importer/glbNormalizer.d.ts +1 -10
  154. package/dist/importer/glbNormalizer.js +120 -146
  155. package/dist/importer/glbNormalizer.js.map +1 -0
  156. package/dist/importer/importerWebMcp.d.ts +4 -3
  157. package/dist/importer/importerWebMcp.js +41 -339
  158. package/dist/importer/importerWebMcp.js.map +1 -0
  159. package/dist/importer/importerWebMcpTools.d.ts +2 -0
  160. package/dist/importer/importerWebMcpTools.js +340 -0
  161. package/dist/importer/importerWebMcpTools.js.map +1 -0
  162. package/dist/importer/index.d.ts +6 -4
  163. package/dist/importer/index.js +32 -25
  164. package/dist/importer/index.js.map +1 -0
  165. package/dist/importer/khrCarPlanHelpers.d.ts +39 -0
  166. package/dist/importer/khrCarPlanHelpers.js +310 -0
  167. package/dist/importer/khrCarPlanHelpers.js.map +1 -0
  168. package/dist/importer/khrCarPlanner.d.ts +8 -0
  169. package/dist/importer/khrCarPlanner.js +315 -0
  170. package/dist/importer/khrCarPlanner.js.map +1 -0
  171. package/dist/importer/khrCompiler.d.ts +4 -41
  172. package/dist/importer/khrCompiler.js +79 -673
  173. package/dist/importer/khrCompiler.js.map +1 -0
  174. package/dist/importer/khrCraftPropCompiler.d.ts +45 -0
  175. package/dist/importer/khrCraftPropCompiler.js +263 -0
  176. package/dist/importer/khrCraftPropCompiler.js.map +1 -0
  177. package/dist/importer/khrNodeNameGuard.d.ts +20 -0
  178. package/dist/importer/khrNodeNameGuard.js +139 -0
  179. package/dist/importer/khrNodeNameGuard.js.map +1 -0
  180. package/dist/importer/launcherBake.js +99 -39
  181. package/dist/importer/launcherBake.js.map +1 -0
  182. package/dist/importer/meshIslands.d.ts +4 -50
  183. package/dist/importer/meshIslands.js +84 -288
  184. package/dist/importer/meshIslands.js.map +1 -0
  185. package/dist/importer/meshSliceBuffers.d.ts +15 -0
  186. package/dist/importer/meshSliceBuffers.js +159 -0
  187. package/dist/importer/meshSliceBuffers.js.map +1 -0
  188. package/dist/importer/polygonEarClipYZ.d.ts +3 -0
  189. package/dist/importer/polygonEarClipYZ.js +67 -0
  190. package/dist/importer/polygonEarClipYZ.js.map +1 -0
  191. package/dist/importer/sceneSiNormalize.d.ts +19 -0
  192. package/dist/importer/sceneSiNormalize.js +145 -0
  193. package/dist/importer/sceneSiNormalize.js.map +1 -0
  194. package/dist/importer/starterScene.d.ts +3 -0
  195. package/dist/importer/starterScene.js +76 -0
  196. package/dist/importer/starterScene.js.map +1 -0
  197. package/dist/importer/surfaceCutter.d.ts +5 -25
  198. package/dist/importer/surfaceCutter.js +70 -334
  199. package/dist/importer/surfaceCutter.js.map +1 -0
  200. package/dist/importer/surfaceGeodesic.d.ts +7 -0
  201. package/dist/importer/surfaceGeodesic.js +130 -0
  202. package/dist/importer/surfaceGeodesic.js.map +1 -0
  203. package/dist/importer/surfaceLoopRefine.d.ts +6 -0
  204. package/dist/importer/surfaceLoopRefine.js +171 -0
  205. package/dist/importer/surfaceLoopRefine.js.map +1 -0
  206. package/dist/importer/surfacePeel.d.ts +11 -0
  207. package/dist/importer/surfacePeel.js +119 -0
  208. package/dist/importer/surfacePeel.js.map +1 -0
  209. package/dist/importer/surfaceTopology.d.ts +4 -19
  210. package/dist/importer/surfaceTopology.js +92 -160
  211. package/dist/importer/surfaceTopology.js.map +1 -0
  212. package/dist/importer/universalGateBake.d.ts +7 -9
  213. package/dist/importer/universalGateBake.js +117 -109
  214. package/dist/importer/universalGateBake.js.map +1 -0
  215. package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
  216. package/dist/importer/usdPhysicsSpecs.js +245 -0
  217. package/dist/importer/usdPhysicsSpecs.js.map +1 -0
  218. package/dist/importer/usdTextParse.d.ts +12 -0
  219. package/dist/importer/usdTextParse.js +118 -0
  220. package/dist/importer/usdTextParse.js.map +1 -0
  221. package/dist/importer/usdToGlb.d.ts +3 -2
  222. package/dist/importer/usdToGlb.js +80 -292
  223. package/dist/importer/usdToGlb.js.map +1 -0
  224. package/dist/importer/useChopShopController.d.ts +51 -74
  225. package/dist/importer/useChopShopController.js +161 -453
  226. package/dist/importer/useChopShopController.js.map +1 -0
  227. package/dist/importer/useChopShopState.d.ts +103 -0
  228. package/dist/importer/useChopShopState.js +324 -0
  229. package/dist/importer/useChopShopState.js.map +1 -0
  230. package/dist/importer/useWasdKeyRef.d.ts +9 -0
  231. package/dist/importer/useWasdKeyRef.js +35 -0
  232. package/dist/importer/useWasdKeyRef.js.map +1 -0
  233. package/dist/importer/vehiclePartSplit.d.ts +33 -0
  234. package/dist/importer/vehiclePartSplit.js +183 -0
  235. package/dist/importer/vehiclePartSplit.js.map +1 -0
  236. package/dist/importer/wheelAxlePairing.d.ts +4 -3
  237. package/dist/importer/wheelAxlePairing.js +128 -122
  238. package/dist/importer/wheelAxlePairing.js.map +1 -0
  239. package/dist/importer/wheelCutterHelpers.d.ts +42 -0
  240. package/dist/importer/wheelCutterHelpers.js +178 -0
  241. package/dist/importer/wheelCutterHelpers.js.map +1 -0
  242. package/dist/importer/wheelRingHandleMath.d.ts +20 -0
  243. package/dist/importer/wheelRingHandleMath.js +66 -0
  244. package/dist/importer/wheelRingHandleMath.js.map +1 -0
  245. package/dist/index.d.ts +3 -2
  246. package/dist/index.js +90 -69
  247. package/dist/index.js.map +1 -0
  248. package/dist/junk/DestructibleTarget.d.ts +3 -3
  249. package/dist/junk/DestructibleTarget.js +177 -114
  250. package/dist/junk/DestructibleTarget.js.map +1 -0
  251. package/dist/junk/KolmoJunk.js +55 -44
  252. package/dist/junk/KolmoJunk.js.map +1 -0
  253. package/dist/junk/ShardPieces.d.ts +2 -1
  254. package/dist/junk/ShardPieces.js +80 -61
  255. package/dist/junk/ShardPieces.js.map +1 -0
  256. package/dist/junk/TargetDecals.d.ts +6 -15
  257. package/dist/junk/TargetDecals.js +66 -40
  258. package/dist/junk/TargetDecals.js.map +1 -0
  259. package/dist/junk/bvhShatter.d.ts +2 -6
  260. package/dist/junk/bvhShatter.js +89 -43
  261. package/dist/junk/bvhShatter.js.map +1 -0
  262. package/dist/junk/bvhTriCollector.d.ts +2 -6
  263. package/dist/junk/bvhTriCollector.js +111 -62
  264. package/dist/junk/bvhTriCollector.js.map +1 -0
  265. package/dist/junk/index.d.ts +2 -2
  266. package/dist/junk/index.js +11 -11
  267. package/dist/junk/index.js.map +1 -0
  268. package/dist/junk/junkGeometry.d.ts +5 -26
  269. package/dist/junk/junkGeometry.js +61 -43
  270. package/dist/junk/junkGeometry.js.map +1 -0
  271. package/dist/junk/junkImportSanitize.d.ts +4 -5
  272. package/dist/junk/junkImportSanitize.js +57 -37
  273. package/dist/junk/junkImportSanitize.js.map +1 -0
  274. package/dist/junk/junkImporter.d.ts +2 -13
  275. package/dist/junk/junkImporter.js +105 -76
  276. package/dist/junk/junkImporter.js.map +1 -0
  277. package/dist/junk/junkLabelCanvas.d.ts +1 -6
  278. package/dist/junk/junkLabelCanvas.js +147 -29
  279. package/dist/junk/junkLabelCanvas.js.map +1 -0
  280. package/dist/junk/junkLabels.d.ts +4 -26
  281. package/dist/junk/junkLabels.js +42 -28
  282. package/dist/junk/junkLabels.js.map +1 -0
  283. package/dist/junk/targetHelpers.d.ts +3 -4
  284. package/dist/junk/targetHelpers.js +121 -67
  285. package/dist/junk/targetHelpers.js.map +1 -0
  286. package/dist/junk/targetHitLogic.d.ts +8 -8
  287. package/dist/junk/targetHitLogic.js +131 -95
  288. package/dist/junk/targetHitLogic.js.map +1 -0
  289. package/dist/junk/useTargetAssets.d.ts +9 -14
  290. package/dist/junk/useTargetAssets.js +113 -85
  291. package/dist/junk/useTargetAssets.js.map +1 -0
  292. package/dist/physics/index.d.ts +1 -8
  293. package/dist/physics/index.js +80 -85
  294. package/dist/physics/index.js.map +1 -0
  295. package/dist/schema/kolmoSchema.d.ts +3 -64
  296. package/dist/schema/kolmoSchema.js +75 -149
  297. package/dist/schema/kolmoSchema.js.map +1 -0
  298. package/dist/schema/kolmoStamp.d.ts +11 -0
  299. package/dist/schema/kolmoStamp.js +119 -0
  300. package/dist/schema/kolmoStamp.js.map +1 -0
  301. package/dist/schema/kolmoTypes.d.ts +63 -0
  302. package/dist/schema/kolmoTypes.js +66 -0
  303. package/dist/schema/kolmoTypes.js.map +1 -0
  304. package/dist/shaders/celestialBackdrop.d.ts +2 -10
  305. package/dist/shaders/celestialBackdrop.js +128 -291
  306. package/dist/shaders/celestialBackdrop.js.map +1 -0
  307. package/dist/shaders/emitterShaders.d.ts +9 -0
  308. package/dist/shaders/emitterShaders.js +114 -0
  309. package/dist/shaders/emitterShaders.js.map +1 -0
  310. package/dist/shaders/index.d.ts +1 -1
  311. package/dist/shaders/index.js +12 -9
  312. package/dist/shaders/index.js.map +1 -0
  313. package/dist/shaders/plumeAndSparkle.d.ts +2 -4
  314. package/dist/shaders/plumeAndSparkle.js +152 -191
  315. package/dist/shaders/plumeAndSparkle.js.map +1 -0
  316. package/dist/shaders/ps2GlslShared.js +29 -2
  317. package/dist/shaders/ps2GlslShared.js.map +1 -0
  318. package/dist/shaders/ps2MaterialsTSL.js +132 -51
  319. package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
  320. package/dist/shaders/ps2MaterialsWebGL.js +45 -28
  321. package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
  322. package/dist/shaders/ps2RoadWebGL.js +69 -32
  323. package/dist/shaders/ps2RoadWebGL.js.map +1 -0
  324. package/dist/shaders/ps2TerrainWebGL.js +107 -30
  325. package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
  326. package/dist/shaders/ps2Textures.d.ts +1 -1
  327. package/dist/shaders/ps2Textures.js +116 -41
  328. package/dist/shaders/ps2Textures.js.map +1 -0
  329. package/dist/shaders/retroPalettes.d.ts +1 -1
  330. package/dist/shaders/retroPalettes.js +90 -57
  331. package/dist/shaders/retroPalettes.js.map +1 -0
  332. package/dist/shaders/retroShader.d.ts +2 -86
  333. package/dist/shaders/retroShader.js +65 -196
  334. package/dist/shaders/retroShader.js.map +1 -0
  335. package/dist/shaders/retroUniforms.d.ts +60 -0
  336. package/dist/shaders/retroUniforms.js +215 -0
  337. package/dist/shaders/retroUniforms.js.map +1 -0
  338. package/dist/shaders/skyboxShaders.d.ts +16 -0
  339. package/dist/shaders/skyboxShaders.js +266 -0
  340. package/dist/shaders/skyboxShaders.js.map +1 -0
  341. package/dist/shaders/tsl.d.ts +1 -1
  342. package/dist/shaders/tsl.js.map +1 -0
  343. package/dist/vite/index.d.ts +1 -1
  344. package/dist/vite/index.js +38 -32
  345. package/dist/vite/index.js.map +1 -0
  346. package/dist/world/frontage.js +25 -21
  347. package/dist/world/frontage.js.map +1 -0
  348. package/dist/world/index.d.ts +4 -4
  349. package/dist/world/index.js +12 -11
  350. package/dist/world/index.js.map +1 -0
  351. package/dist/world/infiniteWorld2D.d.ts +0 -5
  352. package/dist/world/infiniteWorld2D.js +175 -200
  353. package/dist/world/infiniteWorld2D.js.map +1 -0
  354. package/dist/world/island.js +81 -166
  355. package/dist/world/island.js.map +1 -0
  356. package/dist/world/islandPathing.d.ts +6 -0
  357. package/dist/world/islandPathing.js +166 -0
  358. package/dist/world/islandPathing.js.map +1 -0
  359. package/dist/world/macroCellSchema.js +15 -8
  360. package/dist/world/macroCellSchema.js.map +1 -0
  361. package/dist/world/macroKnightAStar.js +140 -71
  362. package/dist/world/macroKnightAStar.js.map +1 -0
  363. package/dist/world/macroSettlementZones.d.ts +9 -0
  364. package/dist/world/macroSettlementZones.js +108 -0
  365. package/dist/world/macroSettlementZones.js.map +1 -0
  366. package/dist/world/random.js +50 -24
  367. package/dist/world/random.js.map +1 -0
  368. package/dist/world/road.js +152 -90
  369. package/dist/world/road.js.map +1 -0
  370. package/dist/world/roadRibbon.d.ts +4 -19
  371. package/dist/world/roadRibbon.js +129 -124
  372. package/dist/world/roadRibbon.js.map +1 -0
  373. package/dist/world/terrain.d.ts +1 -1
  374. package/dist/world/terrain.js +111 -65
  375. package/dist/world/terrain.js.map +1 -0
  376. package/dist/world/terrainGeometry.d.ts +14 -0
  377. package/dist/world/terrainGeometry.js +76 -0
  378. package/dist/world/terrainGeometry.js.map +1 -0
  379. package/dist/world/worldTypes.d.ts +3 -3
  380. package/dist/world/worldTypes.js +133 -67
  381. package/dist/world/worldTypes.js.map +1 -0
  382. package/docs/api-reference.md +190 -0
  383. package/package.json +54 -34
  384. package/dist/engine/kolmoStore.js +0 -247
  385. package/dist/importer/CabinPreviewRig.d.ts +0 -13
  386. package/dist/importer/CabinPreviewRig.js +0 -138
  387. package/dist/importer/CabinStepSection.d.ts +0 -17
  388. package/dist/importer/CabinStepSection.js +0 -222
  389. package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -20
  390. package/dist/importer/ImporterPlinthUikitTags.js +0 -119
  391. package/dist/importer/cabinMeshBuilders.d.ts +0 -13
  392. package/dist/importer/cabinMeshBuilders.js +0 -104
  393. package/dist/importer/cabinMixamoRig.d.ts +0 -53
  394. package/dist/importer/cabinMixamoRig.js +0 -150
  395. package/dist/importer/chopShopUiComponents.d.ts +0 -22
  396. package/dist/importer/chopShopUiComponents.js +0 -91
  397. package/dist/importer/vehiclePanelAnim.js +0 -214
@@ -1,681 +1,87 @@
1
- import { stampKolmoNodesIntoGlb as e } from "../schema/kolmoSchema.js";
2
- import { computeMeshMassProps as t } from "./glbNormalizer.js";
3
- import { computeMixamoCabinSockets as n } from "./cabinMixamoRig.js";
4
- import { CHOP_ROLES as r } from "./surfaceTopology.js";
5
- import { createFleet12GonWheelGroup as i, measureSelection as a, suggestCarAxles as o } from "./wheelAxlePairing.js";
6
- import { buildCabinTubGroup as s } from "./cabinMeshBuilders.js";
7
- import { extractMeshIslands as c, separateVehicleMeshes as l } from "./meshIslands.js";
8
- import { buildPatchPreviewEmitters as u, computeChopPartHinge as d, createVehiclePanelAnimator as f, normalToMinusZQuaternion as p } from "./vehiclePanelAnim.js";
9
- import * as m from "three";
10
- import { exportKhrGlb as h } from "@khr3/core";
11
- import { ENGINE_TORQUE_CURVES as g, STEER_SPEED_CURVES as _, TIRE_ARCHETYPES as v, tireGripForSurface as y } from "@khr3/core/curves";
1
+ import { disambiguateExplicitPatches, stampKolmoNodesIntoGlb } from "../schema/kolmoStamp.js";
2
+ import { buildCarExportPlan } from "./khrCarPlanner.js";
3
+ import { buildCraftExportPlan, buildPropExportPlan, collectPreservedRigPatches, restoreStrippedTextures, stripUnloadedTextures } from "./khrCraftPropCompiler.js";
4
+ import { assignMissingEmitterNames, collectSceneNodeNames, collectSpecNodeNames, ensureRootNameUnique } from "./khrNodeNameGuard.js";
5
+ import { buildPatchPreviewEmitters, computeChopPartHinge, normalToMinusZQuaternion } from "./chopHingeHelpers.js";
6
+ import { isMeshObject } from "./sceneSiNormalize.js";
7
+ import * as THREE from "three";
8
+ import { exportKhrGlb } from "@khr3/core";
12
9
  // src/importer/khrCompiler.ts
13
- var b = Object.keys(v), x = Object.keys(g), S = Object.keys(_), C = [
14
- "map",
15
- "normalMap",
16
- "roughnessMap",
17
- "metalnessMap",
18
- "aoMap",
19
- "emissiveMap"
20
- ], w = (e) => Number(e.toFixed(4)), T = {
21
- naScreamer: {
22
- maxRpm: 7200,
23
- gears: [
24
- 3.1,
25
- 2.05,
26
- 1.42,
27
- 1,
28
- .82
29
- ],
30
- finalDrive: 3.58
31
- },
32
- w16QuadTurbo: {
33
- maxRpm: 6800,
34
- gears: [
35
- 3.2,
36
- 2.15,
37
- 1.52,
38
- 1.12,
39
- .86,
40
- .68
41
- ],
42
- finalDrive: 3.42
43
- },
44
- heavyTurboDiesel: {
45
- maxRpm: 4400,
46
- gears: [
47
- 4.2,
48
- 2.6,
49
- 1.75,
50
- 1.22,
51
- .9,
52
- .72
53
- ],
54
- finalDrive: 4.1
55
- },
56
- evDirectDrive: {
57
- maxRpm: 14e3,
58
- gears: [1],
59
- finalDrive: 9
60
- }
61
- };
62
- function E(e, t, n) {
63
- if (!t) return [];
64
- let i = new Map(e.map((e) => [e.id, e])), o = (e) => Object.entries(t).filter(([t, r]) => r === e && !n.has(Number(t)) && i.has(Number(t))).map(([e]) => Number(e)), s = [], c = (e) => r.find((t) => t.role === e)?.massKg ?? 16, l = (e) => {
65
- let t = e.map((e) => i.get(e).center[2]), n = Math.max(...t) - Math.min(...t), r = (Math.min(...t) + Math.max(...t)) * .5;
66
- return (n > .85 ? [e.filter((e) => i.get(e).center[2] >= r), e.filter((e) => i.get(e).center[2] < r)] : [e]).filter((e) => e.length > 0);
67
- };
68
- for (let t of ["door", "fender"]) {
69
- let n = t === "door" ? "Door" : "Fender";
70
- for (let r of [1, -1]) {
71
- let u = o(t).filter((e) => (i.get(e).center[0] >= 0 ? 1 : -1) === r);
72
- if (u.length === 0) continue;
73
- let f = l(u);
74
- f.forEach((i, o) => {
75
- let l = a(e, i), u = `${f.length > 1 ? o === 0 ? "F" : "R" : l.center[2] >= 0 ? "F" : "R"}${r > 0 ? "L" : "R"}`;
76
- s.push({
77
- nodeName: `${n}_${u}`,
78
- role: `${t}_${u.toLowerCase()}`,
79
- islandIds: i,
80
- massKg: c(t),
81
- hinge: d(l, t)
82
- });
83
- });
10
+ function computeLocalBounds(root) {
11
+ root.updateMatrixWorld(true);
12
+ const invRoot = new THREE.Matrix4().copy(root.matrixWorld).invert();
13
+ const relMat = new THREE.Matrix4();
14
+ const box = new THREE.Box3();
15
+ const v = new THREE.Vector3();
16
+ root.traverse((obj) => {
17
+ if (!isMeshObject(obj)) return;
18
+ const pos = obj.geometry.getAttribute("position");
19
+ if (!pos || pos.count === 0) return;
20
+ relMat.multiplyMatrices(invRoot, obj.matrixWorld);
21
+ for (let i = 0; i < pos.count; i++) {
22
+ v.fromBufferAttribute(pos, i).applyMatrix4(relMat);
23
+ if (Number.isFinite(v.x) && Number.isFinite(v.y) && Number.isFinite(v.z)) box.expandByPoint(v);
84
24
  }
85
- }
86
- for (let t of ["hood", "trunk"]) {
87
- let n = o(t);
88
- n.length > 0 && s.push({
89
- nodeName: t === "hood" ? "Hood" : "Trunk",
90
- role: t,
91
- islandIds: n,
92
- massKg: c(t),
93
- hinge: d(a(e, n), t)
94
- });
95
- }
96
- let u = o("bumper");
97
- if (u.length > 0) {
98
- let t = l(u);
99
- t.forEach((n, r) => {
100
- let i = a(e, n), o = t.length > 1 ? r === 0 ? "F" : "R" : i.center[2] >= 0 ? "F" : "R";
101
- s.push({
102
- nodeName: `Bumper_${o}`,
103
- role: `bumper_${o.toLowerCase()}`,
104
- islandIds: n,
105
- massKg: c("bumper"),
106
- hinge: d(i, "bumper")
107
- });
108
- });
109
- }
110
- return s;
111
- }
112
- function D(e, t, n, r) {
113
- let i = t.filter((e) => e.left.length > 0 || e.right.length > 0);
114
- if (i.length > 0) {
115
- let t = i.map((t) => ({
116
- a: t,
117
- z: a(e, [...t.left, ...t.right]).center[2]
118
- })).sort((e, t) => t.z - e.z), r = t.length, o = [];
119
- return t.forEach(({ a: t }, i) => {
120
- let s = t.left.length > 0, c = t.right.length > 0, l = s ? a(e, t.left) : a(e, t.right), u = c ? a(e, t.right) : l, d = Math.max(.08, l.radius, u.radius), f = Math.max(.06, Math.max(l.halfWidth, u.halfWidth) * 2), p = n === "AWD" || r === 1 ? !0 : n === "FWD" ? i === 0 : i > 0, m = t.steered ?? i === 0, h = t.driven ?? p, g = t.brake ?? !0, _ = r === 2 ? i === 0 ? "F" : "R" : `A${i}`;
121
- if (s && c) o.push({
122
- nodeName: `Wheel_${_}L`,
123
- islandIds: [...t.left],
124
- radius: d,
125
- width: f,
126
- steered: m,
127
- driven: h,
128
- brake: g
129
- }), o.push({
130
- nodeName: `Wheel_${_}R`,
131
- islandIds: [...t.right],
132
- radius: d,
133
- width: f,
134
- steered: m,
135
- driven: h,
136
- brake: g
137
- });
138
- else {
139
- let e = s ? [...t.left] : [...t.right], n = l.center[0], r = Math.abs(n) <= .1 ? "C" : n > 0 ? "L" : "R";
140
- o.push({
141
- nodeName: `Wheel_${_}${r}`,
142
- islandIds: e,
143
- radius: d,
144
- width: f,
145
- steered: m,
146
- driven: h,
147
- brake: g
148
- });
149
- }
150
- }), o;
151
- }
152
- let [o, s, c] = r, l = Math.max(.24, Math.min(.45, s * .24)), u = Math.max(.16, o * .14), d = o * .41, f = c * .32, p = n === "AWD" || n === "FWD", m = n === "AWD" || n === "RWD";
153
- return [
154
- {
155
- nodeName: "Wheel_FL",
156
- islandIds: [],
157
- fallbackPos: [
158
- d,
159
- l,
160
- f
161
- ],
162
- radius: l,
163
- width: u,
164
- steered: !0,
165
- driven: p,
166
- brake: !0
167
- },
168
- {
169
- nodeName: "Wheel_FR",
170
- islandIds: [],
171
- fallbackPos: [
172
- -d,
173
- l,
174
- f
175
- ],
176
- radius: l,
177
- width: u,
178
- steered: !0,
179
- driven: p,
180
- brake: !0
181
- },
182
- {
183
- nodeName: "Wheel_RL",
184
- islandIds: [],
185
- fallbackPos: [
186
- d,
187
- l,
188
- -f
189
- ],
190
- radius: l,
191
- width: u,
192
- steered: !1,
193
- driven: m,
194
- brake: !0
195
- },
196
- {
197
- nodeName: "Wheel_RR",
198
- islandIds: [],
199
- fallbackPos: [
200
- -d,
201
- l,
202
- -f
203
- ],
204
- radius: l,
205
- width: u,
206
- steered: !1,
207
- driven: m,
208
- brake: !0
209
- }
210
- ];
211
- }
212
- function O(e, t) {
213
- let n = [];
214
- return e.traverse((r) => {
215
- r !== e && r.userData && typeof r.userData[t] == "object" && r.userData[t] !== null && n.push(r);
216
- }), n;
217
- }
218
- function k(e, t, n, r) {
219
- e.updateMatrixWorld(!0), t.updateMatrixWorld(!0);
220
- let i = /* @__PURE__ */ new Set();
221
- for (let t of r) for (let n of O(e, t)) i.add(n);
222
- let a = [...i].filter((t) => {
223
- for (let n = t.parent; n && n !== e; n = n.parent) if (i.has(n)) return !1;
224
- return !0;
225
25
  });
226
- for (let e of a) t.attach(e);
227
- for (let t of [...e.children]) n.add(t);
26
+ if (box.isEmpty()) box.set(new THREE.Vector3(-.5, 0, -.5), new THREE.Vector3(.5, 1, .5));
27
+ return box;
228
28
  }
229
- async function A(r, a) {
230
- r.updateMatrixWorld(!0);
231
- let u = new m.Box3().setFromObject(r), d = u.isEmpty() ? new m.Vector3(1.8, 1.3, 4.2) : u.getSize(new m.Vector3()), f = u.isEmpty() ? new m.Vector3(0, .65, 0) : u.getCenter(new m.Vector3()), p = Math.max(.2, d.x), b = Math.max(.2, d.y), x = Math.max(.2, d.z), S = Math.max(5, a.massKg || 1e3), A = new m.Group();
232
- A.name = a.name || r.name || `Kolmo_${a.archetype}`;
233
- let j = [], M, N = a.tirePreset && v[a.tirePreset] ? a.tirePreset : "streetDrift90s", P = a.torqueCurve && g[a.torqueCurve] ? a.torqueCurve : "naScreamer", F = a.steerCurve && _[a.steerCurve] ? a.steerCurve : "driftCountersteer", I = v[N], L = y(I.muPeakLng, .82), R = T[P], z = [...new Set(a.propellerIslandIds ?? [])], B = {
234
- tireGripFactor: L,
235
- latFrictionEllipseScale: I.latFrictionEllipseScale,
236
- relaxLngRate: I.relaxLngRate,
237
- relaxLatRate: I.relaxLatRate,
238
- lngSlipRatioCurveData: I.lng,
239
- latSlipRatioCurveData: I.lat
240
- }, V = [];
241
- if (a.archetype === "car") {
242
- let e = a.islands ?? c(r), d = a.axles?.length ? [] : O(r, "ecctrlWheel"), h = z.length === 0 ? O(r, "ecctrlPropeller") : [], v = d.length > 0 && Object.keys(a.partPicks ?? {}).length === 0 && z.length === 0, y = a.driveType ?? "AWD", C = Math.max(25, a.powerOrThrust || 280), T = [
243
- u.min.x,
244
- u.min.y,
245
- u.min.z
246
- ], N = [
247
- u.max.x,
248
- u.max.y,
249
- u.max.z
250
- ];
251
- if (v) {
252
- let e = r.clone(!0), n = new m.Group();
253
- n.name = "Chassis", k(e, A, n, ["ecctrlWheel", "ecctrlPropeller"]), a.cabin?.enabled && a.cabin.includeInteriorTub && n.add(s(a.cabin, T, N)), A.add(n);
254
- let i = t(n, S, [
255
- f.x,
256
- f.y,
257
- f.z
258
- ], [
259
- p,
260
- b,
261
- x
262
- ]), o = new m.Box3().setFromObject(n), c = o.isEmpty() ? u.min : o.min, l = o.isEmpty() ? u.max : o.max, d = O(A, "ecctrlWheel"), h = Math.max(.18, ...d.map((e) => Number(e.userData.ecctrlWheel.radius) || .3)), g = Math.max(.08, Math.min(.32, h * .68)), _ = g * .4, v = Math.min(l.y - .18, Math.max(c.y, g - _ + .12)), y = Math.max(v + .22, l.y), C = new m.Object3D();
263
- C.name = "Chassis_Hull", C.position.set(w((c.x + l.x) * .5), w((v + y) * .5), w((c.z + l.z) * .5)), n.add(C), j = [{
264
- nodeName: "Chassis",
265
- motion: {
266
- isKinematic: !1,
267
- mass: S,
268
- centerOfMass: i.centerOfMass,
269
- inertiaDiagonal: i.inertiaDiagonal
270
- },
271
- extras: { role: "chassis" }
272
- }, {
273
- nodeName: "Chassis_Hull",
274
- collider: {
275
- shape: {
276
- type: "box",
277
- size: [
278
- w(Math.max(.2, l.x - c.x)),
279
- w(Math.max(.22, y - v)),
280
- w(Math.max(.2, l.z - c.z))
281
- ]
282
- },
283
- friction: .38,
284
- restitution: .05
285
- }
286
- }];
287
- for (let e of d) j.push({
288
- nodeName: e.name,
289
- extras: { ecctrlWheel: {
290
- ...e.userData.ecctrlWheel,
291
- ...B
292
- } }
293
- });
294
- for (let e of O(A, "ecctrlPropeller")) j.push({
295
- nodeName: e.name,
296
- extras: { ecctrlPropeller: e.userData.ecctrlPropeller }
297
- });
298
- } else {
299
- let n = D(e, a.axles ?? o(e), y, [
300
- p,
301
- b,
302
- x
303
- ]), c = z.map((e, t) => ({
304
- nodeName: `Propeller_${t + 1}`,
305
- islandIds: [e]
306
- })), d = /* @__PURE__ */ new Set([...n.flatMap((e) => e.islandIds), ...z]), h = E(e, a.partPicks, d), g = Object.entries(a.partPicks ?? {}).filter(([e, t]) => t === "glass" && !d.has(Number(e))).map(([e]) => Number(e)), _ = [...h.map((e) => ({
307
- nodeName: e.nodeName,
308
- islandIds: e.islandIds,
309
- anchor: e.hinge.anchor
310
- })), ...g.length > 0 ? [{
311
- nodeName: "ChassisGlass",
312
- islandIds: g,
313
- anchor: [
314
- 0,
315
- 0,
316
- 0
317
- ]
318
- }] : []], v = l(r, e, n.filter((e) => e.islandIds.length > 0), _, c), C = new m.Group();
319
- C.name = "Chassis", C.add(v.chassisGroup);
320
- let O = v.panels.find((e) => e.nodeName === "ChassisGlass");
321
- if (O) {
322
- let e = new m.MeshStandardMaterial({
323
- color: "#7dd3fc",
324
- roughness: .12,
325
- metalness: .1,
326
- transparent: !0,
327
- opacity: .34,
328
- side: m.DoubleSide
329
- });
330
- O.group.traverse((t) => {
331
- t instanceof m.Mesh && (t.material = e);
332
- }), C.add(O.group);
333
- }
334
- a.cabin?.enabled && a.cabin.includeInteriorTub && C.add(s(a.cabin, T, N)), A.add(C);
335
- for (let e of n) {
336
- let t = v.wheels.find((t) => t.nodeName === e.nodeName), n = t?.center ?? e.fallbackPos ?? [
337
- 0,
338
- e.radius,
339
- 0
340
- ];
341
- if (a.wheelSource === "fleet12" || !t) {
342
- let t = i(e.radius, e.width, e.nodeName);
343
- t.position.set(n[0], n[1], n[2]), A.add(t);
344
- } else A.add(t.group);
345
- }
346
- for (let e of v.propellers) A.add(e.group);
347
- let k = Math.max(...n.map((e) => e.radius)), M = Math.max(.08, Math.min(.32, k * .68)), P = M * .4, F = new m.Box3().setFromObject(v.chassisGroup), I = F.isEmpty() ? u.min : F.min, L = F.isEmpty() ? u.max : F.max, R = Math.min(L.y - .18, Math.max(I.y, M - P + .12)), V = Math.max(R + .22, L.y), H = [
348
- w(Math.max(.3, L.x - I.x)),
349
- w(Math.max(.22, V - R)),
350
- w(Math.max(.35, L.z - I.z))
351
- ], U = new m.Object3D();
352
- U.name = "Chassis_Hull", U.position.set(w((I.x + L.x) * .5), w((R + V) * .5), w((I.z + L.z) * .5)), C.add(U);
353
- let W = Math.max(40, S - h.reduce((e, t) => e + t.massKg, 0)), G = t(v.chassisGroup, W, [
354
- f.x,
355
- Math.max(k + .12, b * .36),
356
- f.z
357
- ], [
358
- p,
359
- Math.max(.4, b - k * .4),
360
- x
361
- ]), K = n.map((e) => v.wheels.find((t) => t.nodeName === e.nodeName)?.center[2] ?? e.fallbackPos?.[2] ?? 0), q = Math.min(...K), J = Math.max(...K), Y = J - q > .2 ? Math.max(q + .05, Math.min(J - .05, G.centerOfMass[2])) : G.centerOfMass[2], X = Math.max(k * .65, Math.min(L.y * .85, G.centerOfMass[1]));
362
- j = [{
363
- nodeName: "Chassis",
364
- motion: {
365
- isKinematic: !1,
366
- mass: W,
367
- centerOfMass: [
368
- G.centerOfMass[0],
369
- w(X),
370
- w(Y)
371
- ],
372
- inertiaDiagonal: G.inertiaDiagonal
373
- },
374
- extras: { role: "chassis" }
375
- }, {
376
- nodeName: "Chassis_Hull",
377
- collider: {
378
- shape: {
379
- type: "box",
380
- size: H
381
- },
382
- friction: .38,
383
- restitution: .05
384
- }
385
- }];
386
- for (let e of h) {
387
- let n = v.panels.find((t) => t.nodeName === e.nodeName);
388
- if (!n) continue;
389
- C.add(n.group);
390
- let r = t(n.group, e.massKg, [
391
- n.center[0] - n.anchor[0],
392
- n.center[1] - n.anchor[1],
393
- n.center[2] - n.anchor[2]
394
- ], n.size), i = new m.Object3D();
395
- i.name = `${e.nodeName}_Panel`, i.position.set(w(n.center[0] - n.anchor[0]), w(n.center[1] - n.anchor[1]), w(n.center[2] - n.anchor[2])), n.group.add(i), j.push({
396
- nodeName: i.name,
397
- collider: {
398
- shape: {
399
- type: "box",
400
- size: [
401
- w(n.size[0]),
402
- w(n.size[1]),
403
- w(n.size[2])
404
- ]
405
- },
406
- friction: .45
407
- }
408
- }), j.push({
409
- nodeName: e.nodeName,
410
- motion: {
411
- isKinematic: !1,
412
- mass: e.massKg,
413
- centerOfMass: r.centerOfMass,
414
- inertiaDiagonal: r.inertiaDiagonal
415
- },
416
- joint: {
417
- connectedNodeName: "Chassis",
418
- kind: "revolute",
419
- axis: e.hinge.axis,
420
- limits: e.hinge.limits,
421
- drive: {
422
- mode: "acceleration",
423
- stiffness: 60,
424
- damping: 12,
425
- positionTarget: 0
426
- }
427
- },
428
- extras: { role: e.role }
429
- });
430
- }
431
- for (let e of n) {
432
- let t = w(Math.max(.08, Math.min(.32, e.radius * .68))), n = w(t * .4);
433
- j.push({
434
- nodeName: e.nodeName,
435
- extras: { ecctrlWheel: {
436
- radius: w(e.radius),
437
- width: w(e.width),
438
- travel: t,
439
- sag: n,
440
- steer: e.steered,
441
- drive: e.driven,
442
- brake: e.brake,
443
- ...B
444
- } }
445
- });
446
- }
447
- if (v.propellers.length > 0) {
448
- let e = Math.max(400, Math.ceil(S * 9.81 * 2.2 / v.propellers.length));
449
- v.propellers.forEach((t, n) => j.push({
450
- nodeName: t.nodeName,
451
- extras: { ecctrlPropeller: {
452
- maxThrust: e,
453
- torqueRatio: .6,
454
- invertTorque: n % 2 == 1
455
- } }
456
- }));
457
- }
458
- }
459
- a.cabin?.enabled && V.push(...n(a.cabin, T, N)), M = {
460
- tune: {
461
- engineHorsepower: C,
462
- engineMaxRPM: R.maxRpm,
463
- gearRatios: R.gears,
464
- finalDriveRatio: R.finalDrive,
465
- transmissionMode: "auto",
466
- maxSteerAngle: .55,
467
- engineTorqueCurveData: g[P],
468
- steerAngleCurveData: _[F]
469
- },
470
- ...z.length > 0 || h.length > 0 ? { droneTune: {
471
- controlMode: "VELOCITY",
472
- maxYawRate: 2.4,
473
- maxHorizSpeed: 44,
474
- maxVertSpeed: 22,
475
- maxTiltAngle: .52,
476
- airDragFactor: .18
477
- } } : {}
478
- };
479
- } else if (a.archetype === "starcraft") {
480
- let e = a.islands ?? c(r), n = z.length === 0 ? O(r, "ecctrlPropeller") : [], i = new m.Group();
481
- if (i.name = "HullBody", z.length > 0) {
482
- let n = l(r, e, [], [], z.map((e, t) => ({
483
- nodeName: `Propeller_${t + 1}`,
484
- islandIds: [e]
485
- })));
486
- i.add(n.chassisGroup), A.add(i);
487
- let o = t(i, S, [
488
- f.x,
489
- f.y,
490
- f.z
491
- ], [
492
- p,
493
- b,
494
- x
495
- ]), s = new m.Box3().setFromObject(i), c = s.isEmpty() ? d : s.getSize(new m.Vector3()), u = s.isEmpty() ? f : s.getCenter(new m.Vector3()), h = new m.Object3D();
496
- h.name = "HullBody_Col", h.position.set(w(u.x), w(u.y), w(u.z)), i.add(h), j = [{
497
- nodeName: "HullBody",
498
- motion: {
499
- isKinematic: !1,
500
- mass: S,
501
- centerOfMass: o.centerOfMass,
502
- inertiaDiagonal: o.inertiaDiagonal
503
- }
504
- }, {
505
- nodeName: "HullBody_Col",
506
- collider: {
507
- shape: {
508
- type: "box",
509
- size: [
510
- w(Math.max(.2, c.x)),
511
- w(Math.max(.2, c.y)),
512
- w(Math.max(.2, c.z))
513
- ]
514
- },
515
- friction: .35,
516
- restitution: .08
517
- }
518
- }];
519
- let g = Math.max(400, a.powerOrThrust || 4500, Math.ceil(S * 9.81 * 2.2 / n.propellers.length));
520
- n.propellers.forEach((e, t) => {
521
- A.add(e.group), j.push({
522
- nodeName: e.nodeName,
523
- extras: { ecctrlPropeller: {
524
- maxThrust: g,
525
- torqueRatio: .6,
526
- invertTorque: t % 2 == 1
527
- } }
528
- });
529
- });
530
- } else {
531
- k(r.clone(!0), A, i, ["ecctrlPropeller"]), A.add(i);
532
- let e = t(i, S, [
533
- f.x,
534
- f.y,
535
- f.z
536
- ], [
537
- p,
538
- b,
539
- x
540
- ]), o = new m.Object3D();
541
- if (o.name = "HullBody_Col", o.position.set(w(f.x), w(f.y), w(f.z)), i.add(o), j = [{
542
- nodeName: "HullBody",
543
- motion: {
544
- isKinematic: !1,
545
- mass: S,
546
- centerOfMass: e.centerOfMass,
547
- inertiaDiagonal: e.inertiaDiagonal
548
- }
549
- }, {
550
- nodeName: "HullBody_Col",
551
- collider: {
552
- shape: {
553
- type: "box",
554
- size: [
555
- w(p * .88),
556
- w(b * .8),
557
- w(x * .9)
558
- ]
559
- },
560
- friction: .35,
561
- restitution: .08
562
- }
563
- }], n.length > 0) for (let e of O(A, "ecctrlPropeller")) j.push({
564
- nodeName: e.name,
565
- extras: { ecctrlPropeller: e.userData.ecctrlPropeller }
566
- });
567
- else {
568
- let e = Math.max(400, a.powerOrThrust || 4500, Math.ceil(S * 9.81 * .72));
569
- for (let [t, n, r, i] of [
570
- [
571
- "Thruster_FL",
572
- p * .36,
573
- x * .32,
574
- !1
575
- ],
576
- [
577
- "Thruster_FR",
578
- -p * .36,
579
- x * .32,
580
- !0
581
- ],
582
- [
583
- "Thruster_RL",
584
- p * .36,
585
- -x * .32,
586
- !0
587
- ],
588
- [
589
- "Thruster_RR",
590
- -p * .36,
591
- -x * .32,
592
- !1
593
- ]
594
- ]) {
595
- let a = new m.Object3D();
596
- a.name = t, a.position.set(f.x + n, f.y, f.z + r), A.add(a), j.push({
597
- nodeName: t,
598
- extras: { ecctrlPropeller: {
599
- maxThrust: e,
600
- torqueRatio: .6,
601
- invertTorque: i
602
- } }
603
- });
604
- }
605
- }
606
- }
607
- M = { droneTune: {
608
- controlMode: "VELOCITY",
609
- maxYawRate: 2.4,
610
- maxHorizSpeed: 44,
611
- maxVertSpeed: 22,
612
- maxTiltAngle: .52,
613
- airDragFactor: .18
614
- } };
615
- } else {
616
- let e = new m.Group();
617
- e.name = "PropBody";
618
- let n = !1;
619
- for (let t of r.clone(!0).children) e.add(t), t.traverse((e) => {
620
- e instanceof m.Mesh && (e.geometry?.getAttribute("position")?.count ?? 0) >= 3 && (n = !0);
621
- });
622
- A.add(e);
623
- let i = t(e, S, [
624
- f.x,
625
- f.y,
626
- f.z
627
- ], [
628
- p,
629
- b,
630
- x
631
- ]);
632
- j = [{
633
- nodeName: "PropBody",
634
- motion: a.staticProp ? { isKinematic: !0 } : {
635
- isKinematic: !1,
636
- mass: S,
637
- centerOfMass: i.centerOfMass,
638
- inertiaDiagonal: i.inertiaDiagonal
639
- },
640
- collider: n ? {
641
- meshNodeName: "PropBody",
642
- convexHull: !0,
643
- friction: .6,
644
- restitution: .1
645
- } : {
646
- shape: {
647
- type: "box",
648
- size: [
649
- w(p),
650
- w(b),
651
- w(x)
652
- ]
653
- },
654
- friction: .6,
655
- restitution: .1
656
- }
657
- }];
658
- }
659
- let H = [];
660
- A.traverse((e) => {
661
- if (!(e instanceof m.Mesh) || !e.material) return;
662
- let t = e.material;
663
- for (let e of C) {
664
- let n = t[e];
665
- n && !n.image && (H.push({
666
- rec: t,
667
- slot: e,
668
- tex: n
669
- }), t[e] = null);
670
- }
671
- });
672
- let U;
29
+ async function compileKhrAssetGlb(normalizedScene, opts) {
30
+ const box = computeLocalBounds(normalizedScene);
31
+ const sizeVec = box.getSize(new THREE.Vector3());
32
+ const center = box.getCenter(new THREE.Vector3());
33
+ const size = [
34
+ Math.max(.25, sizeVec.x),
35
+ Math.max(.25, sizeVec.y),
36
+ Math.max(.25, sizeVec.z)
37
+ ];
38
+ const totalMass = Math.max(5, opts.massKg || 1e3);
39
+ const exportRoot = new THREE.Group();
40
+ exportRoot.name = opts.name || normalizedScene.name || `Kolmo_${opts.archetype}`;
41
+ let specs;
42
+ let sceneExtras;
43
+ let coveredSourceNodes = null;
44
+ if (opts.archetype === "car") {
45
+ const plan = buildCarExportPlan(normalizedScene, exportRoot, opts, box, size, center, totalMass);
46
+ specs = plan.specs;
47
+ sceneExtras = plan.sceneExtras;
48
+ coveredSourceNodes = plan.coveredSourceNodes;
49
+ } else if (opts.archetype === "craft") {
50
+ const plan = buildCraftExportPlan(normalizedScene, exportRoot, opts, size, center, totalMass);
51
+ specs = plan.specs;
52
+ sceneExtras = plan.sceneExtras;
53
+ } else specs = buildPropExportPlan(normalizedScene, exportRoot, opts, size, center, totalMass);
54
+ const specNames = collectSpecNodeNames(specs);
55
+ ensureRootNameUnique(exportRoot, specNames);
56
+ const reserved = new Set(specNames);
57
+ for (const p of opts.patches ?? []) reserved.add(p.nodeName);
58
+ assignMissingEmitterNames(exportRoot, reserved);
59
+ const stripped = stripUnloadedTextures(exportRoot);
60
+ let exported;
673
61
  try {
674
- U = new Uint8Array(await h(A, j, M));
62
+ exported = new Uint8Array(await exportKhrGlb(exportRoot, specs, sceneExtras));
675
63
  } finally {
676
- for (let e of H) e.rec[e.slot] = e.tex;
64
+ restoreStrippedTextures(stripped);
65
+ }
66
+ const explicitPatches = opts.patches ?? [];
67
+ const preservedFromExport = collectPreservedRigPatches(exportRoot, [], { localToParent: true });
68
+ const preservedFallback = [];
69
+ if (coveredSourceNodes) {
70
+ const avoidNames = collectSceneNodeNames(exportRoot, specNames);
71
+ preservedFallback.push(...collectPreservedRigPatches(normalizedScene, preservedFromExport, {
72
+ localToParent: false,
73
+ skipSubtrees: coveredSourceNodes,
74
+ avoidNames
75
+ }));
677
76
  }
678
- let W = new Set((a.patches ?? []).map((e) => e.nodeName)), G = [...V.filter((e) => !W.has(e.nodeName)), ...a.patches ?? []], K = e(U, G);
679
- return K instanceof Uint8Array ? K : new Uint8Array(K);
77
+ const existingNames = collectSceneNodeNames(exportRoot, specNames);
78
+ for (const p of preservedFromExport) existingNames.add(p.nodeName);
79
+ for (const p of preservedFallback) existingNames.add(p.nodeName);
80
+ const safeExplicit = disambiguateExplicitPatches(explicitPatches, existingNames);
81
+ const withPreserved = stampKolmoNodesIntoGlb(exported, [...preservedFromExport, ...preservedFallback]);
82
+ const stamped = stampKolmoNodesIntoGlb(withPreserved, safeExplicit, void 0, { preserveExistingNodes: true });
83
+ return new Uint8Array(stamped);
680
84
  }
681
- export { S as STEER_CURVE_IDS, b as TIRE_PRESET_IDS, x as TORQUE_CURVE_IDS, u as buildPatchPreviewEmitters, A as compileKhrAssetGlb, d as computeChopPartHinge, f as createVehiclePanelAnimator, p as normalToMinusZQuaternion, E as planArticulatedPanels };
85
+ export { buildPatchPreviewEmitters, compileKhrAssetGlb, computeChopPartHinge, normalToMinusZQuaternion };
86
+
87
+ //# sourceMappingURL=khrCompiler.js.map