@pinkaphant/kolmo 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +36 -36
- package/bin/kolmo.mjs +11 -5
- package/dist/engine/causewayBridge.d.ts +14 -0
- package/dist/engine/causewayBridge.js +166 -0
- package/dist/engine/causewayBridge.js.map +1 -0
- package/dist/engine/index.d.ts +6 -4
- package/dist/engine/index.js +19 -12
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/islandSettlementMesh.d.ts +26 -0
- package/dist/engine/islandSettlementMesh.js +166 -0
- package/dist/engine/islandSettlementMesh.js.map +1 -0
- package/dist/engine/kolmoActions.d.ts +23 -0
- package/dist/engine/kolmoActions.js +164 -0
- package/dist/engine/kolmoActions.js.map +1 -0
- package/dist/engine/kolmoActor.js +241 -206
- package/dist/engine/kolmoActor.js.map +1 -0
- package/dist/engine/kolmoFloatingOrigin.d.ts +17 -0
- package/dist/engine/kolmoFloatingOrigin.js +98 -0
- package/dist/engine/kolmoFloatingOrigin.js.map +1 -0
- package/dist/engine/kolmoGame.d.ts +27 -0
- package/dist/engine/kolmoGame.js +80 -0
- package/dist/engine/kolmoGame.js.map +1 -0
- package/dist/engine/kolmoHud.d.ts +23 -0
- package/dist/engine/kolmoHud.js +195 -0
- package/dist/engine/kolmoHud.js.map +1 -0
- package/dist/engine/kolmoInput.d.ts +1 -1
- package/dist/engine/kolmoInput.js +57 -30
- package/dist/engine/kolmoInput.js.map +1 -0
- package/dist/engine/kolmoIsland.d.ts +5 -10
- package/dist/engine/kolmoIsland.js +182 -250
- package/dist/engine/kolmoIsland.js.map +1 -0
- package/dist/engine/kolmoLongDrive.d.ts +3 -4
- package/dist/engine/kolmoLongDrive.js +139 -249
- package/dist/engine/kolmoLongDrive.js.map +1 -0
- package/dist/engine/kolmoPilotMesh.d.ts +2 -0
- package/dist/engine/kolmoPilotMesh.js +64 -0
- package/dist/engine/kolmoPilotMesh.js.map +1 -0
- package/dist/engine/kolmoProcedural.d.ts +13 -0
- package/dist/engine/kolmoProcedural.js +101 -0
- package/dist/engine/kolmoProcedural.js.map +1 -0
- package/dist/engine/kolmoRigs.d.ts +1 -1
- package/dist/engine/kolmoRigs.js +88 -47
- package/dist/engine/kolmoRigs.js.map +1 -0
- package/dist/engine/kolmoStore.d.ts +3 -101
- package/dist/engine/kolmoSurface.d.ts +2 -2
- package/dist/engine/kolmoSurface.js +150 -134
- package/dist/engine/kolmoSurface.js.map +1 -0
- package/dist/engine/kolmoTraits.d.ts +128 -0
- package/dist/engine/kolmoTraits.js +140 -0
- package/dist/engine/kolmoTraits.js.map +1 -0
- package/dist/engine/kolmoVehicle.d.ts +3 -33
- package/dist/engine/kolmoVehicle.js +66 -253
- package/dist/engine/kolmoVehicle.js.map +1 -0
- package/dist/engine/kolmoVehicleConfig.d.ts +54 -0
- package/dist/engine/kolmoVehicleConfig.js +80 -0
- package/dist/engine/kolmoVehicleConfig.js.map +1 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +8 -13
- package/dist/engine/kolmoVehicleDriver.js +116 -42
- package/dist/engine/kolmoVehicleDriver.js.map +1 -0
- package/dist/engine/kolmoVehicleInner.d.ts +7 -0
- package/dist/engine/kolmoVehicleInner.js +261 -0
- package/dist/engine/kolmoVehicleInner.js.map +1 -0
- package/dist/engine/kolmoWorld.d.ts +6 -4
- package/dist/engine/kolmoWorld.js +134 -136
- package/dist/engine/kolmoWorld.js.map +1 -0
- package/dist/engine/longDriveKit.d.ts +5 -12
- package/dist/engine/longDriveKit.js +121 -233
- package/dist/engine/longDriveKit.js.map +1 -0
- package/dist/engine/longDriveRoadside.d.ts +16 -0
- package/dist/engine/longDriveRoadside.js +171 -0
- package/dist/engine/longDriveRoadside.js.map +1 -0
- package/dist/engine/macroCellBuilder.d.ts +34 -0
- package/dist/engine/macroCellBuilder.js +145 -0
- package/dist/engine/macroCellBuilder.js.map +1 -0
- package/dist/engine/mainlandMacroCell.d.ts +2 -2
- package/dist/engine/mainlandMacroCell.js +77 -165
- package/dist/engine/mainlandMacroCell.js.map +1 -0
- package/dist/engine/shiftedFixedBody.d.ts +1 -1
- package/dist/engine/shiftedFixedBody.js +55 -28
- package/dist/engine/shiftedFixedBody.js.map +1 -0
- package/dist/importer/ChopShopPanel.d.ts +10 -32
- package/dist/importer/ChopShopPanel.js +320 -470
- package/dist/importer/ChopShopPanel.js.map +1 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +2 -1
- package/dist/importer/DomainWorkshopPanel.js +172 -242
- package/dist/importer/DomainWorkshopPanel.js.map +1 -0
- package/dist/importer/GateHudBar.d.ts +8 -3
- package/dist/importer/GateHudBar.js +289 -284
- package/dist/importer/GateHudBar.js.map +1 -0
- package/dist/importer/GlbImportGate.d.ts +2 -1
- package/dist/importer/GlbImportGate.js +252 -261
- package/dist/importer/GlbImportGate.js.map +1 -0
- package/dist/importer/ImperativeVehicleRig.d.ts +2 -2
- package/dist/importer/ImperativeVehicleRig.js +223 -284
- package/dist/importer/ImperativeVehicleRig.js.map +1 -0
- package/dist/importer/LiveDrivePads.d.ts +20 -0
- package/dist/importer/LiveDrivePads.js +169 -0
- package/dist/importer/LiveDrivePads.js.map +1 -0
- package/dist/importer/PaperShellDebrisRig.d.ts +25 -0
- package/dist/importer/PaperShellDebrisRig.js +143 -0
- package/dist/importer/PaperShellDebrisRig.js.map +1 -0
- package/dist/importer/R2VaultDrawer.d.ts +12 -0
- package/dist/importer/R2VaultDrawer.js +90 -0
- package/dist/importer/R2VaultDrawer.js.map +1 -0
- package/dist/importer/Step1CalibrationPlinth.d.ts +23 -15
- package/dist/importer/Step1CalibrationPlinth.js +180 -313
- package/dist/importer/Step1CalibrationPlinth.js.map +1 -0
- package/dist/importer/Step1ExplodedIslands.d.ts +31 -0
- package/dist/importer/Step1ExplodedIslands.js +144 -0
- package/dist/importer/Step1ExplodedIslands.js.map +1 -0
- package/dist/importer/Step2UniversalPad.d.ts +7 -14
- package/dist/importer/Step2UniversalPad.js +54 -197
- package/dist/importer/Step2UniversalPad.js.map +1 -0
- package/dist/importer/VfxEmitterPool.js +59 -86
- package/dist/importer/VfxEmitterPool.js.map +1 -0
- package/dist/importer/WheelRingHandles3D.d.ts +11 -0
- package/dist/importer/WheelRingHandles3D.js +318 -0
- package/dist/importer/WheelRingHandles3D.js.map +1 -0
- package/dist/importer/archLinerGeom.d.ts +2 -0
- package/dist/importer/archLinerGeom.js +51 -0
- package/dist/importer/archLinerGeom.js.map +1 -0
- package/dist/importer/{vehiclePanelAnim.d.ts → chopHingeHelpers.d.ts} +0 -10
- package/dist/importer/chopHingeHelpers.js +193 -0
- package/dist/importer/chopHingeHelpers.js.map +1 -0
- package/dist/importer/chopShopActions.d.ts +20 -32
- package/dist/importer/chopShopActions.js +138 -238
- package/dist/importer/chopShopActions.js.map +1 -0
- package/dist/importer/chopShopHandlers.d.ts +26 -0
- package/dist/importer/chopShopHandlers.js +276 -0
- package/dist/importer/chopShopHandlers.js.map +1 -0
- package/dist/importer/chopShopIoActions.d.ts +15 -0
- package/dist/importer/chopShopIoActions.js +137 -0
- package/dist/importer/chopShopIoActions.js.map +1 -0
- package/dist/importer/chopShopMcpAction.d.ts +18 -0
- package/dist/importer/chopShopMcpAction.js +58 -0
- package/dist/importer/chopShopMcpAction.js.map +1 -0
- package/dist/importer/cylinderBooleanSlice.d.ts +14 -0
- package/dist/importer/cylinderBooleanSlice.js +110 -0
- package/dist/importer/cylinderBooleanSlice.js.map +1 -0
- package/dist/importer/cylinderSliceMath.d.ts +14 -0
- package/dist/importer/cylinderSliceMath.js +251 -0
- package/dist/importer/cylinderSliceMath.js.map +1 -0
- package/dist/importer/fusedWheelDetect.d.ts +4 -0
- package/dist/importer/fusedWheelDetect.js +175 -0
- package/dist/importer/fusedWheelDetect.js.map +1 -0
- package/dist/importer/fusedWheelFit.d.ts +13 -0
- package/dist/importer/fusedWheelFit.js +138 -0
- package/dist/importer/fusedWheelFit.js.map +1 -0
- package/dist/importer/gateStore.d.ts +3 -6
- package/dist/importer/gateStore.js +36 -30
- package/dist/importer/gateStore.js.map +1 -0
- package/dist/importer/glbNormalizer.d.ts +1 -10
- package/dist/importer/glbNormalizer.js +120 -146
- package/dist/importer/glbNormalizer.js.map +1 -0
- package/dist/importer/importerWebMcp.d.ts +4 -3
- package/dist/importer/importerWebMcp.js +41 -339
- package/dist/importer/importerWebMcp.js.map +1 -0
- package/dist/importer/importerWebMcpTools.d.ts +2 -0
- package/dist/importer/importerWebMcpTools.js +340 -0
- package/dist/importer/importerWebMcpTools.js.map +1 -0
- package/dist/importer/index.d.ts +6 -4
- package/dist/importer/index.js +32 -25
- package/dist/importer/index.js.map +1 -0
- package/dist/importer/khrCarPlanHelpers.d.ts +28 -0
- package/dist/importer/khrCarPlanHelpers.js +221 -0
- package/dist/importer/khrCarPlanHelpers.js.map +1 -0
- package/dist/importer/khrCarPlanner.d.ts +7 -0
- package/dist/importer/khrCarPlanner.js +279 -0
- package/dist/importer/khrCarPlanner.js.map +1 -0
- package/dist/importer/khrCompiler.d.ts +4 -41
- package/dist/importer/khrCompiler.js +56 -673
- package/dist/importer/khrCompiler.js.map +1 -0
- package/dist/importer/khrCraftPropCompiler.d.ts +40 -0
- package/dist/importer/khrCraftPropCompiler.js +250 -0
- package/dist/importer/khrCraftPropCompiler.js.map +1 -0
- package/dist/importer/launcherBake.js +76 -39
- package/dist/importer/launcherBake.js.map +1 -0
- package/dist/importer/meshIslands.d.ts +4 -50
- package/dist/importer/meshIslands.js +84 -288
- package/dist/importer/meshIslands.js.map +1 -0
- package/dist/importer/meshSliceBuffers.d.ts +15 -0
- package/dist/importer/meshSliceBuffers.js +159 -0
- package/dist/importer/meshSliceBuffers.js.map +1 -0
- package/dist/importer/polygonEarClipYZ.d.ts +3 -0
- package/dist/importer/polygonEarClipYZ.js +67 -0
- package/dist/importer/polygonEarClipYZ.js.map +1 -0
- package/dist/importer/sceneSiNormalize.d.ts +19 -0
- package/dist/importer/sceneSiNormalize.js +138 -0
- package/dist/importer/sceneSiNormalize.js.map +1 -0
- package/dist/importer/starterScene.d.ts +3 -0
- package/dist/importer/starterScene.js +76 -0
- package/dist/importer/starterScene.js.map +1 -0
- package/dist/importer/surfaceCutter.d.ts +5 -25
- package/dist/importer/surfaceCutter.js +70 -334
- package/dist/importer/surfaceCutter.js.map +1 -0
- package/dist/importer/surfaceGeodesic.d.ts +7 -0
- package/dist/importer/surfaceGeodesic.js +130 -0
- package/dist/importer/surfaceGeodesic.js.map +1 -0
- package/dist/importer/surfaceLoopRefine.d.ts +6 -0
- package/dist/importer/surfaceLoopRefine.js +171 -0
- package/dist/importer/surfaceLoopRefine.js.map +1 -0
- package/dist/importer/surfacePeel.d.ts +11 -0
- package/dist/importer/surfacePeel.js +119 -0
- package/dist/importer/surfacePeel.js.map +1 -0
- package/dist/importer/surfaceTopology.d.ts +4 -19
- package/dist/importer/surfaceTopology.js +92 -160
- package/dist/importer/surfaceTopology.js.map +1 -0
- package/dist/importer/universalGateBake.d.ts +7 -9
- package/dist/importer/universalGateBake.js +104 -109
- package/dist/importer/universalGateBake.js.map +1 -0
- package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
- package/dist/importer/usdPhysicsSpecs.js +245 -0
- package/dist/importer/usdPhysicsSpecs.js.map +1 -0
- package/dist/importer/usdTextParse.d.ts +12 -0
- package/dist/importer/usdTextParse.js +118 -0
- package/dist/importer/usdTextParse.js.map +1 -0
- package/dist/importer/usdToGlb.d.ts +3 -2
- package/dist/importer/usdToGlb.js +80 -292
- package/dist/importer/usdToGlb.js.map +1 -0
- package/dist/importer/useChopShopController.d.ts +51 -74
- package/dist/importer/useChopShopController.js +157 -453
- package/dist/importer/useChopShopController.js.map +1 -0
- package/dist/importer/useChopShopState.d.ts +103 -0
- package/dist/importer/useChopShopState.js +319 -0
- package/dist/importer/useChopShopState.js.map +1 -0
- package/dist/importer/useWasdKeyRef.d.ts +9 -0
- package/dist/importer/useWasdKeyRef.js +35 -0
- package/dist/importer/useWasdKeyRef.js.map +1 -0
- package/dist/importer/vehiclePartSplit.d.ts +33 -0
- package/dist/importer/vehiclePartSplit.js +178 -0
- package/dist/importer/vehiclePartSplit.js.map +1 -0
- package/dist/importer/wheelAxlePairing.d.ts +1 -3
- package/dist/importer/wheelAxlePairing.js +106 -119
- package/dist/importer/wheelAxlePairing.js.map +1 -0
- package/dist/importer/wheelCutterHelpers.d.ts +42 -0
- package/dist/importer/wheelCutterHelpers.js +178 -0
- package/dist/importer/wheelCutterHelpers.js.map +1 -0
- package/dist/importer/wheelRingHandleMath.d.ts +20 -0
- package/dist/importer/wheelRingHandleMath.js +66 -0
- package/dist/importer/wheelRingHandleMath.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +90 -69
- package/dist/index.js.map +1 -0
- package/dist/junk/DestructibleTarget.d.ts +3 -3
- package/dist/junk/DestructibleTarget.js +177 -114
- package/dist/junk/DestructibleTarget.js.map +1 -0
- package/dist/junk/KolmoJunk.js +55 -44
- package/dist/junk/KolmoJunk.js.map +1 -0
- package/dist/junk/ShardPieces.d.ts +2 -1
- package/dist/junk/ShardPieces.js +80 -61
- package/dist/junk/ShardPieces.js.map +1 -0
- package/dist/junk/TargetDecals.d.ts +6 -15
- package/dist/junk/TargetDecals.js +66 -40
- package/dist/junk/TargetDecals.js.map +1 -0
- package/dist/junk/bvhShatter.d.ts +2 -6
- package/dist/junk/bvhShatter.js +89 -43
- package/dist/junk/bvhShatter.js.map +1 -0
- package/dist/junk/bvhTriCollector.d.ts +2 -6
- package/dist/junk/bvhTriCollector.js +111 -62
- package/dist/junk/bvhTriCollector.js.map +1 -0
- package/dist/junk/index.d.ts +2 -2
- package/dist/junk/index.js +11 -11
- package/dist/junk/index.js.map +1 -0
- package/dist/junk/junkGeometry.d.ts +5 -26
- package/dist/junk/junkGeometry.js +61 -43
- package/dist/junk/junkGeometry.js.map +1 -0
- package/dist/junk/junkImportSanitize.d.ts +4 -5
- package/dist/junk/junkImportSanitize.js +57 -37
- package/dist/junk/junkImportSanitize.js.map +1 -0
- package/dist/junk/junkImporter.d.ts +2 -13
- package/dist/junk/junkImporter.js +105 -76
- package/dist/junk/junkImporter.js.map +1 -0
- package/dist/junk/junkLabelCanvas.d.ts +1 -6
- package/dist/junk/junkLabelCanvas.js +147 -29
- package/dist/junk/junkLabelCanvas.js.map +1 -0
- package/dist/junk/junkLabels.d.ts +4 -26
- package/dist/junk/junkLabels.js +42 -28
- package/dist/junk/junkLabels.js.map +1 -0
- package/dist/junk/targetHelpers.d.ts +3 -4
- package/dist/junk/targetHelpers.js +121 -67
- package/dist/junk/targetHelpers.js.map +1 -0
- package/dist/junk/targetHitLogic.d.ts +8 -8
- package/dist/junk/targetHitLogic.js +131 -95
- package/dist/junk/targetHitLogic.js.map +1 -0
- package/dist/junk/useTargetAssets.d.ts +9 -14
- package/dist/junk/useTargetAssets.js +113 -85
- package/dist/junk/useTargetAssets.js.map +1 -0
- package/dist/physics/index.d.ts +1 -8
- package/dist/physics/index.js +80 -85
- package/dist/physics/index.js.map +1 -0
- package/dist/schema/kolmoSchema.d.ts +3 -64
- package/dist/schema/kolmoSchema.js +75 -149
- package/dist/schema/kolmoSchema.js.map +1 -0
- package/dist/schema/kolmoStamp.d.ts +6 -0
- package/dist/schema/kolmoStamp.js +71 -0
- package/dist/schema/kolmoStamp.js.map +1 -0
- package/dist/schema/kolmoTypes.d.ts +63 -0
- package/dist/schema/kolmoTypes.js +66 -0
- package/dist/schema/kolmoTypes.js.map +1 -0
- package/dist/shaders/celestialBackdrop.d.ts +2 -10
- package/dist/shaders/celestialBackdrop.js +128 -291
- package/dist/shaders/celestialBackdrop.js.map +1 -0
- package/dist/shaders/emitterShaders.d.ts +9 -0
- package/dist/shaders/emitterShaders.js +114 -0
- package/dist/shaders/emitterShaders.js.map +1 -0
- package/dist/shaders/index.d.ts +1 -1
- package/dist/shaders/index.js +12 -9
- package/dist/shaders/index.js.map +1 -0
- package/dist/shaders/plumeAndSparkle.d.ts +2 -4
- package/dist/shaders/plumeAndSparkle.js +152 -191
- package/dist/shaders/plumeAndSparkle.js.map +1 -0
- package/dist/shaders/ps2GlslShared.js +29 -2
- package/dist/shaders/ps2GlslShared.js.map +1 -0
- package/dist/shaders/ps2MaterialsTSL.js +132 -51
- package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
- package/dist/shaders/ps2MaterialsWebGL.js +45 -28
- package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
- package/dist/shaders/ps2RoadWebGL.js +69 -32
- package/dist/shaders/ps2RoadWebGL.js.map +1 -0
- package/dist/shaders/ps2TerrainWebGL.js +107 -30
- package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
- package/dist/shaders/ps2Textures.d.ts +1 -1
- package/dist/shaders/ps2Textures.js +116 -41
- package/dist/shaders/ps2Textures.js.map +1 -0
- package/dist/shaders/retroPalettes.d.ts +1 -1
- package/dist/shaders/retroPalettes.js +90 -57
- package/dist/shaders/retroPalettes.js.map +1 -0
- package/dist/shaders/retroShader.d.ts +2 -86
- package/dist/shaders/retroShader.js +65 -196
- package/dist/shaders/retroShader.js.map +1 -0
- package/dist/shaders/retroUniforms.d.ts +60 -0
- package/dist/shaders/retroUniforms.js +215 -0
- package/dist/shaders/retroUniforms.js.map +1 -0
- package/dist/shaders/skyboxShaders.d.ts +16 -0
- package/dist/shaders/skyboxShaders.js +266 -0
- package/dist/shaders/skyboxShaders.js.map +1 -0
- package/dist/shaders/tsl.d.ts +1 -1
- package/dist/shaders/tsl.js.map +1 -0
- package/dist/vite/index.js +39 -23
- package/dist/vite/index.js.map +1 -0
- package/dist/world/frontage.js +25 -21
- package/dist/world/frontage.js.map +1 -0
- package/dist/world/index.d.ts +4 -4
- package/dist/world/index.js +12 -11
- package/dist/world/index.js.map +1 -0
- package/dist/world/infiniteWorld2D.d.ts +0 -5
- package/dist/world/infiniteWorld2D.js +175 -200
- package/dist/world/infiniteWorld2D.js.map +1 -0
- package/dist/world/island.js +81 -166
- package/dist/world/island.js.map +1 -0
- package/dist/world/islandPathing.d.ts +6 -0
- package/dist/world/islandPathing.js +166 -0
- package/dist/world/islandPathing.js.map +1 -0
- package/dist/world/macroCellSchema.js +15 -8
- package/dist/world/macroCellSchema.js.map +1 -0
- package/dist/world/macroKnightAStar.js +140 -71
- package/dist/world/macroKnightAStar.js.map +1 -0
- package/dist/world/macroSettlementZones.d.ts +9 -0
- package/dist/world/macroSettlementZones.js +108 -0
- package/dist/world/macroSettlementZones.js.map +1 -0
- package/dist/world/random.js +50 -24
- package/dist/world/random.js.map +1 -0
- package/dist/world/road.js +152 -90
- package/dist/world/road.js.map +1 -0
- package/dist/world/roadRibbon.d.ts +4 -19
- package/dist/world/roadRibbon.js +129 -124
- package/dist/world/roadRibbon.js.map +1 -0
- package/dist/world/terrain.d.ts +1 -1
- package/dist/world/terrain.js +111 -65
- package/dist/world/terrain.js.map +1 -0
- package/dist/world/terrainGeometry.d.ts +14 -0
- package/dist/world/terrainGeometry.js +76 -0
- package/dist/world/terrainGeometry.js.map +1 -0
- package/dist/world/worldTypes.d.ts +3 -3
- package/dist/world/worldTypes.js +133 -67
- package/dist/world/worldTypes.js.map +1 -0
- package/docs/api-reference.md +187 -0
- package/package.json +58 -32
- package/dist/engine/kolmoStore.js +0 -247
- package/dist/importer/CabinPreviewRig.d.ts +0 -13
- package/dist/importer/CabinPreviewRig.js +0 -138
- package/dist/importer/CabinStepSection.d.ts +0 -17
- package/dist/importer/CabinStepSection.js +0 -222
- package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -20
- package/dist/importer/ImporterPlinthUikitTags.js +0 -119
- package/dist/importer/cabinMeshBuilders.d.ts +0 -13
- package/dist/importer/cabinMeshBuilders.js +0 -104
- package/dist/importer/cabinMixamoRig.d.ts +0 -53
- package/dist/importer/cabinMixamoRig.js +0 -150
- package/dist/importer/chopShopUiComponents.d.ts +0 -22
- package/dist/importer/chopShopUiComponents.js +0 -91
- package/dist/importer/vehiclePanelAnim.js +0 -214
package/dist/junk/ShardPieces.js
CHANGED
|
@@ -1,74 +1,93 @@
|
|
|
1
|
-
import { FloatingBodyTrait
|
|
2
|
-
import { SHARD_COLLIDER_INSET
|
|
3
|
-
import { useEffect
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { FloatingBodyTrait, useActiveKolmoWorld } from "../engine/kolmoTraits.js";
|
|
2
|
+
import { SHARD_COLLIDER_INSET } from "./targetHelpers.js";
|
|
3
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
4
|
+
import "three";
|
|
5
|
+
import { createPortal, useThree } from "@react-three/fiber";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CuboidCollider, RigidBody } from "@react-three/rapier";
|
|
7
8
|
// src/junk/ShardPieces.tsx
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function ShardPieceBody({ item, material }) {
|
|
10
|
+
const activeWorld = useActiveKolmoWorld();
|
|
11
|
+
const rbRef = useRef(null);
|
|
12
|
+
const spawnPoseRef = useRef({
|
|
13
|
+
pos: item.worldPos,
|
|
14
|
+
quat: item.worldQuat
|
|
12
15
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
id:
|
|
16
|
-
getBody: () =>
|
|
17
|
-
}))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const entity = activeWorld.spawn(FloatingBodyTrait({
|
|
18
|
+
id: item.spec.id,
|
|
19
|
+
getBody: () => rbRef.current
|
|
20
|
+
}));
|
|
21
|
+
const rb = rbRef.current;
|
|
22
|
+
if (rb) {
|
|
23
|
+
rb.setLinvel({
|
|
24
|
+
x: item.linvel[0],
|
|
25
|
+
y: item.linvel[1],
|
|
26
|
+
z: item.linvel[2]
|
|
27
|
+
}, true);
|
|
28
|
+
rb.setAngvel({
|
|
29
|
+
x: item.angvel[0],
|
|
30
|
+
y: item.angvel[1],
|
|
31
|
+
z: item.angvel[2]
|
|
32
|
+
}, true);
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
entity.destroy();
|
|
28
36
|
};
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Math.max(.01,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ref: p,
|
|
37
|
+
}, [activeWorld, item]);
|
|
38
|
+
const halfExtents = [
|
|
39
|
+
Math.max(.01, item.spec.halfExtents[0] * SHARD_COLLIDER_INSET),
|
|
40
|
+
Math.max(.01, item.spec.halfExtents[1] * SHARD_COLLIDER_INSET),
|
|
41
|
+
Math.max(.01, item.spec.halfExtents[2] * SHARD_COLLIDER_INSET)
|
|
42
|
+
];
|
|
43
|
+
const userData = useMemo(() => ({
|
|
44
|
+
toolgunId: item.spec.id,
|
|
45
|
+
ecctrl: { excludeCharacterRay: true }
|
|
46
|
+
}), [item.spec.id]);
|
|
47
|
+
return /* @__PURE__ */ jsxs(RigidBody, {
|
|
48
|
+
ref: rbRef,
|
|
42
49
|
type: "dynamic",
|
|
43
|
-
colliders:
|
|
44
|
-
position:
|
|
45
|
-
quaternion:
|
|
50
|
+
colliders: false,
|
|
51
|
+
position: spawnPoseRef.current.pos,
|
|
52
|
+
quaternion: spawnPoseRef.current.quat,
|
|
46
53
|
restitution: .18,
|
|
47
54
|
friction: .8,
|
|
48
55
|
linearDamping: .45,
|
|
49
56
|
angularDamping: .45,
|
|
50
|
-
userData
|
|
51
|
-
children: [/* @__PURE__ */
|
|
52
|
-
args:
|
|
53
|
-
density:
|
|
54
|
-
}), /* @__PURE__ */
|
|
55
|
-
geometry:
|
|
56
|
-
material
|
|
57
|
-
castShadow:
|
|
58
|
-
receiveShadow:
|
|
57
|
+
userData,
|
|
58
|
+
children: [/* @__PURE__ */ jsx(CuboidCollider, {
|
|
59
|
+
args: halfExtents,
|
|
60
|
+
density: item.density
|
|
61
|
+
}), /* @__PURE__ */ jsx("mesh", {
|
|
62
|
+
geometry: item.spec.geometry,
|
|
63
|
+
material,
|
|
64
|
+
castShadow: true,
|
|
65
|
+
receiveShadow: true
|
|
59
66
|
})]
|
|
60
67
|
});
|
|
61
68
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Portals dynamic Rapier shatter fragments directly into the root `THREE.Scene` so world-space
|
|
71
|
+
* `worldPos`/`worldQuat` are never double-transformed by translated or rotated parent `<group>`s,
|
|
72
|
+
* and registers `FloatingBodyTrait` for zero-drift floating-origin rebasing.
|
|
73
|
+
*/
|
|
74
|
+
function ShardPieces({ shards, material }) {
|
|
75
|
+
const scene = useThree((s) => s.scene);
|
|
76
|
+
useEffect(() => () => {
|
|
77
|
+
for (const s of shards) s.spec.geometry.dispose();
|
|
78
|
+
}, [shards]);
|
|
79
|
+
useEffect(() => () => {
|
|
80
|
+
material?.dispose();
|
|
81
|
+
}, [material]);
|
|
82
|
+
if (!material || shards.length === 0) return null;
|
|
83
|
+
return createPortal(/* @__PURE__ */ jsx("group", {
|
|
67
84
|
name: "Kolmo_WorldShardPieces",
|
|
68
|
-
children:
|
|
69
|
-
item
|
|
70
|
-
material
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
85
|
+
children: shards.map((item) => /* @__PURE__ */ jsx(ShardPieceBody, {
|
|
86
|
+
item,
|
|
87
|
+
material
|
|
88
|
+
}, item.spec.id))
|
|
89
|
+
}), scene);
|
|
73
90
|
}
|
|
74
|
-
export {
|
|
91
|
+
export { ShardPieces };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=ShardPieces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShardPieces.js","names":[],"sources":["../../src/junk/ShardPieces.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from \"react\";\nimport * as THREE from \"three\";\nimport { createPortal, useThree } from \"@react-three/fiber\";\nimport { CuboidCollider, RigidBody, type RapierRigidBody } from \"@react-three/rapier\";\nimport { FloatingBodyTrait, useActiveKolmoWorld } from \"../engine/kolmoStore.js\";\nimport { SHARD_COLLIDER_INSET, type SpawnedShardState } from \"./targetHelpers.js\";\n\nexport interface ShardPiecesProps {\n readonly shards: ReadonlyArray<SpawnedShardState>;\n readonly material: THREE.Material | null;\n}\n\nfunction ShardPieceBody({\n item,\n material,\n}: {\n item: SpawnedShardState;\n material: THREE.Material;\n}): React.JSX.Element {\n const activeWorld = useActiveKolmoWorld();\n const rbRef = useRef<RapierRigidBody | null>(null);\n const spawnPoseRef = useRef({ pos: item.worldPos, quat: item.worldQuat });\n\n useEffect(() => {\n const entity = activeWorld.spawn(\n FloatingBodyTrait({\n id: item.spec.id,\n getBody: () => rbRef.current,\n }),\n );\n const rb = rbRef.current;\n if (rb) {\n rb.setLinvel({ x: item.linvel[0], y: item.linvel[1], z: item.linvel[2] }, true);\n rb.setAngvel({ x: item.angvel[0], y: item.angvel[1], z: item.angvel[2] }, true);\n }\n return () => {\n entity.destroy();\n };\n }, [activeWorld, item]);\n\n const halfExtents: [number, number, number] = [\n Math.max(0.01, item.spec.halfExtents[0] * SHARD_COLLIDER_INSET),\n Math.max(0.01, item.spec.halfExtents[1] * SHARD_COLLIDER_INSET),\n Math.max(0.01, item.spec.halfExtents[2] * SHARD_COLLIDER_INSET),\n ];\n\n const userData = useMemo(\n () => ({\n toolgunId: item.spec.id,\n ecctrl: { excludeCharacterRay: true },\n }),\n [item.spec.id],\n );\n\n return (\n <RigidBody\n ref={rbRef}\n type=\"dynamic\"\n colliders={false}\n position={spawnPoseRef.current.pos}\n quaternion={spawnPoseRef.current.quat}\n restitution={0.18}\n friction={0.8}\n linearDamping={0.45}\n angularDamping={0.45}\n userData={userData}\n >\n <CuboidCollider args={halfExtents} density={item.density} />\n <mesh geometry={item.spec.geometry} material={material} castShadow receiveShadow />\n </RigidBody>\n );\n}\n\n/**\n * Portals dynamic Rapier shatter fragments directly into the root `THREE.Scene` so world-space\n * `worldPos`/`worldQuat` are never double-transformed by translated or rotated parent `<group>`s,\n * and registers `FloatingBodyTrait` for zero-drift floating-origin rebasing.\n */\nexport function ShardPieces({ shards, material }: ShardPiecesProps): React.JSX.Element | null {\n const scene = useThree((s) => s.scene);\n\n useEffect(\n () => () => {\n for (const s of shards)\n s.spec.geometry.dispose();\n },\n [shards],\n );\n\n useEffect(\n () => () => {\n material?.dispose();\n },\n [material],\n );\n\n if (!material || shards.length === 0)\n return null;\n\n return createPortal(\n <group name=\"Kolmo_WorldShardPieces\">\n {shards.map((item) => (\n <ShardPieceBody key={item.spec.id} item={item} material={material} />\n ))}\n </group>,\n scene,\n );\n}\n"],"mappings":";;;;;;;;AAYA,SAAS,eAAe,EACpB,MACA,YAIkB;CAClB,MAAM,cAAc,oBAAoB;CACxC,MAAM,QAAQ,OAA+B,IAAI;CACjD,MAAM,eAAe,OAAO;EAAE,KAAK,KAAK;EAAU,MAAM,KAAK;CAAU,CAAC;CAExE,gBAAgB;EACZ,MAAM,SAAS,YAAY,MACvB,kBAAkB;GACd,IAAI,KAAK,KAAK;GACd,eAAe,MAAM;EACzB,CAAC,CACL;EACA,MAAM,KAAK,MAAM;EACjB,IAAI,IAAI;GACJ,GAAG,UAAU;IAAE,GAAG,KAAK,OAAO;IAAI,GAAG,KAAK,OAAO;IAAI,GAAG,KAAK,OAAO;GAAG,GAAG,IAAI;GAC9E,GAAG,UAAU;IAAE,GAAG,KAAK,OAAO;IAAI,GAAG,KAAK,OAAO;IAAI,GAAG,KAAK,OAAO;GAAG,GAAG,IAAI;EAClF;EACA,aAAa;GACT,OAAO,QAAQ;EACnB;CACJ,GAAG,CAAC,aAAa,IAAI,CAAC;CAEtB,MAAM,cAAwC;EAC1C,KAAK,IAAI,KAAM,KAAK,KAAK,YAAY,KAAK,oBAAoB;EAC9D,KAAK,IAAI,KAAM,KAAK,KAAK,YAAY,KAAK,oBAAoB;EAC9D,KAAK,IAAI,KAAM,KAAK,KAAK,YAAY,KAAK,oBAAoB;CAClE;CAEA,MAAM,WAAW,eACN;EACH,WAAW,KAAK,KAAK;EACrB,QAAQ,EAAE,qBAAqB,KAAK;CACxC,IACA,CAAC,KAAK,KAAK,EAAE,CACjB;CAEA,OACI,qBAAC,WAAD;EACI,KAAK;EACL,MAAK;EACL,WAAW;EACX,UAAU,aAAa,QAAQ;EAC/B,YAAY,aAAa,QAAQ;EACjC,aAAa;EACb,UAAU;EACV,eAAe;EACf,gBAAgB;EACN;EAVd,UAAA,CAYI,oBAAC,gBAAD;GAAgB,MAAM;GAAa,SAAS,KAAK;EAAU,CAAA,GAC3D,oBAAC,QAAD;GAAM,UAAU,KAAK,KAAK;GAAoB;GAAU,YAAA;GAAW,eAAA;EAAe,CAAA,CAC3E;;AAEnB;;;;;;AAOA,SAAgB,YAAY,EAAE,QAAQ,YAAwD;CAC1F,MAAM,QAAQ,UAAU,MAAM,EAAE,KAAK;CAErC,sBACgB;EACR,KAAK,MAAM,KAAK,QACZ,EAAE,KAAK,SAAS,QAAQ;CAChC,GACA,CAAC,MAAM,CACX;CAEA,sBACgB;EACR,UAAU,QAAQ;CACtB,GACA,CAAC,QAAQ,CACb;CAEA,IAAI,CAAC,YAAY,OAAO,WAAW,GAC/B,OAAO;CAEX,OAAO,aACH,oBAAC,SAAD;EAAO,MAAK;EACP,UAAA,OAAO,KAAK,SACT,oBAAC,gBAAD;GAAyC;GAAgB;EAAW,GAA/C,KAAK,KAAK,EAAqC,CACvE;CACE,CAAA,GACP,KACJ;AACJ"}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as THREE from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
3
3
|
import type { DecalRecord } from "./junkTypes.js";
|
|
4
|
-
/**
|
|
5
|
-
* Generates and caches a crisp procedural bullet-hole CanvasTexture (SRGBColorSpace).
|
|
6
|
-
* Returns null safely in non-DOM SSR environments.
|
|
7
|
-
*/
|
|
8
4
|
export declare function getBulletHoleTexture(): THREE.CanvasTexture | null;
|
|
9
|
-
export declare function
|
|
10
|
-
|
|
11
|
-
decals: ReadonlyArray<DecalRecord>;
|
|
5
|
+
export declare function TargetDecals({ decals, lodKey, meshRefMap, }: {
|
|
6
|
+
decals: readonly DecalRecord[];
|
|
12
7
|
lodKey?: string;
|
|
13
|
-
meshRefMap?:
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Renders local-space bullet-hole decals on a target mesh (or via explicit meshRefMap for multi-mesh GLBs).
|
|
17
|
-
*/
|
|
18
|
-
export declare function TargetDecals({ decals, lodKey, meshRefMap, }: TargetDecalsProps): import("react").JSX.Element | null;
|
|
8
|
+
meshRefMap?: Map<string, React.RefObject<THREE.Mesh | null>>;
|
|
9
|
+
}): React.JSX.Element | null;
|
|
@@ -1,51 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import { createPortal
|
|
4
|
-
import { Decal
|
|
5
|
-
import { Fragment
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { createPortal } from "@react-three/fiber";
|
|
4
|
+
import { Decal } from "@react-three/drei";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
// src/junk/TargetDecals.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (typeof document
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
var cachedHoleTex = null;
|
|
8
|
+
function getBulletHoleTexture() {
|
|
9
|
+
if (typeof document === "undefined") return null;
|
|
10
|
+
if (cachedHoleTex) return cachedHoleTex;
|
|
11
|
+
const canvas = document.createElement("canvas");
|
|
12
|
+
canvas.width = 128;
|
|
13
|
+
canvas.height = 128;
|
|
14
|
+
const ctx = canvas.getContext("2d");
|
|
15
|
+
if (!ctx) return null;
|
|
16
|
+
ctx.clearRect(0, 0, 128, 128);
|
|
17
|
+
const grad = ctx.createRadialGradient(64, 64, 8, 64, 64, 54);
|
|
18
|
+
grad.addColorStop(0, "rgba(15, 15, 18, 0.92)");
|
|
19
|
+
grad.addColorStop(.45, "rgba(39, 39, 42, 0.55)");
|
|
20
|
+
grad.addColorStop(1, "rgba(24, 24, 27, 0)");
|
|
21
|
+
ctx.fillStyle = grad;
|
|
22
|
+
ctx.beginPath();
|
|
23
|
+
ctx.arc(64, 64, 54, 0, Math.PI * 2);
|
|
24
|
+
ctx.fill();
|
|
25
|
+
ctx.strokeStyle = "rgba(24, 24, 27, 0.85)";
|
|
26
|
+
ctx.lineWidth = 2.5;
|
|
27
|
+
for (let i = 0; i < 8; i++) {
|
|
28
|
+
const a = i / 8 * Math.PI * 2 + .25;
|
|
29
|
+
ctx.beginPath();
|
|
30
|
+
ctx.moveTo(64 + Math.cos(a) * 16, 64 + Math.sin(a) * 16);
|
|
31
|
+
ctx.lineTo(64 + Math.cos(a) * 44, 64 + Math.sin(a) * 44);
|
|
32
|
+
ctx.stroke();
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
ctx.beginPath();
|
|
35
|
+
ctx.arc(64, 64, 21, 0, Math.PI * 2);
|
|
36
|
+
ctx.fillStyle = "#94a3b8";
|
|
37
|
+
ctx.fill();
|
|
38
|
+
ctx.beginPath();
|
|
39
|
+
ctx.arc(64, 64, 15, 0, Math.PI * 2);
|
|
40
|
+
ctx.fillStyle = "#09090b";
|
|
41
|
+
ctx.fill();
|
|
42
|
+
const tex = new THREE.CanvasTexture(canvas);
|
|
43
|
+
tex.colorSpace = THREE.SRGBColorSpace;
|
|
44
|
+
tex.flipY = true;
|
|
45
|
+
tex.needsUpdate = true;
|
|
46
|
+
cachedHoleTex = tex;
|
|
47
|
+
return tex;
|
|
25
48
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
function TargetDecals({ decals, lodKey = "default", meshRefMap }) {
|
|
50
|
+
const holeTex = useMemo(() => getBulletHoleTexture(), []);
|
|
51
|
+
if (decals.length === 0) return null;
|
|
52
|
+
return /* @__PURE__ */ jsx(Fragment, { children: decals.map((d) => {
|
|
53
|
+
const node = /* @__PURE__ */ jsx(Decal, {
|
|
54
|
+
position: d.position,
|
|
55
|
+
rotation: d.rotation,
|
|
32
56
|
scale: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
d.scale,
|
|
58
|
+
d.scale,
|
|
59
|
+
d.scale * 1.4
|
|
36
60
|
],
|
|
37
|
-
depthTest:
|
|
61
|
+
depthTest: true,
|
|
38
62
|
polygonOffsetFactor: -4,
|
|
39
|
-
"material-depthWrite":
|
|
63
|
+
"material-depthWrite": false,
|
|
40
64
|
raycast: () => null,
|
|
41
|
-
userData: { isDecal:
|
|
42
|
-
map:
|
|
65
|
+
userData: { isDecal: true },
|
|
66
|
+
map: holeTex ?? void 0
|
|
43
67
|
});
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
return
|
|
68
|
+
if (meshRefMap) {
|
|
69
|
+
const targetMesh = meshRefMap.get(d.id)?.current;
|
|
70
|
+
return targetMesh ? /* @__PURE__ */ jsx(React.Fragment, { children: createPortal(node, targetMesh) }, `${d.id}-${lodKey}`) : null;
|
|
47
71
|
}
|
|
48
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: node }, `${d.id}-${lodKey}`);
|
|
49
73
|
}) });
|
|
50
74
|
}
|
|
51
|
-
export {
|
|
75
|
+
export { TargetDecals, getBulletHoleTexture };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=TargetDecals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TargetDecals.js","names":["_Fragment"],"sources":["../../src/junk/TargetDecals.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { createPortal } from \"@react-three/fiber\";\nimport { Decal } from \"@react-three/drei\";\nimport * as THREE from \"three\";\nimport type { DecalRecord } from \"./junkTypes.js\";\n\nlet cachedHoleTex: THREE.CanvasTexture | null = null;\n\nexport function getBulletHoleTexture(): THREE.CanvasTexture | null {\n if (typeof document === \"undefined\")\n return null;\n if (cachedHoleTex)\n return cachedHoleTex;\n const canvas = document.createElement(\"canvas\");\n canvas.width = 128;\n canvas.height = 128;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx)\n return null;\n ctx.clearRect(0, 0, 128, 128);\n const grad = ctx.createRadialGradient(64, 64, 8, 64, 64, 54);\n grad.addColorStop(0, \"rgba(15, 15, 18, 0.92)\");\n grad.addColorStop(0.45, \"rgba(39, 39, 42, 0.55)\");\n grad.addColorStop(1, \"rgba(24, 24, 27, 0)\");\n ctx.fillStyle = grad;\n ctx.beginPath();\n ctx.arc(64, 64, 54, 0, Math.PI * 2);\n ctx.fill();\n ctx.strokeStyle = \"rgba(24, 24, 27, 0.85)\";\n ctx.lineWidth = 2.5;\n for (let i = 0; i < 8; i++) {\n const a = (i / 8) * Math.PI * 2 + 0.25;\n ctx.beginPath();\n ctx.moveTo(64 + Math.cos(a) * 16, 64 + Math.sin(a) * 16);\n ctx.lineTo(64 + Math.cos(a) * 44, 64 + Math.sin(a) * 44);\n ctx.stroke();\n }\n ctx.beginPath();\n ctx.arc(64, 64, 21, 0, Math.PI * 2);\n ctx.fillStyle = \"#94a3b8\";\n ctx.fill();\n ctx.beginPath();\n ctx.arc(64, 64, 15, 0, Math.PI * 2);\n ctx.fillStyle = \"#09090b\";\n ctx.fill();\n const tex = new THREE.CanvasTexture(canvas);\n tex.colorSpace = THREE.SRGBColorSpace;\n tex.flipY = true;\n tex.needsUpdate = true;\n cachedHoleTex = tex;\n return tex;\n}\n\nexport function TargetDecals({\n decals,\n lodKey = \"default\",\n meshRefMap,\n}: {\n decals: readonly DecalRecord[];\n lodKey?: string;\n meshRefMap?: Map<string, React.RefObject<THREE.Mesh | null>>;\n}): React.JSX.Element | null {\n const holeTex = useMemo(() => getBulletHoleTexture(), []);\n if (decals.length === 0)\n return null;\n return (\n <>\n {decals.map((d) => {\n const node = (\n <Decal\n position={d.position}\n rotation={d.rotation}\n scale={[d.scale, d.scale, d.scale * 1.4]}\n depthTest\n polygonOffsetFactor={-4}\n material-depthWrite={false}\n raycast={() => null}\n userData={{ isDecal: true }}\n map={holeTex ?? undefined}\n />\n );\n if (meshRefMap) {\n const targetMesh = meshRefMap.get(d.id)?.current;\n return targetMesh ? <React.Fragment key={`${d.id}-${lodKey}`}>{createPortal(node, targetMesh)}</React.Fragment> : null;\n }\n return <React.Fragment key={`${d.id}-${lodKey}`}>{node}</React.Fragment>;\n })}\n </>\n );\n}\n"],"mappings":";;;;;;AAMA,IAAI,gBAA4C;AAEhD,SAAgB,uBAAmD;CAC/D,IAAI,OAAO,aAAa,aACpB,OAAO;CACX,IAAI,eACA,OAAO;CACX,MAAM,SAAS,SAAS,cAAc,QAAQ;CAC9C,OAAO,QAAQ;CACf,OAAO,SAAS;CAChB,MAAM,MAAM,OAAO,WAAW,IAAI;CAClC,IAAI,CAAC,KACD,OAAO;CACX,IAAI,UAAU,GAAG,GAAG,KAAK,GAAG;CAC5B,MAAM,OAAO,IAAI,qBAAqB,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE;CAC3D,KAAK,aAAa,GAAG,wBAAwB;CAC7C,KAAK,aAAa,KAAM,wBAAwB;CAChD,KAAK,aAAa,GAAG,qBAAqB;CAC1C,IAAI,YAAY;CAChB,IAAI,UAAU;CACd,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC;CAClC,IAAI,KAAK;CACT,IAAI,cAAc;C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EAAA,UAA2C,aAAa,MAAM,UAAU,EAAkB,GAArE,GAAG,EAAE,GAAG,GAAG,QAA0D,IAAI;EACtH;EACA,OAAO,oBAAC,MAAM,UAAP,EAAA,UAA2C,KAAqB,GAA3C,GAAG,EAAE,GAAG,GAAG,QAAgC;CAC3E,CAAC,EACH,CAAA;AAEV"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import * as THREE from
|
|
1
|
+
import * as THREE from "three";
|
|
2
2
|
import type { ShardSpec } from "./junkTypes.js";
|
|
3
|
-
|
|
4
|
-
* Splits any single- or multi-mesh Object3D into independent centroid-centered
|
|
5
|
-
* BVH shard geometries ready for Rapier dynamic RigidBodies + CuboidColliders.
|
|
6
|
-
*/
|
|
7
|
-
export declare function splitObjectIntoShards(rootObj: THREE.Object3D, targetPieces: number): ShardSpec[];
|
|
3
|
+
export declare function splitObjectIntoShards(root: THREE.Object3D, pieceCount: number): ShardSpec[];
|
package/dist/junk/bvhShatter.js
CHANGED
|
@@ -1,55 +1,101 @@
|
|
|
1
|
-
import { collectValidTris
|
|
2
|
-
import * as
|
|
1
|
+
import { collectValidTris } from "./bvhTriCollector.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
3
|
// src/junk/bvhShatter.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var MIN_HALF_EXTENT = .015;
|
|
5
|
+
function partitionTris(tris, start, count, targetShards) {
|
|
6
|
+
if (targetShards <= 1 || count <= 1) return [[start, count]];
|
|
7
|
+
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
8
|
+
let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
|
|
9
|
+
for (let i = start; i < start + count; i++) {
|
|
10
|
+
const t = tris[i];
|
|
11
|
+
if (t.minX < minX) minX = t.minX;
|
|
12
|
+
if (t.minY < minY) minY = t.minY;
|
|
13
|
+
if (t.minZ < minZ) minZ = t.minZ;
|
|
14
|
+
if (t.maxX > maxX) maxX = t.maxX;
|
|
15
|
+
if (t.maxY > maxY) maxY = t.maxY;
|
|
16
|
+
if (t.maxZ > maxZ) maxZ = t.maxZ;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
const sx = maxX - minX;
|
|
19
|
+
const sy = maxY - minY;
|
|
20
|
+
const sz = maxZ - minZ;
|
|
21
|
+
const axis = sx >= sy && sx >= sz ? 0 : sy >= sz ? 1 : 2;
|
|
22
|
+
const slice = tris.slice(start, start + count);
|
|
23
|
+
slice.sort((a, b) => axis === 0 ? a.cx - b.cx : axis === 1 ? a.cy - b.cy : a.cz - b.cz);
|
|
24
|
+
for (let i = 0; i < count; i++) tris[start + i] = slice[i];
|
|
25
|
+
const leftShards = Math.floor(targetShards / 2);
|
|
26
|
+
const rightShards = targetShards - leftShards;
|
|
27
|
+
const leftCount = Math.max(1, Math.min(count - 1, Math.round(leftShards / targetShards * count)));
|
|
28
|
+
return [...partitionTris(tris, start, leftCount, leftShards), ...partitionTris(tris, start + leftCount, count - leftCount, rightShards)];
|
|
17
29
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
function splitObjectIntoShards(root, pieceCount) {
|
|
31
|
+
const tris = collectValidTris(root);
|
|
32
|
+
if (tris.length === 0) return [];
|
|
33
|
+
const clampedPieces = Math.max(1, Math.min(Math.round(Number.isFinite(pieceCount) ? pieceCount : 6), tris.length));
|
|
34
|
+
const ranges = partitionTris(tris, 0, tris.length, clampedPieces);
|
|
35
|
+
const vols = [];
|
|
36
|
+
let totalVol = 0;
|
|
37
|
+
const specs = ranges.map(([start, count], idx) => {
|
|
38
|
+
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
39
|
+
let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
|
|
40
|
+
for (let i = start; i < start + count; i++) {
|
|
41
|
+
const t = tris[i];
|
|
42
|
+
if (t.minX < minX) minX = t.minX;
|
|
43
|
+
if (t.minY < minY) minY = t.minY;
|
|
44
|
+
if (t.minZ < minZ) minZ = t.minZ;
|
|
45
|
+
if (t.maxX > maxX) maxX = t.maxX;
|
|
46
|
+
if (t.maxY > maxY) maxY = t.maxY;
|
|
47
|
+
if (t.maxZ > maxZ) maxZ = t.maxZ;
|
|
26
48
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
const cx = (minX + maxX) * .5;
|
|
50
|
+
const cy = (minY + maxY) * .5;
|
|
51
|
+
const cz = (minZ + maxZ) * .5;
|
|
52
|
+
const pos = new Float32Array(count * 9);
|
|
53
|
+
const norm = new Float32Array(count * 9);
|
|
54
|
+
const uv = new Float32Array(count * 6);
|
|
55
|
+
for (let i = 0; i < count; i++) {
|
|
56
|
+
const tri = tris[start + i];
|
|
57
|
+
const base = i * 9;
|
|
58
|
+
for (let k = 0; k < 3; k++) {
|
|
59
|
+
pos[base + k * 3] = tri.p[k * 3] - cx;
|
|
60
|
+
pos[base + k * 3 + 1] = tri.p[k * 3 + 1] - cy;
|
|
61
|
+
pos[base + k * 3 + 2] = tri.p[k * 3 + 2] - cz;
|
|
62
|
+
norm[base + k * 3] = tri.n[k * 3];
|
|
63
|
+
norm[base + k * 3 + 1] = tri.n[k * 3 + 1];
|
|
64
|
+
norm[base + k * 3 + 2] = tri.n[k * 3 + 2];
|
|
65
|
+
}
|
|
66
|
+
uv.set(tri.uv, i * 6);
|
|
32
67
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
68
|
+
const geo = new THREE.BufferGeometry();
|
|
69
|
+
geo.setAttribute("position", new THREE.Float32BufferAttribute(pos, 3));
|
|
70
|
+
geo.setAttribute("normal", new THREE.Float32BufferAttribute(norm, 3));
|
|
71
|
+
geo.setAttribute("uv", new THREE.Float32BufferAttribute(uv, 2));
|
|
72
|
+
geo.computeBoundingBox();
|
|
73
|
+
geo.computeBoundingSphere();
|
|
74
|
+
const hx = Math.max(MIN_HALF_EXTENT, (maxX - minX) * .5);
|
|
75
|
+
const hy = Math.max(MIN_HALF_EXTENT, (maxY - minY) * .5);
|
|
76
|
+
const hz = Math.max(MIN_HALF_EXTENT, (maxZ - minZ) * .5);
|
|
77
|
+
const vol = 8 * hx * hy * hz;
|
|
78
|
+
vols.push(vol);
|
|
79
|
+
totalVol += vol;
|
|
80
|
+
return {
|
|
81
|
+
id: `shard_${idx}`,
|
|
82
|
+
geometry: geo,
|
|
39
83
|
centroid: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
84
|
+
cx,
|
|
85
|
+
cy,
|
|
86
|
+
cz
|
|
43
87
|
],
|
|
44
88
|
halfExtents: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
89
|
+
hx,
|
|
90
|
+
hy,
|
|
91
|
+
hz
|
|
48
92
|
],
|
|
49
|
-
volumeFraction: 1 /
|
|
93
|
+
volumeFraction: 1 / ranges.length
|
|
50
94
|
};
|
|
51
95
|
});
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
96
|
+
if (totalVol > 0) for (let i = 0; i < specs.length; i++) specs[i].volumeFraction = vols[i] / totalVol;
|
|
97
|
+
return specs;
|
|
54
98
|
}
|
|
55
|
-
export {
|
|
99
|
+
export { splitObjectIntoShards };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=bvhShatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvhShatter.js","names":[],"sources":["../../src/junk/bvhShatter.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { collectValidTris, type ShardTri } from \"./bvhTriCollector.js\";\nimport type { ShardSpec } from \"./junkTypes.js\";\n\nconst MIN_HALF_EXTENT = 0.015;\n\nfunction partitionTris(tris: ShardTri[], start: number, count: number, targetShards: number): Array<[number, number]> {\n if (targetShards <= 1 || count <= 1)\n return [[start, count]];\n let minX = Infinity, minY = Infinity, minZ = Infinity;\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\n for (let i = start; i < start + count; i++) {\n const t = tris[i];\n if (t.minX < minX) minX = t.minX;\n if (t.minY < minY) minY = t.minY;\n if (t.minZ < minZ) minZ = t.minZ;\n if (t.maxX > maxX) maxX = t.maxX;\n if (t.maxY > maxY) maxY = t.maxY;\n if (t.maxZ > maxZ) maxZ = t.maxZ;\n }\n const sx = maxX - minX;\n const sy = maxY - minY;\n const sz = maxZ - minZ;\n const axis = sx >= sy && sx >= sz ? 0 : sy >= sz ? 1 : 2;\n const slice = tris.slice(start, start + count);\n slice.sort((a, b) => (axis === 0 ? a.cx - b.cx : axis === 1 ? a.cy - b.cy : a.cz - b.cz));\n for (let i = 0; i < count; i++)\n tris[start + i] = slice[i];\n\n const leftShards = Math.floor(targetShards / 2);\n const rightShards = targetShards - leftShards;\n const leftCount = Math.max(1, Math.min(count - 1, Math.round((leftShards / targetShards) * count)));\n return [\n ...partitionTris(tris, start, leftCount, leftShards),\n ...partitionTris(tris, start + leftCount, count - leftCount, rightShards),\n ];\n}\n\nexport function splitObjectIntoShards(root: THREE.Object3D, pieceCount: number): ShardSpec[] {\n const tris = collectValidTris(root);\n if (tris.length === 0)\n return [];\n const clampedPieces = Math.max(1, Math.min(Math.round(Number.isFinite(pieceCount) ? pieceCount : 6), tris.length));\n const ranges = partitionTris(tris, 0, tris.length, clampedPieces);\n const vols: number[] = [];\n let totalVol = 0;\n\n const specs: ShardSpec[] = ranges.map(([start, count], idx) => {\n let minX = Infinity, minY = Infinity, minZ = Infinity;\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\n for (let i = start; i < start + count; i++) {\n const t = tris[i];\n if (t.minX < minX) minX = t.minX;\n if (t.minY < minY) minY = t.minY;\n if (t.minZ < minZ) minZ = t.minZ;\n if (t.maxX > maxX) maxX = t.maxX;\n if (t.maxY > maxY) maxY = t.maxY;\n if (t.maxZ > maxZ) maxZ = t.maxZ;\n }\n const cx = (minX + maxX) * 0.5;\n const cy = (minY + maxY) * 0.5;\n const cz = (minZ + maxZ) * 0.5;\n const pos = new Float32Array(count * 9);\n const norm = new Float32Array(count * 9);\n const uv = new Float32Array(count * 6);\n for (let i = 0; i < count; i++) {\n const tri = tris[start + i];\n const base = i * 9;\n for (let k = 0; k < 3; k++) {\n pos[base + k * 3] = tri.p[k * 3] - cx;\n pos[base + k * 3 + 1] = tri.p[k * 3 + 1] - cy;\n pos[base + k * 3 + 2] = tri.p[k * 3 + 2] - cz;\n norm[base + k * 3] = tri.n[k * 3];\n norm[base + k * 3 + 1] = tri.n[k * 3 + 1];\n norm[base + k * 3 + 2] = tri.n[k * 3 + 2];\n }\n uv.set(tri.uv, i * 6);\n }\n const geo = new THREE.BufferGeometry();\n geo.setAttribute(\"position\", new THREE.Float32BufferAttribute(pos, 3));\n geo.setAttribute(\"normal\", new THREE.Float32BufferAttribute(norm, 3));\n geo.setAttribute(\"uv\", new THREE.Float32BufferAttribute(uv, 2));\n geo.computeBoundingBox();\n geo.computeBoundingSphere();\n\n const hx = Math.max(MIN_HALF_EXTENT, (maxX - minX) * 0.5);\n const hy = Math.max(MIN_HALF_EXTENT, (maxY - minY) * 0.5);\n const hz = Math.max(MIN_HALF_EXTENT, (maxZ - minZ) * 0.5);\n const vol = 8 * hx * hy * hz;\n vols.push(vol);\n totalVol += vol;\n return {\n id: `shard_${idx}`,\n geometry: geo,\n centroid: [cx, cy, cz],\n halfExtents: [hx, hy, hz],\n volumeFraction: 1 / ranges.length,\n };\n });\n\n if (totalVol > 0) {\n for (let i = 0; i < specs.length; i++)\n specs[i].volumeFraction = vols[i] / totalVol;\n }\n return specs;\n}\n"],"mappings":";;;AAIA,IAAM,kBAAkB;AAExB,SAAS,cAAc,MAAkB,OAAe,OAAe,cAA+C;CAClH,IAAI,gBAA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: [number, number, number, number, number, number, number, number, number];
|
|
4
4
|
n: [number, number, number, number, number, number, number, number, number];
|
|
@@ -13,8 +13,4 @@ export interface ShardTri {
|
|
|
13
13
|
maxY: number;
|
|
14
14
|
maxZ: number;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
* Collects valid root-space triangles from destructible meshes inside rootObj,
|
|
18
|
-
* skipping decals, gizmos, ShaderMaterials, and non-finite/degenerate triangles.
|
|
19
|
-
*/
|
|
20
|
-
export declare function collectValidTris(rootObj: THREE.Object3D): ShardTri[];
|
|
16
|
+
export declare function collectValidTris(root: THREE.Object3D): ShardTri[];
|