@pinkaphant/kolmo 0.4.7 → 0.5.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/README.md +25 -94
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/gltfLoader.d.ts +18 -0
- package/dist/engine/index.d.ts +8 -17
- package/dist/engine/index.js +667 -27
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/{kolmoInput.d.ts → input.d.ts} +8 -6
- package/dist/engine/surface.d.ts +17 -0
- package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +24 -48
- package/dist/engine/vehicle.d.ts +20 -0
- package/dist/engine/world.d.ts +76 -0
- package/dist/index.d.ts +14 -18
- package/dist/index.js +16 -116
- package/dist/physics/index.d.ts +3 -3
- package/dist/physics/index.js +1 -131
- package/dist/physics/nBodyGravity.d.ts +14 -7
- package/dist/physics-ZDFXaCli.js +475 -0
- package/dist/physics-ZDFXaCli.js.map +1 -0
- package/dist/surface-DUol_5ml.js +610 -0
- package/dist/surface-DUol_5ml.js.map +1 -0
- package/dist/toolgun/Toolgun.d.ts +33 -0
- package/dist/toolgun/index.d.ts +2 -0
- package/dist/toolgun/index.js +1 -0
- package/dist/toolgun/store.d.ts +198 -0
- package/dist/toolgun-BfcCIAQx.js +1582 -0
- package/dist/toolgun-BfcCIAQx.js.map +1 -0
- package/dist/vite/index.d.ts +0 -4
- package/dist/vite/index.js +1 -9
- package/dist/vite/index.js.map +1 -1
- package/package.json +32 -89
- package/AGENTS.md +0 -29
- package/CLAUDE.md +0 -8
- package/bin/kolmo.mjs +0 -561
- package/dist/engine/causewayBridge.d.ts +0 -14
- package/dist/engine/causewayBridge.js +0 -166
- package/dist/engine/causewayBridge.js.map +0 -1
- package/dist/engine/islandSettlementMesh.d.ts +0 -26
- package/dist/engine/islandSettlementMesh.js +0 -166
- package/dist/engine/islandSettlementMesh.js.map +0 -1
- package/dist/engine/kolmoActions.d.ts +0 -23
- package/dist/engine/kolmoActions.js +0 -179
- package/dist/engine/kolmoActions.js.map +0 -1
- package/dist/engine/kolmoActor.d.ts +0 -21
- package/dist/engine/kolmoActor.js +0 -273
- package/dist/engine/kolmoActor.js.map +0 -1
- package/dist/engine/kolmoActorHelpers.d.ts +0 -24
- package/dist/engine/kolmoActorHelpers.js +0 -64
- package/dist/engine/kolmoActorHelpers.js.map +0 -1
- package/dist/engine/kolmoBotControl.d.ts +0 -44
- package/dist/engine/kolmoBotControl.js +0 -194
- package/dist/engine/kolmoBotControl.js.map +0 -1
- package/dist/engine/kolmoBotJournal.d.ts +0 -23
- package/dist/engine/kolmoBotJournal.js +0 -138
- package/dist/engine/kolmoBotJournal.js.map +0 -1
- package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
- package/dist/engine/kolmoFloatingOrigin.js +0 -91
- package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
- package/dist/engine/kolmoGame.d.ts +0 -27
- package/dist/engine/kolmoGame.js +0 -83
- package/dist/engine/kolmoGame.js.map +0 -1
- package/dist/engine/kolmoGltfLoader.d.ts +0 -16
- package/dist/engine/kolmoGltfLoader.js +0 -46
- package/dist/engine/kolmoGltfLoader.js.map +0 -1
- package/dist/engine/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -219
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -165
- package/dist/engine/kolmoInput.js.map +0 -1
- package/dist/engine/kolmoIsland.d.ts +0 -14
- package/dist/engine/kolmoIsland.js +0 -243
- package/dist/engine/kolmoIsland.js.map +0 -1
- package/dist/engine/kolmoLongDrive.d.ts +0 -12
- package/dist/engine/kolmoLongDrive.js +0 -178
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -6
- package/dist/engine/kolmoPilotMesh.js +0 -377
- package/dist/engine/kolmoPilotMesh.js.map +0 -1
- package/dist/engine/kolmoProcedural.d.ts +0 -13
- package/dist/engine/kolmoProcedural.js +0 -101
- package/dist/engine/kolmoProcedural.js.map +0 -1
- package/dist/engine/kolmoRigs.d.ts +0 -13
- package/dist/engine/kolmoRigs.js +0 -100
- package/dist/engine/kolmoRigs.js.map +0 -1
- package/dist/engine/kolmoStore.d.ts +0 -3
- package/dist/engine/kolmoStore.js +0 -4
- package/dist/engine/kolmoStore.js.map +0 -1
- package/dist/engine/kolmoSurface.d.ts +0 -18
- package/dist/engine/kolmoSurface.js +0 -198
- package/dist/engine/kolmoSurface.js.map +0 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
- package/dist/engine/kolmoTouchOverlay.js +0 -326
- package/dist/engine/kolmoTouchOverlay.js.map +0 -1
- package/dist/engine/kolmoTouchState.d.ts +0 -50
- package/dist/engine/kolmoTouchState.js +0 -210
- package/dist/engine/kolmoTouchState.js.map +0 -1
- package/dist/engine/kolmoTraits.js +0 -140
- package/dist/engine/kolmoTraits.js.map +0 -1
- package/dist/engine/kolmoVehicle.d.ts +0 -4
- package/dist/engine/kolmoVehicle.js +0 -80
- package/dist/engine/kolmoVehicle.js.map +0 -1
- package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
- package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
- package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
- package/dist/engine/kolmoVehicleConfig.js +0 -84
- package/dist/engine/kolmoVehicleConfig.js.map +0 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
- package/dist/engine/kolmoVehicleDriver.js +0 -147
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -307
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
- package/dist/engine/kolmoWardrobeRig.js +0 -146
- package/dist/engine/kolmoWardrobeRig.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -164
- package/dist/engine/kolmoWorld.js.map +0 -1
- package/dist/engine/longDriveKit.d.ts +0 -19
- package/dist/engine/longDriveKit.js +0 -145
- package/dist/engine/longDriveKit.js.map +0 -1
- package/dist/engine/longDriveRoadside.d.ts +0 -16
- package/dist/engine/longDriveRoadside.js +0 -171
- package/dist/engine/longDriveRoadside.js.map +0 -1
- package/dist/engine/macroCellBuilder.d.ts +0 -44
- package/dist/engine/macroCellBuilder.js +0 -228
- package/dist/engine/macroCellBuilder.js.map +0 -1
- package/dist/engine/mainlandMacroCell.d.ts +0 -15
- package/dist/engine/mainlandMacroCell.js +0 -168
- package/dist/engine/mainlandMacroCell.js.map +0 -1
- package/dist/engine/shiftedFixedBody.d.ts +0 -13
- package/dist/engine/shiftedFixedBody.js +0 -75
- package/dist/engine/shiftedFixedBody.js.map +0 -1
- package/dist/importer/ChopShopPanel.d.ts +0 -52
- package/dist/importer/ChopShopPanel.js +0 -409
- package/dist/importer/ChopShopPanel.js.map +0 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
- package/dist/importer/DomainWorkshopPanel.js +0 -385
- package/dist/importer/DomainWorkshopPanel.js.map +0 -1
- package/dist/importer/GateHudBar.d.ts +0 -39
- package/dist/importer/GateHudBar.js +0 -401
- package/dist/importer/GateHudBar.js.map +0 -1
- package/dist/importer/GlbImportGate.d.ts +0 -8
- package/dist/importer/GlbImportGate.js +0 -300
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -274
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -195
- package/dist/importer/LiveDrivePads.js.map +0 -1
- package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
- package/dist/importer/PaperShellDebrisRig.js +0 -143
- package/dist/importer/PaperShellDebrisRig.js.map +0 -1
- package/dist/importer/R2VaultDrawer.d.ts +0 -12
- package/dist/importer/R2VaultDrawer.js +0 -90
- package/dist/importer/R2VaultDrawer.js.map +0 -1
- package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
- package/dist/importer/Step1CalibrationPlinth.js +0 -204
- package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
- package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
- package/dist/importer/Step1ExplodedIslands.js +0 -144
- package/dist/importer/Step1ExplodedIslands.js.map +0 -1
- package/dist/importer/Step2UniversalPad.d.ts +0 -18
- package/dist/importer/Step2UniversalPad.js +0 -123
- package/dist/importer/Step2UniversalPad.js.map +0 -1
- package/dist/importer/VfxEmitterPool.d.ts +0 -8
- package/dist/importer/VfxEmitterPool.js +0 -64
- package/dist/importer/VfxEmitterPool.js.map +0 -1
- package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
- package/dist/importer/WardrobeWorkshopPanel.js +0 -529
- package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
- package/dist/importer/WheelRingHandles3D.d.ts +0 -11
- package/dist/importer/WheelRingHandles3D.js +0 -319
- package/dist/importer/WheelRingHandles3D.js.map +0 -1
- package/dist/importer/archLinerGeom.d.ts +0 -2
- package/dist/importer/archLinerGeom.js +0 -51
- package/dist/importer/archLinerGeom.js.map +0 -1
- package/dist/importer/chopHingeHelpers.d.ts +0 -15
- package/dist/importer/chopHingeHelpers.js +0 -193
- package/dist/importer/chopHingeHelpers.js.map +0 -1
- package/dist/importer/chopShopActions.d.ts +0 -58
- package/dist/importer/chopShopActions.js +0 -165
- package/dist/importer/chopShopActions.js.map +0 -1
- package/dist/importer/chopShopHandlers.d.ts +0 -26
- package/dist/importer/chopShopHandlers.js +0 -283
- package/dist/importer/chopShopHandlers.js.map +0 -1
- package/dist/importer/chopShopIoActions.d.ts +0 -20
- package/dist/importer/chopShopIoActions.js +0 -192
- package/dist/importer/chopShopIoActions.js.map +0 -1
- package/dist/importer/chopShopMcpAction.d.ts +0 -18
- package/dist/importer/chopShopMcpAction.js +0 -58
- package/dist/importer/chopShopMcpAction.js.map +0 -1
- package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
- package/dist/importer/cylinderBooleanSlice.js +0 -110
- package/dist/importer/cylinderBooleanSlice.js.map +0 -1
- package/dist/importer/cylinderSliceMath.d.ts +0 -14
- package/dist/importer/cylinderSliceMath.js +0 -251
- package/dist/importer/cylinderSliceMath.js.map +0 -1
- package/dist/importer/fusedWheelDetect.d.ts +0 -4
- package/dist/importer/fusedWheelDetect.js +0 -297
- package/dist/importer/fusedWheelDetect.js.map +0 -1
- package/dist/importer/fusedWheelFit.d.ts +0 -19
- package/dist/importer/fusedWheelFit.js +0 -219
- package/dist/importer/fusedWheelFit.js.map +0 -1
- package/dist/importer/gateStore.d.ts +0 -73
- package/dist/importer/gateStore.js +0 -102
- package/dist/importer/gateStore.js.map +0 -1
- package/dist/importer/glbNormalizer.d.ts +0 -22
- package/dist/importer/glbNormalizer.js +0 -177
- package/dist/importer/glbNormalizer.js.map +0 -1
- package/dist/importer/importerWebMcp.d.ts +0 -51
- package/dist/importer/importerWebMcp.js +0 -50
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -368
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -29
- package/dist/importer/index.js +0 -42
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -131
- package/dist/importer/khrCarGeometryMass.js.map +0 -1
- package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
- package/dist/importer/khrCarPlanHelpers.js +0 -300
- package/dist/importer/khrCarPlanHelpers.js.map +0 -1
- package/dist/importer/khrCarPlanner.d.ts +0 -8
- package/dist/importer/khrCarPlanner.js +0 -289
- package/dist/importer/khrCarPlanner.js.map +0 -1
- package/dist/importer/khrCompiler.d.ts +0 -5
- package/dist/importer/khrCompiler.js +0 -87
- package/dist/importer/khrCompiler.js.map +0 -1
- package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
- package/dist/importer/khrCraftPropCompiler.js +0 -263
- package/dist/importer/khrCraftPropCompiler.js.map +0 -1
- package/dist/importer/khrNodeNameGuard.d.ts +0 -20
- package/dist/importer/khrNodeNameGuard.js +0 -139
- package/dist/importer/khrNodeNameGuard.js.map +0 -1
- package/dist/importer/launcherBake.d.ts +0 -15
- package/dist/importer/launcherBake.js +0 -117
- package/dist/importer/launcherBake.js.map +0 -1
- package/dist/importer/launcherCadGeometry.d.ts +0 -22
- package/dist/importer/launcherCadGeometry.js +0 -185
- package/dist/importer/launcherCadGeometry.js.map +0 -1
- package/dist/importer/meshIslands.d.ts +0 -17
- package/dist/importer/meshIslands.js +0 -102
- package/dist/importer/meshIslands.js.map +0 -1
- package/dist/importer/meshSliceBuffers.d.ts +0 -15
- package/dist/importer/meshSliceBuffers.js +0 -159
- package/dist/importer/meshSliceBuffers.js.map +0 -1
- package/dist/importer/polygonEarClipYZ.d.ts +0 -3
- package/dist/importer/polygonEarClipYZ.js +0 -67
- package/dist/importer/polygonEarClipYZ.js.map +0 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
- package/dist/importer/proceduralC12AndCraft.js +0 -302
- package/dist/importer/proceduralC12AndCraft.js.map +0 -1
- package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
- package/dist/importer/proceduralDomainBuilders.js +0 -346
- package/dist/importer/proceduralDomainBuilders.js.map +0 -1
- package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
- package/dist/importer/proceduralPersonAndProp.js +0 -303
- package/dist/importer/proceduralPersonAndProp.js.map +0 -1
- package/dist/importer/sceneSiNormalize.d.ts +0 -19
- package/dist/importer/sceneSiNormalize.js +0 -145
- package/dist/importer/sceneSiNormalize.js.map +0 -1
- package/dist/importer/starterScene.d.ts +0 -5
- package/dist/importer/starterScene.js +0 -139
- package/dist/importer/starterScene.js.map +0 -1
- package/dist/importer/surfaceCutter.d.ts +0 -16
- package/dist/importer/surfaceCutter.js +0 -83
- package/dist/importer/surfaceCutter.js.map +0 -1
- package/dist/importer/surfaceGeodesic.d.ts +0 -7
- package/dist/importer/surfaceGeodesic.js +0 -130
- package/dist/importer/surfaceGeodesic.js.map +0 -1
- package/dist/importer/surfaceLoopRefine.d.ts +0 -6
- package/dist/importer/surfaceLoopRefine.js +0 -171
- package/dist/importer/surfaceLoopRefine.js.map +0 -1
- package/dist/importer/surfacePeel.d.ts +0 -11
- package/dist/importer/surfacePeel.js +0 -119
- package/dist/importer/surfacePeel.js.map +0 -1
- package/dist/importer/surfaceTopology.d.ts +0 -36
- package/dist/importer/surfaceTopology.js +0 -143
- package/dist/importer/surfaceTopology.js.map +0 -1
- package/dist/importer/universalGateBake.d.ts +0 -45
- package/dist/importer/universalGateBake.js +0 -203
- package/dist/importer/universalGateBake.js.map +0 -1
- package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
- package/dist/importer/usdPhysicsSpecs.js +0 -245
- package/dist/importer/usdPhysicsSpecs.js.map +0 -1
- package/dist/importer/usdTextParse.d.ts +0 -12
- package/dist/importer/usdTextParse.js +0 -118
- package/dist/importer/usdTextParse.js.map +0 -1
- package/dist/importer/usdToGlb.d.ts +0 -12
- package/dist/importer/usdToGlb.js +0 -94
- package/dist/importer/usdToGlb.js.map +0 -1
- package/dist/importer/useChopShopController.d.ts +0 -110
- package/dist/importer/useChopShopController.js +0 -219
- package/dist/importer/useChopShopController.js.map +0 -1
- package/dist/importer/useChopShopState.d.ts +0 -103
- package/dist/importer/useChopShopState.js +0 -350
- package/dist/importer/useChopShopState.js.map +0 -1
- package/dist/importer/useWasdKeyRef.d.ts +0 -9
- package/dist/importer/useWasdKeyRef.js +0 -35
- package/dist/importer/useWasdKeyRef.js.map +0 -1
- package/dist/importer/vehiclePartSplit.d.ts +0 -33
- package/dist/importer/vehiclePartSplit.js +0 -183
- package/dist/importer/vehiclePartSplit.js.map +0 -1
- package/dist/importer/wardrobeAutoFit.d.ts +0 -16
- package/dist/importer/wardrobeAutoFit.js +0 -410
- package/dist/importer/wardrobeAutoFit.js.map +0 -1
- package/dist/importer/wardrobeCatalog.d.ts +0 -16
- package/dist/importer/wardrobeCatalog.js +0 -409
- package/dist/importer/wardrobeCatalog.js.map +0 -1
- package/dist/importer/wardrobeController.d.ts +0 -49
- package/dist/importer/wardrobeController.js +0 -181
- package/dist/importer/wardrobeController.js.map +0 -1
- package/dist/importer/wardrobeFitter.d.ts +0 -27
- package/dist/importer/wardrobeFitter.js +0 -269
- package/dist/importer/wardrobeFitter.js.map +0 -1
- package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
- package/dist/importer/wardrobeWebMcpTools.js +0 -198
- package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
- package/dist/importer/wheelAxlePairing.d.ts +0 -21
- package/dist/importer/wheelAxlePairing.js +0 -157
- package/dist/importer/wheelAxlePairing.js.map +0 -1
- package/dist/importer/wheelCutterHelpers.d.ts +0 -45
- package/dist/importer/wheelCutterHelpers.js +0 -208
- package/dist/importer/wheelCutterHelpers.js.map +0 -1
- package/dist/importer/wheelRingHandleMath.d.ts +0 -20
- package/dist/importer/wheelRingHandleMath.js +0 -66
- package/dist/importer/wheelRingHandleMath.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/junk/DestructibleTarget.d.ts +0 -18
- package/dist/junk/DestructibleTarget.js +0 -223
- package/dist/junk/DestructibleTarget.js.map +0 -1
- package/dist/junk/KolmoJunk.d.ts +0 -14
- package/dist/junk/KolmoJunk.js +0 -76
- package/dist/junk/KolmoJunk.js.map +0 -1
- package/dist/junk/ShardPieces.d.ts +0 -13
- package/dist/junk/ShardPieces.js +0 -101
- package/dist/junk/ShardPieces.js.map +0 -1
- package/dist/junk/TargetDecals.d.ts +0 -9
- package/dist/junk/TargetDecals.js +0 -77
- package/dist/junk/TargetDecals.js.map +0 -1
- package/dist/junk/bvhShatter.d.ts +0 -3
- package/dist/junk/bvhShatter.js +0 -101
- package/dist/junk/bvhShatter.js.map +0 -1
- package/dist/junk/bvhTriCollector.d.ts +0 -16
- package/dist/junk/bvhTriCollector.js +0 -127
- package/dist/junk/bvhTriCollector.js.map +0 -1
- package/dist/junk/index.d.ts +0 -14
- package/dist/junk/index.js +0 -13
- package/dist/junk/index.js.map +0 -1
- package/dist/junk/junkGeometry.d.ts +0 -13
- package/dist/junk/junkGeometry.js +0 -87
- package/dist/junk/junkGeometry.js.map +0 -1
- package/dist/junk/junkImportSanitize.d.ts +0 -5
- package/dist/junk/junkImportSanitize.js +0 -74
- package/dist/junk/junkImportSanitize.js.map +0 -1
- package/dist/junk/junkImporter.d.ts +0 -14
- package/dist/junk/junkImporter.js +0 -124
- package/dist/junk/junkImporter.js.map +0 -1
- package/dist/junk/junkLabelCanvas.d.ts +0 -2
- package/dist/junk/junkLabelCanvas.js +0 -185
- package/dist/junk/junkLabelCanvas.js.map +0 -1
- package/dist/junk/junkLabels.d.ts +0 -9
- package/dist/junk/junkLabels.js +0 -49
- package/dist/junk/junkLabels.js.map +0 -1
- package/dist/junk/junkProceduralScenes.d.ts +0 -12
- package/dist/junk/junkProceduralScenes.js +0 -220
- package/dist/junk/junkProceduralScenes.js.map +0 -1
- package/dist/junk/junkSheetSplitter.d.ts +0 -38
- package/dist/junk/junkSheetSplitter.js +0 -104
- package/dist/junk/junkSheetSplitter.js.map +0 -1
- package/dist/junk/junkTypes.d.ts +0 -48
- package/dist/junk/junkTypes.js +0 -0
- package/dist/junk/junkTypes.js.map +0 -1
- package/dist/junk/targetHelpers.d.ts +0 -55
- package/dist/junk/targetHelpers.js +0 -157
- package/dist/junk/targetHelpers.js.map +0 -1
- package/dist/junk/targetHitLogic.d.ts +0 -30
- package/dist/junk/targetHitLogic.js +0 -163
- package/dist/junk/targetHitLogic.js.map +0 -1
- package/dist/junk/useTargetAssets.d.ts +0 -19
- package/dist/junk/useTargetAssets.js +0 -130
- package/dist/junk/useTargetAssets.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/nBodyGravity.js +0 -70
- package/dist/physics/nBodyGravity.js.map +0 -1
- package/dist/sand3d/KolmoSand3D.d.ts +0 -19
- package/dist/sand3d/KolmoSand3D.js +0 -92
- package/dist/sand3d/KolmoSand3D.js.map +0 -1
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
- package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
- package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
- package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
- package/dist/sand3d/gateBakeHelpers.js +0 -225
- package/dist/sand3d/gateBakeHelpers.js.map +0 -1
- package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
- package/dist/sand3d/gateDoorwayBake.js +0 -203
- package/dist/sand3d/gateDoorwayBake.js.map +0 -1
- package/dist/sand3d/index.d.ts +0 -3
- package/dist/sand3d/index.js +0 -4
- package/dist/sand3d/index.js.map +0 -1
- package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
- package/dist/sand3d/sand3dAssetLoader.js +0 -177
- package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
- package/dist/schema/kolmoSchema.d.ts +0 -9
- package/dist/schema/kolmoSchema.js +0 -110
- package/dist/schema/kolmoSchema.js.map +0 -1
- package/dist/schema/kolmoStamp.d.ts +0 -11
- package/dist/schema/kolmoStamp.js +0 -119
- package/dist/schema/kolmoStamp.js.map +0 -1
- package/dist/schema/kolmoTypes.d.ts +0 -63
- package/dist/schema/kolmoTypes.js +0 -66
- package/dist/schema/kolmoTypes.js.map +0 -1
- package/dist/shaders/celestialBackdrop.d.ts +0 -14
- package/dist/shaders/celestialBackdrop.js +0 -181
- package/dist/shaders/celestialBackdrop.js.map +0 -1
- package/dist/shaders/emitterShaders.d.ts +0 -9
- package/dist/shaders/emitterShaders.js +0 -114
- package/dist/shaders/emitterShaders.js.map +0 -1
- package/dist/shaders/index.d.ts +0 -5
- package/dist/shaders/index.js +0 -12
- package/dist/shaders/index.js.map +0 -1
- package/dist/shaders/plumeAndSparkle.d.ts +0 -12
- package/dist/shaders/plumeAndSparkle.js +0 -233
- package/dist/shaders/plumeAndSparkle.js.map +0 -1
- package/dist/shaders/ps2GlslShared.d.ts +0 -20
- package/dist/shaders/ps2GlslShared.js +0 -30
- package/dist/shaders/ps2GlslShared.js.map +0 -1
- package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
- package/dist/shaders/ps2MaterialsTSL.js +0 -146
- package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
- package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
- package/dist/shaders/ps2MaterialsWebGL.js +0 -57
- package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
- package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
- package/dist/shaders/ps2RoadWebGL.js +0 -138
- package/dist/shaders/ps2RoadWebGL.js.map +0 -1
- package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
- package/dist/shaders/ps2TerrainWebGL.js +0 -131
- package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
- package/dist/shaders/ps2Textures.d.ts +0 -22
- package/dist/shaders/ps2Textures.js +0 -299
- package/dist/shaders/ps2Textures.js.map +0 -1
- package/dist/shaders/retroPalettes.d.ts +0 -24
- package/dist/shaders/retroPalettes.js +0 -221
- package/dist/shaders/retroPalettes.js.map +0 -1
- package/dist/shaders/retroShader.d.ts +0 -13
- package/dist/shaders/retroShader.js +0 -110
- package/dist/shaders/retroShader.js.map +0 -1
- package/dist/shaders/retroUniforms.d.ts +0 -60
- package/dist/shaders/retroUniforms.js +0 -215
- package/dist/shaders/retroUniforms.js.map +0 -1
- package/dist/shaders/skyboxShaders.d.ts +0 -16
- package/dist/shaders/skyboxShaders.js +0 -266
- package/dist/shaders/skyboxShaders.js.map +0 -1
- package/dist/shaders/tsl.d.ts +0 -1
- package/dist/shaders/tsl.js +0 -1
- package/dist/shaders/tsl.js.map +0 -1
- package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
- package/dist/suika/KolmoSuikaOrb.js +0 -375
- package/dist/suika/KolmoSuikaOrb.js.map +0 -1
- package/dist/suika/index.d.ts +0 -4
- package/dist/suika/index.js +0 -5
- package/dist/suika/index.js.map +0 -1
- package/dist/suika/suikaArbiter.d.ts +0 -60
- package/dist/suika/suikaArbiter.js +0 -265
- package/dist/suika/suikaArbiter.js.map +0 -1
- package/dist/suika/suikaGeometry.d.ts +0 -10
- package/dist/suika/suikaGeometry.js +0 -251
- package/dist/suika/suikaGeometry.js.map +0 -1
- package/dist/suika/suikaTypes.d.ts +0 -74
- package/dist/suika/suikaTypes.js +0 -196
- package/dist/suika/suikaTypes.js.map +0 -1
- package/dist/world/frontage.d.ts +0 -26
- package/dist/world/frontage.js +0 -36
- package/dist/world/frontage.js.map +0 -1
- package/dist/world/index.d.ts +0 -9
- package/dist/world/index.js +0 -12
- package/dist/world/index.js.map +0 -1
- package/dist/world/infiniteWorld2D.d.ts +0 -19
- package/dist/world/infiniteWorld2D.js +0 -219
- package/dist/world/infiniteWorld2D.js.map +0 -1
- package/dist/world/island.d.ts +0 -29
- package/dist/world/island.js +0 -116
- package/dist/world/island.js.map +0 -1
- package/dist/world/islandPathing.d.ts +0 -6
- package/dist/world/islandPathing.js +0 -166
- package/dist/world/islandPathing.js.map +0 -1
- package/dist/world/macroCellSchema.d.ts +0 -72
- package/dist/world/macroCellSchema.js +0 -34
- package/dist/world/macroCellSchema.js.map +0 -1
- package/dist/world/macroKnightAStar.d.ts +0 -11
- package/dist/world/macroKnightAStar.js +0 -240
- package/dist/world/macroKnightAStar.js.map +0 -1
- package/dist/world/macroSettlementZones.d.ts +0 -9
- package/dist/world/macroSettlementZones.js +0 -108
- package/dist/world/macroSettlementZones.js.map +0 -1
- package/dist/world/random.d.ts +0 -23
- package/dist/world/random.js +0 -59
- package/dist/world/random.js.map +0 -1
- package/dist/world/road.d.ts +0 -37
- package/dist/world/road.js +0 -198
- package/dist/world/road.js.map +0 -1
- package/dist/world/roadRibbon.d.ts +0 -29
- package/dist/world/roadRibbon.js +0 -166
- package/dist/world/roadRibbon.js.map +0 -1
- package/dist/world/terrain.d.ts +0 -62
- package/dist/world/terrain.js +0 -133
- package/dist/world/terrain.js.map +0 -1
- package/dist/world/terrainGeometry.d.ts +0 -14
- package/dist/world/terrainGeometry.js +0 -76
- package/dist/world/terrainGeometry.js.map +0 -1
- package/dist/world/worldTypes.d.ts +0 -43
- package/dist/world/worldTypes.js +0 -197
- package/dist/world/worldTypes.js.map +0 -1
- package/docs/api-reference.md +0 -728
- package/skills/kolmo-engine/SKILL.md +0 -109
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"junkProceduralScenes.js","names":[],"sources":["../../src/junk/junkProceduralScenes.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport {\n BOTTLE_HEIGHT,\n TIN_CAN_HEIGHT,\n TIN_CAN_RADIUS,\n buildGlassBottleGeometry,\n buildTinCanGeometry,\n createGlassBottleMaterial,\n createTinCanMaterials,\n} from \"./junkGeometry.js\";\nimport { getProceduralLabelTexture } from \"./junkLabels.js\";\nimport type { ProceduralLabelId } from \"./junkTypes.js\";\n\nexport type JunkProceduralRecipeId =\n | \"tin_can_cola\"\n | \"tin_can_oil\"\n | \"glass_bottle_amber\"\n | \"glass_bottle_emerald\"\n | \"wooden_supply_crate\"\n | \"hazard_fuel_drum\";\n\nexport interface JunkProceduralRecipe {\n readonly id: JunkProceduralRecipeId;\n readonly label: string;\n readonly domain: \"junk\";\n readonly targetMeters: number;\n readonly massKg: number;\n readonly color: string;\n}\n\nexport const JUNK_PROCEDURAL_RECIPES: readonly JunkProceduralRecipe[] = Object.freeze([\n { id: \"tin_can_cola\", label: \"Tin Can Cola\", domain: \"junk\", targetMeters: 0.25, massKg: 0.42, color: \"#06b6d4\" },\n { id: \"tin_can_oil\", label: \"Tin Can Oil\", domain: \"junk\", targetMeters: 0.28, massKg: 0.68, color: \"#d97706\" },\n { id: \"glass_bottle_amber\", label: \"Glass Bottle Amber\", domain: \"junk\", targetMeters: 0.32, massKg: 0.48, color: \"#f59e0b\" },\n { id: \"glass_bottle_emerald\", label: \"Glass Bottle Emerald\", domain: \"junk\", targetMeters: 0.32, massKg: 0.48, color: \"#10b981\" },\n { id: \"wooden_supply_crate\", label: \"Wooden Supply Crate\", domain: \"junk\", targetMeters: 0.64, massKg: 16, color: \"#b45309\" },\n { id: \"hazard_fuel_drum\", label: \"Hazard Fuel Drum\", domain: \"junk\", targetMeters: 0.88, massKg: 24, color: \"#eab308\" },\n]);\n\nfunction flatMat(color: string, roughness = 0.52, metalness = 0.18): THREE.MeshStandardMaterial {\n return new THREE.MeshStandardMaterial({ color, roughness, metalness, flatShading: true });\n}\n\nfunction addBox(parent: THREE.Object3D, name: string, sx: number, sy: number, sz: number, x: number, y: number, z: number, mat: THREE.Material): THREE.Mesh {\n const mesh = new THREE.Mesh(new THREE.BoxGeometry(sx, sy, sz), mat);\n mesh.name = name;\n mesh.position.set(x, y, z);\n parent.add(mesh);\n return mesh;\n}\n\nfunction buildCanVariant(id: \"tin_can_cola\" | \"tin_can_oil\", labelId: ProceduralLabelId, accentHex: string): THREE.Group {\n const group = new THREE.Group();\n group.name = id;\n const tex = getProceduralLabelTexture(labelId);\n const mats = createTinCanMaterials(tex);\n for (const m of mats) m.flatShading = true;\n if (!tex) mats[0].color.set(accentHex);\n\n const body = new THREE.Mesh(buildTinCanGeometry(\"12-gon\"), mats);\n body.name = \"CanBody\";\n body.position.y = TIN_CAN_HEIGHT * 0.5 + 0.004;\n group.add(body);\n\n const rimMat = flatMat(\"#cbd5e1\", 0.32, 0.78);\n for (const [nm, ry] of [[\"ChimeBottom\", 0.006], [\"ChimeTop\", TIN_CAN_HEIGHT + 0.004]] as const) {\n const ring = new THREE.Mesh(new THREE.TorusGeometry(TIN_CAN_RADIUS + 0.002, 0.005, 6, 12), rimMat);\n ring.name = nm;\n ring.rotation.x = Math.PI * 0.5;\n ring.position.y = ry;\n group.add(ring);\n }\n\n if (id === \"tin_can_cola\") {\n addBox(group, \"PullTab\", 0.024, 0.004, 0.038, 0, TIN_CAN_HEIGHT + 0.008, 0.014, rimMat);\n } else {\n const spout = new THREE.Mesh(new THREE.CylinderGeometry(0.014, 0.018, 0.028, 8), flatMat(\"#f59e0b\", 0.4, 0.3));\n spout.name = \"OilSpout\";\n spout.position.set(0.038, TIN_CAN_HEIGHT + 0.018, 0);\n group.add(spout);\n addBox(group, \"CarryHandle\", 0.07, 0.012, 0.014, -0.015, TIN_CAN_HEIGHT + 0.016, 0, rimMat);\n }\n return group;\n}\n\nfunction buildBottleVariant(id: \"glass_bottle_amber\" | \"glass_bottle_emerald\", labelId: ProceduralLabelId): THREE.Group {\n const group = new THREE.Group();\n group.name = id;\n const glassMat = createGlassBottleMaterial();\n glassMat.flatShading = true;\n if (id === \"glass_bottle_amber\") {\n glassMat.color.set(\"#d97706\");\n glassMat.opacity = 0.54;\n }\n\n const body = new THREE.Mesh(buildGlassBottleGeometry(), glassMat);\n body.name = \"BottleGlass\";\n body.position.y = BOTTLE_HEIGHT * 0.5;\n group.add(body);\n\n const tex = getProceduralLabelTexture(labelId);\n const bandMat = new THREE.MeshStandardMaterial({\n color: tex ? \"#ffffff\" : id === \"glass_bottle_amber\" ? \"#fef3c7\" : \"#ecfccb\",\n map: tex ?? null,\n roughness: 0.6,\n metalness: 0.06,\n flatShading: true,\n });\n const labelBand = new THREE.Mesh(new THREE.CylinderGeometry(0.0565, 0.0565, 0.095, 12, 1, true), bandMat);\n labelBand.name = \"BottleLabel\";\n labelBand.position.y = 0.115;\n group.add(labelBand);\n\n const capMat = flatMat(id === \"glass_bottle_amber\" ? \"#fbbf24\" : \"#a16207\", 0.42, id === \"glass_bottle_amber\" ? 0.68 : 0.12);\n const cap = new THREE.Mesh(new THREE.CylinderGeometry(0.025, 0.026, 0.022, 10), capMat);\n cap.name = \"BottleCap\";\n cap.position.y = BOTTLE_HEIGHT + 0.008;\n group.add(cap);\n return group;\n}\n\nfunction buildWoodenSupplyCrate(): THREE.Group {\n const group = new THREE.Group();\n group.name = \"wooden_supply_crate\";\n const S = 0.64, half = S * 0.5, post = 0.055;\n const plankMat = flatMat(\"#b45309\", 0.78, 0.06);\n const frameMat = flatMat(\"#92400e\", 0.82, 0.08);\n const ironMat = flatMat(\"#3f3f46\", 0.46, 0.62);\n\n addBox(group, \"CrateCore\", S - 0.06, S - 0.06, S - 0.06, 0, half, 0, plankMat);\n for (const sx of [-1, 1] as const) {\n for (const sz of [-1, 1] as const) {\n const o = half - post * 0.5;\n addBox(group, `CornerPost_${sx > 0 ? \"R\" : \"L\"}_${sz > 0 ? \"F\" : \"B\"}`, post, S, post, sx * o, half, sz * o, frameMat);\n addBox(group, `CornerBracket_${sx > 0 ? \"R\" : \"L\"}_${sz > 0 ? \"F\" : \"B\"}`, post + 0.01, 0.05, post + 0.01, sx * o, S - 0.025, sz * o, ironMat);\n }\n }\n for (let i = 0; i < 3; i++) {\n const y = 0.14 + i * 0.18;\n addBox(group, `SlatFront_${i}`, S - post * 1.6, 0.09, 0.024, 0, y, half - 0.012, frameMat);\n addBox(group, `SlatBack_${i}`, S - post * 1.6, 0.09, 0.024, 0, y, -(half - 0.012), frameMat);\n addBox(group, `SlatLeft_${i}`, 0.024, 0.09, S - post * 1.6, -(half - 0.012), y, 0, frameMat);\n addBox(group, `SlatRight_${i}`, 0.024, 0.09, S - post * 1.6, half - 0.012, y, 0, frameMat);\n }\n for (const [nm, z] of [[\"BraceFront\", half - 0.008], [\"BraceBack\", -(half - 0.008)]] as const) {\n const brace = addBox(group, nm, S * 0.92, 0.055, 0.02, 0, half, z, frameMat);\n brace.rotation.z = Math.PI * 0.25;\n }\n return group;\n}\n\nfunction buildHazardFuelDrum(): THREE.Group {\n const group = new THREE.Group();\n group.name = \"hazard_fuel_drum\";\n const H = 0.88, R = 0.285;\n const shellMat = flatMat(\"#dc2626\", 0.46, 0.42);\n const bandMat = flatMat(\"#facc15\", 0.48, 0.25);\n const steelMat = flatMat(\"#94a3b8\", 0.35, 0.72);\n\n const drum = new THREE.Mesh(new THREE.CylinderGeometry(R, R, H - 0.02, 12), shellMat);\n drum.name = \"DrumShell\";\n drum.position.y = H * 0.5;\n group.add(drum);\n\n const stripe = new THREE.Mesh(new THREE.CylinderGeometry(R + 0.003, R + 0.003, 0.22, 12), bandMat);\n stripe.name = \"HazardBand\";\n stripe.position.y = H * 0.5;\n group.add(stripe);\n\n for (const [idx, cy] of [[0, 0.018], [1, H * 0.33], [2, H * 0.67], [3, H - 0.018]] as const) {\n const chime = new THREE.Mesh(new THREE.TorusGeometry(R + 0.008, 0.014, 6, 12), steelMat);\n chime.name = `DrumChime_${idx}`;\n chime.rotation.x = Math.PI * 0.5;\n chime.position.y = cy;\n group.add(chime);\n }\n\n const bungMain = new THREE.Mesh(new THREE.CylinderGeometry(0.032, 0.032, 0.024, 8), steelMat);\n bungMain.name = \"BungFill\";\n bungMain.position.set(0.13, H, 0.05);\n const bungVent = new THREE.Mesh(new THREE.CylinderGeometry(0.018, 0.018, 0.02, 8), steelMat);\n bungVent.name = \"BungVent\";\n bungVent.position.set(-0.12, H, -0.06);\n group.add(bungMain, bungVent);\n return group;\n}\n\nexport function buildProceduralJunkScene(\n recipeOrId: JunkProceduralRecipeId | JunkProceduralRecipe | string = \"hazard_fuel_drum\",\n): THREE.Group {\n const id = typeof recipeOrId === \"string\" ? recipeOrId : recipeOrId.id;\n let scene: THREE.Group;\n switch (id) {\n case \"tin_can_cola\":\n scene = buildCanVariant(\"tin_can_cola\", \"tris-soda\", \"#06b6d4\");\n break;\n case \"tin_can_oil\":\n scene = buildCanVariant(\"tin_can_oil\", \"garys-beans\", \"#d97706\");\n break;\n case \"glass_bottle_amber\":\n scene = buildBottleVariant(\"glass_bottle_amber\", \"target\");\n break;\n case \"glass_bottle_emerald\":\n scene = buildBottleVariant(\"glass_bottle_emerald\", \"goofy-emoji\");\n break;\n case \"wooden_supply_crate\":\n scene = buildWoodenSupplyCrate();\n break;\n default:\n scene = buildHazardFuelDrum();\n break;\n }\n scene.userData.proceduralDomain = \"junk\";\n scene.userData.proceduralRecipeId = scene.name;\n return scene;\n}\n"],"mappings":";;;;AA8BA,IAAa,0BAA2D,OAAO,OAAO;CAClF;EAAE,IAAI;EAAgB,OAAO;EAAgB,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAM,OAAO;CAAU;CAChH;EAAE,IAAI;EAAe,OAAO;EAAe,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAM,OAAO;CAAU;CAC9G;EAAE,IAAI;EAAsB,OAAO;EAAsB,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAM,OAAO;CAAU;CAC5H;EAAE,IAAI;EAAwB,OAAO;EAAwB,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAM,OAAO;CAAU;CAChI;EAAE,IAAI;EAAuB,OAAO;EAAuB,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAI,OAAO;CAAU;CAC5H;EAAE,IAAI;EAAoB,OAAO;EAAoB,QAAQ;EAAQ,cAAc;EAAM,QAAQ;EAAI,OAAO;CAAU;AAC1H,CAAC;AAED,SAAS,QAAQ,OAAe,YAAY,KAAM,YAAY,KAAkC;CAC5F,OAAO,IAAI,MAAM,qBAAqB;EAAE;EAAO;EAAW;EAAW,aAAa;CAAK,CAAC;AAC5F;AAEA,SAAS,OAAO,QAAwB,MAAc,IAAY,IAAY,IAAY,GAAW,GAAW,GAAW,KAAiC;CACxJ,MAAM,OAAO,IAAI,MAAM,KAAK,IAAI,MAAM,YAAY,IAAI,IAAI,EAAE,GAAG,GAAG;CAClE,KAAK,OAAO;CACZ,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC;CACzB,OAAO,IAAI,IAAI;CACf,OAAO;AACX;AAEA,SAAS,gBAAgB,IAAoC,SAA4B,WAAgC;CACrH,MAAM,QAAQ,IAAI,MAAM,MAAM;CAC9B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;GAC9D;EACJ,KAAK;GACD,QAAQ,gBAAgB,eAAe,eAAe,SAAS;GAC/D;EACJ,KAAK;GACD,QAAQ,mBAAmB,sBAAsB,QAAQ;GACzD;EACJ,KAAK;GACD,QAAQ,mBAAmB,wBAAwB,aAAa;GAChE;EACJ,KAAK;GACD,QAAQ,uBAAuB;GAC/B;EACJ,SACI,QAAQ,oBAAoB;CAEpC;CACA,MAAM,SAAS,mBAAmB;CAClC,MAAM,SAAS,qBAAqB,MAAM;CAC1C,OAAO;AACX"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
/** Bulk SI material densities (kg / m^3) for celestial and structural junk substrates. */
|
|
3
|
-
export declare const SUBSTRATE_DENSITY_KG_M3: Readonly<{
|
|
4
|
-
readonly silicateRock: 2700;
|
|
5
|
-
readonly waterIce: 917;
|
|
6
|
-
readonly ironNickel: 7800;
|
|
7
|
-
readonly aluminumAlloy: 2710;
|
|
8
|
-
}>;
|
|
9
|
-
export interface SplitJunkIsland {
|
|
10
|
-
readonly index: number;
|
|
11
|
-
readonly geometry: THREE.BufferGeometry;
|
|
12
|
-
readonly material: THREE.Material;
|
|
13
|
-
/** Original centroid offset in the parent sheet scene (meters). */
|
|
14
|
-
readonly sheetOffset: readonly [number, number, number];
|
|
15
|
-
/** Axis-aligned size of the centered island geometry (meters). */
|
|
16
|
-
readonly sizeMeters: readonly [number, number, number];
|
|
17
|
-
/** Bounding sphere radius around local origin (meters). */
|
|
18
|
-
readonly boundingRadiusM: number;
|
|
19
|
-
/** Signed closed-mesh volume (or 0.52 * AABB fallback for open shells) in m^3. */
|
|
20
|
-
readonly volumeM3: number;
|
|
21
|
-
/** Physical mass m = density * volume (kg). */
|
|
22
|
-
readonly massKg: number;
|
|
23
|
-
/** Standard gravitational parameter mu = G * m (m^3 / s^2). */
|
|
24
|
-
readonly mu: number;
|
|
25
|
-
/** Deduplicated local vertex positions for Rapier `ConvexHullCollider`. */
|
|
26
|
-
readonly hullVertices: Float32Array;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Splits a multi-part sheet `.glb` scene (such as `asteroid_shrapnel.glb`) into independent,
|
|
30
|
-
* origin-centered physical `KolmoJunk` islands with exact SI volume, mass, convex-hull
|
|
31
|
-
* vertices, and self-gravity `mu`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function splitSheetSceneIntoJunkIslands(root: THREE.Object3D, options?: {
|
|
34
|
-
readonly densityKgPerM3?: number;
|
|
35
|
-
readonly scaleMultiplier?: number;
|
|
36
|
-
readonly minTriangles?: number;
|
|
37
|
-
readonly gravitationalConstant?: number;
|
|
38
|
-
}): SplitJunkIsland[];
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { extractMeshIslands } from "../importer/meshIslands.js";
|
|
2
|
-
import "../physics/nBodyGravity.js";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
// src/junk/junkSheetSplitter.ts
|
|
5
|
-
/** Bulk SI material densities (kg / m^3) for celestial and structural junk substrates. */
|
|
6
|
-
var SUBSTRATE_DENSITY_KG_M3 = Object.freeze({
|
|
7
|
-
silicateRock: 2700,
|
|
8
|
-
waterIce: 917,
|
|
9
|
-
ironNickel: 7800,
|
|
10
|
-
aluminumAlloy: 2710
|
|
11
|
-
});
|
|
12
|
-
function computeSignedGeometryVolume(geo) {
|
|
13
|
-
const pos = geo.getAttribute("position");
|
|
14
|
-
if (!pos || pos.count < 3) return 0;
|
|
15
|
-
const idx = geo.getIndex();
|
|
16
|
-
const triCount = idx ? Math.floor(idx.count / 3) : Math.floor(pos.count / 3);
|
|
17
|
-
let vol6 = 0;
|
|
18
|
-
for (let t = 0; t < triCount; t++) {
|
|
19
|
-
const i0 = idx ? idx.getX(t * 3) : t * 3;
|
|
20
|
-
const i1 = idx ? idx.getX(t * 3 + 1) : t * 3 + 1;
|
|
21
|
-
const i2 = idx ? idx.getX(t * 3 + 2) : t * 3 + 2;
|
|
22
|
-
const ax = pos.getX(i0), ay = pos.getY(i0), az = pos.getZ(i0);
|
|
23
|
-
const bx = pos.getX(i1), by = pos.getY(i1), bz = pos.getZ(i1);
|
|
24
|
-
const cx = pos.getX(i2), cy = pos.getY(i2), cz = pos.getZ(i2);
|
|
25
|
-
vol6 += ax * (by * cz - bz * cy) + ay * (bz * cx - bx * cz) + az * (bx * cy - by * cx);
|
|
26
|
-
}
|
|
27
|
-
return Math.abs(vol6) / 6;
|
|
28
|
-
}
|
|
29
|
-
function sampleHullVertices(geo, maxVerts = 96) {
|
|
30
|
-
const pos = geo.getAttribute("position");
|
|
31
|
-
if (!pos || pos.count === 0) return /* @__PURE__ */ new Float32Array(0);
|
|
32
|
-
const step = Math.max(1, Math.ceil(pos.count / maxVerts));
|
|
33
|
-
const out = [];
|
|
34
|
-
for (let i = 0; i < pos.count; i += step) out.push(pos.getX(i), pos.getY(i), pos.getZ(i));
|
|
35
|
-
return new Float32Array(out);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Splits a multi-part sheet `.glb` scene (such as `asteroid_shrapnel.glb`) into independent,
|
|
39
|
-
* origin-centered physical `KolmoJunk` islands with exact SI volume, mass, convex-hull
|
|
40
|
-
* vertices, and self-gravity `mu`.
|
|
41
|
-
*/
|
|
42
|
-
function splitSheetSceneIntoJunkIslands(root, options) {
|
|
43
|
-
const density = Math.max(1, options?.densityKgPerM3 ?? SUBSTRATE_DENSITY_KG_M3.silicateRock);
|
|
44
|
-
const scaleMult = Math.max(1e-4, options?.scaleMultiplier ?? 1);
|
|
45
|
-
const minTris = Math.max(4, options?.minTriangles ?? 8);
|
|
46
|
-
const gConst = options?.gravitationalConstant ?? 66743e-15;
|
|
47
|
-
let firstMat = null;
|
|
48
|
-
root.traverse((obj) => {
|
|
49
|
-
if (firstMat) return;
|
|
50
|
-
const m = obj;
|
|
51
|
-
if (m.isMesh && m.material) firstMat = Array.isArray(m.material) ? m.material[0] : m.material;
|
|
52
|
-
});
|
|
53
|
-
const baseMaterial = firstMat ?? new THREE.MeshStandardMaterial({
|
|
54
|
-
color: "#8b95a5",
|
|
55
|
-
roughness: .86,
|
|
56
|
-
flatShading: true
|
|
57
|
-
});
|
|
58
|
-
const rawIslands = extractMeshIslands(root);
|
|
59
|
-
const results = [];
|
|
60
|
-
for (const isl of rawIslands) {
|
|
61
|
-
if (isl.triangleIndices.length < minTris) {
|
|
62
|
-
isl.geometry.dispose();
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const geo = isl.geometry;
|
|
66
|
-
if (scaleMult !== 1) geo.scale(scaleMult, scaleMult, scaleMult);
|
|
67
|
-
geo.computeBoundingBox();
|
|
68
|
-
const box = geo.boundingBox;
|
|
69
|
-
const center = box.getCenter(new THREE.Vector3());
|
|
70
|
-
const size = box.getSize(new THREE.Vector3());
|
|
71
|
-
geo.translate(-center.x, -center.y, -center.z);
|
|
72
|
-
geo.computeVertexNormals();
|
|
73
|
-
geo.computeBoundingSphere();
|
|
74
|
-
const signedVol = computeSignedGeometryVolume(geo);
|
|
75
|
-
const aabbVol = Math.max(1e-6, size.x * size.y * size.z * .52);
|
|
76
|
-
const volumeM3 = signedVol > aabbVol * .05 ? signedVol : aabbVol;
|
|
77
|
-
const massKg = volumeM3 * density;
|
|
78
|
-
const boundingRadiusM = geo.boundingSphere?.radius ?? Math.hypot(size.x, size.y, size.z) * .5;
|
|
79
|
-
results.push({
|
|
80
|
-
index: results.length,
|
|
81
|
-
geometry: geo,
|
|
82
|
-
material: baseMaterial.clone(),
|
|
83
|
-
sheetOffset: [
|
|
84
|
-
center.x,
|
|
85
|
-
center.y,
|
|
86
|
-
center.z
|
|
87
|
-
],
|
|
88
|
-
sizeMeters: [
|
|
89
|
-
size.x,
|
|
90
|
-
size.y,
|
|
91
|
-
size.z
|
|
92
|
-
],
|
|
93
|
-
boundingRadiusM,
|
|
94
|
-
volumeM3,
|
|
95
|
-
massKg,
|
|
96
|
-
mu: massKg * gConst,
|
|
97
|
-
hullVertices: sampleHullVertices(geo, 96)
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return results;
|
|
101
|
-
}
|
|
102
|
-
export { SUBSTRATE_DENSITY_KG_M3, splitSheetSceneIntoJunkIslands };
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=junkSheetSplitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"junkSheetSplitter.js","names":[],"sources":["../../src/junk/junkSheetSplitter.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { extractMeshIslands } from \"../importer/meshIslands.js\";\nimport { G_SI } from \"../physics/nBodyGravity.js\";\n\n/** Bulk SI material densities (kg / m^3) for celestial and structural junk substrates. */\nexport const SUBSTRATE_DENSITY_KG_M3 = Object.freeze({\n silicateRock: 2700,\n waterIce: 917,\n ironNickel: 7800,\n aluminumAlloy: 2710,\n} as const);\n\nexport interface SplitJunkIsland {\n readonly index: number;\n readonly geometry: THREE.BufferGeometry;\n readonly material: THREE.Material;\n /** Original centroid offset in the parent sheet scene (meters). */\n readonly sheetOffset: readonly [number, number, number];\n /** Axis-aligned size of the centered island geometry (meters). */\n readonly sizeMeters: readonly [number, number, number];\n /** Bounding sphere radius around local origin (meters). */\n readonly boundingRadiusM: number;\n /** Signed closed-mesh volume (or 0.52 * AABB fallback for open shells) in m^3. */\n readonly volumeM3: number;\n /** Physical mass m = density * volume (kg). */\n readonly massKg: number;\n /** Standard gravitational parameter mu = G * m (m^3 / s^2). */\n readonly mu: number;\n /** Deduplicated local vertex positions for Rapier `ConvexHullCollider`. */\n readonly hullVertices: Float32Array;\n}\n\nfunction computeSignedGeometryVolume(geo: THREE.BufferGeometry): number {\n const pos = geo.getAttribute(\"position\");\n if (!pos || pos.count < 3) return 0;\n const idx = geo.getIndex();\n const triCount = idx ? Math.floor(idx.count / 3) : Math.floor(pos.count / 3);\n let vol6 = 0;\n for (let t = 0; t < triCount; t++) {\n const i0 = idx ? idx.getX(t * 3) : t * 3;\n const i1 = idx ? idx.getX(t * 3 + 1) : t * 3 + 1;\n const i2 = idx ? idx.getX(t * 3 + 2) : t * 3 + 2;\n const ax = pos.getX(i0), ay = pos.getY(i0), az = pos.getZ(i0);\n const bx = pos.getX(i1), by = pos.getY(i1), bz = pos.getZ(i1);\n const cx = pos.getX(i2), cy = pos.getY(i2), cz = pos.getZ(i2);\n vol6 += ax * (by * cz - bz * cy) + ay * (bz * cx - bx * cz) + az * (bx * cy - by * cx);\n }\n return Math.abs(vol6) / 6;\n}\n\nfunction sampleHullVertices(geo: THREE.BufferGeometry, maxVerts = 96): Float32Array {\n const pos = geo.getAttribute(\"position\");\n if (!pos || pos.count === 0) return new Float32Array(0);\n const step = Math.max(1, Math.ceil(pos.count / maxVerts));\n const out: number[] = [];\n for (let i = 0; i < pos.count; i += step) {\n out.push(pos.getX(i), pos.getY(i), pos.getZ(i));\n }\n return new Float32Array(out);\n}\n\n/**\n * Splits a multi-part sheet `.glb` scene (such as `asteroid_shrapnel.glb`) into independent,\n * origin-centered physical `KolmoJunk` islands with exact SI volume, mass, convex-hull\n * vertices, and self-gravity `mu`.\n */\nexport function splitSheetSceneIntoJunkIslands(\n root: THREE.Object3D,\n options?: {\n readonly densityKgPerM3?: number;\n readonly scaleMultiplier?: number;\n readonly minTriangles?: number;\n readonly gravitationalConstant?: number;\n },\n): SplitJunkIsland[] {\n const density = Math.max(1, options?.densityKgPerM3 ?? SUBSTRATE_DENSITY_KG_M3.silicateRock);\n const scaleMult = Math.max(1e-4, options?.scaleMultiplier ?? 1);\n const minTris = Math.max(4, options?.minTriangles ?? 8);\n const gConst = options?.gravitationalConstant ?? G_SI;\n\n let firstMat: THREE.Material | null = null;\n root.traverse((obj) => {\n if (firstMat) return;\n const m = obj as THREE.Mesh;\n if (m.isMesh && m.material) {\n firstMat = Array.isArray(m.material) ? m.material[0] : m.material;\n }\n });\n const baseMaterial = firstMat ?? new THREE.MeshStandardMaterial({ color: \"#8b95a5\", roughness: 0.86, flatShading: true });\n\n const rawIslands = extractMeshIslands(root);\n const results: SplitJunkIsland[] = [];\n for (const isl of rawIslands) {\n if (isl.triangleIndices.length < minTris) {\n isl.geometry.dispose();\n continue;\n }\n const geo = isl.geometry;\n if (scaleMult !== 1) geo.scale(scaleMult, scaleMult, scaleMult);\n geo.computeBoundingBox();\n const box = geo.boundingBox!;\n const center = box.getCenter(new THREE.Vector3());\n const size = box.getSize(new THREE.Vector3());\n geo.translate(-center.x, -center.y, -center.z);\n geo.computeVertexNormals();\n geo.computeBoundingSphere();\n\n const signedVol = computeSignedGeometryVolume(geo);\n const aabbVol = Math.max(1e-6, size.x * size.y * size.z * 0.52);\n const volumeM3 = signedVol > aabbVol * 0.05 ? signedVol : aabbVol;\n const massKg = volumeM3 * density;\n const boundingRadiusM = geo.boundingSphere?.radius ?? Math.hypot(size.x, size.y, size.z) * 0.5;\n\n results.push({\n index: results.length,\n geometry: geo,\n material: baseMaterial.clone(),\n sheetOffset: [center.x, center.y, center.z],\n sizeMeters: [size.x, size.y, size.z],\n boundingRadiusM,\n volumeM3,\n massKg,\n mu: massKg * gConst,\n hullVertices: sampleHullVertices(geo, 96),\n });\n }\n return results;\n}\n"],"mappings":";;;;;AAKA,IAAa,0BAA0B,OAAO,OAAO;CACjD,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;AACnB,CAAU;AAsBV,SAAS,4BAA4B,KAAmC;CACpE,MAAM,MAAM,IAAI,aAAa,UAAU;CACvC,IAAI,CAAC,OAAO,IAAI,QAAQ,GAAG,OAAO;CAClC,MAAM,MAAM,IAAI,SAAS;CACzB,MAAM,WAAW,MAAM,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC;CAC3E,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,KAAK;EAC/B,MAAM,KAAK,MAAM,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI;EACvC,MAAM,KAAK,MAAM,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,IAAI,I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;GACA,IAAI,SAAS;GACb,cAAc,mBAAmB,KAAK,EAAE;EAC5C,CAAC;CACL;CACA,OAAO;AACX"}
|
package/dist/junk/junkTypes.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type * as THREE from "three";
|
|
2
|
-
export type JunkKind = "tin-can" | "glass-bottle" | "imported-glb";
|
|
3
|
-
export type CanLodMode = "auto" | "3-gon" | "12-gon";
|
|
4
|
-
export type ProceduralLabelId = "target" | "goofy-emoji" | "tris-soda" | "garys-beans" | "custom";
|
|
5
|
-
export interface DecalRecord {
|
|
6
|
-
id: string;
|
|
7
|
-
/** Position in target mesh local space. */
|
|
8
|
-
position: [number, number, number];
|
|
9
|
-
/** Euler XYZ rotation aligned to surface normal in target mesh local space. */
|
|
10
|
-
rotation: [number, number, number];
|
|
11
|
-
scale: number;
|
|
12
|
-
}
|
|
13
|
-
export interface ShardSpec {
|
|
14
|
-
id: string;
|
|
15
|
-
geometry: THREE.BufferGeometry;
|
|
16
|
-
centroid: [number, number, number];
|
|
17
|
-
halfExtents: [number, number, number];
|
|
18
|
-
volumeFraction: number;
|
|
19
|
-
}
|
|
20
|
-
export interface ImportedJunkSegment {
|
|
21
|
-
segmentId: string;
|
|
22
|
-
originalName: string;
|
|
23
|
-
customName: string;
|
|
24
|
-
destructible: boolean;
|
|
25
|
-
triCount: number;
|
|
26
|
-
bboxSizeM: [number, number, number];
|
|
27
|
-
}
|
|
28
|
-
export interface DestructibleTargetSpec {
|
|
29
|
-
id: string;
|
|
30
|
-
kind: JunkKind;
|
|
31
|
-
labelId: ProceduralLabelId;
|
|
32
|
-
customAlbedoUrl: string | null;
|
|
33
|
-
canLodMode: CanLodMode;
|
|
34
|
-
position: [number, number, number];
|
|
35
|
-
hp: number;
|
|
36
|
-
maxHp: number;
|
|
37
|
-
fragile: boolean;
|
|
38
|
-
shatterPieceCount: number;
|
|
39
|
-
importedUrl?: string | null;
|
|
40
|
-
segments?: ImportedJunkSegment[];
|
|
41
|
-
}
|
|
42
|
-
export interface BallisticHitEvent {
|
|
43
|
-
targetId: string;
|
|
44
|
-
point: [number, number, number];
|
|
45
|
-
normal: [number, number, number];
|
|
46
|
-
impulse: [number, number, number];
|
|
47
|
-
distance: number;
|
|
48
|
-
}
|
package/dist/junk/junkTypes.js
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"junkTypes.js","sources":["../../src/junk/junkTypes.ts"],"mappings":""}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { type ResolvedCanLod } from "./junkGeometry.js";
|
|
3
|
-
import type { BallisticHitEvent, CanLodMode, JunkKind, ProceduralLabelId, ShardSpec } from "./junkTypes.js";
|
|
4
|
-
export declare const SHARD_COLLIDER_INSET = 0.65;
|
|
5
|
-
export declare function getTargetDensity(kind: JunkKind): number;
|
|
6
|
-
export interface SpawnedShardState {
|
|
7
|
-
spec: ShardSpec;
|
|
8
|
-
worldPos: [number, number, number];
|
|
9
|
-
worldQuat: [number, number, number, number];
|
|
10
|
-
impulse: [number, number, number];
|
|
11
|
-
torque: [number, number, number];
|
|
12
|
-
linvel: [number, number, number];
|
|
13
|
-
angvel: [number, number, number];
|
|
14
|
-
density: number;
|
|
15
|
-
}
|
|
16
|
-
export interface DestructibleTargetSnapshot {
|
|
17
|
-
id: string;
|
|
18
|
-
kind: JunkKind;
|
|
19
|
-
lodMode: CanLodMode;
|
|
20
|
-
activeLod: ResolvedCanLod;
|
|
21
|
-
triCount: number;
|
|
22
|
-
labelId: ProceduralLabelId;
|
|
23
|
-
customLabelLoaded: boolean;
|
|
24
|
-
materialTransparent: boolean;
|
|
25
|
-
opacity: number;
|
|
26
|
-
hp: number;
|
|
27
|
-
maxHp: number;
|
|
28
|
-
alive: boolean;
|
|
29
|
-
decalCount: number;
|
|
30
|
-
activeShardCount: number;
|
|
31
|
-
position: [number, number, number];
|
|
32
|
-
linearVelocity: [number, number, number];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Computes target-mesh local-space position & Euler XYZ rotation for a `<Decal>`.
|
|
36
|
-
*/
|
|
37
|
-
export declare function computeLocalDecalTransform(mesh: THREE.Mesh, worldPoint: [number, number, number], worldNormal: [number, number, number]): {
|
|
38
|
-
position: [number, number, number];
|
|
39
|
-
rotation: [number, number, number];
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Finds the nearest non-decal Mesh inside an Object3D to a world-space hit point.
|
|
43
|
-
*/
|
|
44
|
-
export declare function findClosestMeshInGroup(root: THREE.Object3D, worldPoint: [number, number, number]): THREE.Mesh | null;
|
|
45
|
-
/**
|
|
46
|
-
* Splits a target Object3D into BVH shards and computes world poses + impulses.
|
|
47
|
-
*/
|
|
48
|
-
export declare function buildShardStates(rootObj: THREE.Object3D, targetPieces: number, worldPos: THREE.Vector3, worldQuat: THREE.Quaternion, hit: BallisticHitEvent, kind?: JunkKind): {
|
|
49
|
-
states: SpawnedShardState[];
|
|
50
|
-
specs: ShardSpec[];
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Creates a DoubleSide material for tumbling shatter shards matching target kind.
|
|
54
|
-
*/
|
|
55
|
-
export declare function createShardMaterial(kind: JunkKind, labelTexture: THREE.Texture | null, importedRoot?: THREE.Object3D | null): THREE.Material;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { splitObjectIntoShards } from "./bvhShatter.js";
|
|
2
|
-
import { createGlassBottleMaterial } from "./junkGeometry.js";
|
|
3
|
-
import { isMeshNode } from "./junkImportSanitize.js";
|
|
4
|
-
import * as THREE from "three";
|
|
5
|
-
// src/junk/targetHelpers.ts
|
|
6
|
-
var SHARD_COLLIDER_INSET = .65;
|
|
7
|
-
function getTargetDensity(kind) {
|
|
8
|
-
return kind === "glass-bottle" ? 1200 : kind === "imported-glb" ? 800 : 220;
|
|
9
|
-
}
|
|
10
|
-
var _pt = new THREE.Vector3();
|
|
11
|
-
var _norm = new THREE.Vector3();
|
|
12
|
-
var _zAxis = new THREE.Vector3(0, 0, 1);
|
|
13
|
-
var _q = new THREE.Quaternion();
|
|
14
|
-
var _euler = new THREE.Euler();
|
|
15
|
-
var _invWorld = new THREE.Matrix4();
|
|
16
|
-
var _normMat = new THREE.Matrix3();
|
|
17
|
-
var _box = new THREE.Box3();
|
|
18
|
-
/**
|
|
19
|
-
* Computes target-mesh local-space position & Euler XYZ rotation for a `<Decal>`.
|
|
20
|
-
*/
|
|
21
|
-
function computeLocalDecalTransform(mesh, worldPoint, worldNormal) {
|
|
22
|
-
mesh.updateMatrixWorld(true);
|
|
23
|
-
_pt.set(worldPoint[0], worldPoint[1], worldPoint[2]);
|
|
24
|
-
mesh.worldToLocal(_pt);
|
|
25
|
-
_invWorld.copy(mesh.matrixWorld).invert();
|
|
26
|
-
_normMat.getNormalMatrix(_invWorld);
|
|
27
|
-
_norm.set(worldNormal[0], worldNormal[1], worldNormal[2]).applyMatrix3(_normMat);
|
|
28
|
-
if (_norm.lengthSq() > 1e-8) _norm.normalize();
|
|
29
|
-
else _norm.set(0, 0, 1);
|
|
30
|
-
_q.setFromUnitVectors(_zAxis, _norm);
|
|
31
|
-
_euler.setFromQuaternion(_q, "XYZ");
|
|
32
|
-
return {
|
|
33
|
-
position: [
|
|
34
|
-
_pt.x,
|
|
35
|
-
_pt.y,
|
|
36
|
-
_pt.z
|
|
37
|
-
],
|
|
38
|
-
rotation: [
|
|
39
|
-
_euler.x,
|
|
40
|
-
_euler.y,
|
|
41
|
-
_euler.z
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Finds the nearest non-decal Mesh inside an Object3D to a world-space hit point.
|
|
47
|
-
*/
|
|
48
|
-
function findClosestMeshInGroup(root, worldPoint) {
|
|
49
|
-
_pt.set(worldPoint[0], worldPoint[1], worldPoint[2]);
|
|
50
|
-
let best = null;
|
|
51
|
-
let bestDist = Infinity;
|
|
52
|
-
root.traverse((obj) => {
|
|
53
|
-
if (!isMeshNode(obj) || obj.userData.isDecal || obj.userData.isGizmo) return;
|
|
54
|
-
_box.setFromObject(obj);
|
|
55
|
-
const d = _box.distanceToPoint(_pt);
|
|
56
|
-
if (d < bestDist) {
|
|
57
|
-
bestDist = d;
|
|
58
|
-
best = obj;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return best;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Splits a target Object3D into BVH shards and computes world poses + impulses.
|
|
65
|
-
*/
|
|
66
|
-
function buildShardStates(rootObj, targetPieces, worldPos, worldQuat, hit, kind = "tin-can") {
|
|
67
|
-
const specs = splitObjectIntoShards(rootObj, targetPieces);
|
|
68
|
-
const density = getTargetDensity(kind);
|
|
69
|
-
const impVec = new THREE.Vector3(...hit.impulse);
|
|
70
|
-
const speedScale = Math.min(1.5, Math.max(.75, .75 + impVec.length() * .12));
|
|
71
|
-
const hitDir = impVec.lengthSq() > 1e-6 ? impVec.clone().normalize() : new THREE.Vector3(0, .25, -1).normalize();
|
|
72
|
-
return {
|
|
73
|
-
states: specs.map((spec, idx) => {
|
|
74
|
-
const off = new THREE.Vector3(...spec.centroid).applyQuaternion(worldQuat);
|
|
75
|
-
const dir = off.lengthSq() > 1e-6 ? off.clone().normalize() : new THREE.Vector3(idx % 3 - 1, .5, (idx + 1) % 3 - 1).normalize();
|
|
76
|
-
const pos = worldPos.clone().add(off).addScaledVector(dir, .008);
|
|
77
|
-
const hx = Math.max(.01, spec.halfExtents[0] * SHARD_COLLIDER_INSET);
|
|
78
|
-
const hy = Math.max(.01, spec.halfExtents[1] * SHARD_COLLIDER_INSET);
|
|
79
|
-
const hz = Math.max(.01, spec.halfExtents[2] * SHARD_COLLIDER_INSET);
|
|
80
|
-
const mass = Math.max(.008, 8 * hx * hy * hz * density);
|
|
81
|
-
const linvel = dir.clone().multiplyScalar(1.25 * speedScale).addScaledVector(hitDir, .85 * speedScale);
|
|
82
|
-
linvel.y += .8 * speedScale;
|
|
83
|
-
const imp = linvel.clone().multiplyScalar(mass);
|
|
84
|
-
const sign = idx % 2 === 0 ? 1 : -1;
|
|
85
|
-
const angvel = new THREE.Vector3(sign * (.6 + dir.z * .4), sign * (.7 + dir.x * .4), -sign * (.5 + dir.y * .4)).multiplyScalar(7.5);
|
|
86
|
-
const I = Math.max(1e-5, mass * (hx * hx + hy * hy + hz * hz) * .35);
|
|
87
|
-
const torque = angvel.clone().multiplyScalar(I);
|
|
88
|
-
return {
|
|
89
|
-
spec,
|
|
90
|
-
worldPos: [
|
|
91
|
-
pos.x,
|
|
92
|
-
pos.y,
|
|
93
|
-
pos.z
|
|
94
|
-
],
|
|
95
|
-
worldQuat: [
|
|
96
|
-
worldQuat.x,
|
|
97
|
-
worldQuat.y,
|
|
98
|
-
worldQuat.z,
|
|
99
|
-
worldQuat.w
|
|
100
|
-
],
|
|
101
|
-
impulse: [
|
|
102
|
-
imp.x,
|
|
103
|
-
imp.y,
|
|
104
|
-
imp.z
|
|
105
|
-
],
|
|
106
|
-
torque: [
|
|
107
|
-
torque.x,
|
|
108
|
-
torque.y,
|
|
109
|
-
torque.z
|
|
110
|
-
],
|
|
111
|
-
linvel: [
|
|
112
|
-
linvel.x,
|
|
113
|
-
linvel.y,
|
|
114
|
-
linvel.z
|
|
115
|
-
],
|
|
116
|
-
angvel: [
|
|
117
|
-
angvel.x,
|
|
118
|
-
angvel.y,
|
|
119
|
-
angvel.z
|
|
120
|
-
],
|
|
121
|
-
density
|
|
122
|
-
};
|
|
123
|
-
}),
|
|
124
|
-
specs
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Creates a DoubleSide material for tumbling shatter shards matching target kind.
|
|
129
|
-
*/
|
|
130
|
-
function createShardMaterial(kind, labelTexture, importedRoot) {
|
|
131
|
-
if (kind === "glass-bottle") return createGlassBottleMaterial();
|
|
132
|
-
if (kind === "tin-can") return new THREE.MeshStandardMaterial({
|
|
133
|
-
color: labelTexture ? "#e2e8f0" : "#94a3b8",
|
|
134
|
-
map: labelTexture ?? null,
|
|
135
|
-
roughness: .45,
|
|
136
|
-
metalness: .35,
|
|
137
|
-
side: THREE.DoubleSide
|
|
138
|
-
});
|
|
139
|
-
let foundMat = null;
|
|
140
|
-
importedRoot?.traverse((obj) => {
|
|
141
|
-
if (!foundMat && isMeshNode(obj) && !obj.userData.isDecal && !obj.userData.isGizmo) foundMat = Array.isArray(obj.material) ? obj.material[0] ?? null : obj.material ?? null;
|
|
142
|
-
});
|
|
143
|
-
if (foundMat) {
|
|
144
|
-
const cloned = foundMat.clone();
|
|
145
|
-
cloned.side = THREE.DoubleSide;
|
|
146
|
-
return cloned;
|
|
147
|
-
}
|
|
148
|
-
return new THREE.MeshStandardMaterial({
|
|
149
|
-
color: "#cbd5e1",
|
|
150
|
-
roughness: .6,
|
|
151
|
-
metalness: .2,
|
|
152
|
-
side: THREE.DoubleSide
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
export { SHARD_COLLIDER_INSET, buildShardStates, computeLocalDecalTransform, createShardMaterial, findClosestMeshInGroup, getTargetDensity };
|
|
156
|
-
|
|
157
|
-
//# sourceMappingURL=targetHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targetHelpers.js","names":[],"sources":["../../src/junk/targetHelpers.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { splitObjectIntoShards } from \"./bvhShatter.js\";\nimport { createGlassBottleMaterial, type ResolvedCanLod } from \"./junkGeometry.js\";\nimport { isMeshNode } from \"./junkImportSanitize.js\";\nimport type { BallisticHitEvent, CanLodMode, JunkKind, ProceduralLabelId, ShardSpec } from \"./junkTypes.js\";\n\nexport const SHARD_COLLIDER_INSET = 0.65;\n\nexport function getTargetDensity(kind: JunkKind): number {\n return kind === \"glass-bottle\" ? 1200 : kind === \"imported-glb\" ? 800 : 220;\n}\n\nexport interface SpawnedShardState {\n spec: ShardSpec;\n worldPos: [number, number, number];\n worldQuat: [number, number, number, number];\n impulse: [number, number, number];\n torque: [number, number, number];\n linvel: [number, number, number];\n angvel: [number, number, number];\n density: number;\n}\n\nexport interface DestructibleTargetSnapshot {\n id: string;\n kind: JunkKind;\n lodMode: CanLodMode;\n activeLod: ResolvedCanLod;\n triCount: number;\n labelId: ProceduralLabelId;\n customLabelLoaded: boolean;\n materialTransparent: boolean;\n opacity: number;\n hp: number;\n maxHp: number;\n alive: boolean;\n decalCount: number;\n activeShardCount: number;\n position: [number, number, number];\n linearVelocity: [number, number, number];\n}\n\nconst _pt = new THREE.Vector3();\nconst _norm = new THREE.Vector3();\nconst _zAxis = new THREE.Vector3(0, 0, 1);\nconst _q = new THREE.Quaternion();\nconst _euler = new THREE.Euler();\nconst _invWorld = new THREE.Matrix4();\nconst _normMat = new THREE.Matrix3();\nconst _box = new THREE.Box3();\n\n/**\n * Computes target-mesh local-space position & Euler XYZ rotation for a `<Decal>`.\n */\nexport function computeLocalDecalTransform(\n mesh: THREE.Mesh,\n worldPoint: [number, number, number],\n worldNormal: [number, number, number],\n): { position: [number, number, number]; rotation: [number, number, number] } {\n mesh.updateMatrixWorld(true);\n _pt.set(worldPoint[0], worldPoint[1], worldPoint[2]);\n mesh.worldToLocal(_pt);\n _invWorld.copy(mesh.matrixWorld).invert();\n _normMat.getNormalMatrix(_invWorld);\n _norm.set(worldNormal[0], worldNormal[1], worldNormal[2]).applyMatrix3(_normMat);\n if (_norm.lengthSq() > 1e-8)\n _norm.normalize();\n else\n _norm.set(0, 0, 1);\n _q.setFromUnitVectors(_zAxis, _norm);\n _euler.setFromQuaternion(_q, \"XYZ\");\n return {\n position: [_pt.x, _pt.y, _pt.z],\n rotation: [_euler.x, _euler.y, _euler.z],\n };\n}\n\n/**\n * Finds the nearest non-decal Mesh inside an Object3D to a world-space hit point.\n */\nexport function findClosestMeshInGroup(root: THREE.Object3D, worldPoint: [number, number, number]): THREE.Mesh | null {\n _pt.set(worldPoint[0], worldPoint[1], worldPoint[2]);\n let best: THREE.Mesh | null = null;\n let bestDist = Infinity;\n root.traverse((obj) => {\n if (!isMeshNode(obj) || obj.userData.isDecal || obj.userData.isGizmo)\n return;\n _box.setFromObject(obj);\n const d = _box.distanceToPoint(_pt);\n if (d < bestDist) {\n bestDist = d;\n best = obj;\n }\n });\n return best;\n}\n\n/**\n * Splits a target Object3D into BVH shards and computes world poses + impulses.\n */\nexport function buildShardStates(\n rootObj: THREE.Object3D,\n targetPieces: number,\n worldPos: THREE.Vector3,\n worldQuat: THREE.Quaternion,\n hit: BallisticHitEvent,\n kind: JunkKind = \"tin-can\",\n): { states: SpawnedShardState[]; specs: ShardSpec[] } {\n const specs = splitObjectIntoShards(rootObj, targetPieces);\n const density = getTargetDensity(kind);\n const impVec = new THREE.Vector3(...hit.impulse);\n const speedScale = Math.min(1.5, Math.max(0.75, 0.75 + impVec.length() * 0.12));\n const hitDir = impVec.lengthSq() > 1e-6 ? impVec.clone().normalize() : new THREE.Vector3(0, 0.25, -1).normalize();\n\n const states: SpawnedShardState[] = specs.map((spec, idx) => {\n const off = new THREE.Vector3(...spec.centroid).applyQuaternion(worldQuat);\n const dir =\n off.lengthSq() > 1e-6\n ? off.clone().normalize()\n : new THREE.Vector3((idx % 3) - 1, 0.5, ((idx + 1) % 3) - 1).normalize();\n const pos = worldPos.clone().add(off).addScaledVector(dir, 0.008);\n const hx = Math.max(0.01, spec.halfExtents[0] * SHARD_COLLIDER_INSET);\n const hy = Math.max(0.01, spec.halfExtents[1] * SHARD_COLLIDER_INSET);\n const hz = Math.max(0.01, spec.halfExtents[2] * SHARD_COLLIDER_INSET);\n const mass = Math.max(0.008, 8 * hx * hy * hz * density);\n const linvel = dir.clone().multiplyScalar(1.25 * speedScale).addScaledVector(hitDir, 0.85 * speedScale);\n linvel.y += 0.8 * speedScale;\n const imp = linvel.clone().multiplyScalar(mass);\n const sign = idx % 2 === 0 ? 1 : -1;\n const angvel = new THREE.Vector3(sign * (0.6 + dir.z * 0.4), sign * (0.7 + dir.x * 0.4), -sign * (0.5 + dir.y * 0.4)).multiplyScalar(7.5);\n const I = Math.max(1e-5, mass * (hx * hx + hy * hy + hz * hz) * 0.35);\n const torque = angvel.clone().multiplyScalar(I);\n return {\n spec,\n worldPos: [pos.x, pos.y, pos.z],\n worldQuat: [worldQuat.x, worldQuat.y, worldQuat.z, worldQuat.w],\n impulse: [imp.x, imp.y, imp.z],\n torque: [torque.x, torque.y, torque.z],\n linvel: [linvel.x, linvel.y, linvel.z],\n angvel: [angvel.x, angvel.y, angvel.z],\n density,\n };\n });\n return { states, specs };\n}\n\n/**\n * Creates a DoubleSide material for tumbling shatter shards matching target kind.\n */\nexport function createShardMaterial(\n kind: JunkKind,\n labelTexture: THREE.Texture | null,\n importedRoot?: THREE.Object3D | null,\n): THREE.Material {\n if (kind === \"glass-bottle\")\n return createGlassBottleMaterial();\n if (kind === \"tin-can\") {\n return new THREE.MeshStandardMaterial({\n color: labelTexture ? \"#e2e8f0\" : \"#94a3b8\",\n map: labelTexture ?? null,\n roughness: 0.45,\n metalness: 0.35,\n side: THREE.DoubleSide,\n });\n }\n let foundMat: THREE.Material | null = null;\n importedRoot?.traverse((obj) => {\n if (!foundMat && isMeshNode(obj) && !obj.userData.isDecal && !obj.userData.isGizmo) {\n foundMat = Array.isArray(obj.material) ? (obj.material[0] ?? null) : (obj.material ?? null);\n }\n });\n if (foundMat) {\n const cloned = (foundMat as THREE.Material).clone();\n cloned.side = THREE.DoubleSide;\n return cloned;\n }\n return new THREE.MeshStandardMaterial({\n color: \"#cbd5e1\",\n roughness: 0.6,\n metalness: 0.2,\n side: THREE.DoubleSide,\n });\n}\n"],"mappings":";;;;;AAMA,IAAa,uBAAuB;AAEpC,SAAgB,iBAAiB,MAAwB;CACrD,OAAO,SAAS,iBAAiB,OAAO,SAAS,iBAAiB,MAAM;AAC5E;AAgCA,IAAM,MAAM,IAAI,MAAM,QAAQ;AAC9B,IAAM,QAAQ,IAAI,MAAM,QAAQ;AAChC,IAAM,SAAS,IAAI,MAA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AAI,MAAM,qBAAqB;EAClC,OAAO;EACP,WAAW;EACX,WAAW;EACX,MAAM,MAAM;CAChB,CAAC;AACL"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { RefObject } from "react";
|
|
2
|
-
import type { RapierRigidBody } from "@react-three/rapier";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
import type { ResolvedCanLod } from "./junkGeometry.js";
|
|
5
|
-
import type { BallisticHitEvent, DecalRecord, DestructibleTargetSpec, ShardSpec } from "./junkTypes.js";
|
|
6
|
-
import { type DestructibleTargetSnapshot, type SpawnedShardState } from "./targetHelpers.js";
|
|
7
|
-
import type { TargetAssetBundle } from "./useTargetAssets.js";
|
|
8
|
-
export interface HitExecutionResult {
|
|
9
|
-
shattered: boolean;
|
|
10
|
-
nextHp: number;
|
|
11
|
-
shatterPos?: [number, number, number];
|
|
12
|
-
bodyPos?: [number, number, number];
|
|
13
|
-
shardStates?: SpawnedShardState[];
|
|
14
|
-
shardSpecs?: ShardSpec[];
|
|
15
|
-
shardMaterial?: THREE.Material;
|
|
16
|
-
newDecal?: DecalRecord;
|
|
17
|
-
newDecalMesh?: THREE.Mesh;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Applies physical knockback impulse and computes either a shatter state or a local decal.
|
|
21
|
-
*/
|
|
22
|
-
export declare function executeTargetHit(spec: DestructibleTargetSpec, assets: TargetAssetBundle, rb: RapierRigidBody | null, group: THREE.Group | null, primaryMesh: THREE.Mesh | null, currentHp: number, nextDecalId: string, hit: BallisticHitEvent): HitExecutionResult;
|
|
23
|
-
/**
|
|
24
|
-
* Formats a runtime telemetry snapshot for a DestructibleTarget.
|
|
25
|
-
*/
|
|
26
|
-
export declare function buildTargetSnapshot(spec: DestructibleTargetSpec, assets: TargetAssetBundle, rb: RapierRigidBody | null, hp: number, alive: boolean, decalCount: number, shardCount: number, lastPosition?: [number, number, number], activeLod?: ResolvedCanLod): DestructibleTargetSnapshot;
|
|
27
|
-
export declare function attachDecalMeshRef(map: Map<string, RefObject<THREE.Mesh>>, decalId: string, mesh?: THREE.Mesh): void;
|
|
28
|
-
export declare function appendDecalBounded(prev: ReadonlyArray<DecalRecord>, nextDecal: DecalRecord, meshRefs: Map<string, RefObject<THREE.Mesh>>, nextMesh?: THREE.Mesh, maxDecals?: number): DecalRecord[];
|
|
29
|
-
export declare function tagImportedMeshes(root: THREE.Object3D | null, targetId: string, applyHit: (hit: BallisticHitEvent) => void): void;
|
|
30
|
-
export declare function readTargetWorldPos(rb: RapierRigidBody | null, group: THREE.Group | null, out: THREE.Vector3): boolean;
|