@pinkaphant/kolmo 0.4.6 → 0.5.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/README.md +39 -100
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/gltfLoader.d.ts +19 -0
- package/dist/engine/index.d.ts +8 -13
- package/dist/engine/index.js +1270 -22
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/{kolmoInput.d.ts → input.d.ts} +7 -6
- package/dist/engine/surface.d.ts +19 -0
- package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +18 -47
- package/dist/engine/vehicle.d.ts +20 -0
- package/dist/engine/world.d.ts +76 -0
- package/dist/index.d.ts +12 -18
- package/dist/index.js +14 -104
- package/dist/physics/index.d.ts +4 -1
- package/dist/physics/index.js +1 -105
- package/dist/physics/nBodyGravity.d.ts +42 -0
- package/dist/physics-FhWvTBfH.js +424 -0
- package/dist/physics-FhWvTBfH.js.map +1 -0
- package/dist/vite/index.d.ts +2 -12
- package/dist/vite/index.js +8 -77
- package/dist/vite/index.js.map +1 -1
- package/package.json +33 -87
- package/AGENTS.md +0 -29
- package/CLAUDE.md +0 -8
- package/bin/kolmo.mjs +0 -560
- 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 -13
- package/dist/engine/kolmoActor.js +0 -263
- 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/kolmoFloatingOrigin.d.ts +0 -17
- package/dist/engine/kolmoFloatingOrigin.js +0 -98
- 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/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -214
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -163
- 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 -160
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -2
- package/dist/engine/kolmoPilotMesh.js +0 -205
- 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 -10
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -78
- 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 -38
- package/dist/engine/kolmoVehicleDriver.js +0 -139
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -291
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -161
- 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 -23
- package/dist/importer/DomainWorkshopPanel.js +0 -418
- 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 -291
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -273
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -171
- 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/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 -49
- package/dist/importer/importerWebMcp.js +0 -48
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -341
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -23
- package/dist/importer/index.js +0 -36
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -125
- 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 -283
- 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 -108
- package/dist/importer/useChopShopController.js +0 -201
- 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/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 -13
- package/dist/junk/index.js +0 -12
- 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/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/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 -148
- package/skills/kolmo-engine/SKILL.md +0 -111
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { SHARED_PS2_GLSL_HELPERS } from "./ps2GlslShared.js";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
// src/shaders/ps2TerrainWebGL.ts
|
|
4
|
-
function createPS2TerrainMaterialWebGL(textures, opts = {}) {
|
|
5
|
-
const uniforms = {
|
|
6
|
-
uSplat0: { value: textures.splat0Tex },
|
|
7
|
-
uSplat1: { value: textures.splat1Tex },
|
|
8
|
-
uAlphaTex: { value: textures.alphaTex },
|
|
9
|
-
uDetailArray: { value: textures.detailArrayTex },
|
|
10
|
-
uTileScale: { value: opts.tileScale ?? 1 / 3 },
|
|
11
|
-
uDitherTexelsPerMeter: { value: opts.ditherTexelsPerMeter ?? 16 },
|
|
12
|
-
uSplatContrast: { value: opts.splatContrast ?? 1.65 },
|
|
13
|
-
uCavityStrength: { value: opts.cavityStrength ?? 1 },
|
|
14
|
-
uCavityShadowTint: { value: new THREE.Color(7239820) },
|
|
15
|
-
uPs2ColorQuantize: { value: opts.ps2ColorQuantize ?? .85 },
|
|
16
|
-
uScreenPixelScale: { value: opts.screenPixelScale ?? 1 }
|
|
17
|
-
};
|
|
18
|
-
const material = new THREE.MeshLambertMaterial({
|
|
19
|
-
vertexColors: true,
|
|
20
|
-
fog: true
|
|
21
|
-
});
|
|
22
|
-
material.userData.__kolmoRetroApplied = true;
|
|
23
|
-
material.customProgramCacheKey = () => "ps2-terrain-splat8-lambert-v1";
|
|
24
|
-
material.onBeforeCompile = (shader) => {
|
|
25
|
-
Object.assign(shader.uniforms, uniforms);
|
|
26
|
-
shader.vertexShader = shader.vertexShader.replace("#include <common>", `
|
|
27
|
-
#include <common>
|
|
28
|
-
varying vec2 vPs2Uv;
|
|
29
|
-
varying vec3 vPs2WorldPos;
|
|
30
|
-
`).replace("#include <project_vertex>", `
|
|
31
|
-
vPs2Uv = uv;
|
|
32
|
-
vec4 ps2Wp = vec4(transformed, 1.0);
|
|
33
|
-
#ifdef USE_INSTANCING
|
|
34
|
-
ps2Wp = instanceMatrix * ps2Wp;
|
|
35
|
-
#endif
|
|
36
|
-
ps2Wp = modelMatrix * ps2Wp;
|
|
37
|
-
vPs2WorldPos = ps2Wp.xyz;
|
|
38
|
-
#include <project_vertex>
|
|
39
|
-
`);
|
|
40
|
-
shader.fragmentShader = shader.fragmentShader.replace("#include <common>", `
|
|
41
|
-
#include <common>
|
|
42
|
-
precision mediump sampler2DArray;
|
|
43
|
-
|
|
44
|
-
uniform sampler2D uSplat0;
|
|
45
|
-
uniform sampler2D uSplat1;
|
|
46
|
-
uniform sampler2D uAlphaTex;
|
|
47
|
-
uniform sampler2DArray uDetailArray;
|
|
48
|
-
|
|
49
|
-
uniform float uTileScale;
|
|
50
|
-
uniform float uDitherTexelsPerMeter;
|
|
51
|
-
uniform float uSplatContrast;
|
|
52
|
-
uniform float uCavityStrength;
|
|
53
|
-
uniform vec3 uCavityShadowTint;
|
|
54
|
-
uniform float uPs2ColorQuantize;
|
|
55
|
-
uniform float uScreenPixelScale;
|
|
56
|
-
|
|
57
|
-
varying vec2 vPs2Uv;
|
|
58
|
-
varying vec3 vPs2WorldPos;
|
|
59
|
-
|
|
60
|
-
${SHARED_PS2_GLSL_HELPERS}
|
|
61
|
-
`).replace("#include <color_fragment>", `
|
|
62
|
-
if (texture(uAlphaTex, vPs2Uv).r < 0.5) discard;
|
|
63
|
-
|
|
64
|
-
vec4 s0 = pow(max(texture(uSplat0, vPs2Uv), vec4(0.0)), vec4(uSplatContrast));
|
|
65
|
-
vec4 s1 = pow(max(texture(uSplat1, vPs2Uv), vec4(0.0)), vec4(uSplatContrast));
|
|
66
|
-
float totalW = s0.r + s0.g + s0.b + s0.a + s1.r + s1.g + s1.b + s1.a;
|
|
67
|
-
float invW = totalW > 1e-5 ? (1.0 / totalW) : 0.0;
|
|
68
|
-
s0 *= invW;
|
|
69
|
-
s1 *= invW;
|
|
70
|
-
|
|
71
|
-
float bayerWorld = ps2Bayer4x4(vPs2WorldPos.xz * uDitherTexelsPerMeter);
|
|
72
|
-
int winLayer = 7;
|
|
73
|
-
float cdf = s0.r;
|
|
74
|
-
if (bayerWorld < cdf) { winLayer = 0; }
|
|
75
|
-
else if (bayerWorld < (cdf += s0.g)) { winLayer = 1; }
|
|
76
|
-
else if (bayerWorld < (cdf += s0.b)) { winLayer = 2; }
|
|
77
|
-
else if (bayerWorld < (cdf += s0.a)) { winLayer = 3; }
|
|
78
|
-
else if (bayerWorld < (cdf += s1.r)) { winLayer = 4; }
|
|
79
|
-
else if (bayerWorld < (cdf += s1.g)) { winLayer = 5; }
|
|
80
|
-
else if (bayerWorld < (cdf += s1.b)) { winLayer = 6; }
|
|
81
|
-
|
|
82
|
-
vec2 tileUv = vPs2WorldPos.xz * uTileScale;
|
|
83
|
-
vec2 dTileDx = dFdx(tileUv);
|
|
84
|
-
vec2 dTileDy = dFdy(tileUv);
|
|
85
|
-
vec3 splatAlbedo = textureGrad(uDetailArray, vec3(tileUv, float(winLayer)), dTileDx, dTileDy).rgb;
|
|
86
|
-
splatAlbedo *= ps2MacroVariation(vPs2WorldPos.xz);
|
|
87
|
-
|
|
88
|
-
float rawCavity = 1.0;
|
|
89
|
-
#if defined(USE_COLOR) || defined(USE_COLOR_ALPHA)
|
|
90
|
-
rawCavity = vColor.r;
|
|
91
|
-
#endif
|
|
92
|
-
float cavityClamped = clamp(rawCavity, 0.0, 1.0);
|
|
93
|
-
float ridgeLift = max(0.0, rawCavity - 1.0) * 0.85 * uCavityStrength;
|
|
94
|
-
vec3 cavityTint = mix(uCavityShadowTint, vec3(1.0), cavityClamped);
|
|
95
|
-
|
|
96
|
-
diffuseColor.rgb *= splatAlbedo * mix(vec3(1.0), cavityTint, uCavityStrength * 0.45) * (1.0 + ridgeLift);
|
|
97
|
-
`).replace("#include <aomap_fragment>", `
|
|
98
|
-
#include <aomap_fragment>
|
|
99
|
-
#if defined(USE_COLOR) || defined(USE_COLOR_ALPHA)
|
|
100
|
-
float ps2Ao = clamp(vColor.r, 0.0, 1.0);
|
|
101
|
-
float indirectAo = mix(1.0, pow(ps2Ao, 1.45), uCavityStrength);
|
|
102
|
-
float directAo = mix(1.0, mix(0.55, 1.0, ps2Ao), uCavityStrength);
|
|
103
|
-
reflectedLight.indirectDiffuse *= indirectAo;
|
|
104
|
-
reflectedLight.directDiffuse *= directAo;
|
|
105
|
-
#endif
|
|
106
|
-
`).replace("#include <dithering_fragment>", `
|
|
107
|
-
#include <dithering_fragment>
|
|
108
|
-
gl_FragColor.rgb = ps2QuantizeRGB555(
|
|
109
|
-
gl_FragColor.rgb,
|
|
110
|
-
gl_FragCoord.xy,
|
|
111
|
-
uScreenPixelScale,
|
|
112
|
-
uPs2ColorQuantize
|
|
113
|
-
);
|
|
114
|
-
`);
|
|
115
|
-
};
|
|
116
|
-
const depthMaterial = new THREE.MeshDepthMaterial({ depthPacking: THREE.RGBADepthPacking });
|
|
117
|
-
depthMaterial.customProgramCacheKey = () => "ps2-terrain-depth-cutout-v1";
|
|
118
|
-
depthMaterial.onBeforeCompile = (shader) => {
|
|
119
|
-
shader.uniforms.uAlphaTex = uniforms.uAlphaTex;
|
|
120
|
-
shader.vertexShader = shader.vertexShader.replace("#include <common>", "#include <common>\nvarying vec2 vPs2DepthUv;").replace("#include <project_vertex>", "vPs2DepthUv = uv;\n#include <project_vertex>");
|
|
121
|
-
shader.fragmentShader = shader.fragmentShader.replace("#include <common>", "#include <common>\nuniform sampler2D uAlphaTex;\nvarying vec2 vPs2DepthUv;").replace("void main() {", "void main() {\n if (texture(uAlphaTex, vPs2DepthUv).r < 0.5) discard;");
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
material,
|
|
125
|
-
depthMaterial,
|
|
126
|
-
uniforms
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
export { createPS2TerrainMaterialWebGL };
|
|
130
|
-
|
|
131
|
-
//# sourceMappingURL=ps2TerrainWebGL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ps2TerrainWebGL.js","names":[],"sources":["../../src/shaders/ps2TerrainWebGL.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { SHARED_PS2_GLSL_HELPERS, type PS2TerrainMaterialOptions } from \"./ps2GlslShared.js\";\nimport type { PS2TextureBundle } from \"./ps2Textures.js\";\n\nexport function createPS2TerrainMaterialWebGL(\n textures: PS2TextureBundle,\n opts: PS2TerrainMaterialOptions = {},\n): {\n material: THREE.MeshLambertMaterial;\n depthMaterial: THREE.MeshDepthMaterial;\n uniforms: Record<string, THREE.IUniform>;\n} {\n const uniforms: Record<string, THREE.IUniform> = {\n uSplat0: { value: textures.splat0Tex },\n uSplat1: { value: textures.splat1Tex },\n uAlphaTex: { value: textures.alphaTex },\n uDetailArray: { value: textures.detailArrayTex },\n uTileScale: { value: opts.tileScale ?? 1 / 3 },\n uDitherTexelsPerMeter: { value: opts.ditherTexelsPerMeter ?? 16 },\n uSplatContrast: { value: opts.splatContrast ?? 1.65 },\n uCavityStrength: { value: opts.cavityStrength ?? 1 },\n uCavityShadowTint: { value: new THREE.Color(0x6e788c) },\n uPs2ColorQuantize: { value: opts.ps2ColorQuantize ?? 0.85 },\n uScreenPixelScale: { value: opts.screenPixelScale ?? 1 },\n };\n\n const material = new THREE.MeshLambertMaterial({ vertexColors: true, fog: true });\n material.userData.__kolmoRetroApplied = true;\n material.customProgramCacheKey = () => \"ps2-terrain-splat8-lambert-v1\";\n material.onBeforeCompile = (shader) => {\n Object.assign(shader.uniforms, uniforms);\n shader.vertexShader = shader.vertexShader\n .replace(\"#include <common>\", `\n #include <common>\n varying vec2 vPs2Uv;\n varying vec3 vPs2WorldPos;\n `)\n .replace(\"#include <project_vertex>\", `\n vPs2Uv = uv;\n vec4 ps2Wp = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n ps2Wp = instanceMatrix * ps2Wp;\n #endif\n ps2Wp = modelMatrix * ps2Wp;\n vPs2WorldPos = ps2Wp.xyz;\n #include <project_vertex>\n `);\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", `\n #include <common>\n precision mediump sampler2DArray;\n\n uniform sampler2D uSplat0;\n uniform sampler2D uSplat1;\n uniform sampler2D uAlphaTex;\n uniform sampler2DArray uDetailArray;\n\n uniform float uTileScale;\n uniform float uDitherTexelsPerMeter;\n uniform float uSplatContrast;\n uniform float uCavityStrength;\n uniform vec3 uCavityShadowTint;\n uniform float uPs2ColorQuantize;\n uniform float uScreenPixelScale;\n\n varying vec2 vPs2Uv;\n varying vec3 vPs2WorldPos;\n\n ${SHARED_PS2_GLSL_HELPERS}\n `)\n .replace(\"#include <color_fragment>\", `\n if (texture(uAlphaTex, vPs2Uv).r < 0.5) discard;\n\n vec4 s0 = pow(max(texture(uSplat0, vPs2Uv), vec4(0.0)), vec4(uSplatContrast));\n vec4 s1 = pow(max(texture(uSplat1, vPs2Uv), vec4(0.0)), vec4(uSplatContrast));\n float totalW = s0.r + s0.g + s0.b + s0.a + s1.r + s1.g + s1.b + s1.a;\n float invW = totalW > 1e-5 ? (1.0 / totalW) : 0.0;\n s0 *= invW;\n s1 *= invW;\n\n float bayerWorld = ps2Bayer4x4(vPs2WorldPos.xz * uDitherTexelsPerMeter);\n int winLayer = 7;\n float cdf = s0.r;\n if (bayerWorld < cdf) { winLayer = 0; }\n else if (bayerWorld < (cdf += s0.g)) { winLayer = 1; }\n else if (bayerWorld < (cdf += s0.b)) { winLayer = 2; }\n else if (bayerWorld < (cdf += s0.a)) { winLayer = 3; }\n else if (bayerWorld < (cdf += s1.r)) { winLayer = 4; }\n else if (bayerWorld < (cdf += s1.g)) { winLayer = 5; }\n else if (bayerWorld < (cdf += s1.b)) { winLayer = 6; }\n\n vec2 tileUv = vPs2WorldPos.xz * uTileScale;\n vec2 dTileDx = dFdx(tileUv);\n vec2 dTileDy = dFdy(tileUv);\n vec3 splatAlbedo = textureGrad(uDetailArray, vec3(tileUv, float(winLayer)), dTileDx, dTileDy).rgb;\n splatAlbedo *= ps2MacroVariation(vPs2WorldPos.xz);\n\n float rawCavity = 1.0;\n #if defined(USE_COLOR) || defined(USE_COLOR_ALPHA)\n rawCavity = vColor.r;\n #endif\n float cavityClamped = clamp(rawCavity, 0.0, 1.0);\n float ridgeLift = max(0.0, rawCavity - 1.0) * 0.85 * uCavityStrength;\n vec3 cavityTint = mix(uCavityShadowTint, vec3(1.0), cavityClamped);\n\n diffuseColor.rgb *= splatAlbedo * mix(vec3(1.0), cavityTint, uCavityStrength * 0.45) * (1.0 + ridgeLift);\n `)\n .replace(\"#include <aomap_fragment>\", `\n #include <aomap_fragment>\n #if defined(USE_COLOR) || defined(USE_COLOR_ALPHA)\n float ps2Ao = clamp(vColor.r, 0.0, 1.0);\n float indirectAo = mix(1.0, pow(ps2Ao, 1.45), uCavityStrength);\n float directAo = mix(1.0, mix(0.55, 1.0, ps2Ao), uCavityStrength);\n reflectedLight.indirectDiffuse *= indirectAo;\n reflectedLight.directDiffuse *= directAo;\n #endif\n `)\n .replace(\"#include <dithering_fragment>\", `\n #include <dithering_fragment>\n gl_FragColor.rgb = ps2QuantizeRGB555(\n gl_FragColor.rgb,\n gl_FragCoord.xy,\n uScreenPixelScale,\n uPs2ColorQuantize\n );\n `);\n };\n\n const depthMaterial = new THREE.MeshDepthMaterial({ depthPacking: THREE.RGBADepthPacking });\n depthMaterial.customProgramCacheKey = () => \"ps2-terrain-depth-cutout-v1\";\n depthMaterial.onBeforeCompile = (shader) => {\n shader.uniforms.uAlphaTex = uniforms.uAlphaTex;\n shader.vertexShader = shader.vertexShader\n .replace(\"#include <common>\", \"#include <common>\\nvarying vec2 vPs2DepthUv;\")\n .replace(\"#include <project_vertex>\", \"vPs2DepthUv = uv;\\n#include <project_vertex>\");\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", \"#include <common>\\nuniform sampler2D uAlphaTex;\\nvarying vec2 vPs2DepthUv;\")\n .replace(\"void main() {\", \"void main() {\\n if (texture(uAlphaTex, vPs2DepthUv).r < 0.5) discard;\");\n };\n\n return { material, depthMaterial, uniforms };\n}\n"],"mappings":";;;AAIA,SAAgB,8BACZ,UACA,OAAkC,CAAC,GAKrC;CACE,MAAM,WAA2C;EAC7C,SAAS,EAAE,OAAO,SAAS,UAAU;EACrC,SAAS,EAAE,OAAO,SAAS,UAAU;EACrC,WAAW,EAAE,OAAO,SAAS,SAAS;EACtC,cAAc,EAAE,OAAO,SAAS,eAAe;EAC/C,YAAY,EAAE,OAAO,KAAK,aAAa,IAAI,EAAE;EAC7C,uBAAuB,EAAE,OAAO,KAAK,wBAAwB,GAAG;EAChE,gBAAgB,EAAE,OAAO,KAAK,iBAAiB,KAAK;EACpD,iBAAiB,EAAE,OAAO,KAAK,kBAAkB,EAAE;EACnD,mBAAmB,EAAE,OAAO,IAAI,MAAM,MAAM,OAAQ,EAAE;EACtD,mBAAmB,EAAE,OAAO,KAAK,oBAAoB,IAAK;EAC1D,mBAAmB,EAAE,OAAO,KAAK,oBAAoB,EAAE;CAC3D;CAEA,MAAM,WAAW,IAAI,MAAM,oBAAoB;EAAE,cAAc;EAAM,KAAK;CAAK,CAAC;CAChF,SAAS,SAAS,sBAAsB;CACxC,SAAS,8BAA8B;CACvC,SAAS,mBAAmB,WAAW;EACnC,OAAO,OAAO,OAAO,UAAU,QAAQ;EACvC,OAAO,eAAe,OAAO,aACxB,QAAQ,qBAAqB;;;;SAIjC,CAAC,CACG,QAAQ,6BAA6B;;;;;;;;;SASzC;EACD,OAAO,iBAAiB,OAAO,eAC1B,QAAQ,qBAAqB;;;;;;;;;;;;;;;;;;;;UAoBhC,wBAAwB;SACzB,CAAC,CACG,QAAQ,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAoCzC,CAAC,CACG,QAAQ,6BAA6B;;;;;;;;;SASzC,CAAC,CACG,QAAQ,iCAAiC;;;;;;;;SAQ7C;CACL;CAEA,MAAM,gBAAgB,IAAI,MAAM,kBAAkB,EAAE,cAAc,MAAM,iBAAiB,CAAC;CAC1F,cAAc,8BAA8B;CAC5C,cAAc,mBAAmB,WAAW;EACxC,OAAO,SAAS,YAAY,SAAS;EACrC,OAAO,eAAe,OAAO,aACxB,QAAQ,qBAAqB,8CAA8C,CAAC,CAC5E,QAAQ,6BAA6B,8CAA8C;EACxF,OAAO,iBAAiB,OAAO,eAC1B,QAAQ,qBAAqB,4EAA4E,CAAC,CAC1G,QAAQ,iBAAiB,wEAAwE;CAC1G;CAEA,OAAO;EAAE;EAAU;EAAe;CAAS;AAC/C"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { type WorldGenResult } from "../world/worldTypes.js";
|
|
3
|
-
export declare const SPLAT_LAYER: {
|
|
4
|
-
readonly DIRT: 0;
|
|
5
|
-
readonly GRASS: 1;
|
|
6
|
-
readonly SAND: 2;
|
|
7
|
-
readonly ROCK: 3;
|
|
8
|
-
readonly GRAVEL: 4;
|
|
9
|
-
readonly FOREST: 5;
|
|
10
|
-
readonly SNOW: 6;
|
|
11
|
-
readonly ASPHALT: 7;
|
|
12
|
-
};
|
|
13
|
-
export interface PS2TextureBundle {
|
|
14
|
-
readonly splat0Tex: THREE.DataTexture;
|
|
15
|
-
readonly splat1Tex: THREE.DataTexture;
|
|
16
|
-
readonly alphaTex: THREE.DataTexture;
|
|
17
|
-
readonly detailArrayTex: THREE.DataArrayTexture;
|
|
18
|
-
readonly detailSliceTexs: readonly THREE.DataTexture[];
|
|
19
|
-
readonly dispose: () => void;
|
|
20
|
-
}
|
|
21
|
-
export declare function generatePS2DetailSlices(seed: number, size?: number): Uint8Array<ArrayBuffer>[];
|
|
22
|
-
export declare function createPS2WorldTextures(worldData: WorldGenResult): PS2TextureBundle;
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { SplitMix32, hashSeed } from "../world/worldTypes.js";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
// src/shaders/ps2Textures.ts
|
|
4
|
-
var SPLAT_LAYER = {
|
|
5
|
-
DIRT: 0,
|
|
6
|
-
GRASS: 1,
|
|
7
|
-
SAND: 2,
|
|
8
|
-
ROCK: 3,
|
|
9
|
-
GRAVEL: 4,
|
|
10
|
-
FOREST: 5,
|
|
11
|
-
SNOW: 6,
|
|
12
|
-
ASPHALT: 7
|
|
13
|
-
};
|
|
14
|
-
function hashTile(ix, iy, period, seed) {
|
|
15
|
-
const wx = (ix % period + period) % period;
|
|
16
|
-
const wy = (iy % period + period) % period;
|
|
17
|
-
let h = Math.imul(wx, 374761393) + Math.imul(wy, 668265263) + seed | 0;
|
|
18
|
-
h = Math.imul(h ^ h >>> 13, 1274126177);
|
|
19
|
-
return ((h ^ h >>> 16) >>> 0) / 4294967296;
|
|
20
|
-
}
|
|
21
|
-
function tileNoise(u, v, freq, seed) {
|
|
22
|
-
const x = u * freq;
|
|
23
|
-
const y = v * freq;
|
|
24
|
-
const ix = Math.floor(x);
|
|
25
|
-
const iy = Math.floor(y);
|
|
26
|
-
const fx = x - ix;
|
|
27
|
-
const fy = y - iy;
|
|
28
|
-
const sx = fx * fx * (3 - 2 * fx);
|
|
29
|
-
const sy = fy * fy * (3 - 2 * fy);
|
|
30
|
-
const n00 = hashTile(ix, iy, freq, seed);
|
|
31
|
-
const n10 = hashTile(ix + 1, iy, freq, seed);
|
|
32
|
-
const n01 = hashTile(ix, iy + 1, freq, seed);
|
|
33
|
-
const n11 = hashTile(ix + 1, iy + 1, freq, seed);
|
|
34
|
-
return (n00 * (1 - sx) + n10 * sx) * (1 - sy) + (n01 * (1 - sx) + n11 * sx) * sy;
|
|
35
|
-
}
|
|
36
|
-
var clampByte = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
37
|
-
var LAYER_PALETTES = [
|
|
38
|
-
{
|
|
39
|
-
base: [
|
|
40
|
-
108,
|
|
41
|
-
82,
|
|
42
|
-
56
|
|
43
|
-
],
|
|
44
|
-
dark: [
|
|
45
|
-
72,
|
|
46
|
-
53,
|
|
47
|
-
36
|
|
48
|
-
],
|
|
49
|
-
light: [
|
|
50
|
-
138,
|
|
51
|
-
108,
|
|
52
|
-
76
|
|
53
|
-
],
|
|
54
|
-
freqA: 16,
|
|
55
|
-
freqB: 48,
|
|
56
|
-
speckle: .28
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
base: [
|
|
60
|
-
86,
|
|
61
|
-
114,
|
|
62
|
-
52
|
|
63
|
-
],
|
|
64
|
-
dark: [
|
|
65
|
-
58,
|
|
66
|
-
82,
|
|
67
|
-
34
|
|
68
|
-
],
|
|
69
|
-
light: [
|
|
70
|
-
122,
|
|
71
|
-
146,
|
|
72
|
-
68
|
|
73
|
-
],
|
|
74
|
-
freqA: 20,
|
|
75
|
-
freqB: 64,
|
|
76
|
-
speckle: .22
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
base: [
|
|
80
|
-
194,
|
|
81
|
-
174,
|
|
82
|
-
128
|
|
83
|
-
],
|
|
84
|
-
dark: [
|
|
85
|
-
164,
|
|
86
|
-
142,
|
|
87
|
-
98
|
|
88
|
-
],
|
|
89
|
-
light: [
|
|
90
|
-
218,
|
|
91
|
-
202,
|
|
92
|
-
158
|
|
93
|
-
],
|
|
94
|
-
freqA: 12,
|
|
95
|
-
freqB: 64,
|
|
96
|
-
speckle: .14,
|
|
97
|
-
striateY: 3
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
base: [
|
|
101
|
-
112,
|
|
102
|
-
110,
|
|
103
|
-
106
|
|
104
|
-
],
|
|
105
|
-
dark: [
|
|
106
|
-
68,
|
|
107
|
-
66,
|
|
108
|
-
64
|
|
109
|
-
],
|
|
110
|
-
light: [
|
|
111
|
-
148,
|
|
112
|
-
145,
|
|
113
|
-
138
|
|
114
|
-
],
|
|
115
|
-
freqA: 14,
|
|
116
|
-
freqB: 36,
|
|
117
|
-
speckle: .2,
|
|
118
|
-
striateY: 4.5
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
base: [
|
|
122
|
-
124,
|
|
123
|
-
118,
|
|
124
|
-
108
|
|
125
|
-
],
|
|
126
|
-
dark: [
|
|
127
|
-
76,
|
|
128
|
-
72,
|
|
129
|
-
66
|
|
130
|
-
],
|
|
131
|
-
light: [
|
|
132
|
-
168,
|
|
133
|
-
162,
|
|
134
|
-
150
|
|
135
|
-
],
|
|
136
|
-
freqA: 32,
|
|
137
|
-
freqB: 64,
|
|
138
|
-
speckle: .45
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
base: [
|
|
142
|
-
56,
|
|
143
|
-
76,
|
|
144
|
-
42
|
|
145
|
-
],
|
|
146
|
-
dark: [
|
|
147
|
-
36,
|
|
148
|
-
48,
|
|
149
|
-
28
|
|
150
|
-
],
|
|
151
|
-
light: [
|
|
152
|
-
88,
|
|
153
|
-
98,
|
|
154
|
-
54
|
|
155
|
-
],
|
|
156
|
-
freqA: 18,
|
|
157
|
-
freqB: 52,
|
|
158
|
-
speckle: .26
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
base: [
|
|
162
|
-
222,
|
|
163
|
-
228,
|
|
164
|
-
236
|
|
165
|
-
],
|
|
166
|
-
dark: [
|
|
167
|
-
182,
|
|
168
|
-
194,
|
|
169
|
-
212
|
|
170
|
-
],
|
|
171
|
-
light: [
|
|
172
|
-
246,
|
|
173
|
-
248,
|
|
174
|
-
252
|
|
175
|
-
],
|
|
176
|
-
freqA: 12,
|
|
177
|
-
freqB: 40,
|
|
178
|
-
speckle: .1
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
base: [
|
|
182
|
-
54,
|
|
183
|
-
55,
|
|
184
|
-
58
|
|
185
|
-
],
|
|
186
|
-
dark: [
|
|
187
|
-
36,
|
|
188
|
-
37,
|
|
189
|
-
40
|
|
190
|
-
],
|
|
191
|
-
light: [
|
|
192
|
-
86,
|
|
193
|
-
88,
|
|
194
|
-
92
|
|
195
|
-
],
|
|
196
|
-
freqA: 32,
|
|
197
|
-
freqB: 64,
|
|
198
|
-
speckle: .42
|
|
199
|
-
}
|
|
200
|
-
];
|
|
201
|
-
function generatePS2DetailSlices(seed, size = 128) {
|
|
202
|
-
const rng = new SplitMix32(seed);
|
|
203
|
-
const slices = [];
|
|
204
|
-
for (let layer = 0; layer < 8; layer++) {
|
|
205
|
-
const data = new Uint8Array(size * size * 4);
|
|
206
|
-
const pal = LAYER_PALETTES[layer];
|
|
207
|
-
const sA = rng.next() * 2147483647 | 0;
|
|
208
|
-
const sB = rng.next() * 2147483647 | 0;
|
|
209
|
-
const sC = rng.next() * 2147483647 | 0;
|
|
210
|
-
for (let y = 0; y < size; y++) for (let x = 0; x < size; x++) {
|
|
211
|
-
const u = x / size;
|
|
212
|
-
const a = tileNoise(u, y / size * (pal.striateY ?? 1) % 1, pal.freqA, sA);
|
|
213
|
-
const b = tileNoise(u, y / size, pal.freqB, sB);
|
|
214
|
-
const c = hashTile(x, y, size, sC);
|
|
215
|
-
let h = a * .55 + b * .45;
|
|
216
|
-
if (c > 1 - pal.speckle * .35) h = Math.min(1, h + .32);
|
|
217
|
-
else if (c < pal.speckle * .35) h = Math.max(0, h - .3);
|
|
218
|
-
h = Math.round(h * 12) / 12;
|
|
219
|
-
const t = h < .5 ? h * 2 : (h - .5) * 2;
|
|
220
|
-
const c0 = h < .5 ? pal.dark : pal.base;
|
|
221
|
-
const c1 = h < .5 ? pal.base : pal.light;
|
|
222
|
-
const idx = (y * size + x) * 4;
|
|
223
|
-
data[idx] = clampByte(c0[0] * (1 - t) + c1[0] * t);
|
|
224
|
-
data[idx + 1] = clampByte(c0[1] * (1 - t) + c1[1] * t);
|
|
225
|
-
data[idx + 2] = clampByte(c0[2] * (1 - t) + c1[2] * t);
|
|
226
|
-
data[idx + 3] = 255;
|
|
227
|
-
}
|
|
228
|
-
slices.push(data);
|
|
229
|
-
}
|
|
230
|
-
return slices;
|
|
231
|
-
}
|
|
232
|
-
function createPS2WorldTextures(worldData) {
|
|
233
|
-
const n = worldData.config.gridCells;
|
|
234
|
-
const makeSplat = (buf) => {
|
|
235
|
-
const tex = new THREE.DataTexture(buf, n, n, THREE.RGBAFormat, THREE.UnsignedByteType);
|
|
236
|
-
tex.colorSpace = THREE.NoColorSpace;
|
|
237
|
-
tex.wrapS = THREE.ClampToEdgeWrapping;
|
|
238
|
-
tex.wrapT = THREE.ClampToEdgeWrapping;
|
|
239
|
-
tex.magFilter = THREE.LinearFilter;
|
|
240
|
-
tex.minFilter = THREE.LinearFilter;
|
|
241
|
-
tex.generateMipmaps = false;
|
|
242
|
-
tex.flipY = false;
|
|
243
|
-
tex.needsUpdate = true;
|
|
244
|
-
return tex;
|
|
245
|
-
};
|
|
246
|
-
const splat0Tex = makeSplat(worldData.splat0);
|
|
247
|
-
const splat1Tex = makeSplat(worldData.splat1);
|
|
248
|
-
const alphaTex = new THREE.DataTexture(worldData.alphaMap, n, n, THREE.RedFormat, THREE.UnsignedByteType);
|
|
249
|
-
alphaTex.colorSpace = THREE.NoColorSpace;
|
|
250
|
-
alphaTex.wrapS = THREE.ClampToEdgeWrapping;
|
|
251
|
-
alphaTex.wrapT = THREE.ClampToEdgeWrapping;
|
|
252
|
-
alphaTex.magFilter = THREE.NearestFilter;
|
|
253
|
-
alphaTex.minFilter = THREE.NearestFilter;
|
|
254
|
-
alphaTex.generateMipmaps = false;
|
|
255
|
-
alphaTex.flipY = false;
|
|
256
|
-
alphaTex.needsUpdate = true;
|
|
257
|
-
const slices = generatePS2DetailSlices(hashSeed(worldData.config.seed) ^ 2654435769, 128);
|
|
258
|
-
const arrayData = /* @__PURE__ */ new Uint8Array(524288);
|
|
259
|
-
const detailSliceTexs = [];
|
|
260
|
-
for (let i = 0; i < 8; i++) {
|
|
261
|
-
arrayData.set(slices[i], i * 128 * 128 * 4);
|
|
262
|
-
const tex = new THREE.DataTexture(slices[i], 128, 128, THREE.RGBAFormat, THREE.UnsignedByteType);
|
|
263
|
-
tex.colorSpace = THREE.SRGBColorSpace;
|
|
264
|
-
tex.wrapS = THREE.RepeatWrapping;
|
|
265
|
-
tex.wrapT = THREE.RepeatWrapping;
|
|
266
|
-
tex.magFilter = THREE.NearestFilter;
|
|
267
|
-
tex.minFilter = THREE.LinearMipmapNearestFilter;
|
|
268
|
-
tex.generateMipmaps = true;
|
|
269
|
-
tex.needsUpdate = true;
|
|
270
|
-
detailSliceTexs.push(tex);
|
|
271
|
-
}
|
|
272
|
-
const detailArrayTex = new THREE.DataArrayTexture(arrayData, 128, 128, 8);
|
|
273
|
-
detailArrayTex.format = THREE.RGBAFormat;
|
|
274
|
-
detailArrayTex.type = THREE.UnsignedByteType;
|
|
275
|
-
detailArrayTex.colorSpace = THREE.SRGBColorSpace;
|
|
276
|
-
detailArrayTex.wrapS = THREE.RepeatWrapping;
|
|
277
|
-
detailArrayTex.wrapT = THREE.RepeatWrapping;
|
|
278
|
-
detailArrayTex.magFilter = THREE.NearestFilter;
|
|
279
|
-
detailArrayTex.minFilter = THREE.LinearMipmapNearestFilter;
|
|
280
|
-
detailArrayTex.generateMipmaps = true;
|
|
281
|
-
detailArrayTex.needsUpdate = true;
|
|
282
|
-
return {
|
|
283
|
-
splat0Tex,
|
|
284
|
-
splat1Tex,
|
|
285
|
-
alphaTex,
|
|
286
|
-
detailArrayTex,
|
|
287
|
-
detailSliceTexs,
|
|
288
|
-
dispose: () => {
|
|
289
|
-
splat0Tex.dispose();
|
|
290
|
-
splat1Tex.dispose();
|
|
291
|
-
alphaTex.dispose();
|
|
292
|
-
detailArrayTex.dispose();
|
|
293
|
-
detailSliceTexs.forEach((t) => t.dispose());
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
export { SPLAT_LAYER, createPS2WorldTextures, generatePS2DetailSlices };
|
|
298
|
-
|
|
299
|
-
//# sourceMappingURL=ps2Textures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ps2Textures.js","names":[],"sources":["../../src/shaders/ps2Textures.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { SplitMix32, hashSeed, type WorldGenResult } from \"../world/worldTypes.js\";\n\nexport const SPLAT_LAYER = {\n DIRT: 0,\n GRASS: 1,\n SAND: 2,\n ROCK: 3,\n GRAVEL: 4,\n FOREST: 5,\n SNOW: 6,\n ASPHALT: 7,\n} as const;\n\nexport interface PS2TextureBundle {\n readonly splat0Tex: THREE.DataTexture;\n readonly splat1Tex: THREE.DataTexture;\n readonly alphaTex: THREE.DataTexture;\n readonly detailArrayTex: THREE.DataArrayTexture;\n readonly detailSliceTexs: readonly THREE.DataTexture[];\n readonly dispose: () => void;\n}\n\nfunction hashTile(ix: number, iy: number, period: number, seed: number): number {\n const wx = ((ix % period) + period) % period;\n const wy = ((iy % period) + period) % period;\n let h = (Math.imul(wx, 374761393) + Math.imul(wy, 668265263) + seed) | 0;\n h = Math.imul(h ^ (h >>> 13), 1274126177);\n return ((h ^ (h >>> 16)) >>> 0) / 4294967296;\n}\n\nfunction tileNoise(u: number, v: number, freq: number, seed: number): number {\n const x = u * freq;\n const y = v * freq;\n const ix = Math.floor(x);\n const iy = Math.floor(y);\n const fx = x - ix;\n const fy = y - iy;\n const sx = fx * fx * (3 - 2 * fx);\n const sy = fy * fy * (3 - 2 * fy);\n const n00 = hashTile(ix, iy, freq, seed);\n const n10 = hashTile(ix + 1, iy, freq, seed);\n const n01 = hashTile(ix, iy + 1, freq, seed);\n const n11 = hashTile(ix + 1, iy + 1, freq, seed);\n return (n00 * (1 - sx) + n10 * sx) * (1 - sy) + (n01 * (1 - sx) + n11 * sx) * sy;\n}\n\nconst clampByte = (v: number): number => Math.max(0, Math.min(255, Math.round(v)));\n\ninterface LayerPalette {\n base: [number, number, number];\n dark: [number, number, number];\n light: [number, number, number];\n freqA: number;\n freqB: number;\n speckle: number;\n striateY?: number;\n}\n\nconst LAYER_PALETTES: readonly LayerPalette[] = [\n { base: [108, 82, 56], dark: [72, 53, 36], light: [138, 108, 76], freqA: 16, freqB: 48, speckle: 0.28 },\n { base: [86, 114, 52], dark: [58, 82, 34], light: [122, 146, 68], freqA: 20, freqB: 64, speckle: 0.22 },\n { base: [194, 174, 128], dark: [164, 142, 98], light: [218, 202, 158], freqA: 12, freqB: 64, speckle: 0.14, striateY: 3 },\n { base: [112, 110, 106], dark: [68, 66, 64], light: [148, 145, 138], freqA: 14, freqB: 36, speckle: 0.2, striateY: 4.5 },\n { base: [124, 118, 108], dark: [76, 72, 66], light: [168, 162, 150], freqA: 32, freqB: 64, speckle: 0.45 },\n { base: [56, 76, 42], dark: [36, 48, 28], light: [88, 98, 54], freqA: 18, freqB: 52, speckle: 0.26 },\n { base: [222, 228, 236], dark: [182, 194, 212], light: [246, 248, 252], freqA: 12, freqB: 40, speckle: 0.1 },\n { base: [54, 55, 58], dark: [36, 37, 40], light: [86, 88, 92], freqA: 32, freqB: 64, speckle: 0.42 },\n];\n\nexport function generatePS2DetailSlices(seed: number, size = 128): Uint8Array<ArrayBuffer>[] {\n const rng = new SplitMix32(seed);\n const slices: Uint8Array<ArrayBuffer>[] = [];\n for (let layer = 0; layer < 8; layer++) {\n const data = new Uint8Array(size * size * 4);\n const pal = LAYER_PALETTES[layer];\n const sA = (rng.next() * 2147483647) | 0;\n const sB = (rng.next() * 2147483647) | 0;\n const sC = (rng.next() * 2147483647) | 0;\n for (let y = 0; y < size; y++) {\n for (let x = 0; x < size; x++) {\n const u = x / size;\n const a = tileNoise(u, ((y / size) * (pal.striateY ?? 1)) % 1, pal.freqA, sA);\n const b = tileNoise(u, y / size, pal.freqB, sB);\n const c = hashTile(x, y, size, sC);\n let h = a * 0.55 + b * 0.45;\n if (c > 1 - pal.speckle * 0.35)\n h = Math.min(1, h + 0.32);\n else if (c < pal.speckle * 0.35)\n h = Math.max(0, h - 0.3);\n h = Math.round(h * 12) / 12;\n const t = h < 0.5 ? h * 2 : (h - 0.5) * 2;\n const c0 = h < 0.5 ? pal.dark : pal.base;\n const c1 = h < 0.5 ? pal.base : pal.light;\n const idx = (y * size + x) * 4;\n data[idx] = clampByte(c0[0] * (1 - t) + c1[0] * t);\n data[idx + 1] = clampByte(c0[1] * (1 - t) + c1[1] * t);\n data[idx + 2] = clampByte(c0[2] * (1 - t) + c1[2] * t);\n data[idx + 3] = 255;\n }\n }\n slices.push(data);\n }\n return slices;\n}\n\nexport function createPS2WorldTextures(worldData: WorldGenResult): PS2TextureBundle {\n const n = worldData.config.gridCells;\n const makeSplat = (buf: Uint8Array): THREE.DataTexture => {\n const tex = new THREE.DataTexture(buf, n, n, THREE.RGBAFormat, THREE.UnsignedByteType);\n tex.colorSpace = THREE.NoColorSpace;\n tex.wrapS = THREE.ClampToEdgeWrapping;\n tex.wrapT = THREE.ClampToEdgeWrapping;\n tex.magFilter = THREE.LinearFilter;\n tex.minFilter = THREE.LinearFilter;\n tex.generateMipmaps = false;\n tex.flipY = false;\n tex.needsUpdate = true;\n return tex;\n };\n const splat0Tex = makeSplat(worldData.splat0);\n const splat1Tex = makeSplat(worldData.splat1);\n const alphaTex = new THREE.DataTexture(worldData.alphaMap, n, n, THREE.RedFormat, THREE.UnsignedByteType);\n alphaTex.colorSpace = THREE.NoColorSpace;\n alphaTex.wrapS = THREE.ClampToEdgeWrapping;\n alphaTex.wrapT = THREE.ClampToEdgeWrapping;\n alphaTex.magFilter = THREE.NearestFilter;\n alphaTex.minFilter = THREE.NearestFilter;\n alphaTex.generateMipmaps = false;\n alphaTex.flipY = false;\n alphaTex.needsUpdate = true;\n\n const slices = generatePS2DetailSlices(hashSeed(worldData.config.seed) ^ 0x9e3779b9, 128);\n const arrayData = new Uint8Array(128 * 128 * 8 * 4);\n const detailSliceTexs: THREE.DataTexture[] = [];\n for (let i = 0; i < 8; i++) {\n arrayData.set(slices[i], i * 128 * 128 * 4);\n const tex = new THREE.DataTexture(slices[i], 128, 128, THREE.RGBAFormat, THREE.UnsignedByteType);\n tex.colorSpace = THREE.SRGBColorSpace;\n tex.wrapS = THREE.RepeatWrapping;\n tex.wrapT = THREE.RepeatWrapping;\n tex.magFilter = THREE.NearestFilter;\n tex.minFilter = THREE.LinearMipmapNearestFilter;\n tex.generateMipmaps = true;\n tex.needsUpdate = true;\n detailSliceTexs.push(tex);\n }\n const detailArrayTex = new THREE.DataArrayTexture(arrayData, 128, 128, 8);\n detailArrayTex.format = THREE.RGBAFormat;\n detailArrayTex.type = THREE.UnsignedByteType;\n detailArrayTex.colorSpace = THREE.SRGBColorSpace;\n detailArrayTex.wrapS = THREE.RepeatWrapping;\n detailArrayTex.wrapT = THREE.RepeatWrapping;\n detailArrayTex.magFilter = THREE.NearestFilter;\n detailArrayTex.minFilter = THREE.LinearMipmapNearestFilter;\n detailArrayTex.generateMipmaps = true;\n detailArrayTex.needsUpdate = true;\n\n return {\n splat0Tex,\n splat1Tex,\n alphaTex,\n detailArrayTex,\n detailSliceTexs,\n dispose: () => {\n splat0Tex.dispose();\n splat1Tex.dispose();\n alphaTex.dispose();\n detailArrayTex.dispose();\n detailSliceTexs.forEach((t) => t.dispose());\n },\n };\n}\n"],"mappings":";;;AAGA,IAAa,cAAc;CACvB,MAAM;CACN,OAAO;CACP,MAAM;CACN,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,SAAS;AACb;AAWA,SAAS,SAAS,IAAY,IAAY,QAAgB,MAAsB;CAC5E,MAAM,MAAO,KAAK,SAAU,UAAU;CACtC,MAAM,MAAO,KAAK,SAAU,UAAU;CACtC,IAAI,IAAK,KAAK,KAAK,IAAI,SAAS,IAAI,KAAK,KAAK,IAAI,SAAS,IAAI,OAAQ;CACvE,IAAI,KAAK,KAAK,IAAK,MAAM,IAAK,UAAU;CACxC,SAAS,IAAK,MAAM,QAAS,KAAK;AACtC;AAEA,SAA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U,QAAQ;GAClB,UAAU,QAAQ;GAClB,SAAS,QAAQ;GACjB,eAAe,QAAQ;GACvB,gBAAgB,SAAS,MAAM,EAAE,QAAQ,CAAC;EAC9C;CACJ;AACJ"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
export type RetroColorMode = "off" | "rgb555" | "rgb444" | "rgb332" | "crunchy16" | "crunchy64";
|
|
3
|
-
export interface RetroColorModeSpec {
|
|
4
|
-
id: RetroColorMode;
|
|
5
|
-
label: string;
|
|
6
|
-
shortLabel: string;
|
|
7
|
-
description: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const RETRO_COLOR_MODES: readonly RetroColorModeSpec[];
|
|
10
|
-
export declare const PALETTE_CRUNCHY_16: readonly string[];
|
|
11
|
-
export declare const PALETTE_CRUNCHY_64: readonly string[];
|
|
12
|
-
export declare function buildPaletteLutData(paletteHex: readonly string[]): Uint8Array<ArrayBuffer>;
|
|
13
|
-
export declare function getPaletteLutTexture(kind: "crunchy16" | "crunchy64" | "fallback"): THREE.DataTexture;
|
|
14
|
-
export declare function getColorQuantVector(mode: RetroColorMode, target?: THREE.Vector4): THREE.Vector4;
|
|
15
|
-
export interface RetroTextureOptions {
|
|
16
|
-
pixelated?: boolean;
|
|
17
|
-
mipmaps?: boolean;
|
|
18
|
-
anisotropy?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare function applyRetroTextureFiltering(texture: null, opts?: RetroTextureOptions): null;
|
|
21
|
-
export declare function applyRetroTextureFiltering(texture: undefined, opts?: RetroTextureOptions): undefined;
|
|
22
|
-
export declare function applyRetroTextureFiltering<T extends THREE.Texture>(texture: T, opts?: RetroTextureOptions): T;
|
|
23
|
-
export declare function applyRetroFilteringToMaterial(material: THREE.Material | null | undefined, opts?: RetroTextureOptions): void;
|
|
24
|
-
export declare function computeRetroDpr(renderScale: number, isSoftGl?: boolean, devicePixelRatio?: number): number;
|