@pinkaphant/kolmo 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +36 -36
- package/bin/kolmo.mjs +12 -6
- 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 +242 -165
- 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 +140 -205
- 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 -100
- 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 -240
- 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 +4 -1
- package/dist/engine/kolmoVehicleDriver.js +116 -22
- 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 -116
- 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 +9 -1
- package/dist/importer/ChopShopPanel.js +303 -359
- 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 -0
- package/dist/importer/GateHudBar.js +290 -279
- package/dist/importer/GateHudBar.js.map +1 -0
- package/dist/importer/GlbImportGate.d.ts +2 -1
- package/dist/importer/GlbImportGate.js +252 -225
- 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 -5
- package/dist/importer/Step1CalibrationPlinth.js +180 -251
- 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 -7
- package/dist/importer/Step2UniversalPad.js +49 -170
- 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 -26
- package/dist/importer/chopShopActions.js +135 -210
- 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 +1 -1
- package/dist/importer/gateStore.js +36 -27
- package/dist/importer/gateStore.js.map +1 -0
- package/dist/importer/glbNormalizer.js +118 -79
- package/dist/importer/glbNormalizer.js.map +1 -0
- package/dist/importer/importerWebMcp.d.ts +4 -3
- package/dist/importer/importerWebMcp.js +41 -336
- 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 +4 -0
- package/dist/importer/index.js +32 -22
- 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 -22
- package/dist/importer/khrCompiler.js +56 -424
- 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 -35
- package/dist/importer/launcherBake.js.map +1 -0
- package/dist/importer/meshIslands.d.ts +4 -46
- package/dist/importer/meshIslands.js +84 -283
- 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 +4 -15
- package/dist/importer/surfaceCutter.js +69 -240
- 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 +2 -6
- package/dist/importer/surfaceTopology.js +93 -133
- package/dist/importer/surfaceTopology.js.map +1 -0
- package/dist/importer/universalGateBake.d.ts +7 -3
- package/dist/importer/universalGateBake.js +104 -106
- 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 -280
- package/dist/importer/usdToGlb.js.map +1 -0
- package/dist/importer/useChopShopController.d.ts +50 -47
- package/dist/importer/useChopShopController.js +156 -338
- 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.js +106 -70
- 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 -66
- 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 -1
- package/dist/physics/index.js +79 -58
- 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 -211
- package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -19
- package/dist/importer/ImporterPlinthUikitTags.js +0 -112
- package/dist/importer/vehiclePanelAnim.js +0 -214
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { CHOP_ROLES } from "./surfaceTopology.js";
|
|
2
|
+
import { computeChopPartHinge } from "./chopHingeHelpers.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
import { Line } from "@react-three/drei";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/importer/Step1ExplodedIslands.tsx
|
|
8
|
+
var PART_COLORS = Object.fromEntries(CHOP_ROLES.filter((c) => c.role !== "wheel").map((c) => [c.role, c.color]));
|
|
9
|
+
function Step1ExplodedIslands(p) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
+
p.islands.map((isl) => {
|
|
12
|
+
const wheelTint = p.wheelColors.get(isl.id);
|
|
13
|
+
const role = wheelTint ? void 0 : p.partPicks[isl.id];
|
|
14
|
+
const tint = wheelTint ?? (role ? PART_COLORS[role] : void 0);
|
|
15
|
+
if (wheelTint && p.wheelSource === "fleet12") return null;
|
|
16
|
+
let explode = [
|
|
17
|
+
0,
|
|
18
|
+
0,
|
|
19
|
+
0
|
|
20
|
+
];
|
|
21
|
+
let anchor = [
|
|
22
|
+
0,
|
|
23
|
+
0,
|
|
24
|
+
0
|
|
25
|
+
];
|
|
26
|
+
const quat = new THREE.Quaternion();
|
|
27
|
+
if (role && (p.hingeScrub > 0 || p.explodeAmount > 0)) {
|
|
28
|
+
const h = computeChopPartHinge(isl, role);
|
|
29
|
+
anchor = h.anchor;
|
|
30
|
+
if (p.hingeScrub > 0) quat.setFromAxisAngle(new THREE.Vector3(...h.axis).normalize(), h.openAngle * p.hingeScrub);
|
|
31
|
+
if (p.explodeAmount > 0) explode = [
|
|
32
|
+
h.explodeDir[0] * p.explodeAmount,
|
|
33
|
+
h.explodeDir[1] * p.explodeAmount,
|
|
34
|
+
h.explodeDir[2] * p.explodeAmount
|
|
35
|
+
];
|
|
36
|
+
} else if (wheelTint && p.explodeAmount > 0) explode = [
|
|
37
|
+
Math.sign(isl.center[0] || 1) * p.explodeAmount * .65,
|
|
38
|
+
0,
|
|
39
|
+
0
|
|
40
|
+
];
|
|
41
|
+
return /* @__PURE__ */ jsx("group", {
|
|
42
|
+
position: [
|
|
43
|
+
anchor[0] + explode[0],
|
|
44
|
+
anchor[1] + explode[1],
|
|
45
|
+
anchor[2] + explode[2]
|
|
46
|
+
],
|
|
47
|
+
quaternion: quat,
|
|
48
|
+
children: /* @__PURE__ */ jsxs("group", {
|
|
49
|
+
position: [
|
|
50
|
+
-anchor[0],
|
|
51
|
+
-anchor[1],
|
|
52
|
+
-anchor[2]
|
|
53
|
+
],
|
|
54
|
+
children: [/* @__PURE__ */ jsx("mesh", {
|
|
55
|
+
geometry: isl.geometry,
|
|
56
|
+
material: isl.material,
|
|
57
|
+
onClick: (e) => {
|
|
58
|
+
if (e.delta > 5) return;
|
|
59
|
+
if (p.surfaceMode === "island") {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
p.onClickIsland(isl.id);
|
|
62
|
+
} else if (p.surfaceMode !== "triangle") p.onEmitPick(e, isl.id, false);
|
|
63
|
+
},
|
|
64
|
+
onContextMenu: (e) => {
|
|
65
|
+
if (p.surfaceMode !== "island") p.onEmitPick(e, isl.id, false);
|
|
66
|
+
},
|
|
67
|
+
onPointerDown: (e) => {
|
|
68
|
+
if (p.surfaceMode === "triangle" && (e.button === 0 || e.button === 2)) {
|
|
69
|
+
p.draggingRef.current = true;
|
|
70
|
+
p.onEmitPick(e, isl.id, false);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
onPointerMove: (e) => {
|
|
74
|
+
if (p.surfaceMode === "triangle" && p.draggingRef.current) p.onEmitPick(e, isl.id, true);
|
|
75
|
+
}
|
|
76
|
+
}), tint && /* @__PURE__ */ jsx("mesh", {
|
|
77
|
+
geometry: isl.geometry,
|
|
78
|
+
raycast: () => null,
|
|
79
|
+
children: /* @__PURE__ */ jsx("meshBasicMaterial", {
|
|
80
|
+
color: tint,
|
|
81
|
+
transparent: true,
|
|
82
|
+
opacity: .38,
|
|
83
|
+
depthWrite: false
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
}, isl.id);
|
|
88
|
+
}),
|
|
89
|
+
p.fleetWheels.map((fw) => /* @__PURE__ */ jsx("primitive", {
|
|
90
|
+
object: fw.group,
|
|
91
|
+
position: [
|
|
92
|
+
fw.pos[0] + Math.sign(fw.pos[0] || 1) * p.explodeAmount * .65,
|
|
93
|
+
fw.pos[1],
|
|
94
|
+
fw.pos[2]
|
|
95
|
+
]
|
|
96
|
+
}, fw.key)),
|
|
97
|
+
p.primaryOverlayGeo && /* @__PURE__ */ jsx("mesh", {
|
|
98
|
+
geometry: p.primaryOverlayGeo,
|
|
99
|
+
raycast: () => null,
|
|
100
|
+
children: /* @__PURE__ */ jsx("meshBasicMaterial", {
|
|
101
|
+
color: p.activeRoleColor,
|
|
102
|
+
transparent: true,
|
|
103
|
+
opacity: .62,
|
|
104
|
+
side: THREE.DoubleSide,
|
|
105
|
+
depthWrite: false
|
|
106
|
+
})
|
|
107
|
+
}),
|
|
108
|
+
p.mirrorOverlayGeo && /* @__PURE__ */ jsx("mesh", {
|
|
109
|
+
geometry: p.mirrorOverlayGeo,
|
|
110
|
+
raycast: () => null,
|
|
111
|
+
children: /* @__PURE__ */ jsx("meshBasicMaterial", {
|
|
112
|
+
color: "#00E5FF",
|
|
113
|
+
transparent: true,
|
|
114
|
+
opacity: .48,
|
|
115
|
+
side: THREE.DoubleSide,
|
|
116
|
+
depthWrite: false
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
p.loopDots?.points.map((pt, idx) => /* @__PURE__ */ jsxs("mesh", {
|
|
120
|
+
position: [
|
|
121
|
+
pt[0],
|
|
122
|
+
pt[1],
|
|
123
|
+
pt[2]
|
|
124
|
+
],
|
|
125
|
+
raycast: () => null,
|
|
126
|
+
children: [/* @__PURE__ */ jsx("sphereGeometry", { args: [
|
|
127
|
+
.032,
|
|
128
|
+
10,
|
|
129
|
+
10
|
|
130
|
+
] }), /* @__PURE__ */ jsx("meshBasicMaterial", {
|
|
131
|
+
color: idx === 0 ? "#10B981" : "#FFB000",
|
|
132
|
+
depthTest: false
|
|
133
|
+
})]
|
|
134
|
+
}, `dot_${idx}`)),
|
|
135
|
+
p.loopPolyline && p.loopPolyline.length >= 2 && /* @__PURE__ */ jsx(Line, {
|
|
136
|
+
points: p.loopPolyline,
|
|
137
|
+
color: "#FFB000",
|
|
138
|
+
lineWidth: 2.5
|
|
139
|
+
})
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
export { Step1ExplodedIslands };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=Step1ExplodedIslands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step1ExplodedIslands.js","names":["_Fragment"],"sources":["../../src/importer/Step1ExplodedIslands.tsx"],"sourcesContent":["import React from \"react\";\nimport * as THREE from \"three\";\nimport { Line } from \"@react-three/drei\";\nimport type { ThreeEvent } from \"@react-three/fiber\";\nimport type { MeshIsland } from \"./meshIslands.js\";\nimport type { ChopPartRole, CutVec3, SurfaceSelectMode } from \"./surfaceCutter.js\";\nimport { CHOP_ROLES } from \"./surfaceTopology.js\";\nimport { computeChopPartHinge } from \"./chopHingeHelpers.js\";\n\nconst PART_COLORS: Record<string, string> = Object.fromEntries(\n CHOP_ROLES.filter((c) => c.role !== \"wheel\").map((c) => [c.role, c.color]),\n);\n\nexport interface Step1ExplodedIslandsProps {\n readonly islands: readonly MeshIsland[];\n readonly wheelColors: ReadonlyMap<number, string>;\n readonly partPicks: Readonly<Record<number, ChopPartRole>>;\n readonly wheelSource: \"imported\" | \"fleet12\";\n readonly surfaceMode: SurfaceSelectMode;\n readonly activeRoleColor: string;\n readonly hingeScrub: number;\n readonly explodeAmount: number;\n readonly fleetWheels: readonly { key: string; pos: [number, number, number]; group: THREE.Group }[];\n readonly primaryOverlayGeo: THREE.BufferGeometry | null;\n readonly mirrorOverlayGeo: THREE.BufferGeometry | null;\n readonly loopDots: { readonly islandId: number; readonly points: readonly CutVec3[] } | null;\n readonly loopPolyline: readonly [number, number, number][] | null;\n readonly draggingRef: React.MutableRefObject<boolean>;\n readonly onClickIsland: (id: number) => void;\n readonly onEmitPick: (ev: ThreeEvent<PointerEvent | MouseEvent>, islandId: number, isDrag: boolean) => void;\n}\n\nexport function Step1ExplodedIslands(p: Step1ExplodedIslandsProps): React.JSX.Element {\n return (\n <>\n {p.islands.map((isl) => {\n const wheelTint = p.wheelColors.get(isl.id);\n const role = wheelTint ? undefined : p.partPicks[isl.id];\n const tint = wheelTint ?? (role ? PART_COLORS[role] : undefined);\n if (wheelTint && p.wheelSource === \"fleet12\") return null;\n\n let explode: [number, number, number] = [0, 0, 0];\n let anchor: [number, number, number] = [0, 0, 0];\n const quat = new THREE.Quaternion();\n if (role && (p.hingeScrub > 0 || p.explodeAmount > 0)) {\n const h = computeChopPartHinge(isl, role);\n anchor = h.anchor;\n if (p.hingeScrub > 0) {\n quat.setFromAxisAngle(new THREE.Vector3(...h.axis).normalize(), h.openAngle * p.hingeScrub);\n }\n if (p.explodeAmount > 0) {\n explode = [\n h.explodeDir[0] * p.explodeAmount,\n h.explodeDir[1] * p.explodeAmount,\n h.explodeDir[2] * p.explodeAmount,\n ];\n }\n } else if (wheelTint && p.explodeAmount > 0) {\n explode = [Math.sign(isl.center[0] || 1) * p.explodeAmount * 0.65, 0, 0];\n }\n\n return (\n <group\n key={isl.id}\n position={[anchor[0] + explode[0], anchor[1] + explode[1], anchor[2] + explode[2]]}\n quaternion={quat}\n >\n <group position={[-anchor[0], -anchor[1], -anchor[2]]}>\n <mesh\n geometry={isl.geometry}\n material={isl.material}\n onClick={(e) => {\n if (e.delta > 5) return;\n if (p.surfaceMode === \"island\") {\n e.stopPropagation();\n p.onClickIsland(isl.id);\n } else if (p.surfaceMode !== \"triangle\") {\n p.onEmitPick(e, isl.id, false);\n }\n }}\n onContextMenu={(e) => {\n if (p.surfaceMode !== \"island\") p.onEmitPick(e, isl.id, false);\n }}\n onPointerDown={(e) => {\n if (p.surfaceMode === \"triangle\" && (e.button === 0 || e.button === 2)) {\n p.draggingRef.current = true;\n p.onEmitPick(e, isl.id, false);\n }\n }}\n onPointerMove={(e) => {\n if (p.surfaceMode === \"triangle\" && p.draggingRef.current) p.onEmitPick(e, isl.id, true);\n }}\n />\n {tint && (\n <mesh geometry={isl.geometry} raycast={() => null}>\n <meshBasicMaterial color={tint} transparent opacity={0.38} depthWrite={false} />\n </mesh>\n )}\n </group>\n </group>\n );\n })}\n\n {p.fleetWheels.map((fw) => (\n <primitive\n key={fw.key}\n object={fw.group}\n position={[fw.pos[0] + Math.sign(fw.pos[0] || 1) * p.explodeAmount * 0.65, fw.pos[1], fw.pos[2]]}\n />\n ))}\n\n {p.primaryOverlayGeo && (\n <mesh geometry={p.primaryOverlayGeo} raycast={() => null}>\n <meshBasicMaterial color={p.activeRoleColor} transparent opacity={0.62} side={THREE.DoubleSide} depthWrite={false} />\n </mesh>\n )}\n {p.mirrorOverlayGeo && (\n <mesh geometry={p.mirrorOverlayGeo} raycast={() => null}>\n <meshBasicMaterial color=\"#00E5FF\" transparent opacity={0.48} side={THREE.DoubleSide} depthWrite={false} />\n </mesh>\n )}\n\n {p.loopDots?.points.map((pt, idx) => (\n <mesh key={`dot_${idx}`} position={[pt[0], pt[1], pt[2]]} raycast={() => null}>\n <sphereGeometry args={[0.032, 10, 10]} />\n <meshBasicMaterial color={idx === 0 ? \"#10B981\" : \"#FFB000\"} depthTest={false} />\n </mesh>\n ))}\n {p.loopPolyline && p.loopPolyline.length >= 2 && <Line points={p.loopPolyline} color=\"#FFB000\" lineWidth={2.5} />}\n </>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type * as THREE from "three";
|
|
3
|
+
import type { ThreeEvent } from "@react-three/fiber";
|
|
2
4
|
import { type KhrAssetBundle } from "@khr3/core";
|
|
5
|
+
import type { KhrVehicleJointsHandle } from "@khr3/core/vehicle";
|
|
3
6
|
import type { PaperShellAssembly } from "@khr3/vehicles/paper-shell";
|
|
4
|
-
import
|
|
5
|
-
import * as THREE from "three";
|
|
6
|
-
import { type KolmoAuthoredNodePatch } from "../schema/kolmoSchema.js";
|
|
7
|
-
import { type VehiclePanelAnimator } from "./khrCompiler.js";
|
|
7
|
+
import type { KolmoAuthoredNodePatch } from "../schema/kolmoSchema.js";
|
|
8
8
|
export interface Step2UniversalPadProps {
|
|
9
9
|
readonly assembly: PaperShellAssembly;
|
|
10
10
|
readonly importedRoot: THREE.Object3D | null;
|
|
@@ -12,7 +12,7 @@ export interface Step2UniversalPadProps {
|
|
|
12
12
|
readonly liveBundle: KhrAssetBundle | null;
|
|
13
13
|
readonly patches: readonly KolmoAuthoredNodePatch[];
|
|
14
14
|
readonly stampActive: boolean;
|
|
15
|
-
readonly
|
|
15
|
+
readonly panelJointsRef: React.MutableRefObject<KhrVehicleJointsHandle | null>;
|
|
16
16
|
readonly onStampSurface: (e: ThreeEvent<MouseEvent>) => void;
|
|
17
17
|
}
|
|
18
|
-
export declare function Step2UniversalPad({ assembly, importedRoot, rootObjRef, liveBundle, patches, stampActive,
|
|
18
|
+
export declare function Step2UniversalPad({ assembly, importedRoot, rootObjRef, liveBundle, patches, stampActive, panelJointsRef, onStampSurface, }: Step2UniversalPadProps): React.JSX.Element;
|
|
@@ -1,153 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import * as d from "three";
|
|
9
|
-
import { useFrame as f } from "@react-three/fiber";
|
|
10
|
-
import { KhrAssembly as p, PhysicsWorld as m, cloneKhrBundle as h } from "@khr3/core";
|
|
11
|
-
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
12
|
-
import { CuboidCollider as v, RigidBody as y } from "@react-three/rapier";
|
|
13
|
-
import { KhrVehicle as b } from "@khr3/core/vehicle";
|
|
14
|
-
import { easing as x } from "maath";
|
|
1
|
+
import { ImperativeVehicleRig } from "./ImperativeVehicleRig.js";
|
|
2
|
+
import { LiveAssemblyPad, LiveDriveVehiclePad } from "./LiveDrivePads.js";
|
|
3
|
+
import { useGateStore } from "./gateStore.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { PhysicsWorld } from "@khr3/core";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CuboidCollider, RigidBody } from "@react-three/rapier";
|
|
15
8
|
// src/importer/Step2UniversalPad.tsx
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
a: !1,
|
|
22
|
-
d: !1,
|
|
23
|
-
space: !1,
|
|
24
|
-
shift: !1
|
|
25
|
-
}), A = u(new d.Vector3(0, 1, 4)), j = u({
|
|
26
|
-
...t(),
|
|
27
|
-
throttle: 0,
|
|
28
|
-
boost: 0,
|
|
29
|
-
brake: 0,
|
|
30
|
-
headlight: 1,
|
|
31
|
-
always: 1
|
|
32
|
-
}), M = l(() => h(e), [e]), N = l(() => o(p), [p]), P = l(() => s(M), [M]);
|
|
33
|
-
return c(() => (_.current = P, () => {
|
|
34
|
-
_.current === P && (_.current = null);
|
|
35
|
-
}), [P, _]), c(() => {
|
|
36
|
-
i.massKg = M.totalDynamicMass, i.com = [...M.centerOfMass];
|
|
37
|
-
let e = (e) => (t) => {
|
|
38
|
-
(t.code === "KeyW" || t.code === "ArrowUp") && (k.current.w = e), (t.code === "KeyS" || t.code === "ArrowDown") && (k.current.s = e), (t.code === "KeyA" || t.code === "ArrowLeft") && (k.current.a = e), (t.code === "KeyD" || t.code === "ArrowRight") && (k.current.d = e), t.code === "Space" && (k.current.space = e), (t.code === "ShiftLeft" || t.code === "ShiftRight") && (k.current.shift = e);
|
|
39
|
-
}, t = e(!0), n = e(!1);
|
|
40
|
-
return window.addEventListener("keydown", t), window.addEventListener("keyup", n), () => {
|
|
41
|
-
window.removeEventListener("keydown", t), window.removeEventListener("keyup", n);
|
|
42
|
-
};
|
|
43
|
-
}, [M]), f((e, t) => {
|
|
44
|
-
let n = Math.min(Math.max(t, 1e-4), .05);
|
|
45
|
-
P.step(n);
|
|
46
|
-
let o = y.current;
|
|
47
|
-
if (!o?.body) return;
|
|
48
|
-
let s = a.getState().dropTrigger;
|
|
49
|
-
s !== O.current && (O.current = s, o.body.setTranslation({
|
|
50
|
-
x: 0,
|
|
51
|
-
y: 1.35,
|
|
52
|
-
z: 0
|
|
53
|
-
}, !0), o.body.setRotation({
|
|
54
|
-
x: 0,
|
|
55
|
-
y: 0,
|
|
56
|
-
z: 0,
|
|
57
|
-
w: 1
|
|
58
|
-
}, !0), o.body.setLinvel({
|
|
59
|
-
x: 0,
|
|
60
|
-
y: 0,
|
|
61
|
-
z: 0
|
|
62
|
-
}, !0), o.body.setAngvel({
|
|
63
|
-
x: 0,
|
|
64
|
-
y: 0,
|
|
65
|
-
z: 0
|
|
66
|
-
}, !0));
|
|
67
|
-
let c = k.current;
|
|
68
|
-
r === "starcraft" ? o.setMovement({
|
|
69
|
-
pitchForward: c.w,
|
|
70
|
-
pitchBackward: c.s,
|
|
71
|
-
yawLeft: c.a,
|
|
72
|
-
yawRight: c.d,
|
|
73
|
-
throttleUp: c.space
|
|
74
|
-
}) : (o.setMovement({
|
|
75
|
-
forward: c.w,
|
|
76
|
-
backward: c.s,
|
|
77
|
-
steerLeft: c.a,
|
|
78
|
-
steerRight: c.d,
|
|
79
|
-
brake: c.space
|
|
80
|
-
}), c.shift && c.w && o.body.applyImpulse(E.copy(o.bodyZAxis).multiplyScalar(o.body.mass() * 6.2 * n), !0));
|
|
81
|
-
let l = j.current;
|
|
82
|
-
l.throttle = +!!c.w, l.boost = c.w && c.shift ? 1 : 0, l.brake = c.space || c.s ? 1 : 0, i.speedKmh = o.currLinVel.length() * 3.6, i.rpm = Math.max(850, o.engineRPM), D && !m && (S.copy(o.bodyZAxis).projectOnPlane(C), S.lengthSq() < 1e-6 ? S.set(0, 0, 1) : S.normalize(), w.copy(o.currPos).addScaledVector(S, -6.8).addScaledVector(C, 2.25), T.copy(o.currPos).addScaledVector(S, 3.5).addScaledVector(C, .65), x.damp3(e.camera.position, w, .14, n), x.damp3(A.current, T, .08, n), e.camera.lookAt(A.current));
|
|
83
|
-
}), /* @__PURE__ */ g("group", {
|
|
84
|
-
onClick: (e) => {
|
|
85
|
-
m ? v(e) : e.delta <= 5 && P.toggleHitObject(e.object) && e.stopPropagation();
|
|
86
|
-
},
|
|
87
|
-
children: /* @__PURE__ */ g(b, {
|
|
88
|
-
ref: y,
|
|
89
|
-
bundle: M,
|
|
90
|
-
position: [
|
|
91
|
-
0,
|
|
92
|
-
r === "starcraft" ? 1.4 : .35,
|
|
93
|
-
0
|
|
94
|
-
],
|
|
95
|
-
children: /* @__PURE__ */ g(n, {
|
|
96
|
-
emitters: N,
|
|
97
|
-
signalsRef: j
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function O({ bundle: r, domain: s, staticProp: d, patches: f, onStampSurface: m }) {
|
|
103
|
-
let v = u(null), y = u(!1), b = a((e) => e.dropTrigger), x = u({
|
|
104
|
-
...t(),
|
|
105
|
-
throttle: .9,
|
|
106
|
-
boost: 1,
|
|
107
|
-
brake: 1,
|
|
108
|
-
headlight: 1,
|
|
109
|
-
fire: 1,
|
|
110
|
-
always: 1
|
|
111
|
-
}), S = l(() => h(r), [r, b]), C = l(() => o(f), [f]), w = s === "c12" || s === "prop" && d;
|
|
112
|
-
return c(() => {
|
|
113
|
-
i.massKg = S.totalDynamicMass, i.com = [...S.centerOfMass], i.speedKmh = 0;
|
|
114
|
-
}, [S]), /* @__PURE__ */ _("group", {
|
|
115
|
-
onClick: (t) => {
|
|
116
|
-
m(t), y.current = e(v.current, S, y.current);
|
|
117
|
-
},
|
|
118
|
-
children: [/* @__PURE__ */ g(p, {
|
|
119
|
-
ref: v,
|
|
120
|
-
bundle: S,
|
|
121
|
-
position: [
|
|
122
|
-
0,
|
|
123
|
-
w ? 0 : 1.2,
|
|
124
|
-
0
|
|
125
|
-
],
|
|
126
|
-
fixedRoot: w
|
|
127
|
-
}, `asm_${b}`), /* @__PURE__ */ g(n, {
|
|
128
|
-
emitters: C,
|
|
129
|
-
signalsRef: x
|
|
130
|
-
})]
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches: o, stampActive: s, panelAnimRef: c, onStampSurface: l }) {
|
|
134
|
-
let u = a((e) => e.domain), d = a((e) => e.vehicleArchetype), f = a((e) => e.usePaperShellProxy), p = a((e) => e.staticProp);
|
|
135
|
-
return /* @__PURE__ */ _(m, {
|
|
9
|
+
function Step2UniversalPad({ assembly, importedRoot, rootObjRef, liveBundle, patches, stampActive, panelJointsRef, onStampSurface }) {
|
|
10
|
+
const domain = useGateStore((s) => s.domain);
|
|
11
|
+
const usePaperShellProxy = useGateStore((s) => s.usePaperShellProxy);
|
|
12
|
+
const staticProp = useGateStore((s) => s.staticProp);
|
|
13
|
+
return /* @__PURE__ */ jsxs(PhysicsWorld, {
|
|
136
14
|
gravity: [
|
|
137
15
|
0,
|
|
138
16
|
-9.81,
|
|
139
17
|
0
|
|
140
18
|
],
|
|
141
19
|
children: [
|
|
142
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ jsx(RigidBody, {
|
|
143
21
|
type: "fixed",
|
|
144
22
|
position: [
|
|
145
23
|
0,
|
|
146
24
|
-.25,
|
|
147
25
|
0
|
|
148
26
|
],
|
|
149
|
-
colliders:
|
|
150
|
-
children: /* @__PURE__ */
|
|
27
|
+
colliders: false,
|
|
28
|
+
children: /* @__PURE__ */ jsx(CuboidCollider, {
|
|
151
29
|
args: [
|
|
152
30
|
180,
|
|
153
31
|
.25,
|
|
@@ -156,7 +34,7 @@ function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches
|
|
|
156
34
|
friction: .92
|
|
157
35
|
})
|
|
158
36
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ jsxs("mesh", {
|
|
160
38
|
rotation: [
|
|
161
39
|
-Math.PI * .5,
|
|
162
40
|
0,
|
|
@@ -167,13 +45,13 @@ function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches
|
|
|
167
45
|
-.004,
|
|
168
46
|
0
|
|
169
47
|
],
|
|
170
|
-
receiveShadow:
|
|
171
|
-
children: [/* @__PURE__ */
|
|
48
|
+
receiveShadow: true,
|
|
49
|
+
children: [/* @__PURE__ */ jsx("planeGeometry", { args: [360, 360] }), /* @__PURE__ */ jsx("meshStandardMaterial", {
|
|
172
50
|
color: "#11161d",
|
|
173
51
|
roughness: .95
|
|
174
52
|
})]
|
|
175
53
|
}),
|
|
176
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ jsx(RigidBody, {
|
|
177
55
|
type: "fixed",
|
|
178
56
|
position: [
|
|
179
57
|
0,
|
|
@@ -186,17 +64,17 @@ function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches
|
|
|
186
64
|
0
|
|
187
65
|
],
|
|
188
66
|
colliders: "cuboid",
|
|
189
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ jsxs("mesh", { children: [/* @__PURE__ */ jsx("boxGeometry", { args: [
|
|
190
68
|
4.4,
|
|
191
69
|
.22,
|
|
192
70
|
6.2
|
|
193
|
-
] }), /* @__PURE__ */
|
|
71
|
+
] }), /* @__PURE__ */ jsx("meshStandardMaterial", {
|
|
194
72
|
color: "#f59e0b",
|
|
195
73
|
roughness: .75,
|
|
196
|
-
flatShading:
|
|
74
|
+
flatShading: true
|
|
197
75
|
})] })
|
|
198
76
|
}),
|
|
199
|
-
[-12, 12].flatMap((
|
|
77
|
+
[-12, 12].flatMap((x) => [
|
|
200
78
|
-24,
|
|
201
79
|
-12,
|
|
202
80
|
0,
|
|
@@ -204,41 +82,42 @@ function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches
|
|
|
204
82
|
24,
|
|
205
83
|
36,
|
|
206
84
|
48
|
|
207
|
-
].map((
|
|
85
|
+
].map((z) => /* @__PURE__ */ jsxs("mesh", {
|
|
208
86
|
position: [
|
|
209
|
-
|
|
87
|
+
x,
|
|
210
88
|
.35,
|
|
211
|
-
|
|
89
|
+
z
|
|
212
90
|
],
|
|
213
|
-
children: [/* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ jsx("coneGeometry", { args: [
|
|
214
92
|
.28,
|
|
215
93
|
.7,
|
|
216
94
|
8
|
|
217
|
-
] }), /* @__PURE__ */
|
|
95
|
+
] }), /* @__PURE__ */ jsx("meshStandardMaterial", {
|
|
218
96
|
color: "#ff5a1f",
|
|
219
97
|
roughness: .6,
|
|
220
|
-
flatShading:
|
|
98
|
+
flatShading: true
|
|
221
99
|
})]
|
|
222
|
-
}, `cone_${
|
|
223
|
-
|
|
224
|
-
assembly
|
|
225
|
-
importedRoot
|
|
226
|
-
chassisGroupRef:
|
|
227
|
-
}) :
|
|
228
|
-
bundle:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
onStampSurface: l
|
|
100
|
+
}, `cone_${x}_${z}`))),
|
|
101
|
+
domain === "vehicle" && usePaperShellProxy ? /* @__PURE__ */ jsx(ImperativeVehicleRig, {
|
|
102
|
+
assembly,
|
|
103
|
+
importedRoot,
|
|
104
|
+
chassisGroupRef: rootObjRef
|
|
105
|
+
}) : liveBundle ? domain === "vehicle" ? /* @__PURE__ */ jsx(LiveDriveVehiclePad, {
|
|
106
|
+
bundle: liveBundle,
|
|
107
|
+
patches,
|
|
108
|
+
stampActive,
|
|
109
|
+
panelJointsRef,
|
|
110
|
+
onStampSurface
|
|
111
|
+
}) : /* @__PURE__ */ jsx(LiveAssemblyPad, {
|
|
112
|
+
bundle: liveBundle,
|
|
113
|
+
domain,
|
|
114
|
+
staticProp,
|
|
115
|
+
patches,
|
|
116
|
+
onStampSurface
|
|
240
117
|
}) : null
|
|
241
118
|
]
|
|
242
119
|
});
|
|
243
120
|
}
|
|
244
|
-
export {
|
|
121
|
+
export { Step2UniversalPad };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=Step2UniversalPad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step2UniversalPad.js","names":[],"sources":["../../src/importer/Step2UniversalPad.tsx"],"sourcesContent":["import React from \"react\";\nimport type * as THREE from \"three\";\nimport type { ThreeEvent } from \"@react-three/fiber\";\nimport { CuboidCollider, RigidBody } from \"@react-three/rapier\";\nimport { PhysicsWorld, type KhrAssetBundle } from \"@khr3/core\";\nimport type { KhrVehicleJointsHandle } from \"@khr3/core/vehicle\";\nimport type { PaperShellAssembly } from \"@khr3/vehicles/paper-shell\";\nimport type { KolmoAuthoredNodePatch } from \"../schema/kolmoSchema.js\";\nimport { ImperativeVehicleRig } from \"./ImperativeVehicleRig.js\";\nimport { LiveAssemblyPad, LiveDriveVehiclePad } from \"./LiveDrivePads.js\";\nimport { useGateStore } from \"./gateStore.js\";\n\nexport interface Step2UniversalPadProps {\n readonly assembly: PaperShellAssembly;\n readonly importedRoot: THREE.Object3D | null;\n readonly rootObjRef: React.RefObject<THREE.Group | null>;\n readonly liveBundle: KhrAssetBundle | null;\n readonly patches: readonly KolmoAuthoredNodePatch[];\n readonly stampActive: boolean;\n readonly panelJointsRef: React.MutableRefObject<KhrVehicleJointsHandle | null>;\n readonly onStampSurface: (e: ThreeEvent<MouseEvent>) => void;\n}\n\nexport function Step2UniversalPad({\n assembly,\n importedRoot,\n rootObjRef,\n liveBundle,\n patches,\n stampActive,\n panelJointsRef,\n onStampSurface,\n}: Step2UniversalPadProps): React.JSX.Element {\n const domain = useGateStore((s) => s.domain);\n const usePaperShellProxy = useGateStore((s) => s.usePaperShellProxy);\n const staticProp = useGateStore((s) => s.staticProp);\n\n return (\n <PhysicsWorld gravity={[0, -9.81, 0]}>\n <RigidBody type=\"fixed\" position={[0, -0.25, 0]} colliders={false}>\n <CuboidCollider args={[180, 0.25, 180]} friction={0.92} />\n </RigidBody>\n <mesh rotation={[-Math.PI * 0.5, 0, 0]} position={[0, -0.004, 0]} receiveShadow>\n <planeGeometry args={[360, 360]} />\n <meshStandardMaterial color=\"#11161d\" roughness={0.95} />\n </mesh>\n <RigidBody type=\"fixed\" position={[0, 0.36, 18]} rotation={[-0.19, 0, 0]} colliders=\"cuboid\">\n <mesh>\n <boxGeometry args={[4.4, 0.22, 6.2]} />\n <meshStandardMaterial color=\"#f59e0b\" roughness={0.75} flatShading />\n </mesh>\n </RigidBody>\n {[-12, 12].flatMap((x) =>\n [-24, -12, 0, 12, 24, 36, 48].map((z) => (\n <mesh key={`cone_${x}_${z}`} position={[x, 0.35, z]}>\n <coneGeometry args={[0.28, 0.7, 8]} />\n <meshStandardMaterial color=\"#ff5a1f\" roughness={0.6} flatShading />\n </mesh>\n )),\n )}\n {domain === \"vehicle\" && usePaperShellProxy ? (\n <ImperativeVehicleRig assembly={assembly} importedRoot={importedRoot} chassisGroupRef={rootObjRef} />\n ) : liveBundle ? (\n domain === \"vehicle\" ? (\n <LiveDriveVehiclePad\n bundle={liveBundle}\n patches={patches}\n stampActive={stampActive}\n panelJointsRef={panelJointsRef}\n onStampSurface={onStampSurface}\n />\n ) : (\n <LiveAssemblyPad\n bundle={liveBundle}\n domain={domain}\n staticProp={staticProp}\n patches={patches}\n onStampSurface={onStampSurface}\n />\n )\n ) : null}\n </PhysicsWorld>\n );\n}\n"],"mappings":";;;;;;;;AAuBA,SAAgB,kBAAkB,EAC9B,UACA,cACA,YACA,YACA,SACA,aACA,gBACA,kBAC0C;CAC1C,MAAM,SAAS,cAAc,MAAM,EAAE,MAAM;CAC3C,MAAM,qBAAqB,cAAc,MAAM,EAAE,kBAAkB;CACnE,MAAM,aAAa,cAAc,MAAM,EAAE,UAAU;CAEnD,OACI,qBAAC,cAAD;EAAc,SAAS;GAAC;GAAG;GAAO;EAAC;EAAnC,UAAA;GACI,oBAAC,WAAD;IAAW,MAAK;IAAQ,UAAU;KAAC;KAAG;KAAO;IAAC;IAAG,WAAW;IACxD,UAAA,oBAAC,gBAAD;KAAgB,MAAM;MAAC;MAAK;MAAM;KAAG;KAAG,UAAU;IAAO,CAAA;GAClD,CAAA;GACX,qBAAC,QAAD;IAAM,UAAU;KAAC,CAAC,KAAK,KAAK;KAAK;KAAG;IAAC;IAAG,UAAU;KAAC;KAAG;KAAQ;IAAC;IAAG,eAAA;IAAlE,UAAA,CACI,oBAAC,iBAAD,EAAe,MAAM,CAAC,KAAK,GAAG,EAAI,CAAA,GAClC,oBAAC,wBAAD;KAAsB,OAAM;KAAU,WAAW;IAAO,CAAA,CACtD;;GACN,oBAAC,WAAD;IAAW,MAAK;IAAQ,UAAU;KAAC;KAAG;KAAM;IAAE;IAAG,UAAU;KAAC;KAAO;KAAG;IAAC;IAAG,WAAU;IAChF,UAAA,qBAAC,QAAD,EAAA,UAAA,CACI,oBAAC,eAAD,EAAa,MAAM;KAAC;KAAK;KAAM;IAAG,EAAI,CAAA,GACtC,oBAAC,wBAAD;KAAsB,OAAM;KAAU,WAAW;KAAM,aAAA;IAAa,CAAA,CAClE,EAAA,CAAA;GACC,CAAA;GACV,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,MAChB;IAAC;IAAK;IAAK;IAAG;IAAI;IAAI;IAAI;GAAE,CAAC,CAAC,KAAK,MAC/B,qBAAC,QAAD;IAA6B,UAAU;KAAC;KAAG;KAAM;IAAC;IAAlD,UAAA,CACI,oBAAC,gBAAD,EAAc,MAAM;KAAC;KAAM;KAAK;IAAC,EAAI,CAAA,GACrC,oBAAC,wBAAD;KAAsB,OAAM;KAAU,WAAW;KAAK,aAAA;IAAa,CAAA,CACjE;GAHK,GAAA,QAAQ,EAAE,GAAG,GAGlB,CACT,CACL;GACC,WAAW,aAAa,qBACrB,oBAAC,sBAAD;IAAgC;IAAwB;IAAc,iBAAiB;GAAa,CAAA,IACpG,aACA,WAAW,YACP,oBAAC,qBAAD;IACI,QAAQ;IACC;IACI;IACG;IACA;GACnB,CAAA,IAED,oBAAC,iBAAD;IACI,QAAQ;IACA;IACI;IACH;IACO;GACnB,CAAA,IAEL;EACM;;AAEtB"}
|
|
@@ -1,91 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { createDefaultSignals } from "../schema/kolmoTypes.js";
|
|
2
|
+
import { KolmoEmitterRig } from "../shaders/plumeAndSparkle.js";
|
|
3
|
+
import { gateTelemetry } from "./gateStore.js";
|
|
4
|
+
import { useMemo, useRef } from "react";
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
import { useFrame } from "@react-three/fiber";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
// src/importer/VfxEmitterPool.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
function VfxEmitterPool({ chassisObjRef, emitters }) {
|
|
10
|
+
const signalsRef = useRef({
|
|
11
|
+
...createDefaultSignals(),
|
|
12
|
+
always: 1
|
|
13
|
+
});
|
|
14
|
+
const sparkTimerRef = useRef(0);
|
|
15
|
+
const decoded = useMemo(() => emitters.map((em, idx) => {
|
|
16
|
+
const obj = new THREE.Object3D();
|
|
17
|
+
obj.name = `VfxPool_${idx}`;
|
|
18
|
+
obj.position.set(em.position[0], em.position[1], em.position[2]);
|
|
19
|
+
const c = em.desc.colorStart;
|
|
20
|
+
return {
|
|
21
|
+
nodeName: obj.name,
|
|
22
|
+
object: obj,
|
|
23
|
+
localPosition: [
|
|
24
|
+
em.position[0],
|
|
25
|
+
em.position[1],
|
|
26
|
+
em.position[2]
|
|
27
|
+
],
|
|
28
|
+
localQuaternion: [
|
|
29
|
+
0,
|
|
30
|
+
0,
|
|
31
|
+
0,
|
|
32
|
+
1
|
|
33
|
+
],
|
|
34
|
+
kind: idx === 1 ? "sparkle" : "plume",
|
|
35
|
+
drive: idx === 1 ? "damage" : "throttle",
|
|
36
|
+
color: [
|
|
37
|
+
c[0] ?? 1,
|
|
38
|
+
c[1] ?? .65,
|
|
39
|
+
c[2] ?? .2
|
|
40
|
+
],
|
|
41
|
+
size: Math.max(.25, em.desc.sizeStartEnd[0] || .6)
|
|
19
42
|
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
f.makeScale(0, 0, 0), p.setRGB(1, 1, 1);
|
|
33
|
-
for (let t = 0; t < s; t++) e.setMatrixAt(t, f), e.setColorAt(t, p);
|
|
34
|
-
e.instanceMatrix.needsUpdate = !0, e.instanceColor && (e.instanceColor.needsUpdate = !0);
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
let S = (e, t, n, r, i, a, o, s, c, l, u, d, f, p) => {
|
|
38
|
-
let m = _.current;
|
|
39
|
-
_.current = m + 1 & 255;
|
|
40
|
-
let h = m * 3, g = m * 2;
|
|
41
|
-
y.pos[h] = e, y.pos[h + 1] = t, y.pos[h + 2] = n;
|
|
42
|
-
let v = o + Math.random() * (s - o);
|
|
43
|
-
y.vel[h] = (r + (Math.random() - .5) * c) * v, y.vel[h + 1] = (i + (Math.random() - .5) * c) * v + .35, y.vel[h + 2] = (a + (Math.random() - .5) * c) * v, y.age[m] = 0, y.life[m] = Math.max(.05, d), y.sizeStartEnd[g] = l, y.sizeStartEnd[g + 1] = u, y.colorStart[h] = f[0], y.colorStart[h + 1] = f[1], y.colorStart[h + 2] = f[2], y.colorEnd[h] = p[0], y.colorEnd[h + 1] = p[1], y.colorEnd[h + 2] = p[2];
|
|
44
|
-
};
|
|
45
|
-
return a((t, n) => {
|
|
46
|
-
let r = g.current;
|
|
47
|
-
if (!r) return;
|
|
48
|
-
let i = Math.min(.05, n), a = m.current;
|
|
49
|
-
a ? (a.getWorldPosition(c), a.getWorldQuaternion(d)) : (c.set(0, 0, 0), d.identity());
|
|
50
|
-
let o = h[0];
|
|
51
|
-
if (o) {
|
|
52
|
-
let t = Math.max(.15, Math.min(1, e.rpm / 6500));
|
|
53
|
-
for (v.current += o.desc.rateHz * t * i; v.current >= 1;) {
|
|
54
|
-
--v.current, l.set(o.position[0], o.position[1], o.position[2]).applyQuaternion(d).add(c), u.set(0, 0, -1).applyQuaternion(d);
|
|
55
|
-
let e = o.desc;
|
|
56
|
-
S(l.x, l.y, l.z, u.x, u.y, u.z, e.speedMinMax[0], e.speedMinMax[1], e.coneOuterAngle, e.sizeStartEnd[0], e.sizeStartEnd[1], e.lifetimeSec, e.colorStart, e.colorEnd);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
let _ = e.sparkBurst;
|
|
60
|
-
if (_ && h[1]) {
|
|
61
|
-
e.sparkBurst = null;
|
|
62
|
-
let t = h[1].desc;
|
|
63
|
-
u.set(0, 0, -1).applyQuaternion(d);
|
|
64
|
-
for (let e = 0; e < 18; e++) S(_[0], _[1], _[2], u.x, u.y + .4, u.z, t.speedMinMax[0], t.speedMinMax[1], t.coneOuterAngle, t.sizeStartEnd[0], t.sizeStartEnd[1], t.lifetimeSec, t.colorStart, t.colorEnd);
|
|
43
|
+
}), [emitters]);
|
|
44
|
+
useFrame((_, delta) => {
|
|
45
|
+
const sig = signalsRef.current;
|
|
46
|
+
sig.throttle = Math.max(.15, Math.min(1, gateTelemetry.rpm / 6500));
|
|
47
|
+
if (gateTelemetry.sparkBurst) {
|
|
48
|
+
gateTelemetry.sparkBurst = null;
|
|
49
|
+
sparkTimerRef.current = .35;
|
|
50
|
+
} else if (sparkTimerRef.current > 0) sparkTimerRef.current = Math.max(0, sparkTimerRef.current - Math.min(.05, delta));
|
|
51
|
+
sig.damage = sparkTimerRef.current > 0 ? 1 : 0;
|
|
52
|
+
const parent = chassisObjRef.current;
|
|
53
|
+
if (parent) {
|
|
54
|
+
for (const em of decoded) if (em.object.parent !== parent) parent.add(em.object);
|
|
65
55
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
f.makeScale(0, 0, 0), r.setMatrixAt(e, f);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
let a = t + i;
|
|
74
|
-
y.age[e] = a;
|
|
75
|
-
let o = Math.min(1, a / n), s = e * 3, c = e * 2;
|
|
76
|
-
y.pos[s] += y.vel[s] * i, y.pos[s + 1] += y.vel[s + 1] * i, y.pos[s + 2] += y.vel[s + 2] * i;
|
|
77
|
-
let d = y.sizeStartEnd[c] + (y.sizeStartEnd[c + 1] - y.sizeStartEnd[c]) * o;
|
|
78
|
-
l.set(y.pos[s], y.pos[s + 1], y.pos[s + 2]), u.set(d, d, d), f.compose(l, b, u), r.setMatrixAt(e, f), p.setRGB(y.colorStart[s] + (y.colorEnd[s] - y.colorStart[s]) * o, y.colorStart[s + 1] + (y.colorEnd[s + 1] - y.colorStart[s + 1]) * o, y.colorStart[s + 2] + (y.colorEnd[s + 2] - y.colorStart[s + 2]) * o), r.setColorAt(e, p);
|
|
79
|
-
}
|
|
80
|
-
r.instanceMatrix.needsUpdate = !0, r.instanceColor && (r.instanceColor.needsUpdate = !0);
|
|
81
|
-
}), /* @__PURE__ */ o("instancedMesh", {
|
|
82
|
-
ref: g,
|
|
83
|
-
args: [
|
|
84
|
-
b,
|
|
85
|
-
x,
|
|
86
|
-
s
|
|
87
|
-
],
|
|
88
|
-
frustumCulled: !1
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsx(KolmoEmitterRig, {
|
|
58
|
+
emitters: decoded,
|
|
59
|
+
signalsRef
|
|
89
60
|
});
|
|
90
61
|
}
|
|
91
|
-
export {
|
|
62
|
+
export { VfxEmitterPool };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=VfxEmitterPool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VfxEmitterPool.js","names":[],"sources":["../../src/importer/VfxEmitterPool.tsx"],"sourcesContent":["import React, { useMemo, useRef } from \"react\";\nimport * as THREE from \"three\";\nimport { useFrame } from \"@react-three/fiber\";\nimport type { VfxEmitterMount } from \"@khr3/vehicles/paper-shell\";\nimport { createDefaultSignals, type DecodedKolmoEmitter, type KolmoSignalState } from \"../schema/kolmoSchema.js\";\nimport { KolmoEmitterRig } from \"../shaders/plumeAndSparkle.js\";\nimport { gateTelemetry } from \"./gateStore.js\";\n\nexport interface VfxEmitterPoolProps {\n readonly chassisObjRef: React.RefObject<THREE.Object3D | null>;\n readonly emitters: readonly VfxEmitterMount[];\n}\n\nexport function VfxEmitterPool({ chassisObjRef, emitters }: VfxEmitterPoolProps): React.JSX.Element {\n const signalsRef = useRef<KolmoSignalState>({ ...createDefaultSignals(), always: 1 });\n const sparkTimerRef = useRef(0);\n\n const decoded = useMemo<DecodedKolmoEmitter[]>(\n () =>\n emitters.map((em, idx) => {\n const obj = new THREE.Object3D();\n obj.name = `VfxPool_${idx}`;\n obj.position.set(em.position[0], em.position[1], em.position[2]);\n const c = em.desc.colorStart;\n return {\n nodeName: obj.name,\n object: obj,\n localPosition: [em.position[0], em.position[1], em.position[2]],\n localQuaternion: [0, 0, 0, 1],\n kind: idx === 1 ? \"sparkle\" : \"plume\",\n drive: idx === 1 ? \"damage\" : \"throttle\",\n color: [c[0] ?? 1, c[1] ?? 0.65, c[2] ?? 0.2],\n size: Math.max(0.25, em.desc.sizeStartEnd[0] || 0.6),\n };\n }),\n [emitters],\n );\n\n useFrame((_, delta) => {\n const sig = signalsRef.current;\n sig.throttle = Math.max(0.15, Math.min(1, gateTelemetry.rpm / 6500));\n if (gateTelemetry.sparkBurst) {\n gateTelemetry.sparkBurst = null;\n sparkTimerRef.current = 0.35;\n } else if (sparkTimerRef.current > 0) {\n sparkTimerRef.current = Math.max(0, sparkTimerRef.current - Math.min(0.05, delta));\n }\n sig.damage = sparkTimerRef.current > 0 ? 1 : 0;\n const parent = chassisObjRef.current;\n if (parent) {\n for (const em of decoded) {\n if (em.object.parent !== parent) parent.add(em.object);\n }\n }\n });\n\n return <KolmoEmitterRig emitters={decoded} signalsRef={signalsRef} />;\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,eAAe,EAAE,eAAe,YAAoD;CAChG,MAAM,aAAa,OAAyB;EAAE,GAAG,qBAAqB;EAAG,QAAQ;CAAE,CAAC;CACpF,MAAM,gBAAgB,OAAO,CAAC;CAE9B,MAAM,UAAU,cAER,SAAS,KAAK,IAAI,QAAQ;EACtB,MAAM,MAAM,IAAI,MAAM,SAAS;EAC/B,IAAI,OAAO,WAAW;EACtB,IAAI,SAAS,IAAI,GAAG,SAAS,IAAI,GAAG,SAAS,IAAI,GAAG,SAAS,EAAE;EAC/D,MAAM,IAAI,GAAG,KAAK;EAClB,OAAO;GACH,UAAU,IAAI;GACd,QAAQ;GACR,eAAe;IAAC,GAAG,SAAS;IAAI,GAAG,SAAS;IAAI,GAAG,SAAS;GAAE;GAC9D,iBAAiB;IAAC;IAAG;IAAG;IAAG;GAAC;GAC5B,MAAM,QAAQ,IAAI,YAAY;GAC9B,OAAO,QAAQ,IAAI,WAAW;GAC9B,OAAO;IAAC,EAAE,MAAM;IAAG,EAAE,MAAM;IAAM,EAAE,MAAM;GAAG;GAC5C,MAAM,KAAK,IAAI,KAAM,GAAG,KAAK,aAAa,MAAM,EAAG;EACvD;CACJ,CAAC,GACL,CAAC,QAAQ,CACb;CAEA,UAAU,GAAG,UAAU;EACnB,MAAM,MAAM,WAAW;EACvB,IAAI,WAAW,KAAK,IAAI,KAAM,KAAK,IAAI,GAAG,cAAc,MAAM,IAAI,CAAC;EACnE,IAAI,cAAc,YAAY;GAC1B,cAAc,aAAa;GAC3B,cAAc,UAAU;EAC5B,OAAO,IAAI,cAAc,UAAU,GAC/B,cAAc,UAAU,KAAK,IAAI,GAAG,cAAc,UAAU,KAAK,IAAI,KAAM,KAAK,CAAC;EAErF,IAAI,SAAS,cAAc,UAAU,IAAI,IAAI;EAC7C,MAAM,SAAS,cAAc;EAC7B,IAAI,QACK;QAAA,MAAM,MAAM,SACb,IAAI,GAAG,OAAO,WAAW,QAAQ,OAAO,IAAI,GAAG,MAAM;EAAA;CAGjE,CAAC;CAED,OAAO,oBAAC,iBAAD;EAAiB,UAAU;EAAqB;CAAa,CAAA;AACxE"}
|