@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.
- package/LICENSE +1 -1
- package/README.md +36 -36
- package/bin/kolmo.mjs +11 -8
- 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 +125 -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 +254 -262
- 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 +142 -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 +18 -0
- package/dist/importer/chopShopIoActions.js +161 -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 +176 -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 +39 -0
- package/dist/importer/khrCarPlanHelpers.js +310 -0
- package/dist/importer/khrCarPlanHelpers.js.map +1 -0
- package/dist/importer/khrCarPlanner.d.ts +8 -0
- package/dist/importer/khrCarPlanner.js +315 -0
- package/dist/importer/khrCarPlanner.js.map +1 -0
- package/dist/importer/khrCompiler.d.ts +4 -41
- package/dist/importer/khrCompiler.js +79 -673
- package/dist/importer/khrCompiler.js.map +1 -0
- package/dist/importer/khrCraftPropCompiler.d.ts +45 -0
- package/dist/importer/khrCraftPropCompiler.js +263 -0
- package/dist/importer/khrCraftPropCompiler.js.map +1 -0
- package/dist/importer/khrNodeNameGuard.d.ts +20 -0
- package/dist/importer/khrNodeNameGuard.js +139 -0
- package/dist/importer/khrNodeNameGuard.js.map +1 -0
- package/dist/importer/launcherBake.js +99 -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 +145 -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 +117 -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 +161 -453
- package/dist/importer/useChopShopController.js.map +1 -0
- package/dist/importer/useChopShopState.d.ts +103 -0
- package/dist/importer/useChopShopState.js +324 -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 +183 -0
- package/dist/importer/vehiclePartSplit.js.map +1 -0
- package/dist/importer/wheelAxlePairing.d.ts +4 -3
- package/dist/importer/wheelAxlePairing.js +128 -122
- 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 +11 -0
- package/dist/schema/kolmoStamp.js +119 -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.d.ts +1 -1
- package/dist/vite/index.js +38 -32
- 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 +190 -0
- package/package.json +54 -34
- 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,18 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { edgeKey, edgeLength, edgeWeight, mirrorTriangles, shortestEdgePath, snapToVertex } from "./surfaceGeodesic.js";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
// src/importer/surfaceTopology.ts
|
|
3
|
-
var
|
|
4
|
+
var CHOP_ROLES = [
|
|
4
5
|
{
|
|
5
6
|
role: "wheel",
|
|
6
7
|
label: "Wheel / Tire",
|
|
7
8
|
color: "#00E5FF",
|
|
8
9
|
massKg: 22
|
|
9
10
|
},
|
|
10
|
-
{
|
|
11
|
-
role: "propeller",
|
|
12
|
-
label: "Propeller / Rotor",
|
|
13
|
-
color: "#EC4899",
|
|
14
|
-
massKg: 14
|
|
15
|
-
},
|
|
16
11
|
{
|
|
17
12
|
role: "door",
|
|
18
13
|
label: "Door (Hinge)",
|
|
@@ -31,12 +26,6 @@ var t = [
|
|
|
31
26
|
color: "#A855F7",
|
|
32
27
|
massKg: 16
|
|
33
28
|
},
|
|
34
|
-
{
|
|
35
|
-
role: "glass",
|
|
36
|
-
label: "Glass / Window",
|
|
37
|
-
color: "#7DD3FC",
|
|
38
|
-
massKg: 6
|
|
39
|
-
},
|
|
40
29
|
{
|
|
41
30
|
role: "fender",
|
|
42
31
|
label: "Fender Panel",
|
|
@@ -50,162 +39,105 @@ var t = [
|
|
|
50
39
|
massKg: 12
|
|
51
40
|
}
|
|
52
41
|
];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (let i of n(e)) t += i.triangles.length, r += i.mirrored.length;
|
|
63
|
-
return {
|
|
64
|
-
primary: t,
|
|
65
|
-
mirrored: r
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
var i = 2 ** 26, a = .08, o = .65, s = /* @__PURE__ */ new WeakMap(), c = (e, t) => e < t ? e * i + t : t * i + e, l = (e, t, n) => `${Math.round(e * 1e4)},${Math.round(t * 1e4)},${Math.round(n * 1e4)}`;
|
|
69
|
-
function u(e) {
|
|
70
|
-
let t = s.get(e.geometry);
|
|
71
|
-
if (t) return t;
|
|
72
|
-
let n = d(e.geometry);
|
|
73
|
-
return s.set(e.geometry, n), n;
|
|
42
|
+
var MIRROR_OFF_CENTER_M = .08;
|
|
43
|
+
var topoCache = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
var weldKey = (x, y, z) => `${Math.round(x * 1e4)},${Math.round(y * 1e4)},${Math.round(z * 1e4)}`;
|
|
45
|
+
function getIslandTopology(island) {
|
|
46
|
+
const cached = topoCache.get(island.geometry);
|
|
47
|
+
if (cached) return cached;
|
|
48
|
+
const built = buildSurfaceTopology(island.geometry);
|
|
49
|
+
topoCache.set(island.geometry, built);
|
|
50
|
+
return built;
|
|
74
51
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
function buildSurfaceTopology(geometry) {
|
|
53
|
+
const posAttr = geometry.getAttribute("position");
|
|
54
|
+
const index = geometry.getIndex();
|
|
55
|
+
const cornerCount = posAttr ? index ? index.count : posAttr.count : 0;
|
|
56
|
+
const triangleCount = Math.floor(cornerCount / 3);
|
|
57
|
+
const corners = new Uint32Array(triangleCount * 3);
|
|
58
|
+
const weldedMap = /* @__PURE__ */ new Map();
|
|
59
|
+
const rawPoints = [];
|
|
60
|
+
for (let i = 0; i < triangleCount * 3; i++) {
|
|
61
|
+
const srcIdx = index ? index.getX(i) : i;
|
|
62
|
+
const x = posAttr.getX(srcIdx), y = posAttr.getY(srcIdx), z = posAttr.getZ(srcIdx);
|
|
63
|
+
const k = weldKey(x, y, z);
|
|
64
|
+
let vid = weldedMap.get(k);
|
|
65
|
+
if (vid === void 0) {
|
|
66
|
+
vid = weldedMap.size;
|
|
67
|
+
weldedMap.set(k, vid);
|
|
68
|
+
rawPoints.push(x, y, z);
|
|
69
|
+
}
|
|
70
|
+
corners[i] = vid;
|
|
80
71
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
const points = Float32Array.from(rawPoints);
|
|
73
|
+
const vertexCount = weldedMap.size;
|
|
74
|
+
const normals = new Float32Array(triangleCount * 3);
|
|
75
|
+
const areas = new Float32Array(triangleCount);
|
|
76
|
+
const edgeTriangles = /* @__PURE__ */ new Map();
|
|
77
|
+
const neighborSets = Array.from({ length: vertexCount }, () => /* @__PURE__ */ new Set());
|
|
78
|
+
const v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3(), cross = new THREE.Vector3();
|
|
79
|
+
for (let t = 0; t < triangleCount; t++) {
|
|
80
|
+
const a = corners[t * 3], b = corners[t * 3 + 1], c = corners[t * 3 + 2];
|
|
81
|
+
v0.fromArray(points, a * 3);
|
|
82
|
+
v1.fromArray(points, b * 3);
|
|
83
|
+
v2.fromArray(points, c * 3);
|
|
84
|
+
cross.crossVectors(v1.sub(v0), v2.sub(v0));
|
|
85
|
+
const len = cross.length();
|
|
86
|
+
areas[t] = len * .5;
|
|
87
|
+
if (len > 0) cross.divideScalar(len).toArray(normals, t * 3);
|
|
88
|
+
for (const [ea, eb] of [
|
|
89
|
+
[a, b],
|
|
90
|
+
[b, c],
|
|
91
|
+
[c, a]
|
|
91
92
|
]) {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
if (ea === eb) continue;
|
|
94
|
+
const ek = edgeKey(ea, eb);
|
|
95
|
+
let list = edgeTriangles.get(ek);
|
|
96
|
+
if (!list) {
|
|
97
|
+
list = [];
|
|
98
|
+
edgeTriangles.set(ek, list);
|
|
99
|
+
}
|
|
100
|
+
list.push(t);
|
|
101
|
+
neighborSets[ea].add(eb);
|
|
102
|
+
neighborSets[eb].add(ea);
|
|
95
103
|
}
|
|
96
104
|
}
|
|
97
105
|
return {
|
|
98
|
-
geometry
|
|
99
|
-
triangleCount
|
|
100
|
-
vertexCount
|
|
101
|
-
corners
|
|
102
|
-
points
|
|
103
|
-
normals
|
|
104
|
-
areas
|
|
105
|
-
edgeTriangles
|
|
106
|
-
neighbors:
|
|
106
|
+
geometry,
|
|
107
|
+
triangleCount,
|
|
108
|
+
vertexCount,
|
|
109
|
+
corners,
|
|
110
|
+
points,
|
|
111
|
+
normals,
|
|
112
|
+
areas,
|
|
113
|
+
edgeTriangles,
|
|
114
|
+
neighbors: neighborSets.map((set) => [...set])
|
|
107
115
|
};
|
|
108
116
|
}
|
|
109
|
-
function
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
let o = e.corners[a * 3 + t], s = e.corners[a * 3 + (t + 1) % 3];
|
|
117
|
-
if (o === s) continue;
|
|
118
|
-
let l = c(o, s);
|
|
119
|
-
for (let t of e.edgeTriangles.get(l) ?? []) !r[t] && n(l, a, t) && (r[t] = 1, i.push(t));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return i.sort((e, t) => e - t);
|
|
123
|
-
}
|
|
124
|
-
function p(e, t, n = 32) {
|
|
125
|
-
let r = Math.cos(n * Math.PI / 180), i = e.normals;
|
|
126
|
-
return f(e, t, (e, t, n) => i[t * 3] * i[n * 3] + i[t * 3 + 1] * i[n * 3 + 1] + i[t * 3 + 2] * i[n * 3 + 2] >= r);
|
|
127
|
-
}
|
|
128
|
-
function m(e, t, n = .03) {
|
|
129
|
-
let r = Math.max(n, 1e-4), i = (e, t, n) => `${Math.floor(e / r)},${Math.floor(t / r)},${Math.floor(n / r)}`, a = /* @__PURE__ */ new Map(), o = new Float32Array(e.triangleCount * 3);
|
|
130
|
-
for (let t = 0; t < e.triangleCount; t++) {
|
|
131
|
-
let n = 0, r = 0, s = 0;
|
|
117
|
+
function floodTriangles(topo, seed, mayCross) {
|
|
118
|
+
if (seed < 0 || seed >= topo.triangleCount) return [];
|
|
119
|
+
const visited = new Uint8Array(topo.triangleCount);
|
|
120
|
+
const queue = [seed];
|
|
121
|
+
visited[seed] = 1;
|
|
122
|
+
for (let qi = 0; qi < queue.length; qi++) {
|
|
123
|
+
const cur = queue[qi];
|
|
132
124
|
for (let i = 0; i < 3; i++) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
let s = new Set(t), c = /* @__PURE__ */ new Set();
|
|
141
|
-
for (let e of s) {
|
|
142
|
-
let t = -o[e * 3], l = o[e * 3 + 1], u = o[e * 3 + 2], d = -1, f = n;
|
|
143
|
-
for (let n = -1; n <= 1; n++) for (let c = -1; c <= 1; c++) for (let p = -1; p <= 1; p++) for (let m of a.get(i(t + n * r, l + c * r, u + p * r)) ?? []) {
|
|
144
|
-
if (m === e || s.has(m)) continue;
|
|
145
|
-
let n = Math.hypot(o[m * 3] - t, o[m * 3 + 1] - l, o[m * 3 + 2] - u);
|
|
146
|
-
n <= f && (f = n, d = m);
|
|
147
|
-
}
|
|
148
|
-
d >= 0 && c.add(d);
|
|
149
|
-
}
|
|
150
|
-
return [...c].sort((e, t) => e - t);
|
|
151
|
-
}
|
|
152
|
-
function h(e, t, n) {
|
|
153
|
-
let r = e.points;
|
|
154
|
-
return Math.hypot(r[t * 3] - r[n * 3], r[t * 3 + 1] - r[n * 3 + 1], r[t * 3 + 2] - r[n * 3 + 2]);
|
|
155
|
-
}
|
|
156
|
-
function g(e, t, n) {
|
|
157
|
-
let r = e.edgeTriangles.get(c(t, n)), i = 1;
|
|
158
|
-
if (r && r.length === 2) {
|
|
159
|
-
let t = e.normals, n = r[0], a = r[1], o = t[n * 3] * t[a * 3] + t[n * 3 + 1] * t[a * 3 + 1] + t[n * 3 + 2] * t[a * 3 + 2];
|
|
160
|
-
i = Math.min(1, Math.acos(Math.max(-1, Math.min(1, o))) / (Math.PI / 2));
|
|
161
|
-
}
|
|
162
|
-
return h(e, t, n) * (1 - o * i);
|
|
163
|
-
}
|
|
164
|
-
function _(e, t) {
|
|
165
|
-
let n = 0, r = Infinity;
|
|
166
|
-
for (let i = 0; i < e.vertexCount; i++) {
|
|
167
|
-
let a = (e.points[i * 3] - t[0]) ** 2 + (e.points[i * 3 + 1] - t[1]) ** 2 + (e.points[i * 3 + 2] - t[2]) ** 2;
|
|
168
|
-
a < r && (r = a, n = i);
|
|
169
|
-
}
|
|
170
|
-
return n;
|
|
171
|
-
}
|
|
172
|
-
function v(e, t, n, r, i = g) {
|
|
173
|
-
if (t === n) return [t];
|
|
174
|
-
let a = new Float64Array(e.vertexCount).fill(Infinity), o = new Int32Array(e.vertexCount).fill(-1), s = [[0, t]];
|
|
175
|
-
a[t] = 0;
|
|
176
|
-
let c = (e) => {
|
|
177
|
-
s.push(e);
|
|
178
|
-
for (let e = s.length - 1; e > 0;) {
|
|
179
|
-
let t = e - 1 >> 1;
|
|
180
|
-
if (s[t][0] <= s[e][0]) break;
|
|
181
|
-
[s[t], s[e]] = [s[e], s[t]], e = t;
|
|
182
|
-
}
|
|
183
|
-
}, l = () => {
|
|
184
|
-
let e = s[0], t = s.pop();
|
|
185
|
-
if (s.length > 0) {
|
|
186
|
-
s[0] = t;
|
|
187
|
-
for (let e = 0;;) {
|
|
188
|
-
let t = e * 2 + 1, n = t + 1, r = e;
|
|
189
|
-
if (t < s.length && s[t][0] < s[r][0] && (r = t), n < s.length && s[n][0] < s[r][0] && (r = n), r === e) break;
|
|
190
|
-
[s[r], s[e]] = [s[e], s[r]], e = r;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return e;
|
|
194
|
-
};
|
|
195
|
-
for (; s.length > 0;) {
|
|
196
|
-
let [t, s] = l();
|
|
197
|
-
if (!(t > a[s])) {
|
|
198
|
-
if (s === n) break;
|
|
199
|
-
for (let l of e.neighbors[s]) {
|
|
200
|
-
if (l !== n && r?.has(l)) continue;
|
|
201
|
-
let u = t + i(e, s, l);
|
|
202
|
-
u < a[l] && (a[l] = u, o[l] = s, c([u, l]));
|
|
125
|
+
const va = topo.corners[cur * 3 + i], vb = topo.corners[cur * 3 + (i + 1) % 3];
|
|
126
|
+
if (va === vb) continue;
|
|
127
|
+
const ek = edgeKey(va, vb);
|
|
128
|
+
for (const next of topo.edgeTriangles.get(ek) ?? []) if (!visited[next] && mayCross(ek, cur, next)) {
|
|
129
|
+
visited[next] = 1;
|
|
130
|
+
queue.push(next);
|
|
203
131
|
}
|
|
204
132
|
}
|
|
205
133
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
134
|
+
return queue.sort((a, b) => a - b);
|
|
135
|
+
}
|
|
136
|
+
function floodFillByCrease(topo, seed, maxCreaseDeg = 32) {
|
|
137
|
+
const minDot = Math.cos(maxCreaseDeg * Math.PI / 180);
|
|
138
|
+
const n = topo.normals;
|
|
139
|
+
return floodTriangles(topo, seed, (_edge, from, to) => n[from * 3] * n[to * 3] + n[from * 3 + 1] * n[to * 3 + 1] + n[from * 3 + 2] * n[to * 3 + 2] >= minDot);
|
|
210
140
|
}
|
|
211
|
-
export {
|
|
141
|
+
export { CHOP_ROLES, MIRROR_OFF_CENTER_M, buildSurfaceTopology, edgeKey, edgeLength, edgeWeight, floodFillByCrease, floodTriangles, getIslandTopology, mirrorTriangles, shortestEdgePath, snapToVertex, weldKey };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=surfaceTopology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceTopology.js","names":[],"sources":["../../src/importer/surfaceTopology.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport type { MeshIsland } from \"./meshIslands.js\";\nimport { edgeKey, edgeLength, edgeWeight, mirrorTriangles, shortestEdgePath, snapToVertex } from \"./surfaceGeodesic.js\";\n\nexport type SurfaceSelectMode = \"island\" | \"crease\" | \"loop\" | \"triangle\";\nexport type ChopPartRole = \"door\" | \"hood\" | \"trunk\" | \"fender\" | \"bumper\";\nexport type ActiveChopRole = \"wheel\" | ChopPartRole;\nexport type CutVec3 = readonly [number, number, number];\n\nexport const CHOP_ROLES: ReadonlyArray<{\n role: ActiveChopRole;\n label: string;\n color: string;\n massKg: number;\n}> = [\n { role: \"wheel\", label: \"Wheel / Tire\", color: \"#00E5FF\", massKg: 22 },\n { role: \"door\", label: \"Door (Hinge)\", color: \"#FFB000\", massKg: 24 },\n { role: \"hood\", label: \"Hood (Hinge)\", color: \"#10B981\", massKg: 18 },\n { role: \"trunk\", label: \"Trunk / Gate\", color: \"#A855F7\", massKg: 16 },\n { role: \"fender\", label: \"Fender Panel\", color: \"#F43F5E\", massKg: 11 },\n { role: \"bumper\", label: \"Bumper Cover\", color: \"#38BDF8\", massKg: 12 },\n];\n\nexport interface FaceSelection {\n readonly islandId: number;\n readonly triangles: number[];\n readonly mirrored: number[];\n}\n\nexport interface SurfaceTopology {\n readonly geometry: THREE.BufferGeometry;\n readonly triangleCount: number;\n readonly vertexCount: number;\n readonly corners: Uint32Array;\n readonly points: Float32Array;\n readonly normals: Float32Array;\n readonly areas: Float32Array;\n readonly edgeTriangles: Map<number, number[]>;\n readonly neighbors: number[][];\n}\n\nexport const MIRROR_OFF_CENTER_M = 0.08;\nconst topoCache = new WeakMap<THREE.BufferGeometry, SurfaceTopology>();\n\nexport { edgeKey, edgeLength, edgeWeight, mirrorTriangles, shortestEdgePath, snapToVertex };\n\nexport const weldKey = (x: number, y: number, z: number): string =>\n `${Math.round(x * 1e4)},${Math.round(y * 1e4)},${Math.round(z * 1e4)}`;\n\nexport function getIslandTopology(island: MeshIsland): SurfaceTopology {\n const cached = topoCache.get(island.geometry);\n if (cached) return cached;\n const built = buildSurfaceTopology(island.geometry);\n topoCache.set(island.geometry, built);\n return built;\n}\n\nexport function buildSurfaceTopology(geometry: THREE.BufferGeometry): SurfaceTopology {\n const posAttr = geometry.getAttribute(\"position\");\n const index = geometry.getIndex();\n const cornerCount = posAttr ? (index ? index.count : posAttr.count) : 0;\n const triangleCount = Math.floor(cornerCount / 3);\n const corners = new Uint32Array(triangleCount * 3);\n const weldedMap = new Map<string, number>();\n const rawPoints: number[] = [];\n\n for (let i = 0; i < triangleCount * 3; i++) {\n const srcIdx = index ? index.getX(i) : i;\n const x = posAttr.getX(srcIdx), y = posAttr.getY(srcIdx), z = posAttr.getZ(srcIdx);\n const k = weldKey(x, y, z);\n let vid = weldedMap.get(k);\n if (vid === undefined) {\n vid = weldedMap.size;\n weldedMap.set(k, vid);\n rawPoints.push(x, y, z);\n }\n corners[i] = vid;\n }\n\n const points = Float32Array.from(rawPoints);\n const vertexCount = weldedMap.size;\n const normals = new Float32Array(triangleCount * 3);\n const areas = new Float32Array(triangleCount);\n const edgeTriangles = new Map<number, number[]>();\n const neighborSets = Array.from({ length: vertexCount }, () => new Set<number>());\n\n const v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3(), cross = new THREE.Vector3();\n for (let t = 0; t < triangleCount; t++) {\n const a = corners[t * 3], b = corners[t * 3 + 1], c = corners[t * 3 + 2];\n v0.fromArray(points, a * 3);\n v1.fromArray(points, b * 3);\n v2.fromArray(points, c * 3);\n cross.crossVectors(v1.sub(v0), v2.sub(v0));\n const len = cross.length();\n areas[t] = len * 0.5;\n if (len > 0) cross.divideScalar(len).toArray(normals, t * 3);\n\n for (const [ea, eb] of [[a, b], [b, c], [c, a]] as const) {\n if (ea === eb) continue;\n const ek = edgeKey(ea, eb);\n let list = edgeTriangles.get(ek);\n if (!list) { list = []; edgeTriangles.set(ek, list); }\n list.push(t);\n neighborSets[ea].add(eb);\n neighborSets[eb].add(ea);\n }\n }\n\n return {\n geometry, triangleCount, vertexCount, corners, points, normals, areas, edgeTriangles,\n neighbors: neighborSets.map((set) => [...set]),\n };\n}\n\nexport function floodTriangles(\n topo: SurfaceTopology,\n seed: number,\n mayCross: (edge: number, from: number, to: number) => boolean,\n): number[] {\n if (seed < 0 || seed >= topo.triangleCount) return [];\n const visited = new Uint8Array(topo.triangleCount);\n const queue = [seed];\n visited[seed] = 1;\n for (let qi = 0; qi < queue.length; qi++) {\n const cur = queue[qi];\n for (let i = 0; i < 3; i++) {\n const va = topo.corners[cur * 3 + i], vb = topo.corners[cur * 3 + ((i + 1) % 3)];\n if (va === vb) continue;\n const ek = edgeKey(va, vb);\n for (const next of topo.edgeTriangles.get(ek) ?? []) {\n if (!visited[next] && mayCross(ek, cur, next)) {\n visited[next] = 1;\n queue.push(next);\n }\n }\n }\n }\n return queue.sort((a, b) => a - b);\n}\n\nexport function floodFillByCrease(topo: SurfaceTopology, seed: number, maxCreaseDeg = 32): number[] {\n const minDot = Math.cos((maxCreaseDeg * Math.PI) / 180);\n const n = topo.normals;\n return floodTriangles(\n topo,\n seed,\n (_edge, from, to) => n[from * 3] * n[to * 3] + n[from * 3 + 1] * n[to * 3 + 1] + n[from * 3 + 2] * n[to * 3 + 2] >= minDot,\n );\n}\n"],"mappings":";;;AASA,IAAa,aAKR;CACD;EAAE,MAAM;EAAS,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;CACrE;EAAE,MAAM;EAAQ,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;CACpE;EAAE,MAAM;EAAQ,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;CACpE;EAAE,MAAM;EAAS,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;CACrE;EAAE,MAAM;EAAU,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;CACtE;EAAE,MAAM;EAAU,OAAO;EAAgB,OAAO;EAAW,QAAQ;CAAG;AAC1E;AAoBA,IAAa,sBAAsB;AACnC,IAAM,4BAAY,IAAI,QAA+C;AAIrE,IAAa,WAAW,GAAW,GAAW,MAC1C,GAAG,KAAK,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,MAAM,IAAI,GAAG;AAEvE,SAAgB,kBAAkB,QAAqC;CACnE,MAAM,SAAS,UAAU,IAAI,OAAO,QAAQ;CAC5C,IAAI,QAAQ,OAAO;CACnB,MAAM,QAAQ,qBAAqB,OAAO,QAAQ;CAClD,UAAU,IAAI,OAAO,UAAU,KAAK;CACpC,OAAO;AACX;AAEA,SAAgB,qBAAqB,UAAiD;CAClF,MAAM,UAAU,SAAS,aAAa,UAAU;CAChD,MAAM,QAAQ,SAAS,SAAS;CAChC,MAAM,cAAc,UAAW,QAAQ,MAAM,QAAQ,QAAQ,QAAS;CACtE,MAAM,gBAAgB,KAAK,MAAM,cAAc,CAAC;CAChD,MAAM,UAAU,IAAI,YAAY,gBAAgB,CAAC;CACjD,MAAM,4BAAY,IAAI,IAAoB;CAC1C,MAAM,YAAsB,CAAC;CAE7B,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,GAAG,KAAK;EACxC,MAAM,SAAS,QAAQ,MAAM,KAAK,CAAC,IAAI;EACvC,MAAM,IAAI,QAAQ,KAAK,MAAM,GAAG,IAAI,QAAQ,KAAK,MAAM,GAAG,IAAI,QAAQ,KAAK,MAAM;EACjF,MAAM,IAAI,QAAQ,GAAG,GAAG,CAAC;EACzB,IAAI,MAAM,UAAU,IAAI,CAAC;EACzB,IAAI,QAAQ,KAAA,GAAW;GACnB,MAAM,UAAU;GAChB,UAAU,IAAI,GAAG,GAAG;GACpB,UAAU,KAAK,GAAG,GAAG,CAAC;EAC1B;EACA,QAAQ,KAAK;CACjB;CAEA,MAAM,SAAS,aAAa,KAAK,SAAS;CAC1C,MAAM,cAAc,UAAU;CAC9B,MAAM,UAAU,IAAI,aAAa,gBAAgB,CAAC;CAClD,MAAM,QAAQ,IAAI,aAAa,aAAa;CAC5C,MAAM,gCAAgB,IAAI,IAAsB;CAChD,MAAM,eAAe,MAAM,KAAK,EAAE,QAAQ,YAAY,yBAAS,IAAI,IAAY,CAAC;CAEhF,MAAM,KAAK,IAAI,MAAM,QAAQ,GAAG,KAAK,IAAI,MAAM,QAAQ,GAAG,KAAK,IAAI,MAAM,QAAQ,GAAG,QAAQ,IAAI,MAAM,QAAQ;CAC9G,KAAK,IAAI,IAAI,GAAG,IAAI,eAAe,KAAK;EACpC,MAAM,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI;EACtE,GAAG,UAAU,QAAQ,IAAI,CAAC;EAC1B,GAAG,UAAU,QAAQ,IAAI,CAAC;EAC1B,GAAG,UAAU,QAAQ,IAAI,CAAC;EAC1B,MAAM,aAAa,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,CAAC;EACzC,MAAM,MAAM,MAAM,OAAO;EACzB,MAAM,KAAK,MAAM;EACjB,IAAI,MAAM,GAAG,MAAM,aAAa,GAAG,CAAC,CAAC,QAAQ,SAAS,IAAI,CAAC;EAE3D,KAAK,MAAM,CAAC,IAAI,OAAO;GAAC,CAAC,GAAG,CAAC;GAAG,CAAC,GAAG,CAAC;GAAG,CAAC,GAAG,CAAC;EAAC,GAAY;GACtD,IAAI,OAAO,IAAI;GACf,MAAM,KAAK,QAAQ,IAAI,EAAE;GACzB,IAAI,OAAO,cAAc,IAAI,EAAE;GAC/B,IAAI,CAAC,MAAM;IAAE,OAAO,CAAC;IAAG,cAAc,IAAI,IAAI,IAAI;GAAG;GACrD,KAAK,KAAK,CAAC;GACX,aAAa,GAAG,CAAC,IAAI,EAAE;GACvB,aAAa,GAAG,CAAC,IAAI,EAAE;EAC3B;CACJ;CAEA,OAAO;EACH;EAAU;EAAe;EAAa;EAAS;EAAQ;EAAS;EAAO;EACvE,WAAW,aAAa,KAAK,QAAQ,CAAC,GAAG,GAAG,CAAC;CACjD;AACJ;AAEA,SAAgB,eACZ,MACA,MACA,UACQ;CACR,IAAI,OAAO,KAAK,QAAQ,KAAK,eAAe,OAAO,CAAC;CACpD,MAAM,UAAU,IAAI,WAAW,KAAK,aAAa;CACjD,MAAM,QAAQ,CAAC,IAAI;CACnB,QAAQ,QAAQ;CAChB,KAAK,IAAI,KAAK,GAAG,KAAK,MAAM,QAAQ,MAAM;EACtC,MAAM,MAAM,MAAM;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;GACxB,MAAM,KAAK,KAAK,QAAQ,MAAM,IAAI,IAAI,KAAK,KAAK,QAAQ,MAAM,KAAM,IAAI,KAAK;GAC7E,IAAI,OAAO,IAAI;GACf,MAAM,KAAK,QAAQ,IAAI,EAAE;GACzB,KAAK,MAAM,QAAQ,KAAK,cAAc,IAAI,EAAE,KAAK,CAAC,GAC9C,IAAI,CAAC,QAAQ,SAAS,SAAS,IAAI,KAAK,IAAI,GAAG;IAC3C,QAAQ,QAAQ;IAChB,MAAM,KAAK,IAAI;GACnB;EAER;CACJ;CACA,OAAO,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC;AACrC;AAEA,SAAgB,kBAAkB,MAAuB,MAAc,eAAe,IAAc;CAChG,MAAM,SAAS,KAAK,IAAK,eAAe,KAAK,KAAM,GAAG;CACtD,MAAM,IAAI,KAAK;CACf,OAAO,eACH,MACA,OACC,OAAO,MAAM,OAAO,EAAE,OAAO,KAAK,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,IAAI,MAAM,MACxH;AACJ"}
|
|
@@ -2,12 +2,12 @@ import * as THREE from "three";
|
|
|
2
2
|
import { type KhrAssetBundle } from "@khr3/core";
|
|
3
3
|
import { type PaperShellAssembly } from "@khr3/vehicles/paper-shell";
|
|
4
4
|
import { type KolmoAuthoredNodePatch } from "../schema/kolmoSchema.js";
|
|
5
|
+
import type { WheelCutterSpec } from "./fusedWheelDetect.js";
|
|
5
6
|
import type { GateDomain, VehicleSubArchetype } from "./gateStore.js";
|
|
6
|
-
import type
|
|
7
|
-
import type { ChopPartRole } from "./surfaceCutter.js";
|
|
7
|
+
import { type CarDriveMode, type WheelVisualSource } from "./khrCompiler.js";
|
|
8
8
|
import type { MeshIsland, WheelAxle } from "./meshIslands.js";
|
|
9
|
-
import
|
|
10
|
-
export type WorldAssetKind =
|
|
9
|
+
import type { ChopPartRole } from "./surfaceCutter.js";
|
|
10
|
+
export type WorldAssetKind = "vehicle" | "prop";
|
|
11
11
|
export interface GateWorldPayload {
|
|
12
12
|
readonly id: string;
|
|
13
13
|
readonly label: string;
|
|
@@ -28,16 +28,14 @@ export interface UniversalBakeInput {
|
|
|
28
28
|
readonly massKg: number;
|
|
29
29
|
readonly powerOrThrust: number;
|
|
30
30
|
readonly driveType: CarDriveMode;
|
|
31
|
-
readonly tirePreset?: TireArchetypeId;
|
|
32
|
-
readonly torqueCurve?: EngineTorqueCurveId;
|
|
33
|
-
readonly steerCurve?: SteerSpeedCurveId;
|
|
34
31
|
readonly staticProp: boolean;
|
|
35
32
|
readonly axles: readonly WheelAxle[];
|
|
36
|
-
readonly propellerIslandIds?: readonly number[];
|
|
37
33
|
readonly islands: readonly MeshIsland[];
|
|
38
34
|
readonly partPicks?: Readonly<Record<number, ChopPartRole>>;
|
|
39
35
|
readonly wheelSource?: WheelVisualSource;
|
|
40
|
-
readonly
|
|
36
|
+
readonly wheelCutters?: readonly WheelCutterSpec[];
|
|
37
|
+
readonly sealArchLiner?: boolean;
|
|
38
|
+
readonly mirrorX?: boolean;
|
|
41
39
|
readonly patches: readonly KolmoAuthoredNodePatch[];
|
|
42
40
|
}
|
|
43
41
|
export declare function bakeUniversalGateGlb(input: UniversalBakeInput): Promise<{
|
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
import { stampKolmoNodesIntoGlb
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { disambiguateExplicitPatches, stampKolmoNodesIntoGlb } from "../schema/kolmoStamp.js";
|
|
2
|
+
import { compileKhrAssetGlb } from "./khrCompiler.js";
|
|
3
|
+
import { boxInertia, collectPreservedRigPatches, restoreStrippedTextures, stripUnloadedTextures } from "./khrCraftPropCompiler.js";
|
|
4
|
+
import { assignMissingEmitterNames, collectSceneNodeNames, disambiguateSubtreeNodeNames, ensureRootNameUnique } from "./khrNodeNameGuard.js";
|
|
5
|
+
import { KOLMOGOROV_CARBINE, LAUNCHER_RECIPES, bakeArticulatedLauncherGlb } from "./launcherBake.js";
|
|
6
|
+
import { cloneForNormalize, isMeshObject } from "./sceneSiNormalize.js";
|
|
7
|
+
import * as THREE from "three";
|
|
8
|
+
import { exportKhrGlb, loadKhrGlb, patchGlbJsonChunk } from "@khr3/core";
|
|
9
|
+
import { exportPaperShellKhrGlb } from "@khr3/vehicles/paper-shell";
|
|
8
10
|
// src/importer/universalGateBake.ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"roughnessMap",
|
|
13
|
-
"metalnessMap",
|
|
14
|
-
"aoMap",
|
|
15
|
-
"emissiveMap"
|
|
16
|
-
];
|
|
17
|
-
async function p(t, n, r, i) {
|
|
18
|
-
let a = [];
|
|
19
|
-
t.traverse((e) => {
|
|
20
|
-
if (!(e instanceof s.Mesh) || !e.material) return;
|
|
21
|
-
let t = e.material;
|
|
22
|
-
for (let e of f) {
|
|
23
|
-
let n = t[e];
|
|
24
|
-
n && !n.image && (a.push({
|
|
25
|
-
rec: t,
|
|
26
|
-
slot: e,
|
|
27
|
-
tex: n
|
|
28
|
-
}), t[e] = null);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
let o;
|
|
11
|
+
async function exportAndStampGlb(scene, specs, sceneExtras, preservedPatches, explicitPatches) {
|
|
12
|
+
const stripped = stripUnloadedTextures(scene);
|
|
13
|
+
let exported;
|
|
32
14
|
try {
|
|
33
|
-
|
|
15
|
+
exported = new Uint8Array(await exportKhrGlb(scene, specs, sceneExtras));
|
|
34
16
|
} finally {
|
|
35
|
-
|
|
17
|
+
restoreStrippedTextures(stripped);
|
|
36
18
|
}
|
|
37
|
-
|
|
38
|
-
|
|
19
|
+
const withPreserved = stampKolmoNodesIntoGlb(exported, preservedPatches);
|
|
20
|
+
const stamped = stampKolmoNodesIntoGlb(withPreserved, explicitPatches, void 0, { preserveExistingNodes: true });
|
|
21
|
+
return new Uint8Array(stamped);
|
|
39
22
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
var toArrayBuffer = (u8) => new Uint8Array(u8).buffer;
|
|
24
|
+
async function bakeUniversalGateGlb(input) {
|
|
25
|
+
if (input.domain === "vehicle" && input.usePaperShellProxy) {
|
|
26
|
+
const { glb } = await exportPaperShellKhrGlb(input.assembly, input.attachedMask, input.fuelLiters);
|
|
27
|
+
const patched = new Uint8Array(patchGlbJsonChunk(glb, (gltf) => {
|
|
28
|
+
const s0 = gltf.scenes?.[0];
|
|
29
|
+
if (s0) s0.extras = {
|
|
30
|
+
...s0.extras ?? {},
|
|
46
31
|
tune: {
|
|
47
32
|
engineHorsepower: 190,
|
|
48
33
|
gearRatios: [
|
|
@@ -53,8 +38,9 @@ async function m(c) {
|
|
|
53
38
|
],
|
|
54
39
|
finalDriveRatio: 3.9
|
|
55
40
|
}
|
|
56
|
-
}
|
|
57
|
-
}))
|
|
41
|
+
};
|
|
42
|
+
}));
|
|
43
|
+
const withSeat = stampKolmoNodesIntoGlb(patched, [{
|
|
58
44
|
nodeName: "Socket_seat_gate",
|
|
59
45
|
translation: [
|
|
60
46
|
.34,
|
|
@@ -62,102 +48,124 @@ async function m(c) {
|
|
|
62
48
|
-.08
|
|
63
49
|
],
|
|
64
50
|
extension: { socket: "seat" }
|
|
65
|
-
}
|
|
51
|
+
}], void 0, { preserveExistingNodes: true });
|
|
52
|
+
const glbBytes = new Uint8Array(stampKolmoNodesIntoGlb(withSeat, input.patches, void 0, { preserveExistingNodes: true }));
|
|
66
53
|
return {
|
|
67
|
-
glbBytes
|
|
68
|
-
bundle: await
|
|
69
|
-
worldKind: "
|
|
54
|
+
glbBytes,
|
|
55
|
+
bundle: await loadKhrGlb(toArrayBuffer(glbBytes)),
|
|
56
|
+
worldKind: "vehicle"
|
|
70
57
|
};
|
|
71
58
|
}
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
archetype:
|
|
76
|
-
massKg:
|
|
77
|
-
powerOrThrust:
|
|
78
|
-
driveType:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
name: c.name
|
|
90
|
-
}), t = e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
59
|
+
const baseScene = input.normalizedScene ?? new THREE.Group();
|
|
60
|
+
if (input.domain === "vehicle") {
|
|
61
|
+
const glbBytes = await compileKhrAssetGlb(baseScene, {
|
|
62
|
+
archetype: input.vehicleArchetype,
|
|
63
|
+
massKg: input.massKg,
|
|
64
|
+
powerOrThrust: input.powerOrThrust,
|
|
65
|
+
driveType: input.driveType,
|
|
66
|
+
wheelSource: input.wheelSource,
|
|
67
|
+
axles: input.axles,
|
|
68
|
+
islands: input.islands,
|
|
69
|
+
partPicks: input.partPicks,
|
|
70
|
+
wheelCutters: input.wheelCutters,
|
|
71
|
+
sealArchLiner: input.sealArchLiner,
|
|
72
|
+
mirrorX: input.mirrorX,
|
|
73
|
+
patches: input.patches,
|
|
74
|
+
name: input.name
|
|
75
|
+
});
|
|
91
76
|
return {
|
|
92
|
-
glbBytes
|
|
93
|
-
bundle: await
|
|
94
|
-
worldKind:
|
|
77
|
+
glbBytes,
|
|
78
|
+
bundle: await loadKhrGlb(toArrayBuffer(glbBytes)),
|
|
79
|
+
worldKind: "vehicle"
|
|
95
80
|
};
|
|
96
81
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
82
|
+
if (input.domain === "launcher") {
|
|
83
|
+
const lower = input.name.toLowerCase();
|
|
84
|
+
const recipe = LAUNCHER_RECIPES.find((r) => lower.includes(r.id.replace("kolmogorov_", ""))) ?? KOLMOGOROV_CARBINE;
|
|
85
|
+
const hasOverlay = !!(input.normalizedScene && !input.normalizedScene.name.startsWith("Starter_") && !input.normalizedScene.userData?.isProceduralLauncher);
|
|
86
|
+
const { glbBytes, bundle } = await bakeArticulatedLauncherGlb(recipe, hasOverlay ? baseScene : null, input.patches);
|
|
99
87
|
return {
|
|
100
|
-
glbBytes
|
|
101
|
-
bundle
|
|
88
|
+
glbBytes,
|
|
89
|
+
bundle,
|
|
102
90
|
worldKind: "prop"
|
|
103
91
|
};
|
|
104
92
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
93
|
+
baseScene.updateMatrixWorld(true);
|
|
94
|
+
const box = new THREE.Box3().setFromObject(baseScene);
|
|
95
|
+
const size = box.isEmpty() ? new THREE.Vector3(1, 1, 1) : box.getSize(new THREE.Vector3());
|
|
96
|
+
const center = box.isEmpty() ? new THREE.Vector3(0, .5, 0) : box.getCenter(new THREE.Vector3());
|
|
97
|
+
const sx = Math.max(.08, size.x);
|
|
98
|
+
const sy = Math.max(.08, size.y);
|
|
99
|
+
const sz = Math.max(.08, size.z);
|
|
100
|
+
const root = new THREE.Group();
|
|
101
|
+
root.name = input.name;
|
|
102
|
+
const bodyGroup = new THREE.Group();
|
|
103
|
+
bodyGroup.name = input.domain === "c12" ? "C12Shell" : input.domain === "person" ? "PersonRig" : input.domain === "junk" ? "JunkTarget" : "PropBody";
|
|
104
|
+
const reservedNames = /* @__PURE__ */ new Set([bodyGroup.name]);
|
|
105
|
+
const clonedBase = cloneForNormalize(baseScene);
|
|
106
|
+
disambiguateSubtreeNodeNames(clonedBase, reservedNames, false);
|
|
107
|
+
let hasGeometry = false;
|
|
108
|
+
for (const child of [...clonedBase.children]) {
|
|
109
|
+
bodyGroup.add(child);
|
|
110
|
+
child.traverse((obj) => {
|
|
111
|
+
if (isMeshObject(obj) && (obj.geometry.getAttribute("position")?.count ?? 0) >= 3) hasGeometry = true;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
root.add(bodyGroup);
|
|
115
|
+
ensureRootNameUnique(root, reservedNames);
|
|
116
|
+
const emitterReserved = new Set(reservedNames);
|
|
117
|
+
for (const p of input.patches) emitterReserved.add(p.nodeName);
|
|
118
|
+
assignMissingEmitterNames(root, emitterReserved);
|
|
119
|
+
const preserved = collectPreservedRigPatches(root, [], { localToParent: true });
|
|
120
|
+
const existingNames = collectSceneNodeNames(root, preserved.map((p) => p.nodeName));
|
|
121
|
+
const safeExplicit = disambiguateExplicitPatches(input.patches, existingNames);
|
|
122
|
+
const isFixed = input.domain === "c12" || input.domain === "prop" && input.staticProp;
|
|
123
|
+
const massKg = Math.max(.5, input.massKg || (input.domain === "person" ? 72 : input.domain === "junk" ? 18 : 65));
|
|
124
|
+
const com = [
|
|
125
|
+
Number(center.x.toFixed(4)),
|
|
126
|
+
Number(center.y.toFixed(4)),
|
|
127
|
+
Number(center.z.toFixed(4))
|
|
128
|
+
];
|
|
129
|
+
const glbBytes = await exportAndStampGlb(root, [{
|
|
130
|
+
nodeName: bodyGroup.name,
|
|
131
|
+
motion: isFixed ? { isKinematic: true } : {
|
|
132
|
+
isKinematic: false,
|
|
133
|
+
mass: massKg,
|
|
134
|
+
centerOfMass: com,
|
|
135
|
+
inertiaDiagonal: boxInertia(massKg, sx, sy, sz)
|
|
130
136
|
},
|
|
131
|
-
collider:
|
|
132
|
-
meshNodeName:
|
|
133
|
-
convexHull:
|
|
137
|
+
collider: hasGeometry && !isFixed ? {
|
|
138
|
+
meshNodeName: bodyGroup.name,
|
|
139
|
+
convexHull: true,
|
|
134
140
|
friction: .62,
|
|
135
141
|
restitution: .12
|
|
136
142
|
} : {
|
|
137
143
|
shape: {
|
|
138
144
|
type: "box",
|
|
139
145
|
size: [
|
|
140
|
-
Number(
|
|
141
|
-
Number(
|
|
142
|
-
Number(
|
|
146
|
+
Number(sx.toFixed(4)),
|
|
147
|
+
Number(sy.toFixed(4)),
|
|
148
|
+
Number(sz.toFixed(4))
|
|
143
149
|
]
|
|
144
150
|
},
|
|
145
151
|
friction: .72,
|
|
146
152
|
restitution: .08
|
|
147
153
|
},
|
|
148
154
|
extras: {
|
|
149
|
-
role:
|
|
150
|
-
...
|
|
155
|
+
role: input.domain,
|
|
156
|
+
...input.domain === "junk" ? { destructible: {
|
|
151
157
|
fractureShards: 8,
|
|
152
158
|
decalBudget: 16,
|
|
153
159
|
breakImpulseNs: 65
|
|
154
160
|
} } : {}
|
|
155
161
|
}
|
|
156
|
-
}], { gateDomain:
|
|
162
|
+
}], { gateDomain: input.domain }, preserved, safeExplicit);
|
|
157
163
|
return {
|
|
158
|
-
glbBytes
|
|
159
|
-
bundle: await
|
|
164
|
+
glbBytes,
|
|
165
|
+
bundle: await loadKhrGlb(toArrayBuffer(glbBytes)),
|
|
160
166
|
worldKind: "prop"
|
|
161
167
|
};
|
|
162
168
|
}
|
|
163
|
-
export {
|
|
169
|
+
export { bakeUniversalGateGlb };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=universalGateBake.js.map
|