@pinkaphant/kolmo 0.3.0 → 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.
- package/LICENSE +1 -1
- package/README.md +36 -36
- package/bin/kolmo.mjs +11 -5
- package/dist/engine/causewayBridge.d.ts +14 -0
- package/dist/engine/causewayBridge.js +166 -0
- package/dist/engine/causewayBridge.js.map +1 -0
- package/dist/engine/index.d.ts +6 -4
- package/dist/engine/index.js +19 -12
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/islandSettlementMesh.d.ts +26 -0
- package/dist/engine/islandSettlementMesh.js +166 -0
- package/dist/engine/islandSettlementMesh.js.map +1 -0
- package/dist/engine/kolmoActions.d.ts +23 -0
- package/dist/engine/kolmoActions.js +164 -0
- package/dist/engine/kolmoActions.js.map +1 -0
- package/dist/engine/kolmoActor.js +241 -206
- package/dist/engine/kolmoActor.js.map +1 -0
- package/dist/engine/kolmoFloatingOrigin.d.ts +17 -0
- package/dist/engine/kolmoFloatingOrigin.js +98 -0
- package/dist/engine/kolmoFloatingOrigin.js.map +1 -0
- package/dist/engine/kolmoGame.d.ts +27 -0
- package/dist/engine/kolmoGame.js +80 -0
- package/dist/engine/kolmoGame.js.map +1 -0
- package/dist/engine/kolmoHud.d.ts +23 -0
- package/dist/engine/kolmoHud.js +195 -0
- package/dist/engine/kolmoHud.js.map +1 -0
- package/dist/engine/kolmoInput.d.ts +1 -1
- package/dist/engine/kolmoInput.js +57 -30
- package/dist/engine/kolmoInput.js.map +1 -0
- package/dist/engine/kolmoIsland.d.ts +5 -10
- package/dist/engine/kolmoIsland.js +182 -250
- package/dist/engine/kolmoIsland.js.map +1 -0
- package/dist/engine/kolmoLongDrive.d.ts +3 -4
- package/dist/engine/kolmoLongDrive.js +139 -249
- package/dist/engine/kolmoLongDrive.js.map +1 -0
- package/dist/engine/kolmoPilotMesh.d.ts +2 -0
- package/dist/engine/kolmoPilotMesh.js +64 -0
- package/dist/engine/kolmoPilotMesh.js.map +1 -0
- package/dist/engine/kolmoProcedural.d.ts +13 -0
- package/dist/engine/kolmoProcedural.js +101 -0
- package/dist/engine/kolmoProcedural.js.map +1 -0
- package/dist/engine/kolmoRigs.d.ts +1 -1
- package/dist/engine/kolmoRigs.js +88 -47
- package/dist/engine/kolmoRigs.js.map +1 -0
- package/dist/engine/kolmoStore.d.ts +3 -101
- package/dist/engine/kolmoSurface.d.ts +2 -2
- package/dist/engine/kolmoSurface.js +150 -134
- package/dist/engine/kolmoSurface.js.map +1 -0
- package/dist/engine/kolmoTraits.d.ts +128 -0
- package/dist/engine/kolmoTraits.js +140 -0
- package/dist/engine/kolmoTraits.js.map +1 -0
- package/dist/engine/kolmoVehicle.d.ts +3 -33
- package/dist/engine/kolmoVehicle.js +66 -253
- package/dist/engine/kolmoVehicle.js.map +1 -0
- package/dist/engine/kolmoVehicleConfig.d.ts +54 -0
- package/dist/engine/kolmoVehicleConfig.js +80 -0
- package/dist/engine/kolmoVehicleConfig.js.map +1 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +8 -13
- package/dist/engine/kolmoVehicleDriver.js +116 -42
- package/dist/engine/kolmoVehicleDriver.js.map +1 -0
- package/dist/engine/kolmoVehicleInner.d.ts +7 -0
- package/dist/engine/kolmoVehicleInner.js +261 -0
- package/dist/engine/kolmoVehicleInner.js.map +1 -0
- package/dist/engine/kolmoWorld.d.ts +6 -4
- package/dist/engine/kolmoWorld.js +134 -136
- package/dist/engine/kolmoWorld.js.map +1 -0
- package/dist/engine/longDriveKit.d.ts +5 -12
- package/dist/engine/longDriveKit.js +121 -233
- package/dist/engine/longDriveKit.js.map +1 -0
- package/dist/engine/longDriveRoadside.d.ts +16 -0
- package/dist/engine/longDriveRoadside.js +171 -0
- package/dist/engine/longDriveRoadside.js.map +1 -0
- package/dist/engine/macroCellBuilder.d.ts +34 -0
- package/dist/engine/macroCellBuilder.js +145 -0
- package/dist/engine/macroCellBuilder.js.map +1 -0
- package/dist/engine/mainlandMacroCell.d.ts +2 -2
- package/dist/engine/mainlandMacroCell.js +77 -165
- package/dist/engine/mainlandMacroCell.js.map +1 -0
- package/dist/engine/shiftedFixedBody.d.ts +1 -1
- package/dist/engine/shiftedFixedBody.js +55 -28
- package/dist/engine/shiftedFixedBody.js.map +1 -0
- package/dist/importer/ChopShopPanel.d.ts +10 -32
- package/dist/importer/ChopShopPanel.js +320 -470
- package/dist/importer/ChopShopPanel.js.map +1 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +2 -1
- package/dist/importer/DomainWorkshopPanel.js +172 -242
- package/dist/importer/DomainWorkshopPanel.js.map +1 -0
- package/dist/importer/GateHudBar.d.ts +8 -3
- package/dist/importer/GateHudBar.js +289 -284
- package/dist/importer/GateHudBar.js.map +1 -0
- package/dist/importer/GlbImportGate.d.ts +2 -1
- package/dist/importer/GlbImportGate.js +252 -261
- package/dist/importer/GlbImportGate.js.map +1 -0
- package/dist/importer/ImperativeVehicleRig.d.ts +2 -2
- package/dist/importer/ImperativeVehicleRig.js +223 -284
- package/dist/importer/ImperativeVehicleRig.js.map +1 -0
- package/dist/importer/LiveDrivePads.d.ts +20 -0
- package/dist/importer/LiveDrivePads.js +169 -0
- package/dist/importer/LiveDrivePads.js.map +1 -0
- package/dist/importer/PaperShellDebrisRig.d.ts +25 -0
- package/dist/importer/PaperShellDebrisRig.js +143 -0
- package/dist/importer/PaperShellDebrisRig.js.map +1 -0
- package/dist/importer/R2VaultDrawer.d.ts +12 -0
- package/dist/importer/R2VaultDrawer.js +90 -0
- package/dist/importer/R2VaultDrawer.js.map +1 -0
- package/dist/importer/Step1CalibrationPlinth.d.ts +23 -15
- package/dist/importer/Step1CalibrationPlinth.js +180 -313
- package/dist/importer/Step1CalibrationPlinth.js.map +1 -0
- package/dist/importer/Step1ExplodedIslands.d.ts +31 -0
- package/dist/importer/Step1ExplodedIslands.js +144 -0
- package/dist/importer/Step1ExplodedIslands.js.map +1 -0
- package/dist/importer/Step2UniversalPad.d.ts +7 -14
- package/dist/importer/Step2UniversalPad.js +54 -197
- package/dist/importer/Step2UniversalPad.js.map +1 -0
- package/dist/importer/VfxEmitterPool.js +59 -86
- package/dist/importer/VfxEmitterPool.js.map +1 -0
- package/dist/importer/WheelRingHandles3D.d.ts +11 -0
- package/dist/importer/WheelRingHandles3D.js +318 -0
- package/dist/importer/WheelRingHandles3D.js.map +1 -0
- package/dist/importer/archLinerGeom.d.ts +2 -0
- package/dist/importer/archLinerGeom.js +51 -0
- package/dist/importer/archLinerGeom.js.map +1 -0
- package/dist/importer/{vehiclePanelAnim.d.ts → chopHingeHelpers.d.ts} +0 -10
- package/dist/importer/chopHingeHelpers.js +193 -0
- package/dist/importer/chopHingeHelpers.js.map +1 -0
- package/dist/importer/chopShopActions.d.ts +20 -32
- package/dist/importer/chopShopActions.js +138 -238
- package/dist/importer/chopShopActions.js.map +1 -0
- package/dist/importer/chopShopHandlers.d.ts +26 -0
- package/dist/importer/chopShopHandlers.js +276 -0
- package/dist/importer/chopShopHandlers.js.map +1 -0
- package/dist/importer/chopShopIoActions.d.ts +15 -0
- package/dist/importer/chopShopIoActions.js +137 -0
- package/dist/importer/chopShopIoActions.js.map +1 -0
- package/dist/importer/chopShopMcpAction.d.ts +18 -0
- package/dist/importer/chopShopMcpAction.js +58 -0
- package/dist/importer/chopShopMcpAction.js.map +1 -0
- package/dist/importer/cylinderBooleanSlice.d.ts +14 -0
- package/dist/importer/cylinderBooleanSlice.js +110 -0
- package/dist/importer/cylinderBooleanSlice.js.map +1 -0
- package/dist/importer/cylinderSliceMath.d.ts +14 -0
- package/dist/importer/cylinderSliceMath.js +251 -0
- package/dist/importer/cylinderSliceMath.js.map +1 -0
- package/dist/importer/fusedWheelDetect.d.ts +4 -0
- package/dist/importer/fusedWheelDetect.js +175 -0
- package/dist/importer/fusedWheelDetect.js.map +1 -0
- package/dist/importer/fusedWheelFit.d.ts +13 -0
- package/dist/importer/fusedWheelFit.js +138 -0
- package/dist/importer/fusedWheelFit.js.map +1 -0
- package/dist/importer/gateStore.d.ts +3 -6
- package/dist/importer/gateStore.js +36 -30
- package/dist/importer/gateStore.js.map +1 -0
- package/dist/importer/glbNormalizer.d.ts +1 -10
- package/dist/importer/glbNormalizer.js +120 -146
- package/dist/importer/glbNormalizer.js.map +1 -0
- package/dist/importer/importerWebMcp.d.ts +4 -3
- package/dist/importer/importerWebMcp.js +41 -339
- package/dist/importer/importerWebMcp.js.map +1 -0
- package/dist/importer/importerWebMcpTools.d.ts +2 -0
- package/dist/importer/importerWebMcpTools.js +340 -0
- package/dist/importer/importerWebMcpTools.js.map +1 -0
- package/dist/importer/index.d.ts +6 -4
- package/dist/importer/index.js +32 -25
- package/dist/importer/index.js.map +1 -0
- package/dist/importer/khrCarPlanHelpers.d.ts +28 -0
- package/dist/importer/khrCarPlanHelpers.js +221 -0
- package/dist/importer/khrCarPlanHelpers.js.map +1 -0
- package/dist/importer/khrCarPlanner.d.ts +7 -0
- package/dist/importer/khrCarPlanner.js +279 -0
- package/dist/importer/khrCarPlanner.js.map +1 -0
- package/dist/importer/khrCompiler.d.ts +4 -41
- package/dist/importer/khrCompiler.js +56 -673
- package/dist/importer/khrCompiler.js.map +1 -0
- package/dist/importer/khrCraftPropCompiler.d.ts +40 -0
- package/dist/importer/khrCraftPropCompiler.js +250 -0
- package/dist/importer/khrCraftPropCompiler.js.map +1 -0
- package/dist/importer/launcherBake.js +76 -39
- package/dist/importer/launcherBake.js.map +1 -0
- package/dist/importer/meshIslands.d.ts +4 -50
- package/dist/importer/meshIslands.js +84 -288
- package/dist/importer/meshIslands.js.map +1 -0
- package/dist/importer/meshSliceBuffers.d.ts +15 -0
- package/dist/importer/meshSliceBuffers.js +159 -0
- package/dist/importer/meshSliceBuffers.js.map +1 -0
- package/dist/importer/polygonEarClipYZ.d.ts +3 -0
- package/dist/importer/polygonEarClipYZ.js +67 -0
- package/dist/importer/polygonEarClipYZ.js.map +1 -0
- package/dist/importer/sceneSiNormalize.d.ts +19 -0
- package/dist/importer/sceneSiNormalize.js +138 -0
- package/dist/importer/sceneSiNormalize.js.map +1 -0
- package/dist/importer/starterScene.d.ts +3 -0
- package/dist/importer/starterScene.js +76 -0
- package/dist/importer/starterScene.js.map +1 -0
- package/dist/importer/surfaceCutter.d.ts +5 -25
- package/dist/importer/surfaceCutter.js +70 -334
- package/dist/importer/surfaceCutter.js.map +1 -0
- package/dist/importer/surfaceGeodesic.d.ts +7 -0
- package/dist/importer/surfaceGeodesic.js +130 -0
- package/dist/importer/surfaceGeodesic.js.map +1 -0
- package/dist/importer/surfaceLoopRefine.d.ts +6 -0
- package/dist/importer/surfaceLoopRefine.js +171 -0
- package/dist/importer/surfaceLoopRefine.js.map +1 -0
- package/dist/importer/surfacePeel.d.ts +11 -0
- package/dist/importer/surfacePeel.js +119 -0
- package/dist/importer/surfacePeel.js.map +1 -0
- package/dist/importer/surfaceTopology.d.ts +4 -19
- package/dist/importer/surfaceTopology.js +92 -160
- package/dist/importer/surfaceTopology.js.map +1 -0
- package/dist/importer/universalGateBake.d.ts +7 -9
- package/dist/importer/universalGateBake.js +104 -109
- package/dist/importer/universalGateBake.js.map +1 -0
- package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
- package/dist/importer/usdPhysicsSpecs.js +245 -0
- package/dist/importer/usdPhysicsSpecs.js.map +1 -0
- package/dist/importer/usdTextParse.d.ts +12 -0
- package/dist/importer/usdTextParse.js +118 -0
- package/dist/importer/usdTextParse.js.map +1 -0
- package/dist/importer/usdToGlb.d.ts +3 -2
- package/dist/importer/usdToGlb.js +80 -292
- package/dist/importer/usdToGlb.js.map +1 -0
- package/dist/importer/useChopShopController.d.ts +51 -74
- package/dist/importer/useChopShopController.js +157 -453
- package/dist/importer/useChopShopController.js.map +1 -0
- package/dist/importer/useChopShopState.d.ts +103 -0
- package/dist/importer/useChopShopState.js +319 -0
- package/dist/importer/useChopShopState.js.map +1 -0
- package/dist/importer/useWasdKeyRef.d.ts +9 -0
- package/dist/importer/useWasdKeyRef.js +35 -0
- package/dist/importer/useWasdKeyRef.js.map +1 -0
- package/dist/importer/vehiclePartSplit.d.ts +33 -0
- package/dist/importer/vehiclePartSplit.js +178 -0
- package/dist/importer/vehiclePartSplit.js.map +1 -0
- package/dist/importer/wheelAxlePairing.d.ts +1 -3
- package/dist/importer/wheelAxlePairing.js +106 -119
- package/dist/importer/wheelAxlePairing.js.map +1 -0
- package/dist/importer/wheelCutterHelpers.d.ts +42 -0
- package/dist/importer/wheelCutterHelpers.js +178 -0
- package/dist/importer/wheelCutterHelpers.js.map +1 -0
- package/dist/importer/wheelRingHandleMath.d.ts +20 -0
- package/dist/importer/wheelRingHandleMath.js +66 -0
- package/dist/importer/wheelRingHandleMath.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +90 -69
- package/dist/index.js.map +1 -0
- package/dist/junk/DestructibleTarget.d.ts +3 -3
- package/dist/junk/DestructibleTarget.js +177 -114
- package/dist/junk/DestructibleTarget.js.map +1 -0
- package/dist/junk/KolmoJunk.js +55 -44
- package/dist/junk/KolmoJunk.js.map +1 -0
- package/dist/junk/ShardPieces.d.ts +2 -1
- package/dist/junk/ShardPieces.js +80 -61
- package/dist/junk/ShardPieces.js.map +1 -0
- package/dist/junk/TargetDecals.d.ts +6 -15
- package/dist/junk/TargetDecals.js +66 -40
- package/dist/junk/TargetDecals.js.map +1 -0
- package/dist/junk/bvhShatter.d.ts +2 -6
- package/dist/junk/bvhShatter.js +89 -43
- package/dist/junk/bvhShatter.js.map +1 -0
- package/dist/junk/bvhTriCollector.d.ts +2 -6
- package/dist/junk/bvhTriCollector.js +111 -62
- package/dist/junk/bvhTriCollector.js.map +1 -0
- package/dist/junk/index.d.ts +2 -2
- package/dist/junk/index.js +11 -11
- package/dist/junk/index.js.map +1 -0
- package/dist/junk/junkGeometry.d.ts +5 -26
- package/dist/junk/junkGeometry.js +61 -43
- package/dist/junk/junkGeometry.js.map +1 -0
- package/dist/junk/junkImportSanitize.d.ts +4 -5
- package/dist/junk/junkImportSanitize.js +57 -37
- package/dist/junk/junkImportSanitize.js.map +1 -0
- package/dist/junk/junkImporter.d.ts +2 -13
- package/dist/junk/junkImporter.js +105 -76
- package/dist/junk/junkImporter.js.map +1 -0
- package/dist/junk/junkLabelCanvas.d.ts +1 -6
- package/dist/junk/junkLabelCanvas.js +147 -29
- package/dist/junk/junkLabelCanvas.js.map +1 -0
- package/dist/junk/junkLabels.d.ts +4 -26
- package/dist/junk/junkLabels.js +42 -28
- package/dist/junk/junkLabels.js.map +1 -0
- package/dist/junk/targetHelpers.d.ts +3 -4
- package/dist/junk/targetHelpers.js +121 -67
- package/dist/junk/targetHelpers.js.map +1 -0
- package/dist/junk/targetHitLogic.d.ts +8 -8
- package/dist/junk/targetHitLogic.js +131 -95
- package/dist/junk/targetHitLogic.js.map +1 -0
- package/dist/junk/useTargetAssets.d.ts +9 -14
- package/dist/junk/useTargetAssets.js +113 -85
- package/dist/junk/useTargetAssets.js.map +1 -0
- package/dist/physics/index.d.ts +1 -8
- package/dist/physics/index.js +80 -85
- package/dist/physics/index.js.map +1 -0
- package/dist/schema/kolmoSchema.d.ts +3 -64
- package/dist/schema/kolmoSchema.js +75 -149
- package/dist/schema/kolmoSchema.js.map +1 -0
- package/dist/schema/kolmoStamp.d.ts +6 -0
- package/dist/schema/kolmoStamp.js +71 -0
- package/dist/schema/kolmoStamp.js.map +1 -0
- package/dist/schema/kolmoTypes.d.ts +63 -0
- package/dist/schema/kolmoTypes.js +66 -0
- package/dist/schema/kolmoTypes.js.map +1 -0
- package/dist/shaders/celestialBackdrop.d.ts +2 -10
- package/dist/shaders/celestialBackdrop.js +128 -291
- package/dist/shaders/celestialBackdrop.js.map +1 -0
- package/dist/shaders/emitterShaders.d.ts +9 -0
- package/dist/shaders/emitterShaders.js +114 -0
- package/dist/shaders/emitterShaders.js.map +1 -0
- package/dist/shaders/index.d.ts +1 -1
- package/dist/shaders/index.js +12 -9
- package/dist/shaders/index.js.map +1 -0
- package/dist/shaders/plumeAndSparkle.d.ts +2 -4
- package/dist/shaders/plumeAndSparkle.js +152 -191
- package/dist/shaders/plumeAndSparkle.js.map +1 -0
- package/dist/shaders/ps2GlslShared.js +29 -2
- package/dist/shaders/ps2GlslShared.js.map +1 -0
- package/dist/shaders/ps2MaterialsTSL.js +132 -51
- package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
- package/dist/shaders/ps2MaterialsWebGL.js +45 -28
- package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
- package/dist/shaders/ps2RoadWebGL.js +69 -32
- package/dist/shaders/ps2RoadWebGL.js.map +1 -0
- package/dist/shaders/ps2TerrainWebGL.js +107 -30
- package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
- package/dist/shaders/ps2Textures.d.ts +1 -1
- package/dist/shaders/ps2Textures.js +116 -41
- package/dist/shaders/ps2Textures.js.map +1 -0
- package/dist/shaders/retroPalettes.d.ts +1 -1
- package/dist/shaders/retroPalettes.js +90 -57
- package/dist/shaders/retroPalettes.js.map +1 -0
- package/dist/shaders/retroShader.d.ts +2 -86
- package/dist/shaders/retroShader.js +65 -196
- package/dist/shaders/retroShader.js.map +1 -0
- package/dist/shaders/retroUniforms.d.ts +60 -0
- package/dist/shaders/retroUniforms.js +215 -0
- package/dist/shaders/retroUniforms.js.map +1 -0
- package/dist/shaders/skyboxShaders.d.ts +16 -0
- package/dist/shaders/skyboxShaders.js +266 -0
- package/dist/shaders/skyboxShaders.js.map +1 -0
- package/dist/shaders/tsl.d.ts +1 -1
- package/dist/shaders/tsl.js.map +1 -0
- package/dist/vite/index.js +39 -23
- package/dist/vite/index.js.map +1 -0
- package/dist/world/frontage.js +25 -21
- package/dist/world/frontage.js.map +1 -0
- package/dist/world/index.d.ts +4 -4
- package/dist/world/index.js +12 -11
- package/dist/world/index.js.map +1 -0
- package/dist/world/infiniteWorld2D.d.ts +0 -5
- package/dist/world/infiniteWorld2D.js +175 -200
- package/dist/world/infiniteWorld2D.js.map +1 -0
- package/dist/world/island.js +81 -166
- package/dist/world/island.js.map +1 -0
- package/dist/world/islandPathing.d.ts +6 -0
- package/dist/world/islandPathing.js +166 -0
- package/dist/world/islandPathing.js.map +1 -0
- package/dist/world/macroCellSchema.js +15 -8
- package/dist/world/macroCellSchema.js.map +1 -0
- package/dist/world/macroKnightAStar.js +140 -71
- package/dist/world/macroKnightAStar.js.map +1 -0
- package/dist/world/macroSettlementZones.d.ts +9 -0
- package/dist/world/macroSettlementZones.js +108 -0
- package/dist/world/macroSettlementZones.js.map +1 -0
- package/dist/world/random.js +50 -24
- package/dist/world/random.js.map +1 -0
- package/dist/world/road.js +152 -90
- package/dist/world/road.js.map +1 -0
- package/dist/world/roadRibbon.d.ts +4 -19
- package/dist/world/roadRibbon.js +129 -124
- package/dist/world/roadRibbon.js.map +1 -0
- package/dist/world/terrain.d.ts +1 -1
- package/dist/world/terrain.js +111 -65
- package/dist/world/terrain.js.map +1 -0
- package/dist/world/terrainGeometry.d.ts +14 -0
- package/dist/world/terrainGeometry.js +76 -0
- package/dist/world/terrainGeometry.js.map +1 -0
- package/dist/world/worldTypes.d.ts +3 -3
- package/dist/world/worldTypes.js +133 -67
- package/dist/world/worldTypes.js.map +1 -0
- package/docs/api-reference.md +187 -0
- package/package.json +58 -32
- package/dist/engine/kolmoStore.js +0 -247
- package/dist/importer/CabinPreviewRig.d.ts +0 -13
- package/dist/importer/CabinPreviewRig.js +0 -138
- package/dist/importer/CabinStepSection.d.ts +0 -17
- package/dist/importer/CabinStepSection.js +0 -222
- package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -20
- package/dist/importer/ImporterPlinthUikitTags.js +0 -119
- package/dist/importer/cabinMeshBuilders.d.ts +0 -13
- package/dist/importer/cabinMeshBuilders.js +0 -104
- package/dist/importer/cabinMixamoRig.d.ts +0 -53
- package/dist/importer/cabinMixamoRig.js +0 -150
- package/dist/importer/chopShopUiComponents.d.ts +0 -22
- package/dist/importer/chopShopUiComponents.js +0 -91
- package/dist/importer/vehiclePanelAnim.js +0 -214
|
@@ -1,681 +1,64 @@
|
|
|
1
|
-
import { stampKolmoNodesIntoGlb
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
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 { stampKolmoNodesIntoGlb } from "../schema/kolmoStamp.js";
|
|
2
|
+
import { buildCarExportPlan } from "./khrCarPlanner.js";
|
|
3
|
+
import { buildCraftExportPlan, buildPropExportPlan, collectPreservedRigPatches, restoreStrippedTextures, stripUnloadedTextures } from "./khrCraftPropCompiler.js";
|
|
4
|
+
import { buildPatchPreviewEmitters, computeChopPartHinge, normalToMinusZQuaternion } from "./chopHingeHelpers.js";
|
|
5
|
+
import { isMeshObject } from "./sceneSiNormalize.js";
|
|
6
|
+
import * as THREE from "three";
|
|
7
|
+
import { exportKhrGlb } from "@khr3/core";
|
|
12
8
|
// src/importer/khrCompiler.ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
});
|
|
84
|
-
}
|
|
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
|
|
9
|
+
function computeLocalBounds(root) {
|
|
10
|
+
root.updateMatrixWorld(true);
|
|
11
|
+
const invRoot = new THREE.Matrix4().copy(root.matrixWorld).invert();
|
|
12
|
+
const relMat = new THREE.Matrix4();
|
|
13
|
+
const box = new THREE.Box3();
|
|
14
|
+
const v = new THREE.Vector3();
|
|
15
|
+
root.traverse((obj) => {
|
|
16
|
+
if (!isMeshObject(obj)) return;
|
|
17
|
+
const pos = obj.geometry.getAttribute("position");
|
|
18
|
+
if (!pos || pos.count === 0) return;
|
|
19
|
+
relMat.multiplyMatrices(invRoot, obj.matrixWorld);
|
|
20
|
+
for (let i = 0; i < pos.count; i++) {
|
|
21
|
+
v.fromBufferAttribute(pos, i).applyMatrix4(relMat);
|
|
22
|
+
if (Number.isFinite(v.x) && Number.isFinite(v.y) && Number.isFinite(v.z)) box.expandByPoint(v);
|
|
209
23
|
}
|
|
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
24
|
});
|
|
226
|
-
|
|
227
|
-
|
|
25
|
+
if (box.isEmpty()) box.set(new THREE.Vector3(-.5, 0, -.5), new THREE.Vector3(.5, 1, .5));
|
|
26
|
+
return box;
|
|
228
27
|
}
|
|
229
|
-
async function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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;
|
|
28
|
+
async function compileKhrAssetGlb(normalizedScene, opts) {
|
|
29
|
+
const box = computeLocalBounds(normalizedScene);
|
|
30
|
+
const sizeVec = box.getSize(new THREE.Vector3());
|
|
31
|
+
const center = box.getCenter(new THREE.Vector3());
|
|
32
|
+
const size = [
|
|
33
|
+
Math.max(.25, sizeVec.x),
|
|
34
|
+
Math.max(.25, sizeVec.y),
|
|
35
|
+
Math.max(.25, sizeVec.z)
|
|
36
|
+
];
|
|
37
|
+
const totalMass = Math.max(5, opts.massKg || 1e3);
|
|
38
|
+
const exportRoot = new THREE.Group();
|
|
39
|
+
exportRoot.name = opts.name || normalizedScene.name || `Kolmo_${opts.archetype}`;
|
|
40
|
+
let specs;
|
|
41
|
+
let sceneExtras;
|
|
42
|
+
if (opts.archetype === "car") {
|
|
43
|
+
const plan = buildCarExportPlan(normalizedScene, exportRoot, opts, box, size, center, totalMass);
|
|
44
|
+
specs = plan.specs;
|
|
45
|
+
sceneExtras = plan.sceneExtras;
|
|
46
|
+
} else if (opts.archetype === "craft") {
|
|
47
|
+
const plan = buildCraftExportPlan(normalizedScene, exportRoot, opts, size, center, totalMass);
|
|
48
|
+
specs = plan.specs;
|
|
49
|
+
sceneExtras = plan.sceneExtras;
|
|
50
|
+
} else specs = buildPropExportPlan(normalizedScene, exportRoot, opts, size, center, totalMass);
|
|
51
|
+
const stripped = stripUnloadedTextures(exportRoot);
|
|
52
|
+
let exported;
|
|
673
53
|
try {
|
|
674
|
-
|
|
54
|
+
exported = new Uint8Array(await exportKhrGlb(exportRoot, specs, sceneExtras));
|
|
675
55
|
} finally {
|
|
676
|
-
|
|
56
|
+
restoreStrippedTextures(stripped);
|
|
677
57
|
}
|
|
678
|
-
|
|
679
|
-
|
|
58
|
+
const allPatches = [...collectPreservedRigPatches(normalizedScene, opts.patches ?? []), ...opts.patches ?? []];
|
|
59
|
+
const stamped = stampKolmoNodesIntoGlb(exported, allPatches);
|
|
60
|
+
return new Uint8Array(stamped);
|
|
680
61
|
}
|
|
681
|
-
export {
|
|
62
|
+
export { buildPatchPreviewEmitters, compileKhrAssetGlb, computeChopPartHinge, normalToMinusZQuaternion };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=khrCompiler.js.map
|