@pinkaphant/kolmo 0.4.7 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -94
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/gltfLoader.d.ts +18 -0
- package/dist/engine/index.d.ts +8 -17
- package/dist/engine/index.js +667 -27
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/{kolmoInput.d.ts → input.d.ts} +8 -6
- package/dist/engine/surface.d.ts +17 -0
- package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +24 -48
- package/dist/engine/vehicle.d.ts +20 -0
- package/dist/engine/world.d.ts +76 -0
- package/dist/index.d.ts +14 -18
- package/dist/index.js +16 -116
- package/dist/physics/index.d.ts +3 -3
- package/dist/physics/index.js +1 -131
- package/dist/physics/nBodyGravity.d.ts +14 -7
- package/dist/physics-ZDFXaCli.js +475 -0
- package/dist/physics-ZDFXaCli.js.map +1 -0
- package/dist/surface-DUol_5ml.js +610 -0
- package/dist/surface-DUol_5ml.js.map +1 -0
- package/dist/toolgun/Toolgun.d.ts +33 -0
- package/dist/toolgun/index.d.ts +2 -0
- package/dist/toolgun/index.js +1 -0
- package/dist/toolgun/store.d.ts +198 -0
- package/dist/toolgun-BfcCIAQx.js +1582 -0
- package/dist/toolgun-BfcCIAQx.js.map +1 -0
- package/dist/vite/index.d.ts +0 -4
- package/dist/vite/index.js +1 -9
- package/dist/vite/index.js.map +1 -1
- package/package.json +32 -89
- package/AGENTS.md +0 -29
- package/CLAUDE.md +0 -8
- package/bin/kolmo.mjs +0 -561
- package/dist/engine/causewayBridge.d.ts +0 -14
- package/dist/engine/causewayBridge.js +0 -166
- package/dist/engine/causewayBridge.js.map +0 -1
- package/dist/engine/islandSettlementMesh.d.ts +0 -26
- package/dist/engine/islandSettlementMesh.js +0 -166
- package/dist/engine/islandSettlementMesh.js.map +0 -1
- package/dist/engine/kolmoActions.d.ts +0 -23
- package/dist/engine/kolmoActions.js +0 -179
- package/dist/engine/kolmoActions.js.map +0 -1
- package/dist/engine/kolmoActor.d.ts +0 -21
- package/dist/engine/kolmoActor.js +0 -273
- package/dist/engine/kolmoActor.js.map +0 -1
- package/dist/engine/kolmoActorHelpers.d.ts +0 -24
- package/dist/engine/kolmoActorHelpers.js +0 -64
- package/dist/engine/kolmoActorHelpers.js.map +0 -1
- package/dist/engine/kolmoBotControl.d.ts +0 -44
- package/dist/engine/kolmoBotControl.js +0 -194
- package/dist/engine/kolmoBotControl.js.map +0 -1
- package/dist/engine/kolmoBotJournal.d.ts +0 -23
- package/dist/engine/kolmoBotJournal.js +0 -138
- package/dist/engine/kolmoBotJournal.js.map +0 -1
- package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
- package/dist/engine/kolmoFloatingOrigin.js +0 -91
- package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
- package/dist/engine/kolmoGame.d.ts +0 -27
- package/dist/engine/kolmoGame.js +0 -83
- package/dist/engine/kolmoGame.js.map +0 -1
- package/dist/engine/kolmoGltfLoader.d.ts +0 -16
- package/dist/engine/kolmoGltfLoader.js +0 -46
- package/dist/engine/kolmoGltfLoader.js.map +0 -1
- package/dist/engine/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -219
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -165
- package/dist/engine/kolmoInput.js.map +0 -1
- package/dist/engine/kolmoIsland.d.ts +0 -14
- package/dist/engine/kolmoIsland.js +0 -243
- package/dist/engine/kolmoIsland.js.map +0 -1
- package/dist/engine/kolmoLongDrive.d.ts +0 -12
- package/dist/engine/kolmoLongDrive.js +0 -178
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -6
- package/dist/engine/kolmoPilotMesh.js +0 -377
- package/dist/engine/kolmoPilotMesh.js.map +0 -1
- package/dist/engine/kolmoProcedural.d.ts +0 -13
- package/dist/engine/kolmoProcedural.js +0 -101
- package/dist/engine/kolmoProcedural.js.map +0 -1
- package/dist/engine/kolmoRigs.d.ts +0 -13
- package/dist/engine/kolmoRigs.js +0 -100
- package/dist/engine/kolmoRigs.js.map +0 -1
- package/dist/engine/kolmoStore.d.ts +0 -3
- package/dist/engine/kolmoStore.js +0 -4
- package/dist/engine/kolmoStore.js.map +0 -1
- package/dist/engine/kolmoSurface.d.ts +0 -18
- package/dist/engine/kolmoSurface.js +0 -198
- package/dist/engine/kolmoSurface.js.map +0 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
- package/dist/engine/kolmoTouchOverlay.js +0 -326
- package/dist/engine/kolmoTouchOverlay.js.map +0 -1
- package/dist/engine/kolmoTouchState.d.ts +0 -50
- package/dist/engine/kolmoTouchState.js +0 -210
- package/dist/engine/kolmoTouchState.js.map +0 -1
- package/dist/engine/kolmoTraits.js +0 -140
- package/dist/engine/kolmoTraits.js.map +0 -1
- package/dist/engine/kolmoVehicle.d.ts +0 -4
- package/dist/engine/kolmoVehicle.js +0 -80
- package/dist/engine/kolmoVehicle.js.map +0 -1
- package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
- package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
- package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
- package/dist/engine/kolmoVehicleConfig.js +0 -84
- package/dist/engine/kolmoVehicleConfig.js.map +0 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
- package/dist/engine/kolmoVehicleDriver.js +0 -147
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -307
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
- package/dist/engine/kolmoWardrobeRig.js +0 -146
- package/dist/engine/kolmoWardrobeRig.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -164
- package/dist/engine/kolmoWorld.js.map +0 -1
- package/dist/engine/longDriveKit.d.ts +0 -19
- package/dist/engine/longDriveKit.js +0 -145
- package/dist/engine/longDriveKit.js.map +0 -1
- package/dist/engine/longDriveRoadside.d.ts +0 -16
- package/dist/engine/longDriveRoadside.js +0 -171
- package/dist/engine/longDriveRoadside.js.map +0 -1
- package/dist/engine/macroCellBuilder.d.ts +0 -44
- package/dist/engine/macroCellBuilder.js +0 -228
- package/dist/engine/macroCellBuilder.js.map +0 -1
- package/dist/engine/mainlandMacroCell.d.ts +0 -15
- package/dist/engine/mainlandMacroCell.js +0 -168
- package/dist/engine/mainlandMacroCell.js.map +0 -1
- package/dist/engine/shiftedFixedBody.d.ts +0 -13
- package/dist/engine/shiftedFixedBody.js +0 -75
- package/dist/engine/shiftedFixedBody.js.map +0 -1
- package/dist/importer/ChopShopPanel.d.ts +0 -52
- package/dist/importer/ChopShopPanel.js +0 -409
- package/dist/importer/ChopShopPanel.js.map +0 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
- package/dist/importer/DomainWorkshopPanel.js +0 -385
- package/dist/importer/DomainWorkshopPanel.js.map +0 -1
- package/dist/importer/GateHudBar.d.ts +0 -39
- package/dist/importer/GateHudBar.js +0 -401
- package/dist/importer/GateHudBar.js.map +0 -1
- package/dist/importer/GlbImportGate.d.ts +0 -8
- package/dist/importer/GlbImportGate.js +0 -300
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -274
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -195
- package/dist/importer/LiveDrivePads.js.map +0 -1
- package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
- package/dist/importer/PaperShellDebrisRig.js +0 -143
- package/dist/importer/PaperShellDebrisRig.js.map +0 -1
- package/dist/importer/R2VaultDrawer.d.ts +0 -12
- package/dist/importer/R2VaultDrawer.js +0 -90
- package/dist/importer/R2VaultDrawer.js.map +0 -1
- package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
- package/dist/importer/Step1CalibrationPlinth.js +0 -204
- package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
- package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
- package/dist/importer/Step1ExplodedIslands.js +0 -144
- package/dist/importer/Step1ExplodedIslands.js.map +0 -1
- package/dist/importer/Step2UniversalPad.d.ts +0 -18
- package/dist/importer/Step2UniversalPad.js +0 -123
- package/dist/importer/Step2UniversalPad.js.map +0 -1
- package/dist/importer/VfxEmitterPool.d.ts +0 -8
- package/dist/importer/VfxEmitterPool.js +0 -64
- package/dist/importer/VfxEmitterPool.js.map +0 -1
- package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
- package/dist/importer/WardrobeWorkshopPanel.js +0 -529
- package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
- package/dist/importer/WheelRingHandles3D.d.ts +0 -11
- package/dist/importer/WheelRingHandles3D.js +0 -319
- package/dist/importer/WheelRingHandles3D.js.map +0 -1
- package/dist/importer/archLinerGeom.d.ts +0 -2
- package/dist/importer/archLinerGeom.js +0 -51
- package/dist/importer/archLinerGeom.js.map +0 -1
- package/dist/importer/chopHingeHelpers.d.ts +0 -15
- package/dist/importer/chopHingeHelpers.js +0 -193
- package/dist/importer/chopHingeHelpers.js.map +0 -1
- package/dist/importer/chopShopActions.d.ts +0 -58
- package/dist/importer/chopShopActions.js +0 -165
- package/dist/importer/chopShopActions.js.map +0 -1
- package/dist/importer/chopShopHandlers.d.ts +0 -26
- package/dist/importer/chopShopHandlers.js +0 -283
- package/dist/importer/chopShopHandlers.js.map +0 -1
- package/dist/importer/chopShopIoActions.d.ts +0 -20
- package/dist/importer/chopShopIoActions.js +0 -192
- package/dist/importer/chopShopIoActions.js.map +0 -1
- package/dist/importer/chopShopMcpAction.d.ts +0 -18
- package/dist/importer/chopShopMcpAction.js +0 -58
- package/dist/importer/chopShopMcpAction.js.map +0 -1
- package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
- package/dist/importer/cylinderBooleanSlice.js +0 -110
- package/dist/importer/cylinderBooleanSlice.js.map +0 -1
- package/dist/importer/cylinderSliceMath.d.ts +0 -14
- package/dist/importer/cylinderSliceMath.js +0 -251
- package/dist/importer/cylinderSliceMath.js.map +0 -1
- package/dist/importer/fusedWheelDetect.d.ts +0 -4
- package/dist/importer/fusedWheelDetect.js +0 -297
- package/dist/importer/fusedWheelDetect.js.map +0 -1
- package/dist/importer/fusedWheelFit.d.ts +0 -19
- package/dist/importer/fusedWheelFit.js +0 -219
- package/dist/importer/fusedWheelFit.js.map +0 -1
- package/dist/importer/gateStore.d.ts +0 -73
- package/dist/importer/gateStore.js +0 -102
- package/dist/importer/gateStore.js.map +0 -1
- package/dist/importer/glbNormalizer.d.ts +0 -22
- package/dist/importer/glbNormalizer.js +0 -177
- package/dist/importer/glbNormalizer.js.map +0 -1
- package/dist/importer/importerWebMcp.d.ts +0 -51
- package/dist/importer/importerWebMcp.js +0 -50
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -368
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -29
- package/dist/importer/index.js +0 -42
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -131
- package/dist/importer/khrCarGeometryMass.js.map +0 -1
- package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
- package/dist/importer/khrCarPlanHelpers.js +0 -300
- package/dist/importer/khrCarPlanHelpers.js.map +0 -1
- package/dist/importer/khrCarPlanner.d.ts +0 -8
- package/dist/importer/khrCarPlanner.js +0 -289
- package/dist/importer/khrCarPlanner.js.map +0 -1
- package/dist/importer/khrCompiler.d.ts +0 -5
- package/dist/importer/khrCompiler.js +0 -87
- package/dist/importer/khrCompiler.js.map +0 -1
- package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
- package/dist/importer/khrCraftPropCompiler.js +0 -263
- package/dist/importer/khrCraftPropCompiler.js.map +0 -1
- package/dist/importer/khrNodeNameGuard.d.ts +0 -20
- package/dist/importer/khrNodeNameGuard.js +0 -139
- package/dist/importer/khrNodeNameGuard.js.map +0 -1
- package/dist/importer/launcherBake.d.ts +0 -15
- package/dist/importer/launcherBake.js +0 -117
- package/dist/importer/launcherBake.js.map +0 -1
- package/dist/importer/launcherCadGeometry.d.ts +0 -22
- package/dist/importer/launcherCadGeometry.js +0 -185
- package/dist/importer/launcherCadGeometry.js.map +0 -1
- package/dist/importer/meshIslands.d.ts +0 -17
- package/dist/importer/meshIslands.js +0 -102
- package/dist/importer/meshIslands.js.map +0 -1
- package/dist/importer/meshSliceBuffers.d.ts +0 -15
- package/dist/importer/meshSliceBuffers.js +0 -159
- package/dist/importer/meshSliceBuffers.js.map +0 -1
- package/dist/importer/polygonEarClipYZ.d.ts +0 -3
- package/dist/importer/polygonEarClipYZ.js +0 -67
- package/dist/importer/polygonEarClipYZ.js.map +0 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
- package/dist/importer/proceduralC12AndCraft.js +0 -302
- package/dist/importer/proceduralC12AndCraft.js.map +0 -1
- package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
- package/dist/importer/proceduralDomainBuilders.js +0 -346
- package/dist/importer/proceduralDomainBuilders.js.map +0 -1
- package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
- package/dist/importer/proceduralPersonAndProp.js +0 -303
- package/dist/importer/proceduralPersonAndProp.js.map +0 -1
- package/dist/importer/sceneSiNormalize.d.ts +0 -19
- package/dist/importer/sceneSiNormalize.js +0 -145
- package/dist/importer/sceneSiNormalize.js.map +0 -1
- package/dist/importer/starterScene.d.ts +0 -5
- package/dist/importer/starterScene.js +0 -139
- package/dist/importer/starterScene.js.map +0 -1
- package/dist/importer/surfaceCutter.d.ts +0 -16
- package/dist/importer/surfaceCutter.js +0 -83
- package/dist/importer/surfaceCutter.js.map +0 -1
- package/dist/importer/surfaceGeodesic.d.ts +0 -7
- package/dist/importer/surfaceGeodesic.js +0 -130
- package/dist/importer/surfaceGeodesic.js.map +0 -1
- package/dist/importer/surfaceLoopRefine.d.ts +0 -6
- package/dist/importer/surfaceLoopRefine.js +0 -171
- package/dist/importer/surfaceLoopRefine.js.map +0 -1
- package/dist/importer/surfacePeel.d.ts +0 -11
- package/dist/importer/surfacePeel.js +0 -119
- package/dist/importer/surfacePeel.js.map +0 -1
- package/dist/importer/surfaceTopology.d.ts +0 -36
- package/dist/importer/surfaceTopology.js +0 -143
- package/dist/importer/surfaceTopology.js.map +0 -1
- package/dist/importer/universalGateBake.d.ts +0 -45
- package/dist/importer/universalGateBake.js +0 -203
- package/dist/importer/universalGateBake.js.map +0 -1
- package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
- package/dist/importer/usdPhysicsSpecs.js +0 -245
- package/dist/importer/usdPhysicsSpecs.js.map +0 -1
- package/dist/importer/usdTextParse.d.ts +0 -12
- package/dist/importer/usdTextParse.js +0 -118
- package/dist/importer/usdTextParse.js.map +0 -1
- package/dist/importer/usdToGlb.d.ts +0 -12
- package/dist/importer/usdToGlb.js +0 -94
- package/dist/importer/usdToGlb.js.map +0 -1
- package/dist/importer/useChopShopController.d.ts +0 -110
- package/dist/importer/useChopShopController.js +0 -219
- package/dist/importer/useChopShopController.js.map +0 -1
- package/dist/importer/useChopShopState.d.ts +0 -103
- package/dist/importer/useChopShopState.js +0 -350
- package/dist/importer/useChopShopState.js.map +0 -1
- package/dist/importer/useWasdKeyRef.d.ts +0 -9
- package/dist/importer/useWasdKeyRef.js +0 -35
- package/dist/importer/useWasdKeyRef.js.map +0 -1
- package/dist/importer/vehiclePartSplit.d.ts +0 -33
- package/dist/importer/vehiclePartSplit.js +0 -183
- package/dist/importer/vehiclePartSplit.js.map +0 -1
- package/dist/importer/wardrobeAutoFit.d.ts +0 -16
- package/dist/importer/wardrobeAutoFit.js +0 -410
- package/dist/importer/wardrobeAutoFit.js.map +0 -1
- package/dist/importer/wardrobeCatalog.d.ts +0 -16
- package/dist/importer/wardrobeCatalog.js +0 -409
- package/dist/importer/wardrobeCatalog.js.map +0 -1
- package/dist/importer/wardrobeController.d.ts +0 -49
- package/dist/importer/wardrobeController.js +0 -181
- package/dist/importer/wardrobeController.js.map +0 -1
- package/dist/importer/wardrobeFitter.d.ts +0 -27
- package/dist/importer/wardrobeFitter.js +0 -269
- package/dist/importer/wardrobeFitter.js.map +0 -1
- package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
- package/dist/importer/wardrobeWebMcpTools.js +0 -198
- package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
- package/dist/importer/wheelAxlePairing.d.ts +0 -21
- package/dist/importer/wheelAxlePairing.js +0 -157
- package/dist/importer/wheelAxlePairing.js.map +0 -1
- package/dist/importer/wheelCutterHelpers.d.ts +0 -45
- package/dist/importer/wheelCutterHelpers.js +0 -208
- package/dist/importer/wheelCutterHelpers.js.map +0 -1
- package/dist/importer/wheelRingHandleMath.d.ts +0 -20
- package/dist/importer/wheelRingHandleMath.js +0 -66
- package/dist/importer/wheelRingHandleMath.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/junk/DestructibleTarget.d.ts +0 -18
- package/dist/junk/DestructibleTarget.js +0 -223
- package/dist/junk/DestructibleTarget.js.map +0 -1
- package/dist/junk/KolmoJunk.d.ts +0 -14
- package/dist/junk/KolmoJunk.js +0 -76
- package/dist/junk/KolmoJunk.js.map +0 -1
- package/dist/junk/ShardPieces.d.ts +0 -13
- package/dist/junk/ShardPieces.js +0 -101
- package/dist/junk/ShardPieces.js.map +0 -1
- package/dist/junk/TargetDecals.d.ts +0 -9
- package/dist/junk/TargetDecals.js +0 -77
- package/dist/junk/TargetDecals.js.map +0 -1
- package/dist/junk/bvhShatter.d.ts +0 -3
- package/dist/junk/bvhShatter.js +0 -101
- package/dist/junk/bvhShatter.js.map +0 -1
- package/dist/junk/bvhTriCollector.d.ts +0 -16
- package/dist/junk/bvhTriCollector.js +0 -127
- package/dist/junk/bvhTriCollector.js.map +0 -1
- package/dist/junk/index.d.ts +0 -14
- package/dist/junk/index.js +0 -13
- package/dist/junk/index.js.map +0 -1
- package/dist/junk/junkGeometry.d.ts +0 -13
- package/dist/junk/junkGeometry.js +0 -87
- package/dist/junk/junkGeometry.js.map +0 -1
- package/dist/junk/junkImportSanitize.d.ts +0 -5
- package/dist/junk/junkImportSanitize.js +0 -74
- package/dist/junk/junkImportSanitize.js.map +0 -1
- package/dist/junk/junkImporter.d.ts +0 -14
- package/dist/junk/junkImporter.js +0 -124
- package/dist/junk/junkImporter.js.map +0 -1
- package/dist/junk/junkLabelCanvas.d.ts +0 -2
- package/dist/junk/junkLabelCanvas.js +0 -185
- package/dist/junk/junkLabelCanvas.js.map +0 -1
- package/dist/junk/junkLabels.d.ts +0 -9
- package/dist/junk/junkLabels.js +0 -49
- package/dist/junk/junkLabels.js.map +0 -1
- package/dist/junk/junkProceduralScenes.d.ts +0 -12
- package/dist/junk/junkProceduralScenes.js +0 -220
- package/dist/junk/junkProceduralScenes.js.map +0 -1
- package/dist/junk/junkSheetSplitter.d.ts +0 -38
- package/dist/junk/junkSheetSplitter.js +0 -104
- package/dist/junk/junkSheetSplitter.js.map +0 -1
- package/dist/junk/junkTypes.d.ts +0 -48
- package/dist/junk/junkTypes.js +0 -0
- package/dist/junk/junkTypes.js.map +0 -1
- package/dist/junk/targetHelpers.d.ts +0 -55
- package/dist/junk/targetHelpers.js +0 -157
- package/dist/junk/targetHelpers.js.map +0 -1
- package/dist/junk/targetHitLogic.d.ts +0 -30
- package/dist/junk/targetHitLogic.js +0 -163
- package/dist/junk/targetHitLogic.js.map +0 -1
- package/dist/junk/useTargetAssets.d.ts +0 -19
- package/dist/junk/useTargetAssets.js +0 -130
- package/dist/junk/useTargetAssets.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/nBodyGravity.js +0 -70
- package/dist/physics/nBodyGravity.js.map +0 -1
- package/dist/sand3d/KolmoSand3D.d.ts +0 -19
- package/dist/sand3d/KolmoSand3D.js +0 -92
- package/dist/sand3d/KolmoSand3D.js.map +0 -1
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
- package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
- package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
- package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
- package/dist/sand3d/gateBakeHelpers.js +0 -225
- package/dist/sand3d/gateBakeHelpers.js.map +0 -1
- package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
- package/dist/sand3d/gateDoorwayBake.js +0 -203
- package/dist/sand3d/gateDoorwayBake.js.map +0 -1
- package/dist/sand3d/index.d.ts +0 -3
- package/dist/sand3d/index.js +0 -4
- package/dist/sand3d/index.js.map +0 -1
- package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
- package/dist/sand3d/sand3dAssetLoader.js +0 -177
- package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
- package/dist/schema/kolmoSchema.d.ts +0 -9
- package/dist/schema/kolmoSchema.js +0 -110
- package/dist/schema/kolmoSchema.js.map +0 -1
- package/dist/schema/kolmoStamp.d.ts +0 -11
- package/dist/schema/kolmoStamp.js +0 -119
- package/dist/schema/kolmoStamp.js.map +0 -1
- package/dist/schema/kolmoTypes.d.ts +0 -63
- package/dist/schema/kolmoTypes.js +0 -66
- package/dist/schema/kolmoTypes.js.map +0 -1
- package/dist/shaders/celestialBackdrop.d.ts +0 -14
- package/dist/shaders/celestialBackdrop.js +0 -181
- package/dist/shaders/celestialBackdrop.js.map +0 -1
- package/dist/shaders/emitterShaders.d.ts +0 -9
- package/dist/shaders/emitterShaders.js +0 -114
- package/dist/shaders/emitterShaders.js.map +0 -1
- package/dist/shaders/index.d.ts +0 -5
- package/dist/shaders/index.js +0 -12
- package/dist/shaders/index.js.map +0 -1
- package/dist/shaders/plumeAndSparkle.d.ts +0 -12
- package/dist/shaders/plumeAndSparkle.js +0 -233
- package/dist/shaders/plumeAndSparkle.js.map +0 -1
- package/dist/shaders/ps2GlslShared.d.ts +0 -20
- package/dist/shaders/ps2GlslShared.js +0 -30
- package/dist/shaders/ps2GlslShared.js.map +0 -1
- package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
- package/dist/shaders/ps2MaterialsTSL.js +0 -146
- package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
- package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
- package/dist/shaders/ps2MaterialsWebGL.js +0 -57
- package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
- package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
- package/dist/shaders/ps2RoadWebGL.js +0 -138
- package/dist/shaders/ps2RoadWebGL.js.map +0 -1
- package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
- package/dist/shaders/ps2TerrainWebGL.js +0 -131
- package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
- package/dist/shaders/ps2Textures.d.ts +0 -22
- package/dist/shaders/ps2Textures.js +0 -299
- package/dist/shaders/ps2Textures.js.map +0 -1
- package/dist/shaders/retroPalettes.d.ts +0 -24
- package/dist/shaders/retroPalettes.js +0 -221
- package/dist/shaders/retroPalettes.js.map +0 -1
- package/dist/shaders/retroShader.d.ts +0 -13
- package/dist/shaders/retroShader.js +0 -110
- package/dist/shaders/retroShader.js.map +0 -1
- package/dist/shaders/retroUniforms.d.ts +0 -60
- package/dist/shaders/retroUniforms.js +0 -215
- package/dist/shaders/retroUniforms.js.map +0 -1
- package/dist/shaders/skyboxShaders.d.ts +0 -16
- package/dist/shaders/skyboxShaders.js +0 -266
- package/dist/shaders/skyboxShaders.js.map +0 -1
- package/dist/shaders/tsl.d.ts +0 -1
- package/dist/shaders/tsl.js +0 -1
- package/dist/shaders/tsl.js.map +0 -1
- package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
- package/dist/suika/KolmoSuikaOrb.js +0 -375
- package/dist/suika/KolmoSuikaOrb.js.map +0 -1
- package/dist/suika/index.d.ts +0 -4
- package/dist/suika/index.js +0 -5
- package/dist/suika/index.js.map +0 -1
- package/dist/suika/suikaArbiter.d.ts +0 -60
- package/dist/suika/suikaArbiter.js +0 -265
- package/dist/suika/suikaArbiter.js.map +0 -1
- package/dist/suika/suikaGeometry.d.ts +0 -10
- package/dist/suika/suikaGeometry.js +0 -251
- package/dist/suika/suikaGeometry.js.map +0 -1
- package/dist/suika/suikaTypes.d.ts +0 -74
- package/dist/suika/suikaTypes.js +0 -196
- package/dist/suika/suikaTypes.js.map +0 -1
- package/dist/world/frontage.d.ts +0 -26
- package/dist/world/frontage.js +0 -36
- package/dist/world/frontage.js.map +0 -1
- package/dist/world/index.d.ts +0 -9
- package/dist/world/index.js +0 -12
- package/dist/world/index.js.map +0 -1
- package/dist/world/infiniteWorld2D.d.ts +0 -19
- package/dist/world/infiniteWorld2D.js +0 -219
- package/dist/world/infiniteWorld2D.js.map +0 -1
- package/dist/world/island.d.ts +0 -29
- package/dist/world/island.js +0 -116
- package/dist/world/island.js.map +0 -1
- package/dist/world/islandPathing.d.ts +0 -6
- package/dist/world/islandPathing.js +0 -166
- package/dist/world/islandPathing.js.map +0 -1
- package/dist/world/macroCellSchema.d.ts +0 -72
- package/dist/world/macroCellSchema.js +0 -34
- package/dist/world/macroCellSchema.js.map +0 -1
- package/dist/world/macroKnightAStar.d.ts +0 -11
- package/dist/world/macroKnightAStar.js +0 -240
- package/dist/world/macroKnightAStar.js.map +0 -1
- package/dist/world/macroSettlementZones.d.ts +0 -9
- package/dist/world/macroSettlementZones.js +0 -108
- package/dist/world/macroSettlementZones.js.map +0 -1
- package/dist/world/random.d.ts +0 -23
- package/dist/world/random.js +0 -59
- package/dist/world/random.js.map +0 -1
- package/dist/world/road.d.ts +0 -37
- package/dist/world/road.js +0 -198
- package/dist/world/road.js.map +0 -1
- package/dist/world/roadRibbon.d.ts +0 -29
- package/dist/world/roadRibbon.js +0 -166
- package/dist/world/roadRibbon.js.map +0 -1
- package/dist/world/terrain.d.ts +0 -62
- package/dist/world/terrain.js +0 -133
- package/dist/world/terrain.js.map +0 -1
- package/dist/world/terrainGeometry.d.ts +0 -14
- package/dist/world/terrainGeometry.js +0 -76
- package/dist/world/terrainGeometry.js.map +0 -1
- package/dist/world/worldTypes.d.ts +0 -43
- package/dist/world/worldTypes.js +0 -197
- package/dist/world/worldTypes.js.map +0 -1
- package/docs/api-reference.md +0 -728
- package/skills/kolmo-engine/SKILL.md +0 -109
package/dist/engine/index.js
CHANGED
|
@@ -1,27 +1,667 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { A as writeEntityKinematics, C as flipVehicleBodyUpright, D as useActiveKolmoWorld, E as pilotedVehicleQuery, O as useOptionalKootaWorld, S as ensureWorldSession, T as kolmoWorld, _ as VehicleTelemetryTrait, a as computeCircularOrbitSpeed, b as WorldSessionTrait, c as evaluatePreparedNBodyGravity, d as ActorTrait, f as InteractableTrait, g as TransformTrait, h as PilotedTag, i as G_SI, j as writeVehicleTelemetry, k as vehicleSimQuery, l as prepareAttractors, m as PilotLink, n as KolmoPhysics, o as createNBodyGravityField, p as KolmoWorldContext, r as useIsKolmoCustomGravity, s as evaluateNBodyGravity, t as KolmoGravityContext, u as resolveAttractorMu, v as VehicleTrait, w as kolmoActions, x as createEmptyVehicleCmd, y as VelocityTrait } from "../physics-ZDFXaCli.js";
|
|
2
|
+
import { a as KOLMO_KEY_MAP, c as KolmoKeyboardContext, i as EMPTY_KOLMO_INPUT, l as useKolmoInput, n as KolmoSurface, o as KOLMO_STICK_DEADZONE, r as KolmoVehicle, s as KolmoKeyboardBridge, t as KolmoProp } from "../surface-DUol_5ml.js";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
import { clone } from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
6
|
+
import { Canvas, useFrame, useThree } from "@react-three/fiber";
|
|
7
|
+
import { useRapier } from "@react-three/rapier";
|
|
8
|
+
import { WorldProvider, useQueryFirst } from "koota/react";
|
|
9
|
+
import { Ecctrl } from "@pinkaphant/ecctrl";
|
|
10
|
+
import { EcctrlCameraControls } from "@pinkaphant/ecctrl/camera";
|
|
11
|
+
import { assignRef, loadKhrGlb } from "@khr3/core";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { createPortal as createPortal$1 } from "react-dom";
|
|
14
|
+
import { KeyboardControls } from "@react-three/drei";
|
|
15
|
+
import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js";
|
|
16
|
+
import "koota";
|
|
17
|
+
import { Joystick, VirtualButton } from "@pinkaphant/ecctrl/input";
|
|
18
|
+
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
19
|
+
import { KTX2Loader } from "three/examples/jsm/loaders/KTX2Loader.js";
|
|
20
|
+
import { MeshoptDecoder } from "three/examples/jsm/libs/meshopt_decoder.module.js";
|
|
21
|
+
// src/engine/actor.tsx
|
|
22
|
+
var _seatVec = new THREE.Vector3();
|
|
23
|
+
var _camFwd = new THREE.Vector3();
|
|
24
|
+
var _worldUp = new THREE.Vector3(0, 1, 0);
|
|
25
|
+
function findNearestInteractableVehicleId(world, actorPos) {
|
|
26
|
+
let nearestId = null;
|
|
27
|
+
let bestDistSq = 1e400;
|
|
28
|
+
for (const ent of world.query(VehicleTrait, InteractableTrait)) {
|
|
29
|
+
const v = ent.get(VehicleTrait);
|
|
30
|
+
const it = ent.get(InteractableTrait);
|
|
31
|
+
if (!v?.handle || !it) continue;
|
|
32
|
+
_seatVec.set(v.seatOffset[0], v.seatOffset[1], v.seatOffset[2]).applyQuaternion(v.handle.currQuat).add(v.handle.currPos);
|
|
33
|
+
const dSq = actorPos.distanceToSquared(_seatVec);
|
|
34
|
+
if (dSq <= it.radius * it.radius && dSq < bestDistSq) {
|
|
35
|
+
bestDistSq = dSq;
|
|
36
|
+
nearestId = v.id;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return nearestId;
|
|
40
|
+
}
|
|
41
|
+
function KolmoActor({ ref, cameraRef, cameraProps, getInput, bundle, enable = true, enableCustomGravity, position = [
|
|
42
|
+
0,
|
|
43
|
+
1.4,
|
|
44
|
+
0
|
|
45
|
+
], rotation, userData, children, ...ecctrlRest }) {
|
|
46
|
+
const ctxCustomGravity = useContext(KolmoGravityContext);
|
|
47
|
+
const effCustomGravity = enableCustomGravity ?? ctxCustomGravity;
|
|
48
|
+
const activeWorld = useActiveKolmoWorld();
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
ensureWorldSession(activeWorld);
|
|
51
|
+
}, [activeWorld]);
|
|
52
|
+
const pilotedVehEnt = useQueryFirst(VehicleTrait, PilotedTag);
|
|
53
|
+
const readInput = useKolmoInput(getInput);
|
|
54
|
+
const domElement = useThree((s) => s.gl?.domElement);
|
|
55
|
+
const hasDom = Boolean(domElement && typeof domElement.addEventListener === "function");
|
|
56
|
+
const { world: rapierWorld } = useRapier();
|
|
57
|
+
const actorEntRef = useRef(null);
|
|
58
|
+
const ecctrlRef = useRef(null);
|
|
59
|
+
const camCtrlRef = useRef(null);
|
|
60
|
+
const followPos = useRef(new THREE.Vector3());
|
|
61
|
+
const followUp = useRef(new THREE.Vector3(0, 1, 0));
|
|
62
|
+
const camSyncedRef = useRef(false);
|
|
63
|
+
const prevInteractRef = useRef(false);
|
|
64
|
+
const prevNearIdRef = useRef("");
|
|
65
|
+
const cooldownRef = useRef(0);
|
|
66
|
+
const stickRef = useRef({
|
|
67
|
+
x: 0,
|
|
68
|
+
y: 0
|
|
69
|
+
});
|
|
70
|
+
const moveCmdRef = useRef({
|
|
71
|
+
forward: false,
|
|
72
|
+
backward: false,
|
|
73
|
+
leftward: false,
|
|
74
|
+
rightward: false,
|
|
75
|
+
joystick: stickRef.current,
|
|
76
|
+
run: false,
|
|
77
|
+
jump: false
|
|
78
|
+
});
|
|
79
|
+
const [latchedExit, setLatchedExit] = useState(null);
|
|
80
|
+
useLayoutEffect(() => {
|
|
81
|
+
const ent = activeWorld.spawn(ActorTrait({
|
|
82
|
+
id: "pilot",
|
|
83
|
+
handle: ecctrlRef.current,
|
|
84
|
+
exitSpawnPos: null,
|
|
85
|
+
exitSpawnYaw: 0,
|
|
86
|
+
exitLinVel: null
|
|
87
|
+
}), TransformTrait, VelocityTrait);
|
|
88
|
+
actorEntRef.current = ent;
|
|
89
|
+
const prePiloted = activeWorld.queryFirst(pilotedVehicleQuery);
|
|
90
|
+
if (prePiloted) ent.add(PilotLink(prePiloted));
|
|
91
|
+
const unsub = activeWorld.onChange(ActorTrait, (changed) => {
|
|
92
|
+
if (changed !== ent) return;
|
|
93
|
+
const d = ent.get(ActorTrait);
|
|
94
|
+
if (d?.exitSpawnPos) setLatchedExit({
|
|
95
|
+
pos: d.exitSpawnPos,
|
|
96
|
+
yaw: d.exitSpawnYaw
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
return () => {
|
|
100
|
+
unsub();
|
|
101
|
+
actorEntRef.current = null;
|
|
102
|
+
ent.destroy();
|
|
103
|
+
};
|
|
104
|
+
}, [activeWorld]);
|
|
105
|
+
const onFoot = enable && !pilotedVehEnt;
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
if (!onFoot) camSyncedRef.current = false;
|
|
108
|
+
}, [onFoot]);
|
|
109
|
+
useLayoutEffect(() => {
|
|
110
|
+
const ent = actorEntRef.current;
|
|
111
|
+
if (ent && pilotedVehEnt && !ent.has(PilotLink(pilotedVehEnt))) ent.add(PilotLink(pilotedVehEnt));
|
|
112
|
+
}, [pilotedVehEnt]);
|
|
113
|
+
const assignEcctrlRef = useCallback((handle) => {
|
|
114
|
+
ecctrlRef.current = handle;
|
|
115
|
+
assignRef(ref, handle);
|
|
116
|
+
const ent = actorEntRef.current;
|
|
117
|
+
if (!ent?.isAlive()) return;
|
|
118
|
+
const cur = ent.get(ActorTrait);
|
|
119
|
+
if (handle?.body && cur?.exitLinVel) handle.body.setLinvel({
|
|
120
|
+
x: cur.exitLinVel[0],
|
|
121
|
+
y: cur.exitLinVel[1],
|
|
122
|
+
z: cur.exitLinVel[2]
|
|
123
|
+
}, true);
|
|
124
|
+
ent.set(ActorTrait, {
|
|
125
|
+
id: cur?.id ?? "pilot",
|
|
126
|
+
handle,
|
|
127
|
+
exitSpawnPos: cur?.exitSpawnPos ?? null,
|
|
128
|
+
exitSpawnYaw: cur?.exitSpawnYaw ?? 0,
|
|
129
|
+
exitLinVel: handle?.body ? null : cur?.exitLinVel ?? null
|
|
130
|
+
});
|
|
131
|
+
}, [ref]);
|
|
132
|
+
const assignCamRef = useCallback((ctrl) => {
|
|
133
|
+
camCtrlRef.current = ctrl;
|
|
134
|
+
assignRef(cameraRef, ctrl);
|
|
135
|
+
}, [cameraRef]);
|
|
136
|
+
const mergedUserData = useMemo(() => {
|
|
137
|
+
const base = userData ?? {};
|
|
138
|
+
const ecctrlMeta = base.ecctrl ?? {};
|
|
139
|
+
return {
|
|
140
|
+
...base,
|
|
141
|
+
ecctrl: {
|
|
142
|
+
excludeVehicleRay: true,
|
|
143
|
+
...ecctrlMeta
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}, [userData]);
|
|
147
|
+
const clonedScene = useMemo(() => bundle ? clone(bundle.scene) : null, [bundle]);
|
|
148
|
+
useFrame((state, delta) => {
|
|
149
|
+
if (!enable) return;
|
|
150
|
+
const dt = rapierWorld.timestep > 0 ? rapierWorld.timestep : Math.min(Math.max(delta, 1e-4), 1 / 30);
|
|
151
|
+
if (cooldownRef.current > 0) cooldownRef.current = Math.max(0, cooldownRef.current - dt);
|
|
152
|
+
const inp = readInput();
|
|
153
|
+
const interactEdge = inp.interact && !prevInteractRef.current;
|
|
154
|
+
prevInteractRef.current = inp.interact;
|
|
155
|
+
if (activeWorld.queryFirst(pilotedVehicleQuery)) {
|
|
156
|
+
if (interactEdge && cooldownRef.current === 0) {
|
|
157
|
+
cooldownRef.current = .25;
|
|
158
|
+
kolmoActions(activeWorld).exitVehicle();
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const handle = ecctrlRef.current;
|
|
163
|
+
if (!handle?.body) return;
|
|
164
|
+
stickRef.current.x = inp.stickX;
|
|
165
|
+
stickRef.current.y = inp.stickY;
|
|
166
|
+
const cmd = moveCmdRef.current;
|
|
167
|
+
cmd.forward = inp.forward;
|
|
168
|
+
cmd.backward = inp.backward;
|
|
169
|
+
cmd.leftward = inp.left;
|
|
170
|
+
cmd.rightward = inp.right;
|
|
171
|
+
cmd.joystick = stickRef.current;
|
|
172
|
+
cmd.run = inp.boost;
|
|
173
|
+
cmd.jump = inp.brake;
|
|
174
|
+
handle.setMovement(cmd);
|
|
175
|
+
if (actorEntRef.current?.isAlive()) writeEntityKinematics(activeWorld, actorEntRef.current, handle.currPos, handle.currQuat, handle.currLinVel, handle.moveSpeed * 3.6);
|
|
176
|
+
const nearId = findNearestInteractableVehicleId(activeWorld, handle.currPos) ?? "";
|
|
177
|
+
if (nearId !== prevNearIdRef.current) {
|
|
178
|
+
prevNearIdRef.current = nearId;
|
|
179
|
+
activeWorld.set(WorldSessionTrait, { nearVehicleId: nearId });
|
|
180
|
+
}
|
|
181
|
+
if (interactEdge && nearId && cooldownRef.current === 0) {
|
|
182
|
+
cooldownRef.current = .25;
|
|
183
|
+
kolmoActions(activeWorld).boardVehicle(nearId);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const cam = camCtrlRef.current;
|
|
187
|
+
if (cam && handle.currPos.lengthSq() > 0) {
|
|
188
|
+
if (handle.upAxis.lengthSq() > .25) followUp.current.copy(handle.upAxis).normalize();
|
|
189
|
+
else followUp.current.copy(_worldUp);
|
|
190
|
+
followPos.current.copy(handle.currPos).addScaledVector(followUp.current, .55);
|
|
191
|
+
if (!camSyncedRef.current) {
|
|
192
|
+
camSyncedRef.current = true;
|
|
193
|
+
state.camera.up.copy(followUp.current);
|
|
194
|
+
cam.setUp(followUp.current);
|
|
195
|
+
_camFwd.copy(handle.bodyZAxis).projectOnPlane(followUp.current);
|
|
196
|
+
if (_camFwd.lengthSq() < 1e-4) _camFwd.set(0, 0, -1).projectOnPlane(followUp.current);
|
|
197
|
+
_camFwd.normalize();
|
|
198
|
+
cam.setLookAt(followPos.current.x - _camFwd.x * 7.5 + followUp.current.x * 2.4, followPos.current.y - _camFwd.y * 7.5 + followUp.current.y * 2.4, followPos.current.z - _camFwd.z * 7.5 + followUp.current.z * 2.4, followPos.current.x, followPos.current.y, followPos.current.z, false);
|
|
199
|
+
} else {
|
|
200
|
+
cam.moveTo(followPos.current.x, followPos.current.y, followPos.current.z, true);
|
|
201
|
+
if (effCustomGravity && state.camera.up.distanceToSquared(followUp.current) > 1e-6) {
|
|
202
|
+
state.camera.up.lerp(followUp.current, 1 - Math.exp(-8 * dt)).normalize();
|
|
203
|
+
cam.setUp(state.camera.up);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
if (!onFoot) return null;
|
|
209
|
+
const spawnPos = latchedExit?.pos ?? position;
|
|
210
|
+
const spawnRot = rotation ?? (latchedExit ? [
|
|
211
|
+
0,
|
|
212
|
+
latchedExit.yaw,
|
|
213
|
+
0
|
|
214
|
+
] : void 0);
|
|
215
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [hasDom && cameraProps !== false && cameraProps !== null && /* @__PURE__ */ jsx(EcctrlCameraControls, {
|
|
216
|
+
ref: assignCamRef,
|
|
217
|
+
makeDefault: true,
|
|
218
|
+
minPolarAngle: .12,
|
|
219
|
+
maxPolarAngle: Math.PI - .12,
|
|
220
|
+
smoothTime: .08,
|
|
221
|
+
...cameraProps ?? {}
|
|
222
|
+
}), /* @__PURE__ */ jsx(Ecctrl, {
|
|
223
|
+
ref: assignEcctrlRef,
|
|
224
|
+
enable,
|
|
225
|
+
enableCustomGravity: effCustomGravity,
|
|
226
|
+
position: spawnPos,
|
|
227
|
+
...spawnRot === void 0 ? {} : { rotation: spawnRot },
|
|
228
|
+
userData: mergedUserData,
|
|
229
|
+
...ecctrlRest,
|
|
230
|
+
children: children ?? (clonedScene ? /* @__PURE__ */ jsx("primitive", { object: clonedScene }) : null)
|
|
231
|
+
})] });
|
|
232
|
+
}
|
|
233
|
+
// src/engine/world.tsx
|
|
234
|
+
var KolmoInCanvasContext = createContext(false);
|
|
235
|
+
var KolmoOverlayPortalContext = createContext(null);
|
|
236
|
+
function RoomEnvRig({ intensity = .65 }) {
|
|
237
|
+
const { gl, scene } = useThree();
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
const pmrem = new THREE.PMREMGenerator(gl);
|
|
240
|
+
const room = new RoomEnvironment();
|
|
241
|
+
const rt = pmrem.fromScene(room, .04);
|
|
242
|
+
const prevEnv = scene.environment;
|
|
243
|
+
const prevInt = scene.environmentIntensity;
|
|
244
|
+
scene.environment = rt.texture;
|
|
245
|
+
scene.environmentIntensity = intensity;
|
|
246
|
+
room.dispose();
|
|
247
|
+
pmrem.dispose();
|
|
248
|
+
return () => {
|
|
249
|
+
scene.environment = prevEnv;
|
|
250
|
+
scene.environmentIntensity = prevInt;
|
|
251
|
+
rt.dispose();
|
|
252
|
+
};
|
|
253
|
+
}, [
|
|
254
|
+
gl,
|
|
255
|
+
scene,
|
|
256
|
+
intensity
|
|
257
|
+
]);
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
function KolmoCanvas({ children, className, style, fov = 56, near = .15, far = 4e3, cameraPosition = [
|
|
261
|
+
0,
|
|
262
|
+
3.2,
|
|
263
|
+
-8.5
|
|
264
|
+
], dpr = [1, 1.5], frameloop = "always", shadows = true, antialias = true, toneMapping, roomEnv = .65 }) {
|
|
265
|
+
return /* @__PURE__ */ jsxs(Canvas, {
|
|
266
|
+
className,
|
|
267
|
+
style: {
|
|
268
|
+
width: "100%",
|
|
269
|
+
height: "100%",
|
|
270
|
+
display: "block",
|
|
271
|
+
touchAction: "none",
|
|
272
|
+
userSelect: "none",
|
|
273
|
+
...style
|
|
274
|
+
},
|
|
275
|
+
shadows,
|
|
276
|
+
dpr,
|
|
277
|
+
frameloop,
|
|
278
|
+
gl: {
|
|
279
|
+
antialias,
|
|
280
|
+
powerPreference: "high-performance",
|
|
281
|
+
...toneMapping === void 0 ? {} : { toneMapping }
|
|
282
|
+
},
|
|
283
|
+
camera: {
|
|
284
|
+
fov,
|
|
285
|
+
near,
|
|
286
|
+
far,
|
|
287
|
+
position: cameraPosition
|
|
288
|
+
},
|
|
289
|
+
onCreated: ({ gl }) => {
|
|
290
|
+
gl.outputColorSpace = THREE.SRGBColorSpace;
|
|
291
|
+
},
|
|
292
|
+
children: [roomEnv !== false && /* @__PURE__ */ jsx(RoomEnvRig, { intensity: typeof roomEnv === "number" ? roomEnv : .65 }), children]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function KolmoWorld({ gravity = "planar", paused = false, timeScale = 1, maxDelta, physicsDebug = false, skybox = "day", lighting = "default", fogExp2, sunLightRef, world = kolmoWorld, keyboardMap = KOLMO_KEY_MAP, children }) {
|
|
296
|
+
const outerWorld = useOptionalKootaWorld();
|
|
297
|
+
const effectiveWorld = world ?? outerWorld ?? kolmoWorld;
|
|
298
|
+
useLayoutEffect(() => {
|
|
299
|
+
ensureWorldSession(effectiveWorld);
|
|
300
|
+
}, [effectiveWorld]);
|
|
301
|
+
const inner = /* @__PURE__ */ jsxs(KolmoInCanvasContext.Provider, {
|
|
302
|
+
value: true,
|
|
303
|
+
children: [
|
|
304
|
+
skybox === "day" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("color", {
|
|
305
|
+
attach: "background",
|
|
306
|
+
args: ["#6ba6d6"]
|
|
307
|
+
}), !fogExp2 && /* @__PURE__ */ jsx("fog", {
|
|
308
|
+
attach: "fog",
|
|
309
|
+
args: [
|
|
310
|
+
"#9dc4e2",
|
|
311
|
+
110,
|
|
312
|
+
520
|
|
313
|
+
]
|
|
314
|
+
})] }),
|
|
315
|
+
skybox === "night" && /* @__PURE__ */ jsx("color", {
|
|
316
|
+
attach: "background",
|
|
317
|
+
args: ["#090d16"]
|
|
318
|
+
}),
|
|
319
|
+
fogExp2 && /* @__PURE__ */ jsx("fogExp2", {
|
|
320
|
+
attach: "fog",
|
|
321
|
+
args: fogExp2
|
|
322
|
+
}),
|
|
323
|
+
lighting === "default" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hemisphereLight", { args: [
|
|
324
|
+
"#b8dcff",
|
|
325
|
+
"#241d30",
|
|
326
|
+
.8
|
|
327
|
+
] }), /* @__PURE__ */ jsx("directionalLight", {
|
|
328
|
+
ref: sunLightRef,
|
|
329
|
+
position: [
|
|
330
|
+
48,
|
|
331
|
+
76,
|
|
332
|
+
36
|
|
333
|
+
],
|
|
334
|
+
intensity: 1.85,
|
|
335
|
+
color: "#fff3dc",
|
|
336
|
+
castShadow: true,
|
|
337
|
+
"shadow-mapSize": [2048, 2048],
|
|
338
|
+
"shadow-bias": -4e-4,
|
|
339
|
+
"shadow-camera-left": -55,
|
|
340
|
+
"shadow-camera-right": 55,
|
|
341
|
+
"shadow-camera-top": 55,
|
|
342
|
+
"shadow-camera-bottom": -55,
|
|
343
|
+
"shadow-camera-near": 1,
|
|
344
|
+
"shadow-camera-far": 220
|
|
345
|
+
})] }),
|
|
346
|
+
/* @__PURE__ */ jsx(KolmoPhysics, {
|
|
347
|
+
gravity,
|
|
348
|
+
paused,
|
|
349
|
+
timeScale,
|
|
350
|
+
maxDelta,
|
|
351
|
+
physicsDebug,
|
|
352
|
+
world: effectiveWorld,
|
|
353
|
+
children
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
});
|
|
357
|
+
const withKeyboard = keyboardMap ? /* @__PURE__ */ jsx(KeyboardControls, {
|
|
358
|
+
map: keyboardMap,
|
|
359
|
+
children: /* @__PURE__ */ jsx(KolmoKeyboardBridge, { children: inner })
|
|
360
|
+
}) : /* @__PURE__ */ jsx(KolmoKeyboardContext.Provider, {
|
|
361
|
+
value: null,
|
|
362
|
+
children: inner
|
|
363
|
+
});
|
|
364
|
+
return effectiveWorld !== outerWorld ? /* @__PURE__ */ jsx(KolmoWorldContext.Provider, {
|
|
365
|
+
value: effectiveWorld,
|
|
366
|
+
children: /* @__PURE__ */ jsx(WorldProvider, {
|
|
367
|
+
world: effectiveWorld,
|
|
368
|
+
children: withKeyboard
|
|
369
|
+
})
|
|
370
|
+
}) : withKeyboard;
|
|
371
|
+
}
|
|
372
|
+
function useKolmoGame(explicitWorld) {
|
|
373
|
+
const active = useActiveKolmoWorld();
|
|
374
|
+
const targetWorld = explicitWorld ?? active;
|
|
375
|
+
const [, bump] = useReducer((x) => x + 1, 0);
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
ensureWorldSession(targetWorld);
|
|
378
|
+
const onChange = () => bump();
|
|
379
|
+
const u1 = targetWorld.onChange(WorldSessionTrait, onChange);
|
|
380
|
+
const u2 = targetWorld.onAdd(PilotedTag, onChange);
|
|
381
|
+
const u3 = targetWorld.onRemove(PilotedTag, onChange);
|
|
382
|
+
const u4 = targetWorld.onAdd(PilotLink, onChange);
|
|
383
|
+
const u5 = targetWorld.onRemove(PilotLink, onChange);
|
|
384
|
+
return () => {
|
|
385
|
+
u1();
|
|
386
|
+
u2();
|
|
387
|
+
u3();
|
|
388
|
+
u4();
|
|
389
|
+
u5();
|
|
390
|
+
};
|
|
391
|
+
}, [targetWorld]);
|
|
392
|
+
const session = targetWorld.has(WorldSessionTrait) ? targetWorld.get(WorldSessionTrait) : void 0;
|
|
393
|
+
const pilotedData = (targetWorld.queryFirst(ActorTrait)?.targetFor(PilotLink) ?? targetWorld.queryFirst(pilotedVehicleQuery))?.get(VehicleTrait);
|
|
394
|
+
const actions = kolmoActions(targetWorld);
|
|
395
|
+
return {
|
|
396
|
+
world: targetWorld,
|
|
397
|
+
mode: pilotedData ? pilotedData.isFlight ? "flight" : "car" : "foot",
|
|
398
|
+
activeVehicleId: pilotedData?.id ?? "",
|
|
399
|
+
nearVehicleId: session?.nearVehicleId || null,
|
|
400
|
+
boardVehicle: actions.boardVehicle,
|
|
401
|
+
exitVehicle: actions.exitVehicle,
|
|
402
|
+
resetVehicle: actions.resetVehicle
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function detectTouchDevice() {
|
|
406
|
+
if (typeof window === "undefined") return false;
|
|
407
|
+
return navigator.maxTouchPoints > 0 || window.matchMedia?.("(pointer: coarse)")?.matches === true;
|
|
408
|
+
}
|
|
409
|
+
function formatHudStrings(world) {
|
|
410
|
+
const actor = world.queryFirst(ActorTrait);
|
|
411
|
+
const vehEnt = actor?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery);
|
|
412
|
+
if (vehEnt) {
|
|
413
|
+
const vd = vehEnt.get(VehicleTrait);
|
|
414
|
+
const vel = vehEnt.get(VelocityTrait);
|
|
415
|
+
const tel = vehEnt.get(VehicleTelemetryTrait);
|
|
416
|
+
const kmh = Math.round(vel?.speedKmh ?? 0);
|
|
417
|
+
const rpm = Math.round(tel?.rpm ?? 0);
|
|
418
|
+
const gear = tel?.gear ?? 1;
|
|
419
|
+
return {
|
|
420
|
+
line: `${vd?.isFlight ? "Flight" : "Car"} · ${kmh} km/h · G${gear} · ${rpm} rpm`,
|
|
421
|
+
prompt: vd?.isFlight ? "[WASD] Fly · [Space/X] Rise/Dive · [Shift] Boost · [G] Mode · [V] Cam · [F] Exit" : "[WASD] Drive · [Shift] Boost · [Space] Brake · [V] Cam · [R] Flip · [F] Exit"
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
const vel = actor?.get(VelocityTrait);
|
|
425
|
+
const near = world.has(WorldSessionTrait) ? world.get(WorldSessionTrait)?.nearVehicleId : "";
|
|
426
|
+
return {
|
|
427
|
+
line: `On foot · ${Math.round(vel?.speedKmh ?? 0)} km/h`,
|
|
428
|
+
prompt: near ? "[F] Board vehicle · [WASD] Walk · [Shift] Sprint · [Space] Jump" : "[WASD] Walk · [Shift] Sprint · [Space] Jump"
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function KolmoHudView({ telemetryRef, promptRef, touchEnabled, style }) {
|
|
432
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
433
|
+
style: {
|
|
434
|
+
position: "fixed",
|
|
435
|
+
inset: 0,
|
|
436
|
+
pointerEvents: "none",
|
|
437
|
+
zIndex: 30,
|
|
438
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
439
|
+
color: "#e6edf3",
|
|
440
|
+
...style
|
|
441
|
+
},
|
|
442
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
443
|
+
ref: telemetryRef,
|
|
444
|
+
style: {
|
|
445
|
+
position: "absolute",
|
|
446
|
+
top: "max(10px, env(safe-area-inset-top))",
|
|
447
|
+
left: "max(12px, env(safe-area-inset-left))",
|
|
448
|
+
padding: "6px 10px",
|
|
449
|
+
background: "rgba(9, 13, 22, 0.82)",
|
|
450
|
+
border: "1px solid #38bdf8",
|
|
451
|
+
borderRadius: 4,
|
|
452
|
+
fontSize: 12,
|
|
453
|
+
fontWeight: 700
|
|
454
|
+
},
|
|
455
|
+
children: "On foot · 0 km/h"
|
|
456
|
+
}), !touchEnabled ? /* @__PURE__ */ jsx("div", {
|
|
457
|
+
ref: promptRef,
|
|
458
|
+
style: {
|
|
459
|
+
position: "absolute",
|
|
460
|
+
bottom: "max(12px, env(safe-area-inset-bottom))",
|
|
461
|
+
left: "50%",
|
|
462
|
+
transform: "translateX(-50%)",
|
|
463
|
+
padding: "5px 10px",
|
|
464
|
+
background: "rgba(9, 13, 22, 0.78)",
|
|
465
|
+
border: "1px solid rgba(255,255,255,0.16)",
|
|
466
|
+
borderRadius: 4,
|
|
467
|
+
fontSize: 11,
|
|
468
|
+
whiteSpace: "nowrap"
|
|
469
|
+
},
|
|
470
|
+
children: "[WASD] Walk · [Shift] Sprint · [Space] Jump"
|
|
471
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
472
|
+
style: { pointerEvents: "auto" },
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsx(Joystick, {}),
|
|
475
|
+
/* @__PURE__ */ jsx(VirtualButton, {
|
|
476
|
+
id: "jump",
|
|
477
|
+
label: "JMP",
|
|
478
|
+
buttonWrapperStyle: {
|
|
479
|
+
position: "fixed",
|
|
480
|
+
right: 20,
|
|
481
|
+
bottom: 24
|
|
482
|
+
}
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ jsx(VirtualButton, {
|
|
485
|
+
id: "boost",
|
|
486
|
+
label: "BST",
|
|
487
|
+
buttonWrapperStyle: {
|
|
488
|
+
position: "fixed",
|
|
489
|
+
right: 88,
|
|
490
|
+
bottom: 24
|
|
491
|
+
}
|
|
492
|
+
}),
|
|
493
|
+
/* @__PURE__ */ jsx(VirtualButton, {
|
|
494
|
+
id: "interact",
|
|
495
|
+
label: "USE",
|
|
496
|
+
buttonWrapperStyle: {
|
|
497
|
+
position: "fixed",
|
|
498
|
+
right: 20,
|
|
499
|
+
bottom: 92
|
|
500
|
+
}
|
|
501
|
+
})
|
|
502
|
+
]
|
|
503
|
+
})]
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
function KolmoHudInCanvas({ showTouchControls, extraPrompt, style }) {
|
|
507
|
+
const portalTarget = useContext(KolmoOverlayPortalContext);
|
|
508
|
+
const world = useActiveKolmoWorld();
|
|
509
|
+
const telemetryRef = useRef(null);
|
|
510
|
+
const promptRef = useRef(null);
|
|
511
|
+
const lastRef = useRef({
|
|
512
|
+
line: "",
|
|
513
|
+
prompt: "",
|
|
514
|
+
elapsed: 0
|
|
515
|
+
});
|
|
516
|
+
const [isTouch, setIsTouch] = useState(detectTouchDevice);
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
setIsTouch(detectTouchDevice());
|
|
519
|
+
}, []);
|
|
520
|
+
const touchEnabled = showTouchControls ?? isTouch;
|
|
521
|
+
useFrame((_, delta) => {
|
|
522
|
+
const st = lastRef.current;
|
|
523
|
+
st.elapsed += delta;
|
|
524
|
+
if (st.elapsed < .05) return;
|
|
525
|
+
st.elapsed = 0;
|
|
526
|
+
const { line, prompt } = formatHudStrings(world);
|
|
527
|
+
const fullPrompt = extraPrompt ? `${prompt} · ${extraPrompt}` : prompt;
|
|
528
|
+
if (line !== st.line && telemetryRef.current) {
|
|
529
|
+
telemetryRef.current.textContent = line;
|
|
530
|
+
st.line = line;
|
|
531
|
+
}
|
|
532
|
+
if (fullPrompt !== st.prompt && promptRef.current) {
|
|
533
|
+
promptRef.current.textContent = fullPrompt;
|
|
534
|
+
st.prompt = fullPrompt;
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
const target = portalTarget ?? (typeof document !== "undefined" ? document.body : null);
|
|
538
|
+
if (!target) return null;
|
|
539
|
+
return createPortal$1(/* @__PURE__ */ jsx(KolmoHudView, {
|
|
540
|
+
telemetryRef,
|
|
541
|
+
promptRef,
|
|
542
|
+
touchEnabled,
|
|
543
|
+
style
|
|
544
|
+
}), target);
|
|
545
|
+
}
|
|
546
|
+
function KolmoHudOutsideCanvas({ showTouchControls, extraPrompt, style }) {
|
|
547
|
+
const world = useActiveKolmoWorld();
|
|
548
|
+
const telemetryRef = useRef(null);
|
|
549
|
+
const promptRef = useRef(null);
|
|
550
|
+
const [isTouch, setIsTouch] = useState(detectTouchDevice);
|
|
551
|
+
useEffect(() => {
|
|
552
|
+
setIsTouch(detectTouchDevice());
|
|
553
|
+
}, []);
|
|
554
|
+
const touchEnabled = showTouchControls ?? isTouch;
|
|
555
|
+
useEffect(() => {
|
|
556
|
+
const sync = () => {
|
|
557
|
+
const { line, prompt } = formatHudStrings(world);
|
|
558
|
+
const fullPrompt = extraPrompt ? `${prompt} · ${extraPrompt}` : prompt;
|
|
559
|
+
if (telemetryRef.current) telemetryRef.current.textContent = line;
|
|
560
|
+
if (promptRef.current) promptRef.current.textContent = fullPrompt;
|
|
561
|
+
};
|
|
562
|
+
sync();
|
|
563
|
+
const id = window.setInterval(sync, 66);
|
|
564
|
+
return () => window.clearInterval(id);
|
|
565
|
+
}, [world, extraPrompt]);
|
|
566
|
+
return /* @__PURE__ */ jsx(KolmoHudView, {
|
|
567
|
+
telemetryRef,
|
|
568
|
+
promptRef,
|
|
569
|
+
touchEnabled,
|
|
570
|
+
style
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function KolmoHud(props) {
|
|
574
|
+
return useContext(KolmoInCanvasContext) ? /* @__PURE__ */ jsx(KolmoHudInCanvas, { ...props }) : /* @__PURE__ */ jsx(KolmoHudOutsideCanvas, { ...props });
|
|
575
|
+
}
|
|
576
|
+
function KolmoGame({ gravity = "planar", skybox = "day", lighting = "default", fogExp2, paused = false, timeScale = 1, maxDelta, physicsDebug = false, dpr, roomEnv = .65, kootaWorld = kolmoWorld, style, className, children }) {
|
|
577
|
+
const outerWorld = useOptionalKootaWorld();
|
|
578
|
+
const [overlayEl, setOverlayEl] = useState(null);
|
|
579
|
+
const shell = /* @__PURE__ */ jsx(KolmoOverlayPortalContext.Provider, {
|
|
580
|
+
value: overlayEl,
|
|
581
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
582
|
+
className,
|
|
583
|
+
style: {
|
|
584
|
+
position: "relative",
|
|
585
|
+
width: "100vw",
|
|
586
|
+
height: "100dvh",
|
|
587
|
+
overflow: "hidden",
|
|
588
|
+
touchAction: "none",
|
|
589
|
+
userSelect: "none",
|
|
590
|
+
...style
|
|
591
|
+
},
|
|
592
|
+
children: [/* @__PURE__ */ jsx(KolmoCanvas, {
|
|
593
|
+
dpr,
|
|
594
|
+
roomEnv,
|
|
595
|
+
children: /* @__PURE__ */ jsx(KolmoWorld, {
|
|
596
|
+
gravity,
|
|
597
|
+
paused,
|
|
598
|
+
timeScale,
|
|
599
|
+
maxDelta,
|
|
600
|
+
skybox,
|
|
601
|
+
lighting,
|
|
602
|
+
fogExp2,
|
|
603
|
+
physicsDebug,
|
|
604
|
+
world: kootaWorld,
|
|
605
|
+
children
|
|
606
|
+
})
|
|
607
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
608
|
+
ref: setOverlayEl,
|
|
609
|
+
style: {
|
|
610
|
+
position: "absolute",
|
|
611
|
+
inset: 0,
|
|
612
|
+
pointerEvents: "none"
|
|
613
|
+
}
|
|
614
|
+
})]
|
|
615
|
+
})
|
|
616
|
+
});
|
|
617
|
+
return kootaWorld !== outerWorld ? /* @__PURE__ */ jsx(KolmoWorldContext.Provider, {
|
|
618
|
+
value: kootaWorld,
|
|
619
|
+
children: /* @__PURE__ */ jsx(WorldProvider, {
|
|
620
|
+
world: kootaWorld,
|
|
621
|
+
children: shell
|
|
622
|
+
})
|
|
623
|
+
}) : shell;
|
|
624
|
+
}
|
|
625
|
+
// src/engine/gltfLoader.ts
|
|
626
|
+
var ktx2ByRenderer = /* @__PURE__ */ new WeakMap();
|
|
627
|
+
function getScopedKtx2Loader(renderer, transcoderPath) {
|
|
628
|
+
let byPath = ktx2ByRenderer.get(renderer);
|
|
629
|
+
if (!byPath) {
|
|
630
|
+
byPath = /* @__PURE__ */ new Map();
|
|
631
|
+
ktx2ByRenderer.set(renderer, byPath);
|
|
632
|
+
}
|
|
633
|
+
let ktx2 = byPath.get(transcoderPath);
|
|
634
|
+
if (!ktx2) {
|
|
635
|
+
ktx2 = new KTX2Loader();
|
|
636
|
+
ktx2.setTranscoderPath(transcoderPath);
|
|
637
|
+
ktx2.detectSupport(renderer);
|
|
638
|
+
byPath.set(transcoderPath, ktx2);
|
|
639
|
+
}
|
|
640
|
+
return ktx2;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Khronos-compliant `GLTFLoader` configured with `EXT_meshopt_compression` (`MeshoptDecoder`)
|
|
644
|
+
* and `KHR_texture_basisu` (`KTX2Loader` when a renderer is supplied).
|
|
645
|
+
*/
|
|
646
|
+
function createKolmoGltfLoader(options) {
|
|
647
|
+
const loader = new GLTFLoader();
|
|
648
|
+
loader.setMeshoptDecoder(MeshoptDecoder);
|
|
649
|
+
if (options?.renderer) loader.setKTX2Loader(getScopedKtx2Loader(options.renderer, options.basisTranscoderPath ?? "/basis/"));
|
|
650
|
+
return loader;
|
|
651
|
+
}
|
|
652
|
+
async function parseKolmoGlbBuffer(buffer, options) {
|
|
653
|
+
await MeshoptDecoder.ready;
|
|
654
|
+
const loader = createKolmoGltfLoader(options);
|
|
655
|
+
return loadKhrGlb(buffer, {
|
|
656
|
+
...options?.khrOptions,
|
|
657
|
+
loader
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
async function loadKolmoGlbUrl(url, options) {
|
|
661
|
+
const res = await fetch(url);
|
|
662
|
+
if (!res.ok) throw new Error(`Failed to fetch GLB (${res.status}): ${url}`);
|
|
663
|
+
return parseKolmoGlbBuffer(await res.arrayBuffer(), options);
|
|
664
|
+
}
|
|
665
|
+
export { ActorTrait, EMPTY_KOLMO_INPUT, G_SI, InteractableTrait, KOLMO_KEY_MAP, KOLMO_STICK_DEADZONE, KolmoActor, KolmoCanvas, KolmoGame, KolmoGravityContext, KolmoHud, KolmoInCanvasContext, KolmoKeyboardBridge, KolmoKeyboardContext, KolmoOverlayPortalContext, KolmoPhysics, KolmoProp, KolmoSurface, KolmoVehicle, KolmoWorld, KolmoWorldContext, PilotLink, PilotedTag, RoomEnvRig, TransformTrait, VehicleTelemetryTrait, VehicleTrait, VelocityTrait, WorldSessionTrait, computeCircularOrbitSpeed, createEmptyVehicleCmd, createKolmoGltfLoader, createNBodyGravityField, ensureWorldSession, evaluateNBodyGravity, evaluatePreparedNBodyGravity, flipVehicleBodyUpright, kolmoActions, kolmoWorld, loadKolmoGlbUrl, parseKolmoGlbBuffer, pilotedVehicleQuery, prepareAttractors, resolveAttractorMu, useActiveKolmoWorld, useIsKolmoCustomGravity, useKolmoGame, useKolmoInput, useOptionalKootaWorld, vehicleSimQuery, writeEntityKinematics, writeVehicleTelemetry };
|
|
666
|
+
|
|
667
|
+
//# sourceMappingURL=index.js.map
|