@pinkaphant/kolmo 0.2.3 → 0.4.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 (381) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -36
  3. package/bin/kolmo.mjs +12 -6
  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 +242 -165
  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 +140 -205
  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 -100
  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 -240
  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 +4 -1
  59. package/dist/engine/kolmoVehicleDriver.js +116 -22
  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 -116
  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 +9 -1
  83. package/dist/importer/ChopShopPanel.js +303 -359
  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 -0
  89. package/dist/importer/GateHudBar.js +290 -279
  90. package/dist/importer/GateHudBar.js.map +1 -0
  91. package/dist/importer/GlbImportGate.d.ts +2 -1
  92. package/dist/importer/GlbImportGate.js +252 -225
  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 -5
  107. package/dist/importer/Step1CalibrationPlinth.js +180 -251
  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 -7
  113. package/dist/importer/Step2UniversalPad.js +49 -170
  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 -26
  127. package/dist/importer/chopShopActions.js +135 -210
  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 +15 -0
  133. package/dist/importer/chopShopIoActions.js +137 -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 +175 -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 +1 -1
  151. package/dist/importer/gateStore.js +36 -27
  152. package/dist/importer/gateStore.js.map +1 -0
  153. package/dist/importer/glbNormalizer.js +118 -79
  154. package/dist/importer/glbNormalizer.js.map +1 -0
  155. package/dist/importer/importerWebMcp.d.ts +4 -3
  156. package/dist/importer/importerWebMcp.js +41 -336
  157. package/dist/importer/importerWebMcp.js.map +1 -0
  158. package/dist/importer/importerWebMcpTools.d.ts +2 -0
  159. package/dist/importer/importerWebMcpTools.js +340 -0
  160. package/dist/importer/importerWebMcpTools.js.map +1 -0
  161. package/dist/importer/index.d.ts +4 -0
  162. package/dist/importer/index.js +32 -22
  163. package/dist/importer/index.js.map +1 -0
  164. package/dist/importer/khrCarPlanHelpers.d.ts +28 -0
  165. package/dist/importer/khrCarPlanHelpers.js +221 -0
  166. package/dist/importer/khrCarPlanHelpers.js.map +1 -0
  167. package/dist/importer/khrCarPlanner.d.ts +7 -0
  168. package/dist/importer/khrCarPlanner.js +279 -0
  169. package/dist/importer/khrCarPlanner.js.map +1 -0
  170. package/dist/importer/khrCompiler.d.ts +4 -22
  171. package/dist/importer/khrCompiler.js +56 -424
  172. package/dist/importer/khrCompiler.js.map +1 -0
  173. package/dist/importer/khrCraftPropCompiler.d.ts +40 -0
  174. package/dist/importer/khrCraftPropCompiler.js +250 -0
  175. package/dist/importer/khrCraftPropCompiler.js.map +1 -0
  176. package/dist/importer/launcherBake.js +76 -35
  177. package/dist/importer/launcherBake.js.map +1 -0
  178. package/dist/importer/meshIslands.d.ts +4 -46
  179. package/dist/importer/meshIslands.js +84 -283
  180. package/dist/importer/meshIslands.js.map +1 -0
  181. package/dist/importer/meshSliceBuffers.d.ts +15 -0
  182. package/dist/importer/meshSliceBuffers.js +159 -0
  183. package/dist/importer/meshSliceBuffers.js.map +1 -0
  184. package/dist/importer/polygonEarClipYZ.d.ts +3 -0
  185. package/dist/importer/polygonEarClipYZ.js +67 -0
  186. package/dist/importer/polygonEarClipYZ.js.map +1 -0
  187. package/dist/importer/sceneSiNormalize.d.ts +19 -0
  188. package/dist/importer/sceneSiNormalize.js +138 -0
  189. package/dist/importer/sceneSiNormalize.js.map +1 -0
  190. package/dist/importer/starterScene.d.ts +3 -0
  191. package/dist/importer/starterScene.js +76 -0
  192. package/dist/importer/starterScene.js.map +1 -0
  193. package/dist/importer/surfaceCutter.d.ts +4 -15
  194. package/dist/importer/surfaceCutter.js +69 -240
  195. package/dist/importer/surfaceCutter.js.map +1 -0
  196. package/dist/importer/surfaceGeodesic.d.ts +7 -0
  197. package/dist/importer/surfaceGeodesic.js +130 -0
  198. package/dist/importer/surfaceGeodesic.js.map +1 -0
  199. package/dist/importer/surfaceLoopRefine.d.ts +6 -0
  200. package/dist/importer/surfaceLoopRefine.js +171 -0
  201. package/dist/importer/surfaceLoopRefine.js.map +1 -0
  202. package/dist/importer/surfacePeel.d.ts +11 -0
  203. package/dist/importer/surfacePeel.js +119 -0
  204. package/dist/importer/surfacePeel.js.map +1 -0
  205. package/dist/importer/surfaceTopology.d.ts +2 -6
  206. package/dist/importer/surfaceTopology.js +93 -133
  207. package/dist/importer/surfaceTopology.js.map +1 -0
  208. package/dist/importer/universalGateBake.d.ts +7 -3
  209. package/dist/importer/universalGateBake.js +104 -106
  210. package/dist/importer/universalGateBake.js.map +1 -0
  211. package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
  212. package/dist/importer/usdPhysicsSpecs.js +245 -0
  213. package/dist/importer/usdPhysicsSpecs.js.map +1 -0
  214. package/dist/importer/usdTextParse.d.ts +12 -0
  215. package/dist/importer/usdTextParse.js +118 -0
  216. package/dist/importer/usdTextParse.js.map +1 -0
  217. package/dist/importer/usdToGlb.d.ts +3 -2
  218. package/dist/importer/usdToGlb.js +80 -280
  219. package/dist/importer/usdToGlb.js.map +1 -0
  220. package/dist/importer/useChopShopController.d.ts +50 -47
  221. package/dist/importer/useChopShopController.js +156 -338
  222. package/dist/importer/useChopShopController.js.map +1 -0
  223. package/dist/importer/useChopShopState.d.ts +103 -0
  224. package/dist/importer/useChopShopState.js +319 -0
  225. package/dist/importer/useChopShopState.js.map +1 -0
  226. package/dist/importer/useWasdKeyRef.d.ts +9 -0
  227. package/dist/importer/useWasdKeyRef.js +35 -0
  228. package/dist/importer/useWasdKeyRef.js.map +1 -0
  229. package/dist/importer/vehiclePartSplit.d.ts +33 -0
  230. package/dist/importer/vehiclePartSplit.js +178 -0
  231. package/dist/importer/vehiclePartSplit.js.map +1 -0
  232. package/dist/importer/wheelAxlePairing.js +106 -70
  233. package/dist/importer/wheelAxlePairing.js.map +1 -0
  234. package/dist/importer/wheelCutterHelpers.d.ts +42 -0
  235. package/dist/importer/wheelCutterHelpers.js +178 -0
  236. package/dist/importer/wheelCutterHelpers.js.map +1 -0
  237. package/dist/importer/wheelRingHandleMath.d.ts +20 -0
  238. package/dist/importer/wheelRingHandleMath.js +66 -0
  239. package/dist/importer/wheelRingHandleMath.js.map +1 -0
  240. package/dist/index.d.ts +3 -2
  241. package/dist/index.js +90 -66
  242. package/dist/index.js.map +1 -0
  243. package/dist/junk/DestructibleTarget.d.ts +3 -3
  244. package/dist/junk/DestructibleTarget.js +177 -114
  245. package/dist/junk/DestructibleTarget.js.map +1 -0
  246. package/dist/junk/KolmoJunk.js +55 -44
  247. package/dist/junk/KolmoJunk.js.map +1 -0
  248. package/dist/junk/ShardPieces.d.ts +2 -1
  249. package/dist/junk/ShardPieces.js +80 -61
  250. package/dist/junk/ShardPieces.js.map +1 -0
  251. package/dist/junk/TargetDecals.d.ts +6 -15
  252. package/dist/junk/TargetDecals.js +66 -40
  253. package/dist/junk/TargetDecals.js.map +1 -0
  254. package/dist/junk/bvhShatter.d.ts +2 -6
  255. package/dist/junk/bvhShatter.js +89 -43
  256. package/dist/junk/bvhShatter.js.map +1 -0
  257. package/dist/junk/bvhTriCollector.d.ts +2 -6
  258. package/dist/junk/bvhTriCollector.js +111 -62
  259. package/dist/junk/bvhTriCollector.js.map +1 -0
  260. package/dist/junk/index.d.ts +2 -2
  261. package/dist/junk/index.js +11 -11
  262. package/dist/junk/index.js.map +1 -0
  263. package/dist/junk/junkGeometry.d.ts +5 -26
  264. package/dist/junk/junkGeometry.js +61 -43
  265. package/dist/junk/junkGeometry.js.map +1 -0
  266. package/dist/junk/junkImportSanitize.d.ts +4 -5
  267. package/dist/junk/junkImportSanitize.js +57 -37
  268. package/dist/junk/junkImportSanitize.js.map +1 -0
  269. package/dist/junk/junkImporter.d.ts +2 -13
  270. package/dist/junk/junkImporter.js +105 -76
  271. package/dist/junk/junkImporter.js.map +1 -0
  272. package/dist/junk/junkLabelCanvas.d.ts +1 -6
  273. package/dist/junk/junkLabelCanvas.js +147 -29
  274. package/dist/junk/junkLabelCanvas.js.map +1 -0
  275. package/dist/junk/junkLabels.d.ts +4 -26
  276. package/dist/junk/junkLabels.js +42 -28
  277. package/dist/junk/junkLabels.js.map +1 -0
  278. package/dist/junk/targetHelpers.d.ts +3 -4
  279. package/dist/junk/targetHelpers.js +121 -67
  280. package/dist/junk/targetHelpers.js.map +1 -0
  281. package/dist/junk/targetHitLogic.d.ts +8 -8
  282. package/dist/junk/targetHitLogic.js +131 -95
  283. package/dist/junk/targetHitLogic.js.map +1 -0
  284. package/dist/junk/useTargetAssets.d.ts +9 -14
  285. package/dist/junk/useTargetAssets.js +113 -85
  286. package/dist/junk/useTargetAssets.js.map +1 -0
  287. package/dist/physics/index.d.ts +1 -1
  288. package/dist/physics/index.js +79 -58
  289. package/dist/physics/index.js.map +1 -0
  290. package/dist/schema/kolmoSchema.d.ts +3 -64
  291. package/dist/schema/kolmoSchema.js +75 -149
  292. package/dist/schema/kolmoSchema.js.map +1 -0
  293. package/dist/schema/kolmoStamp.d.ts +6 -0
  294. package/dist/schema/kolmoStamp.js +71 -0
  295. package/dist/schema/kolmoStamp.js.map +1 -0
  296. package/dist/schema/kolmoTypes.d.ts +63 -0
  297. package/dist/schema/kolmoTypes.js +66 -0
  298. package/dist/schema/kolmoTypes.js.map +1 -0
  299. package/dist/shaders/celestialBackdrop.d.ts +2 -10
  300. package/dist/shaders/celestialBackdrop.js +128 -291
  301. package/dist/shaders/celestialBackdrop.js.map +1 -0
  302. package/dist/shaders/emitterShaders.d.ts +9 -0
  303. package/dist/shaders/emitterShaders.js +114 -0
  304. package/dist/shaders/emitterShaders.js.map +1 -0
  305. package/dist/shaders/index.d.ts +1 -1
  306. package/dist/shaders/index.js +12 -9
  307. package/dist/shaders/index.js.map +1 -0
  308. package/dist/shaders/plumeAndSparkle.d.ts +2 -4
  309. package/dist/shaders/plumeAndSparkle.js +152 -191
  310. package/dist/shaders/plumeAndSparkle.js.map +1 -0
  311. package/dist/shaders/ps2GlslShared.js +29 -2
  312. package/dist/shaders/ps2GlslShared.js.map +1 -0
  313. package/dist/shaders/ps2MaterialsTSL.js +132 -51
  314. package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
  315. package/dist/shaders/ps2MaterialsWebGL.js +45 -28
  316. package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
  317. package/dist/shaders/ps2RoadWebGL.js +69 -32
  318. package/dist/shaders/ps2RoadWebGL.js.map +1 -0
  319. package/dist/shaders/ps2TerrainWebGL.js +107 -30
  320. package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
  321. package/dist/shaders/ps2Textures.d.ts +1 -1
  322. package/dist/shaders/ps2Textures.js +116 -41
  323. package/dist/shaders/ps2Textures.js.map +1 -0
  324. package/dist/shaders/retroPalettes.d.ts +1 -1
  325. package/dist/shaders/retroPalettes.js +90 -57
  326. package/dist/shaders/retroPalettes.js.map +1 -0
  327. package/dist/shaders/retroShader.d.ts +2 -86
  328. package/dist/shaders/retroShader.js +65 -196
  329. package/dist/shaders/retroShader.js.map +1 -0
  330. package/dist/shaders/retroUniforms.d.ts +60 -0
  331. package/dist/shaders/retroUniforms.js +215 -0
  332. package/dist/shaders/retroUniforms.js.map +1 -0
  333. package/dist/shaders/skyboxShaders.d.ts +16 -0
  334. package/dist/shaders/skyboxShaders.js +266 -0
  335. package/dist/shaders/skyboxShaders.js.map +1 -0
  336. package/dist/shaders/tsl.d.ts +1 -1
  337. package/dist/shaders/tsl.js.map +1 -0
  338. package/dist/vite/index.js +39 -23
  339. package/dist/vite/index.js.map +1 -0
  340. package/dist/world/frontage.js +25 -21
  341. package/dist/world/frontage.js.map +1 -0
  342. package/dist/world/index.d.ts +4 -4
  343. package/dist/world/index.js +12 -11
  344. package/dist/world/index.js.map +1 -0
  345. package/dist/world/infiniteWorld2D.d.ts +0 -5
  346. package/dist/world/infiniteWorld2D.js +175 -200
  347. package/dist/world/infiniteWorld2D.js.map +1 -0
  348. package/dist/world/island.js +81 -166
  349. package/dist/world/island.js.map +1 -0
  350. package/dist/world/islandPathing.d.ts +6 -0
  351. package/dist/world/islandPathing.js +166 -0
  352. package/dist/world/islandPathing.js.map +1 -0
  353. package/dist/world/macroCellSchema.js +15 -8
  354. package/dist/world/macroCellSchema.js.map +1 -0
  355. package/dist/world/macroKnightAStar.js +140 -71
  356. package/dist/world/macroKnightAStar.js.map +1 -0
  357. package/dist/world/macroSettlementZones.d.ts +9 -0
  358. package/dist/world/macroSettlementZones.js +108 -0
  359. package/dist/world/macroSettlementZones.js.map +1 -0
  360. package/dist/world/random.js +50 -24
  361. package/dist/world/random.js.map +1 -0
  362. package/dist/world/road.js +152 -90
  363. package/dist/world/road.js.map +1 -0
  364. package/dist/world/roadRibbon.d.ts +4 -19
  365. package/dist/world/roadRibbon.js +129 -124
  366. package/dist/world/roadRibbon.js.map +1 -0
  367. package/dist/world/terrain.d.ts +1 -1
  368. package/dist/world/terrain.js +111 -65
  369. package/dist/world/terrain.js.map +1 -0
  370. package/dist/world/terrainGeometry.d.ts +14 -0
  371. package/dist/world/terrainGeometry.js +76 -0
  372. package/dist/world/terrainGeometry.js.map +1 -0
  373. package/dist/world/worldTypes.d.ts +3 -3
  374. package/dist/world/worldTypes.js +133 -67
  375. package/dist/world/worldTypes.js.map +1 -0
  376. package/docs/api-reference.md +187 -0
  377. package/package.json +58 -32
  378. package/dist/engine/kolmoStore.js +0 -211
  379. package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -19
  380. package/dist/importer/ImporterPlinthUikitTags.js +0 -112
  381. package/dist/importer/vehiclePanelAnim.js +0 -214
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@pinkaphant/kolmo",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
+ "description": "Low-overhead retro 3D game runtime: declarative React Three Fiber world & vehicle engine, C12 road/island/long-drive generator, PS1/Dreamcast/PS2 retro shader stack, and GLB import calibration gate.",
4
5
  "license": "MIT",
5
6
  "type": "module",
6
7
  "sideEffects": false,
7
- "description": "Kolmo 3D Game Engine (ecctrl 2 + khr3) & Universal KHR3 GLB/USD Gate",
8
- "main": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
8
  "bin": {
11
9
  "kolmo": "./bin/kolmo.mjs"
12
10
  },
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
16
  "import": "./dist/index.js"
17
17
  },
18
+ "./all": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
18
22
  "./physics": {
19
23
  "types": "./dist/physics/index.d.ts",
20
24
  "import": "./dist/physics/index.js"
@@ -47,14 +51,15 @@
47
51
  "types": "./dist/junk/index.d.ts",
48
52
  "import": "./dist/junk/index.js"
49
53
  },
50
- "./all": {
51
- "types": "./dist/index.d.ts",
52
- "import": "./dist/index.js"
54
+ "./schema": {
55
+ "types": "./dist/schema/kolmoSchema.d.ts",
56
+ "import": "./dist/schema/kolmoSchema.js"
53
57
  },
54
58
  "./package.json": "./package.json"
55
59
  },
56
60
  "files": [
57
61
  "dist",
62
+ "docs",
58
63
  "bin",
59
64
  "LICENSE",
60
65
  "README.md"
@@ -64,57 +69,78 @@
64
69
  },
65
70
  "scripts": {
66
71
  "dev": "vite",
72
+ "example": "tsx example/headless.ts",
67
73
  "typecheck": "tsc --noEmit",
68
- "build": "npm run build:lib",
74
+ "test": "node --import tsx --test \"src/**/*.test.ts*\"",
69
75
  "build:lib": "rm -rf dist && vite build -c vite.lib.config.ts && tsc -p tsconfig.lib.json",
70
- "build:studio": "vite build --outDir studio-dist",
71
- "prepack": "npm run build:lib",
72
- "test": "node --expose-gc --import ./test-loader.mjs --import tsx --test \"tests/**/*.test.ts*\"",
73
- "compile:fleet": "node --import ./test-loader.mjs --import tsx scripts/compile-fleet.mts"
76
+ "prepack": "npm run build:lib >&2",
77
+ "pack:dry": "npm pack --dry-run"
78
+ },
79
+ "dependencies": {
80
+ "@khr3/assets": "^0.2.4",
81
+ "@khr3/c12": "^0.3.4",
82
+ "@khr3/core": "^0.2.0",
83
+ "@khr3/launchers": "^0.2.5",
84
+ "@khr3/vehicles": "^0.2.0"
85
+ },
86
+ "overrides": {
87
+ "@dimforge/rapier3d-compat": "0.19.2",
88
+ "@pinkaphant/ecctrl": "2.0.4-beta.2"
74
89
  },
75
90
  "peerDependencies": {
76
91
  "@dimforge/rapier3d-compat": "0.19.2",
77
92
  "@pinkaphant/ecctrl": "2.0.4-beta.2",
78
- "@react-three/drei": ">=10.7.0",
79
- "@react-three/fiber": ">=9.6.0",
80
- "@react-three/rapier": "^2.2.0",
81
- "koota": ">=0.6.5",
82
- "react": ">=19.0.0",
83
- "react-dom": ">=19.0.0",
84
- "three": ">=0.184.0"
85
- },
86
- "dependencies": {
87
- "@khr3/assets": "^0.2.2",
88
- "@khr3/c12": "^0.3.1",
89
- "@khr3/core": "^0.1.4",
90
- "@khr3/launchers": "^0.2.2",
91
- "@khr3/vehicles": "^0.1.4",
92
93
  "@pmndrs/uikit": "^1.0.78",
93
94
  "@preact/signals-core": "^1.14.5",
95
+ "@react-three/drei": "^10.7.7",
96
+ "@react-three/fiber": "^9.0.0",
97
+ "@react-three/rapier": "^2.2.0",
94
98
  "@react-three/uikit": "^1.0.78",
95
- "maath": "^0.10.8",
96
- "zustand": "^5.0.14"
99
+ "koota": "^0.6.5",
100
+ "react": "^19.0.0",
101
+ "react-dom": "^19.0.0",
102
+ "three": ">=0.180.0",
103
+ "zustand": "^5.0.0"
97
104
  },
98
105
  "devDependencies": {
99
106
  "@dimforge/rapier3d-compat": "0.19.2",
100
107
  "@pinkaphant/ecctrl": "2.0.4-beta.2",
108
+ "@pmndrs/uikit": "^1.0.78",
109
+ "@preact/signals-core": "^1.14.5",
101
110
  "@react-three/drei": "^10.7.7",
102
111
  "@react-three/fiber": "^9.6.1",
103
112
  "@react-three/rapier": "^2.2.0",
104
- "@react-three/test-renderer": "^9.1.1",
113
+ "@react-three/uikit": "^1.0.78",
105
114
  "@types/node": "^22.20.5",
106
115
  "@types/react": "^19.2.16",
107
116
  "@types/react-dom": "^19.2.3",
108
117
  "@types/three": "^0.184.0",
109
118
  "@vitejs/plugin-react": "^6.1.1",
110
119
  "koota": "^0.6.5",
111
- "partyserver": "^0.5.10",
112
- "partysocket": "^1.3.0",
113
120
  "react": "^19.2.7",
114
121
  "react-dom": "^19.2.7",
115
122
  "three": "^0.184.0",
116
123
  "tsx": "^4.23.15",
117
124
  "typescript": "^6.0.3",
118
- "vite": "^8.3.8"
125
+ "vite": "^8.3.8",
126
+ "wrangler": "^4.164.0",
127
+ "zustand": "^5.0.14"
128
+ },
129
+ "keywords": [
130
+ "threejs",
131
+ "react-three-fiber",
132
+ "rapier",
133
+ "ecctrl",
134
+ "khr3",
135
+ "retro",
136
+ "game-engine"
137
+ ],
138
+ "repository": {
139
+ "type": "git",
140
+ "url": "git+https://github.com/pinkAphant/kolmo.git"
141
+ },
142
+ "homepage": "https://github.com/pinkAphant/kolmo#readme",
143
+ "bugs": {
144
+ "url": "https://github.com/pinkAphant/kolmo/issues"
119
145
  }
120
146
  }
@@ -1,211 +0,0 @@
1
- import { syncRetroUniforms as e } from "../shaders/retroShader.js";
2
- import { useEffect as t, useReducer as n, useRef as r } from "react";
3
- import * as i from "three";
4
- import { useWorld as a } from "koota/react";
5
- import { createActions as o, createWorld as s, relation as c, trait as l } from "koota";
6
- // src/engine/kolmoStore.ts
7
- var u = l(() => ({
8
- id: "",
9
- handle: null,
10
- centerOfMass: [
11
- 0,
12
- 0,
13
- 0
14
- ],
15
- seatOffset: [
16
- 0,
17
- .55,
18
- 0
19
- ],
20
- exitOffset: [
21
- -1.5,
22
- .45,
23
- 0
24
- ],
25
- isFlight: !1
26
- })), d = l(() => ({
27
- id: "pilot",
28
- handle: null,
29
- exitSpawnPos: null,
30
- exitSpawnYaw: 0,
31
- exitLinVel: null
32
- })), f = l({
33
- id: "",
34
- radius: 4,
35
- kind: "vehicle"
36
- }), p = l(() => ({
37
- id: "",
38
- getBody: () => null
39
- })), m = c({ exclusive: !0 }), h = l({
40
- activeVehicleId: "",
41
- activeRetroPreset: "dreamcast"
42
- }), g = s(h);
43
- function _() {
44
- try {
45
- return a();
46
- } catch {
47
- return g;
48
- }
49
- }
50
- function v(e) {
51
- e.has(h) || e.add(h);
52
- }
53
- function y(e, i) {
54
- let [, a] = n((e) => e + 1, 0), o = r(e && e.has(i) ? e.get(i) : void 0);
55
- return o.current = e && e.has(i) ? e.get(i) : void 0, t(() => {
56
- if (!e) return;
57
- let t = () => {
58
- o.current = e.has(i) ? e.get(i) : void 0, a();
59
- }, n = e.onAdd(i, () => t()), r = e.onChange(i, () => t()), s = e.onRemove(i, () => t());
60
- return (e.has(i) ? e.get(i) : void 0) !== o.current && t(), () => {
61
- n(), r(), s();
62
- };
63
- }, [e, i]), o.current;
64
- }
65
- function b(e, t) {
66
- let n = e.has(h) ? e.get(h)?.activeVehicleId : "";
67
- if (n) for (let t of e.query(u)) {
68
- let e = t.get(u);
69
- if (e?.id === n && e.handle?.body) {
70
- let t = e.handle.body.translation();
71
- return [t.x, t.z];
72
- }
73
- }
74
- for (let t of e.query(d)) {
75
- let e = t.get(d)?.handle?.body;
76
- if (e) {
77
- let t = e.translation();
78
- return [t.x, t.z];
79
- }
80
- }
81
- for (let t of e.query(u)) {
82
- let e = t.get(u)?.handle?.body;
83
- if (e) {
84
- let t = e.translation();
85
- return [t.x, t.z];
86
- }
87
- }
88
- return [t?.position.x ?? 0, t?.position.z ?? 0];
89
- }
90
- var x = new i.Vector3(), S = new i.Quaternion(), C = new i.Matrix4(), w = new i.Vector3(), T = new i.Quaternion(), E = new i.Vector3();
91
- function D(e, t, n, r) {
92
- let i = e.translation(), a = i.x - t, o = i.z - n;
93
- if (e.setTranslation({
94
- x: a,
95
- y: i.y,
96
- z: o
97
- }, !0), !r?.rigidBodyStates || typeof e.handle != "number") return;
98
- let s = r.rigidBodyStates.get(e.handle);
99
- if (!s || s.meshType === "instancedMesh") return;
100
- let c = typeof e.rotation == "function" ? e.rotation() : null;
101
- x.set(a, i.y, o), c ? S.set(c.x, c.y, c.z, c.w) : S.identity(), C.compose(x, S, s.scale).premultiply(s.invertedWorldMatrix).decompose(w, T, E), s.object.position.copy(w), c && s.object.quaternion.copy(T), s.object.updateMatrixWorld(!0);
102
- }
103
- function O(e, t, n, r, i) {
104
- t && (t.position.x -= n, t.position.z -= r);
105
- for (let t of e.query(u)) {
106
- let e = t.get(u), a = e?.handle?.body;
107
- a && D(a, n, r, i), e?.onOriginShift?.(n, r);
108
- }
109
- for (let t of e.query(d)) {
110
- let e = t.get(d), a = e?.handle?.body;
111
- a && D(a, n, r, i), e?.exitSpawnPos && t.set(d, {
112
- ...e,
113
- exitSpawnPos: [
114
- e.exitSpawnPos[0] - n,
115
- e.exitSpawnPos[1],
116
- e.exitSpawnPos[2] - r
117
- ]
118
- }), e?.onOriginShift?.(n, r);
119
- }
120
- for (let t of e.query(p)) {
121
- let e = t.get(p)?.getBody();
122
- e && D(e, n, r, i);
123
- }
124
- if (i?.world) {
125
- let e = i.world;
126
- e.propagateModifiedBodyPositionsToColliders();
127
- let t = e.timestep;
128
- e.timestep = 0, e.step(), e.timestep = t;
129
- }
130
- }
131
- var k = {
132
- speedKmh: 0,
133
- rpm: 0,
134
- gear: 1,
135
- throttle: 0,
136
- boost: 0,
137
- mode: "foot",
138
- activeVehicleId: null,
139
- activeRetroPreset: "dreamcast",
140
- nearVehicleId: null
141
- }, A = new i.Vector3(), j = new i.Vector3(), M = o((t) => ({
142
- boardVehicle: (e) => {
143
- v(t);
144
- let n = t.queryFirst(d);
145
- for (let r of t.query(u)) if (r.get(u)?.id === e) {
146
- n && n.add(m(r));
147
- break;
148
- }
149
- let r = t.get(h);
150
- t.set(h, {
151
- activeVehicleId: e,
152
- activeRetroPreset: r?.activeRetroPreset ?? "dreamcast"
153
- }), k.activeVehicleId = e, k.nearVehicleId = null;
154
- },
155
- exitVehicle: () => {
156
- v(t);
157
- let e = t.get(h), n = e?.activeVehicleId || "", r = t.queryFirst(d);
158
- for (let e of t.query(u)) {
159
- let t = e.get(u);
160
- if (t && n && t.id === n) {
161
- if (r && (r.has(m(e)) && r.remove(m(e)), t.handle)) {
162
- A.set(t.exitOffset[0] - t.centerOfMass[0], t.exitOffset[1] - t.centerOfMass[1], t.exitOffset[2] - t.centerOfMass[2]).applyQuaternion(t.handle.currQuat).add(t.handle.currPos), j.copy(t.handle.bodyZAxis).projectOnPlane(t.handle.upAxis).normalize();
163
- let e = j.lengthSq() > 1e-6 ? Math.atan2(j.x, j.z) : 0, n = t.handle.currLinVel, i = r.get(d);
164
- r.set(d, {
165
- id: i?.id ?? "pilot",
166
- handle: null,
167
- exitSpawnPos: [
168
- A.x,
169
- A.y,
170
- A.z
171
- ],
172
- exitSpawnYaw: e,
173
- exitLinVel: [
174
- n.x,
175
- n.y,
176
- n.z
177
- ],
178
- onOriginShift: i?.onOriginShift
179
- });
180
- }
181
- t.handle?.setMovement({
182
- forward: !1,
183
- backward: !1,
184
- steerLeft: !1,
185
- steerRight: !1,
186
- brake: !t.isFlight
187
- });
188
- }
189
- }
190
- t.set(h, {
191
- activeVehicleId: "",
192
- activeRetroPreset: e?.activeRetroPreset ?? "dreamcast"
193
- }), Object.assign(k, {
194
- activeVehicleId: null,
195
- mode: "foot",
196
- speedKmh: 0,
197
- rpm: 0,
198
- throttle: 0,
199
- boost: 0
200
- });
201
- },
202
- setRetroPreset: (n) => {
203
- v(t), e(n);
204
- let r = t.get(h);
205
- t.set(h, {
206
- activeVehicleId: r?.activeVehicleId ?? "",
207
- activeRetroPreset: n
208
- }), k.activeRetroPreset = n;
209
- }
210
- }));
211
- export { d as ActorTrait, p as FloatingBodyTrait, f as InteractableTrait, m as PilotLink, u as VehicleTrait, h as WorldSessionTrait, v as ensureWorldSession, M as kolmoActions, k as kolmoTelemetry, g as kolmoWorld, b as readFloatingOriginAnchorXZ, O as shiftFloatingOriginEntities, _ as useActiveKolmoWorld, y as useWorldTrait };
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import * as THREE from "three";
3
- import type { CalibrationMetrics, GateDomain } from "./gateStore.js";
4
- import type { ChopPartRole } from "./surfaceCutter.js";
5
- import type { MeshIsland } from "./meshIslands.js";
6
- export declare function makeStarterDomainScene(domain: GateDomain): THREE.Group;
7
- /**
8
- * Spatial 3D `@react-three/uikit` tags floating directly inside the Step-1 Calibration Plinth:
9
- * - SI Bounding-Box Dimension Tag (`W × H × L m · Y-floor`)
10
- * - Interactive 3D Pills over tagged `Wheel` & `Door`/`Hood`/`Trunk` islands as you orbit around the model.
11
- */
12
- export declare function ImporterPlinthUikitTags({ cal, islands, wheelColors, partPicks, explodeAmount, onClickIsland, }: {
13
- readonly cal: CalibrationMetrics;
14
- readonly islands: readonly MeshIsland[];
15
- readonly wheelColors: ReadonlyMap<number, string>;
16
- readonly partPicks: Readonly<Record<number, ChopPartRole>>;
17
- readonly explodeAmount: number;
18
- readonly onClickIsland: (id: number) => void;
19
- }): React.JSX.Element;
@@ -1,112 +0,0 @@
1
- import { useMemo as e, useRef as t } from "react";
2
- import * as n from "three";
3
- import { useFrame as r, useThree as i } from "@react-three/fiber";
4
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
- import { Container as s, Root as c, Text as l } from "@react-three/uikit";
6
- // src/importer/ImporterPlinthUikitTags.tsx
7
- function u(e) {
8
- let t = new n.Group();
9
- t.name = `Starter_${e}`;
10
- let r = e === "c12" ? new n.BoxGeometry(3, 3, 3) : e === "person" ? new n.CapsuleGeometry(.3, 1, 6, 12) : e === "launcher" ? new n.BoxGeometry(.14, .24, .92) : e === "junk" ? new n.CylinderGeometry(.32, .34, .85, 12) : new n.BoxGeometry(1.72, 1.25, 4.25), i = new n.Mesh(r, new n.MeshStandardMaterial({
11
- color: "#38bdf8",
12
- roughness: .55,
13
- flatShading: !0
14
- }));
15
- return i.position.y = e === "c12" ? 1.5 : e === "person" ? .88 : .65, t.add(i), t;
16
- }
17
- new n.Vector3();
18
- function d({ position: e, label: n, sub: u, accent: d, onClick: f }) {
19
- let p = t(null), { camera: m } = i();
20
- return r(() => {
21
- p.current && p.current.quaternion.copy(m.quaternion);
22
- }), /* @__PURE__ */ a("group", {
23
- ref: p,
24
- position: [
25
- e[0],
26
- e[1],
27
- e[2]
28
- ],
29
- children: /* @__PURE__ */ a(c, {
30
- pixelSize: .0022,
31
- children: /* @__PURE__ */ o(s, {
32
- paddingX: 10,
33
- paddingY: 4,
34
- borderRadius: 999,
35
- backgroundColor: "rgba(9, 13, 24, 0.88)",
36
- borderWidth: 1.5,
37
- borderColor: d,
38
- flexDirection: "row",
39
- alignItems: "center",
40
- gap: 6,
41
- hover: { backgroundColor: "#1e293b" },
42
- onClick: f ? (e) => {
43
- e.stopPropagation(), f();
44
- } : void 0,
45
- children: [/* @__PURE__ */ a(l, {
46
- fontSize: 12,
47
- fontWeight: "bold",
48
- color: d,
49
- children: n
50
- }), /* @__PURE__ */ a(l, {
51
- fontSize: 11,
52
- color: "#cbd5e1",
53
- children: u
54
- })]
55
- })
56
- })
57
- });
58
- }
59
- function f({ cal: t, islands: n, wheelColors: r, partPicks: i, explodeAmount: s, onClickIsland: c }) {
60
- let l = e(() => `${t.aabbSize[0].toFixed(2)}m W × ${t.aabbSize[1].toFixed(2)}m H × ${t.aabbSize[2].toFixed(2)}m L`, [t.aabbSize]), u = e(() => `Ymin ${t.minY >= 0 ? "+" : ""}${t.minY.toFixed(3)}m`, [t.minY]), f = e(() => {
61
- let e = [];
62
- for (let t of n) {
63
- let n = r.get(t.id), a = i[t.id];
64
- if (!n && !a) continue;
65
- let o = Math.sign(t.center[0] || 1) * s * .65, c = [
66
- t.center[0] + o,
67
- t.center[1] + t.size[1] * .5 + .16,
68
- t.center[2]
69
- ];
70
- if (n) {
71
- let r = t.center[0] >= 0 ? "L" : "R", i = t.center[2] >= 0 ? "F" : "R";
72
- e.push({
73
- id: t.id,
74
- pos: c,
75
- label: `WHEEL ${i}${r}`,
76
- sub: `R ${(t.size[1] * .5).toFixed(2)}m`,
77
- accent: n
78
- });
79
- } else a && e.push({
80
- id: t.id,
81
- pos: c,
82
- label: a.toUpperCase(),
83
- sub: `${t.triangleIndices.length} tris`,
84
- accent: "#38bdf8"
85
- });
86
- if (e.length >= 12) break;
87
- }
88
- return e;
89
- }, [
90
- n,
91
- r,
92
- i,
93
- s
94
- ]);
95
- return /* @__PURE__ */ o("group", { children: [/* @__PURE__ */ a(d, {
96
- position: [
97
- 0,
98
- t.aabbSize[1] + t.minY + .34,
99
- 0
100
- ],
101
- label: "SI BOUNDS",
102
- sub: `${l} · ${u}`,
103
- accent: "#00e5ff"
104
- }), f.map((e) => /* @__PURE__ */ a(d, {
105
- position: e.pos,
106
- label: e.label,
107
- sub: e.sub,
108
- accent: e.accent,
109
- onClick: () => c(e.id)
110
- }, `pill_${e.id}`))] });
111
- }
112
- export { f as ImporterPlinthUikitTags, u as makeStarterDomainScene };
@@ -1,214 +0,0 @@
1
- import * as e from "three";
2
- // src/importer/vehiclePanelAnim.ts
3
- var t = {
4
- plume: [
5
- .22,
6
- .91,
7
- 1
8
- ],
9
- sparkle: [
10
- 1,
11
- .72,
12
- .24
13
- ],
14
- fume: [
15
- .68,
16
- .74,
17
- .82
18
- ],
19
- trail: [
20
- .32,
21
- .88,
22
- 1
23
- ],
24
- flare: [
25
- 1,
26
- .18,
27
- .08
28
- ]
29
- }, n = new e.Vector3(0, 0, 0), r = new e.Vector3(0, 1, 0), i = new e.Vector3(0, 0, 1), a = new e.Matrix4(), o = new e.Quaternion(), s = new e.Vector3(), c = (e) => Number(e.toFixed(4));
30
- function l(e) {
31
- let t = e.clone();
32
- return t.lengthSq() < 1e-10 ? t.set(0, 0, -1) : t.normalize(), a.lookAt(n, t, Math.abs(t.y) > .98 ? i : r), o.setFromRotationMatrix(a).normalize(), [
33
- Number(o.x.toFixed(5)),
34
- Number(o.y.toFixed(5)),
35
- Number(o.z.toFixed(5)),
36
- Number(o.w.toFixed(5))
37
- ];
38
- }
39
- function u(n) {
40
- let r = [];
41
- for (let i of n) {
42
- let n = i.extension.kind;
43
- if (!n) continue;
44
- let a = i.rotation ?? [
45
- 0,
46
- 0,
47
- 0,
48
- 1
49
- ], o = new e.Object3D();
50
- o.name = i.nodeName, o.position.set(i.translation[0], i.translation[1], i.translation[2]), o.quaternion.set(a[0], a[1], a[2], a[3]);
51
- let s = i.extension.drive ?? "always", c = i.extension.color ?? t[n];
52
- r.push({
53
- nodeName: i.nodeName,
54
- object: o,
55
- localPosition: i.translation,
56
- localQuaternion: a,
57
- kind: n,
58
- drive: s,
59
- color: c,
60
- size: i.extension.size ?? 1
61
- });
62
- }
63
- return r;
64
- }
65
- function d(e, t) {
66
- let [n, r, i] = e.min, [a, o, s] = e.max, [l, u, d] = e.center;
67
- if (t === "door") {
68
- let e = l >= 0;
69
- return {
70
- anchor: [
71
- c(e ? a - .02 : n + .02),
72
- c(u),
73
- c(s)
74
- ],
75
- axis: [
76
- 0,
77
- 1,
78
- 0
79
- ],
80
- limits: e ? [-1.15, 0] : [0, 1.15],
81
- openAngle: e ? -1.15 : 1.15,
82
- explodeDir: [
83
- e ? 1 : -1,
84
- .1,
85
- 0
86
- ]
87
- };
88
- }
89
- if (t === "hood") return {
90
- anchor: [
91
- c(l),
92
- c(o),
93
- c(i)
94
- ],
95
- axis: [
96
- 1,
97
- 0,
98
- 0
99
- ],
100
- limits: [-1.05, 0],
101
- openAngle: -1.05,
102
- explodeDir: [
103
- 0,
104
- .55,
105
- .75
106
- ]
107
- };
108
- if (t === "trunk") return {
109
- anchor: [
110
- c(l),
111
- c(o),
112
- c(s)
113
- ],
114
- axis: [
115
- 1,
116
- 0,
117
- 0
118
- ],
119
- limits: [0, 1.15],
120
- openAngle: 1.15,
121
- explodeDir: [
122
- 0,
123
- .55,
124
- -.75
125
- ]
126
- };
127
- if (t === "fender") {
128
- let e = l >= 0;
129
- return {
130
- anchor: [
131
- c(e ? n : a),
132
- c(o),
133
- c(d)
134
- ],
135
- axis: [
136
- 0,
137
- 0,
138
- 1
139
- ],
140
- limits: e ? [0, .55] : [-.55, 0],
141
- openAngle: e ? .55 : -.55,
142
- explodeDir: [
143
- e ? 1 : -1,
144
- .25,
145
- 0
146
- ]
147
- };
148
- }
149
- let f = d >= 0;
150
- return {
151
- anchor: [
152
- c(l),
153
- c(o),
154
- c(f ? i : s)
155
- ],
156
- axis: [
157
- 1,
158
- 0,
159
- 0
160
- ],
161
- limits: f ? [-.55, 0] : [0, .55],
162
- openAngle: f ? -.55 : .55,
163
- explodeDir: [
164
- 0,
165
- .15,
166
- f ? 1 : -1
167
- ]
168
- };
169
- }
170
- function f(t) {
171
- let n = t.bodies.filter((e) => e.joint !== null && e.joint.kind === "revolute" && e.joint.limits !== null).map((e) => {
172
- let t = e.joint.limits, n = Math.abs(t[0]) > Math.abs(t[1]) ? t[0] : t[1];
173
- return {
174
- nodeName: e.nodeName,
175
- role: (e.role ?? e.nodeName).toLowerCase(),
176
- object: e.object,
177
- restQuat: e.object.quaternion.clone(),
178
- axis: e.joint.axis,
179
- openAngle: n,
180
- open: !1,
181
- angle: 0
182
- };
183
- }), r = new Map(n.map((e) => [e.object, e])), i = new e.Quaternion();
184
- return {
185
- hasPanels: n.length > 0,
186
- panelNames: n.map((e) => e.nodeName),
187
- toggleHitObject(e) {
188
- for (let t = e; t; t = t.parent) {
189
- let e = r.get(t);
190
- if (e) return e.open = !e.open, !0;
191
- }
192
- return !1;
193
- },
194
- toggleRolePrefix(e) {
195
- let t = e.toLowerCase(), r = n.filter((e) => e.role.startsWith(t) || e.nodeName.toLowerCase().startsWith(t));
196
- if (r.length === 0) return;
197
- let i = !r[0].open;
198
- for (let e of r) e.open = i;
199
- },
200
- toggleAll() {
201
- if (n.length === 0) return;
202
- let e = !n.some((e) => e.open);
203
- for (let t of n) t.open = e;
204
- },
205
- step(e) {
206
- let t = 1 - Math.exp(-11 * Math.min(e, .05));
207
- for (let e of n) {
208
- let n = e.open ? e.openAngle : 0;
209
- Math.abs(n - e.angle) < 1e-4 || (e.angle += (n - e.angle) * t, s.set(e.axis[0], e.axis[1], e.axis[2]).normalize(), i.setFromAxisAngle(s, e.angle), e.object.quaternion.copy(e.restQuat).multiply(i));
210
- }
211
- }
212
- };
213
- }
214
- export { u as buildPatchPreviewEmitters, d as computeChopPartHinge, f as createVehiclePanelAnimator, l as normalToMinusZQuaternion };