@pinkaphant/kolmo 0.4.7 → 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 -93
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/{kolmoGltfLoader.d.ts → gltfLoader.d.ts} +6 -3
- package/dist/engine/index.d.ts +8 -17
- package/dist/engine/index.js +1270 -27
- 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 -116
- package/dist/physics/index.js +1 -131
- package/dist/physics-FhWvTBfH.js +424 -0
- package/dist/physics-FhWvTBfH.js.map +1 -0
- package/package.json +31 -85
- 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.js +0 -46
- package/dist/engine/kolmoGltfLoader.js.map +0 -1
- package/dist/engine/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -219
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -165
- package/dist/engine/kolmoInput.js.map +0 -1
- package/dist/engine/kolmoIsland.d.ts +0 -14
- package/dist/engine/kolmoIsland.js +0 -243
- package/dist/engine/kolmoIsland.js.map +0 -1
- package/dist/engine/kolmoLongDrive.d.ts +0 -12
- package/dist/engine/kolmoLongDrive.js +0 -178
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -6
- package/dist/engine/kolmoPilotMesh.js +0 -377
- package/dist/engine/kolmoPilotMesh.js.map +0 -1
- package/dist/engine/kolmoProcedural.d.ts +0 -13
- package/dist/engine/kolmoProcedural.js +0 -101
- package/dist/engine/kolmoProcedural.js.map +0 -1
- package/dist/engine/kolmoRigs.d.ts +0 -13
- package/dist/engine/kolmoRigs.js +0 -100
- package/dist/engine/kolmoRigs.js.map +0 -1
- package/dist/engine/kolmoStore.d.ts +0 -3
- package/dist/engine/kolmoStore.js +0 -4
- package/dist/engine/kolmoStore.js.map +0 -1
- package/dist/engine/kolmoSurface.d.ts +0 -18
- package/dist/engine/kolmoSurface.js +0 -198
- package/dist/engine/kolmoSurface.js.map +0 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
- package/dist/engine/kolmoTouchOverlay.js +0 -326
- package/dist/engine/kolmoTouchOverlay.js.map +0 -1
- package/dist/engine/kolmoTouchState.d.ts +0 -50
- package/dist/engine/kolmoTouchState.js +0 -210
- package/dist/engine/kolmoTouchState.js.map +0 -1
- package/dist/engine/kolmoTraits.js +0 -140
- package/dist/engine/kolmoTraits.js.map +0 -1
- package/dist/engine/kolmoVehicle.d.ts +0 -4
- package/dist/engine/kolmoVehicle.js +0 -80
- package/dist/engine/kolmoVehicle.js.map +0 -1
- package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
- package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
- package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
- package/dist/engine/kolmoVehicleConfig.js +0 -84
- package/dist/engine/kolmoVehicleConfig.js.map +0 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
- package/dist/engine/kolmoVehicleDriver.js +0 -147
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -307
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
- package/dist/engine/kolmoWardrobeRig.js +0 -146
- package/dist/engine/kolmoWardrobeRig.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -164
- package/dist/engine/kolmoWorld.js.map +0 -1
- package/dist/engine/longDriveKit.d.ts +0 -19
- package/dist/engine/longDriveKit.js +0 -145
- package/dist/engine/longDriveKit.js.map +0 -1
- package/dist/engine/longDriveRoadside.d.ts +0 -16
- package/dist/engine/longDriveRoadside.js +0 -171
- package/dist/engine/longDriveRoadside.js.map +0 -1
- package/dist/engine/macroCellBuilder.d.ts +0 -44
- package/dist/engine/macroCellBuilder.js +0 -228
- package/dist/engine/macroCellBuilder.js.map +0 -1
- package/dist/engine/mainlandMacroCell.d.ts +0 -15
- package/dist/engine/mainlandMacroCell.js +0 -168
- package/dist/engine/mainlandMacroCell.js.map +0 -1
- package/dist/engine/shiftedFixedBody.d.ts +0 -13
- package/dist/engine/shiftedFixedBody.js +0 -75
- package/dist/engine/shiftedFixedBody.js.map +0 -1
- package/dist/importer/ChopShopPanel.d.ts +0 -52
- package/dist/importer/ChopShopPanel.js +0 -409
- package/dist/importer/ChopShopPanel.js.map +0 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
- package/dist/importer/DomainWorkshopPanel.js +0 -385
- package/dist/importer/DomainWorkshopPanel.js.map +0 -1
- package/dist/importer/GateHudBar.d.ts +0 -39
- package/dist/importer/GateHudBar.js +0 -401
- package/dist/importer/GateHudBar.js.map +0 -1
- package/dist/importer/GlbImportGate.d.ts +0 -8
- package/dist/importer/GlbImportGate.js +0 -300
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -274
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -195
- package/dist/importer/LiveDrivePads.js.map +0 -1
- package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
- package/dist/importer/PaperShellDebrisRig.js +0 -143
- package/dist/importer/PaperShellDebrisRig.js.map +0 -1
- package/dist/importer/R2VaultDrawer.d.ts +0 -12
- package/dist/importer/R2VaultDrawer.js +0 -90
- package/dist/importer/R2VaultDrawer.js.map +0 -1
- package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
- package/dist/importer/Step1CalibrationPlinth.js +0 -204
- package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
- package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
- package/dist/importer/Step1ExplodedIslands.js +0 -144
- package/dist/importer/Step1ExplodedIslands.js.map +0 -1
- package/dist/importer/Step2UniversalPad.d.ts +0 -18
- package/dist/importer/Step2UniversalPad.js +0 -123
- package/dist/importer/Step2UniversalPad.js.map +0 -1
- package/dist/importer/VfxEmitterPool.d.ts +0 -8
- package/dist/importer/VfxEmitterPool.js +0 -64
- package/dist/importer/VfxEmitterPool.js.map +0 -1
- package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
- package/dist/importer/WardrobeWorkshopPanel.js +0 -529
- package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
- package/dist/importer/WheelRingHandles3D.d.ts +0 -11
- package/dist/importer/WheelRingHandles3D.js +0 -319
- package/dist/importer/WheelRingHandles3D.js.map +0 -1
- package/dist/importer/archLinerGeom.d.ts +0 -2
- package/dist/importer/archLinerGeom.js +0 -51
- package/dist/importer/archLinerGeom.js.map +0 -1
- package/dist/importer/chopHingeHelpers.d.ts +0 -15
- package/dist/importer/chopHingeHelpers.js +0 -193
- package/dist/importer/chopHingeHelpers.js.map +0 -1
- package/dist/importer/chopShopActions.d.ts +0 -58
- package/dist/importer/chopShopActions.js +0 -165
- package/dist/importer/chopShopActions.js.map +0 -1
- package/dist/importer/chopShopHandlers.d.ts +0 -26
- package/dist/importer/chopShopHandlers.js +0 -283
- package/dist/importer/chopShopHandlers.js.map +0 -1
- package/dist/importer/chopShopIoActions.d.ts +0 -20
- package/dist/importer/chopShopIoActions.js +0 -192
- package/dist/importer/chopShopIoActions.js.map +0 -1
- package/dist/importer/chopShopMcpAction.d.ts +0 -18
- package/dist/importer/chopShopMcpAction.js +0 -58
- package/dist/importer/chopShopMcpAction.js.map +0 -1
- package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
- package/dist/importer/cylinderBooleanSlice.js +0 -110
- package/dist/importer/cylinderBooleanSlice.js.map +0 -1
- package/dist/importer/cylinderSliceMath.d.ts +0 -14
- package/dist/importer/cylinderSliceMath.js +0 -251
- package/dist/importer/cylinderSliceMath.js.map +0 -1
- package/dist/importer/fusedWheelDetect.d.ts +0 -4
- package/dist/importer/fusedWheelDetect.js +0 -297
- package/dist/importer/fusedWheelDetect.js.map +0 -1
- package/dist/importer/fusedWheelFit.d.ts +0 -19
- package/dist/importer/fusedWheelFit.js +0 -219
- package/dist/importer/fusedWheelFit.js.map +0 -1
- package/dist/importer/gateStore.d.ts +0 -73
- package/dist/importer/gateStore.js +0 -102
- package/dist/importer/gateStore.js.map +0 -1
- package/dist/importer/glbNormalizer.d.ts +0 -22
- package/dist/importer/glbNormalizer.js +0 -177
- package/dist/importer/glbNormalizer.js.map +0 -1
- package/dist/importer/importerWebMcp.d.ts +0 -51
- package/dist/importer/importerWebMcp.js +0 -50
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -368
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -29
- package/dist/importer/index.js +0 -42
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -131
- package/dist/importer/khrCarGeometryMass.js.map +0 -1
- package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
- package/dist/importer/khrCarPlanHelpers.js +0 -300
- package/dist/importer/khrCarPlanHelpers.js.map +0 -1
- package/dist/importer/khrCarPlanner.d.ts +0 -8
- package/dist/importer/khrCarPlanner.js +0 -289
- package/dist/importer/khrCarPlanner.js.map +0 -1
- package/dist/importer/khrCompiler.d.ts +0 -5
- package/dist/importer/khrCompiler.js +0 -87
- package/dist/importer/khrCompiler.js.map +0 -1
- package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
- package/dist/importer/khrCraftPropCompiler.js +0 -263
- package/dist/importer/khrCraftPropCompiler.js.map +0 -1
- package/dist/importer/khrNodeNameGuard.d.ts +0 -20
- package/dist/importer/khrNodeNameGuard.js +0 -139
- package/dist/importer/khrNodeNameGuard.js.map +0 -1
- package/dist/importer/launcherBake.d.ts +0 -15
- package/dist/importer/launcherBake.js +0 -117
- package/dist/importer/launcherBake.js.map +0 -1
- package/dist/importer/launcherCadGeometry.d.ts +0 -22
- package/dist/importer/launcherCadGeometry.js +0 -185
- package/dist/importer/launcherCadGeometry.js.map +0 -1
- package/dist/importer/meshIslands.d.ts +0 -17
- package/dist/importer/meshIslands.js +0 -102
- package/dist/importer/meshIslands.js.map +0 -1
- package/dist/importer/meshSliceBuffers.d.ts +0 -15
- package/dist/importer/meshSliceBuffers.js +0 -159
- package/dist/importer/meshSliceBuffers.js.map +0 -1
- package/dist/importer/polygonEarClipYZ.d.ts +0 -3
- package/dist/importer/polygonEarClipYZ.js +0 -67
- package/dist/importer/polygonEarClipYZ.js.map +0 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
- package/dist/importer/proceduralC12AndCraft.js +0 -302
- package/dist/importer/proceduralC12AndCraft.js.map +0 -1
- package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
- package/dist/importer/proceduralDomainBuilders.js +0 -346
- package/dist/importer/proceduralDomainBuilders.js.map +0 -1
- package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
- package/dist/importer/proceduralPersonAndProp.js +0 -303
- package/dist/importer/proceduralPersonAndProp.js.map +0 -1
- package/dist/importer/sceneSiNormalize.d.ts +0 -19
- package/dist/importer/sceneSiNormalize.js +0 -145
- package/dist/importer/sceneSiNormalize.js.map +0 -1
- package/dist/importer/starterScene.d.ts +0 -5
- package/dist/importer/starterScene.js +0 -139
- package/dist/importer/starterScene.js.map +0 -1
- package/dist/importer/surfaceCutter.d.ts +0 -16
- package/dist/importer/surfaceCutter.js +0 -83
- package/dist/importer/surfaceCutter.js.map +0 -1
- package/dist/importer/surfaceGeodesic.d.ts +0 -7
- package/dist/importer/surfaceGeodesic.js +0 -130
- package/dist/importer/surfaceGeodesic.js.map +0 -1
- package/dist/importer/surfaceLoopRefine.d.ts +0 -6
- package/dist/importer/surfaceLoopRefine.js +0 -171
- package/dist/importer/surfaceLoopRefine.js.map +0 -1
- package/dist/importer/surfacePeel.d.ts +0 -11
- package/dist/importer/surfacePeel.js +0 -119
- package/dist/importer/surfacePeel.js.map +0 -1
- package/dist/importer/surfaceTopology.d.ts +0 -36
- package/dist/importer/surfaceTopology.js +0 -143
- package/dist/importer/surfaceTopology.js.map +0 -1
- package/dist/importer/universalGateBake.d.ts +0 -45
- package/dist/importer/universalGateBake.js +0 -203
- package/dist/importer/universalGateBake.js.map +0 -1
- package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
- package/dist/importer/usdPhysicsSpecs.js +0 -245
- package/dist/importer/usdPhysicsSpecs.js.map +0 -1
- package/dist/importer/usdTextParse.d.ts +0 -12
- package/dist/importer/usdTextParse.js +0 -118
- package/dist/importer/usdTextParse.js.map +0 -1
- package/dist/importer/usdToGlb.d.ts +0 -12
- package/dist/importer/usdToGlb.js +0 -94
- package/dist/importer/usdToGlb.js.map +0 -1
- package/dist/importer/useChopShopController.d.ts +0 -110
- package/dist/importer/useChopShopController.js +0 -219
- package/dist/importer/useChopShopController.js.map +0 -1
- package/dist/importer/useChopShopState.d.ts +0 -103
- package/dist/importer/useChopShopState.js +0 -350
- package/dist/importer/useChopShopState.js.map +0 -1
- package/dist/importer/useWasdKeyRef.d.ts +0 -9
- package/dist/importer/useWasdKeyRef.js +0 -35
- package/dist/importer/useWasdKeyRef.js.map +0 -1
- package/dist/importer/vehiclePartSplit.d.ts +0 -33
- package/dist/importer/vehiclePartSplit.js +0 -183
- package/dist/importer/vehiclePartSplit.js.map +0 -1
- package/dist/importer/wardrobeAutoFit.d.ts +0 -16
- package/dist/importer/wardrobeAutoFit.js +0 -410
- package/dist/importer/wardrobeAutoFit.js.map +0 -1
- package/dist/importer/wardrobeCatalog.d.ts +0 -16
- package/dist/importer/wardrobeCatalog.js +0 -409
- package/dist/importer/wardrobeCatalog.js.map +0 -1
- package/dist/importer/wardrobeController.d.ts +0 -49
- package/dist/importer/wardrobeController.js +0 -181
- package/dist/importer/wardrobeController.js.map +0 -1
- package/dist/importer/wardrobeFitter.d.ts +0 -27
- package/dist/importer/wardrobeFitter.js +0 -269
- package/dist/importer/wardrobeFitter.js.map +0 -1
- package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
- package/dist/importer/wardrobeWebMcpTools.js +0 -198
- package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
- package/dist/importer/wheelAxlePairing.d.ts +0 -21
- package/dist/importer/wheelAxlePairing.js +0 -157
- package/dist/importer/wheelAxlePairing.js.map +0 -1
- package/dist/importer/wheelCutterHelpers.d.ts +0 -45
- package/dist/importer/wheelCutterHelpers.js +0 -208
- package/dist/importer/wheelCutterHelpers.js.map +0 -1
- package/dist/importer/wheelRingHandleMath.d.ts +0 -20
- package/dist/importer/wheelRingHandleMath.js +0 -66
- package/dist/importer/wheelRingHandleMath.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/junk/DestructibleTarget.d.ts +0 -18
- package/dist/junk/DestructibleTarget.js +0 -223
- package/dist/junk/DestructibleTarget.js.map +0 -1
- package/dist/junk/KolmoJunk.d.ts +0 -14
- package/dist/junk/KolmoJunk.js +0 -76
- package/dist/junk/KolmoJunk.js.map +0 -1
- package/dist/junk/ShardPieces.d.ts +0 -13
- package/dist/junk/ShardPieces.js +0 -101
- package/dist/junk/ShardPieces.js.map +0 -1
- package/dist/junk/TargetDecals.d.ts +0 -9
- package/dist/junk/TargetDecals.js +0 -77
- package/dist/junk/TargetDecals.js.map +0 -1
- package/dist/junk/bvhShatter.d.ts +0 -3
- package/dist/junk/bvhShatter.js +0 -101
- package/dist/junk/bvhShatter.js.map +0 -1
- package/dist/junk/bvhTriCollector.d.ts +0 -16
- package/dist/junk/bvhTriCollector.js +0 -127
- package/dist/junk/bvhTriCollector.js.map +0 -1
- package/dist/junk/index.d.ts +0 -14
- package/dist/junk/index.js +0 -13
- package/dist/junk/index.js.map +0 -1
- package/dist/junk/junkGeometry.d.ts +0 -13
- package/dist/junk/junkGeometry.js +0 -87
- package/dist/junk/junkGeometry.js.map +0 -1
- package/dist/junk/junkImportSanitize.d.ts +0 -5
- package/dist/junk/junkImportSanitize.js +0 -74
- package/dist/junk/junkImportSanitize.js.map +0 -1
- package/dist/junk/junkImporter.d.ts +0 -14
- package/dist/junk/junkImporter.js +0 -124
- package/dist/junk/junkImporter.js.map +0 -1
- package/dist/junk/junkLabelCanvas.d.ts +0 -2
- package/dist/junk/junkLabelCanvas.js +0 -185
- package/dist/junk/junkLabelCanvas.js.map +0 -1
- package/dist/junk/junkLabels.d.ts +0 -9
- package/dist/junk/junkLabels.js +0 -49
- package/dist/junk/junkLabels.js.map +0 -1
- package/dist/junk/junkProceduralScenes.d.ts +0 -12
- package/dist/junk/junkProceduralScenes.js +0 -220
- package/dist/junk/junkProceduralScenes.js.map +0 -1
- package/dist/junk/junkSheetSplitter.d.ts +0 -38
- package/dist/junk/junkSheetSplitter.js +0 -104
- package/dist/junk/junkSheetSplitter.js.map +0 -1
- package/dist/junk/junkTypes.d.ts +0 -48
- package/dist/junk/junkTypes.js +0 -0
- package/dist/junk/junkTypes.js.map +0 -1
- package/dist/junk/targetHelpers.d.ts +0 -55
- package/dist/junk/targetHelpers.js +0 -157
- package/dist/junk/targetHelpers.js.map +0 -1
- package/dist/junk/targetHitLogic.d.ts +0 -30
- package/dist/junk/targetHitLogic.js +0 -163
- package/dist/junk/targetHitLogic.js.map +0 -1
- package/dist/junk/useTargetAssets.d.ts +0 -19
- package/dist/junk/useTargetAssets.js +0 -130
- package/dist/junk/useTargetAssets.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/nBodyGravity.js +0 -70
- package/dist/physics/nBodyGravity.js.map +0 -1
- package/dist/sand3d/KolmoSand3D.d.ts +0 -19
- package/dist/sand3d/KolmoSand3D.js +0 -92
- package/dist/sand3d/KolmoSand3D.js.map +0 -1
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
- package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
- package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
- package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
- package/dist/sand3d/gateBakeHelpers.js +0 -225
- package/dist/sand3d/gateBakeHelpers.js.map +0 -1
- package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
- package/dist/sand3d/gateDoorwayBake.js +0 -203
- package/dist/sand3d/gateDoorwayBake.js.map +0 -1
- package/dist/sand3d/index.d.ts +0 -3
- package/dist/sand3d/index.js +0 -4
- package/dist/sand3d/index.js.map +0 -1
- package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
- package/dist/sand3d/sand3dAssetLoader.js +0 -177
- package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
- package/dist/schema/kolmoSchema.d.ts +0 -9
- package/dist/schema/kolmoSchema.js +0 -110
- package/dist/schema/kolmoSchema.js.map +0 -1
- package/dist/schema/kolmoStamp.d.ts +0 -11
- package/dist/schema/kolmoStamp.js +0 -119
- package/dist/schema/kolmoStamp.js.map +0 -1
- package/dist/schema/kolmoTypes.d.ts +0 -63
- package/dist/schema/kolmoTypes.js +0 -66
- package/dist/schema/kolmoTypes.js.map +0 -1
- package/dist/shaders/celestialBackdrop.d.ts +0 -14
- package/dist/shaders/celestialBackdrop.js +0 -181
- package/dist/shaders/celestialBackdrop.js.map +0 -1
- package/dist/shaders/emitterShaders.d.ts +0 -9
- package/dist/shaders/emitterShaders.js +0 -114
- package/dist/shaders/emitterShaders.js.map +0 -1
- package/dist/shaders/index.d.ts +0 -5
- package/dist/shaders/index.js +0 -12
- package/dist/shaders/index.js.map +0 -1
- package/dist/shaders/plumeAndSparkle.d.ts +0 -12
- package/dist/shaders/plumeAndSparkle.js +0 -233
- package/dist/shaders/plumeAndSparkle.js.map +0 -1
- package/dist/shaders/ps2GlslShared.d.ts +0 -20
- package/dist/shaders/ps2GlslShared.js +0 -30
- package/dist/shaders/ps2GlslShared.js.map +0 -1
- package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
- package/dist/shaders/ps2MaterialsTSL.js +0 -146
- package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
- package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
- package/dist/shaders/ps2MaterialsWebGL.js +0 -57
- package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
- package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
- package/dist/shaders/ps2RoadWebGL.js +0 -138
- package/dist/shaders/ps2RoadWebGL.js.map +0 -1
- package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
- package/dist/shaders/ps2TerrainWebGL.js +0 -131
- package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
- package/dist/shaders/ps2Textures.d.ts +0 -22
- package/dist/shaders/ps2Textures.js +0 -299
- package/dist/shaders/ps2Textures.js.map +0 -1
- package/dist/shaders/retroPalettes.d.ts +0 -24
- package/dist/shaders/retroPalettes.js +0 -221
- package/dist/shaders/retroPalettes.js.map +0 -1
- package/dist/shaders/retroShader.d.ts +0 -13
- package/dist/shaders/retroShader.js +0 -110
- package/dist/shaders/retroShader.js.map +0 -1
- package/dist/shaders/retroUniforms.d.ts +0 -60
- package/dist/shaders/retroUniforms.js +0 -215
- package/dist/shaders/retroUniforms.js.map +0 -1
- package/dist/shaders/skyboxShaders.d.ts +0 -16
- package/dist/shaders/skyboxShaders.js +0 -266
- package/dist/shaders/skyboxShaders.js.map +0 -1
- package/dist/shaders/tsl.d.ts +0 -1
- package/dist/shaders/tsl.js +0 -1
- package/dist/shaders/tsl.js.map +0 -1
- package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
- package/dist/suika/KolmoSuikaOrb.js +0 -375
- package/dist/suika/KolmoSuikaOrb.js.map +0 -1
- package/dist/suika/index.d.ts +0 -4
- package/dist/suika/index.js +0 -5
- package/dist/suika/index.js.map +0 -1
- package/dist/suika/suikaArbiter.d.ts +0 -60
- package/dist/suika/suikaArbiter.js +0 -265
- package/dist/suika/suikaArbiter.js.map +0 -1
- package/dist/suika/suikaGeometry.d.ts +0 -10
- package/dist/suika/suikaGeometry.js +0 -251
- package/dist/suika/suikaGeometry.js.map +0 -1
- package/dist/suika/suikaTypes.d.ts +0 -74
- package/dist/suika/suikaTypes.js +0 -196
- package/dist/suika/suikaTypes.js.map +0 -1
- package/dist/world/frontage.d.ts +0 -26
- package/dist/world/frontage.js +0 -36
- package/dist/world/frontage.js.map +0 -1
- package/dist/world/index.d.ts +0 -9
- package/dist/world/index.js +0 -12
- package/dist/world/index.js.map +0 -1
- package/dist/world/infiniteWorld2D.d.ts +0 -19
- package/dist/world/infiniteWorld2D.js +0 -219
- package/dist/world/infiniteWorld2D.js.map +0 -1
- package/dist/world/island.d.ts +0 -29
- package/dist/world/island.js +0 -116
- package/dist/world/island.js.map +0 -1
- package/dist/world/islandPathing.d.ts +0 -6
- package/dist/world/islandPathing.js +0 -166
- package/dist/world/islandPathing.js.map +0 -1
- package/dist/world/macroCellSchema.d.ts +0 -72
- package/dist/world/macroCellSchema.js +0 -34
- package/dist/world/macroCellSchema.js.map +0 -1
- package/dist/world/macroKnightAStar.d.ts +0 -11
- package/dist/world/macroKnightAStar.js +0 -240
- package/dist/world/macroKnightAStar.js.map +0 -1
- package/dist/world/macroSettlementZones.d.ts +0 -9
- package/dist/world/macroSettlementZones.js +0 -108
- package/dist/world/macroSettlementZones.js.map +0 -1
- package/dist/world/random.d.ts +0 -23
- package/dist/world/random.js +0 -59
- package/dist/world/random.js.map +0 -1
- package/dist/world/road.d.ts +0 -37
- package/dist/world/road.js +0 -198
- package/dist/world/road.js.map +0 -1
- package/dist/world/roadRibbon.d.ts +0 -29
- package/dist/world/roadRibbon.js +0 -166
- package/dist/world/roadRibbon.js.map +0 -1
- package/dist/world/terrain.d.ts +0 -62
- package/dist/world/terrain.js +0 -133
- package/dist/world/terrain.js.map +0 -1
- package/dist/world/terrainGeometry.d.ts +0 -14
- package/dist/world/terrainGeometry.js +0 -76
- package/dist/world/terrainGeometry.js.map +0 -1
- package/dist/world/worldTypes.d.ts +0 -43
- package/dist/world/worldTypes.js +0 -197
- package/dist/world/worldTypes.js.map +0 -1
- package/docs/api-reference.md +0 -728
- package/skills/kolmo-engine/SKILL.md +0 -109
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { PALETTE_CRUNCHY_16, PALETTE_CRUNCHY_64, RETRO_COLOR_MODES, applyRetroFilteringToMaterial, applyRetroTextureFiltering, buildPaletteLutData, computeRetroDpr, getColorQuantVector, getPaletteLutTexture } from "./retroPalettes.js";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
// src/shaders/retroUniforms.ts
|
|
4
|
-
var PS1_SNAP_RESOLUTION = new THREE.Vector2(320, 180);
|
|
5
|
-
var RETRO_UNIFORMS = {
|
|
6
|
-
uPs1Grid: { value: PS1_SNAP_RESOLUTION },
|
|
7
|
-
uDitherMix: { value: .62 },
|
|
8
|
-
uSnapStrength: { value: 0 },
|
|
9
|
-
uDitherScale: { value: 2 },
|
|
10
|
-
uColorQuant: { value: getColorQuantVector("rgb555") },
|
|
11
|
-
uPaletteLut: { value: getPaletteLutTexture("fallback") },
|
|
12
|
-
uAffineStrength: { value: 0 },
|
|
13
|
-
uGouraudStrength: { value: 0 },
|
|
14
|
-
uN64FilterStrength: { value: 0 },
|
|
15
|
-
uN64TexSize: { value: 256 }
|
|
16
|
-
};
|
|
17
|
-
function getRetroShaderUniforms() {
|
|
18
|
-
return {
|
|
19
|
-
uPs1Grid: RETRO_UNIFORMS.uPs1Grid,
|
|
20
|
-
uDitherMix: RETRO_UNIFORMS.uDitherMix,
|
|
21
|
-
uSnapStrength: RETRO_UNIFORMS.uSnapStrength,
|
|
22
|
-
uDitherScale: RETRO_UNIFORMS.uDitherScale,
|
|
23
|
-
uColorQuant: RETRO_UNIFORMS.uColorQuant,
|
|
24
|
-
uPaletteLut: RETRO_UNIFORMS.uPaletteLut,
|
|
25
|
-
uAffineStrength: RETRO_UNIFORMS.uAffineStrength,
|
|
26
|
-
uGouraudStrength: RETRO_UNIFORMS.uGouraudStrength,
|
|
27
|
-
uN64FilterStrength: RETRO_UNIFORMS.uN64FilterStrength,
|
|
28
|
-
uN64TexSize: RETRO_UNIFORMS.uN64TexSize
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
var RETRO_PRESETS = [
|
|
32
|
-
{
|
|
33
|
-
id: "dreamcast",
|
|
34
|
-
label: "Nu-School Dreamcast",
|
|
35
|
-
renderScale: .67,
|
|
36
|
-
ditherAmount: .62,
|
|
37
|
-
pixelSnapAmount: 0,
|
|
38
|
-
colorMode: "rgb555",
|
|
39
|
-
ditherScale: 2,
|
|
40
|
-
affineAmount: 0,
|
|
41
|
-
gouraudAmount: 0,
|
|
42
|
-
n64FilterAmount: 0,
|
|
43
|
-
fogEnabled: false
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: "n64-emu-1080p",
|
|
47
|
-
label: "N64 Emu 1080p ('08)",
|
|
48
|
-
renderScale: 1,
|
|
49
|
-
ditherAmount: .32,
|
|
50
|
-
pixelSnapAmount: 0,
|
|
51
|
-
colorMode: "rgb555",
|
|
52
|
-
ditherScale: 1,
|
|
53
|
-
affineAmount: 0,
|
|
54
|
-
gouraudAmount: .9,
|
|
55
|
-
n64FilterAmount: 1,
|
|
56
|
-
fogEnabled: false
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "n64-psx-hybrid",
|
|
60
|
-
label: "N64 Bouba × PSX Kiki",
|
|
61
|
-
renderScale: .56,
|
|
62
|
-
ditherAmount: .78,
|
|
63
|
-
pixelSnapAmount: .55,
|
|
64
|
-
colorMode: "rgb555",
|
|
65
|
-
ditherScale: 2,
|
|
66
|
-
affineAmount: 0,
|
|
67
|
-
gouraudAmount: .65,
|
|
68
|
-
n64FilterAmount: 1,
|
|
69
|
-
fogEnabled: false
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: "psx-plus",
|
|
73
|
-
label: "PSX++ Pixel Snap",
|
|
74
|
-
renderScale: .5,
|
|
75
|
-
ditherAmount: .85,
|
|
76
|
-
pixelSnapAmount: .68,
|
|
77
|
-
colorMode: "rgb555",
|
|
78
|
-
ditherScale: 2,
|
|
79
|
-
affineAmount: 0,
|
|
80
|
-
gouraudAmount: .45,
|
|
81
|
-
n64FilterAmount: 0,
|
|
82
|
-
fogEnabled: false
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: "ps2-shinobi",
|
|
86
|
-
label: "PS2 Shinobi",
|
|
87
|
-
renderScale: .58,
|
|
88
|
-
ditherAmount: .8,
|
|
89
|
-
pixelSnapAmount: 0,
|
|
90
|
-
colorMode: "rgb555",
|
|
91
|
-
ditherScale: 2,
|
|
92
|
-
affineAmount: 0,
|
|
93
|
-
gouraudAmount: .28,
|
|
94
|
-
n64FilterAmount: 0,
|
|
95
|
-
fogEnabled: false
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: "n64-ultra",
|
|
99
|
-
label: "N64 3-Point RDP",
|
|
100
|
-
renderScale: .5,
|
|
101
|
-
ditherAmount: .55,
|
|
102
|
-
pixelSnapAmount: 0,
|
|
103
|
-
colorMode: "rgb555",
|
|
104
|
-
ditherScale: 2,
|
|
105
|
-
affineAmount: 0,
|
|
106
|
-
gouraudAmount: .85,
|
|
107
|
-
n64FilterAmount: 1,
|
|
108
|
-
fogEnabled: false
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: "dsi-crisp",
|
|
112
|
-
label: "DSi Crisp",
|
|
113
|
-
renderScale: .5,
|
|
114
|
-
ditherAmount: .88,
|
|
115
|
-
pixelSnapAmount: .35,
|
|
116
|
-
colorMode: "rgb444",
|
|
117
|
-
ditherScale: 2,
|
|
118
|
-
affineAmount: 0,
|
|
119
|
-
gouraudAmount: .2,
|
|
120
|
-
n64FilterAmount: 0,
|
|
121
|
-
fogEnabled: false
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: "psx-chonk",
|
|
125
|
-
label: "PSX Full Chonk",
|
|
126
|
-
renderScale: .33,
|
|
127
|
-
ditherAmount: 1,
|
|
128
|
-
pixelSnapAmount: 1,
|
|
129
|
-
colorMode: "rgb555",
|
|
130
|
-
ditherScale: 2.5,
|
|
131
|
-
affineAmount: 0,
|
|
132
|
-
gouraudAmount: .65,
|
|
133
|
-
n64FilterAmount: 0,
|
|
134
|
-
fogEnabled: false
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "psx-raw-1995",
|
|
138
|
-
label: "PSX 1995 Raw Affine",
|
|
139
|
-
renderScale: .33,
|
|
140
|
-
ditherAmount: 1,
|
|
141
|
-
pixelSnapAmount: 1,
|
|
142
|
-
colorMode: "rgb555",
|
|
143
|
-
ditherScale: 2.5,
|
|
144
|
-
affineAmount: 1,
|
|
145
|
-
gouraudAmount: 1,
|
|
146
|
-
n64FilterAmount: 0,
|
|
147
|
-
fogEnabled: false
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: "clean-hd",
|
|
151
|
-
label: "HD Remaster 1:1",
|
|
152
|
-
renderScale: 1,
|
|
153
|
-
ditherAmount: 0,
|
|
154
|
-
pixelSnapAmount: 0,
|
|
155
|
-
colorMode: "off",
|
|
156
|
-
ditherScale: 1,
|
|
157
|
-
affineAmount: 0,
|
|
158
|
-
gouraudAmount: 0,
|
|
159
|
-
n64FilterAmount: 0,
|
|
160
|
-
fogEnabled: false
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
var RETRO_DREAMCAST = RETRO_PRESETS[0];
|
|
164
|
-
var RETRO_PSX_PLUS = RETRO_PRESETS[3];
|
|
165
|
-
var RETRO_PS2_SHINOBI = RETRO_PRESETS[4];
|
|
166
|
-
var RETRO_CLEAN_HD = RETRO_PRESETS[9];
|
|
167
|
-
function getRetroPreset(id) {
|
|
168
|
-
if (typeof id === "object") return id;
|
|
169
|
-
return RETRO_PRESETS.find((p) => p.id === id) ?? RETRO_PRESETS[0];
|
|
170
|
-
}
|
|
171
|
-
var vpWidth = 1280;
|
|
172
|
-
var vpHeight = 720;
|
|
173
|
-
var vpDpr = 1;
|
|
174
|
-
var curRenderScale = .67;
|
|
175
|
-
var curDitherScale = 2;
|
|
176
|
-
function recomputeSnapGrid() {
|
|
177
|
-
RETRO_UNIFORMS.uDitherScale.value = Math.max(1, Math.round(curDitherScale * vpDpr));
|
|
178
|
-
const t = THREE.MathUtils.clamp((curRenderScale - .33) / .67, 0, 1);
|
|
179
|
-
const snap = RETRO_UNIFORMS.uSnapStrength.value;
|
|
180
|
-
const targetLines = (180 + t * 180) * (1.18 - snap * .46);
|
|
181
|
-
const div = Math.max(1, Math.round(vpHeight / Math.max(90, targetLines)));
|
|
182
|
-
const gx = vpWidth / (2 * div), gy = vpHeight / (2 * div);
|
|
183
|
-
const minAxis = Math.min(gx, gy);
|
|
184
|
-
const boost = minAxis > 0 && minAxis < 45 ? 45 / minAxis : 1;
|
|
185
|
-
PS1_SNAP_RESOLUTION.set(Math.max(1, Math.round(gx * boost)), Math.max(1, Math.round(gy * boost)));
|
|
186
|
-
}
|
|
187
|
-
function syncRetroUniforms(presetOrDither, pixelSnapAmount = 0, renderScale = .67, colorMode, ditherScale, affineAmount, gouraudAmount, n64FilterAmount) {
|
|
188
|
-
if (typeof presetOrDither === "string" || typeof presetOrDither === "object") {
|
|
189
|
-
const preset = getRetroPreset(presetOrDither);
|
|
190
|
-
syncRetroUniforms(preset.ditherAmount, preset.pixelSnapAmount, preset.renderScale, preset.colorMode, preset.ditherScale, preset.affineAmount, preset.gouraudAmount, preset.n64FilterAmount);
|
|
191
|
-
return preset;
|
|
192
|
-
}
|
|
193
|
-
if (Number.isFinite(presetOrDither)) RETRO_UNIFORMS.uDitherMix.value = THREE.MathUtils.clamp(presetOrDither, 0, 1);
|
|
194
|
-
if (Number.isFinite(pixelSnapAmount)) RETRO_UNIFORMS.uSnapStrength.value = THREE.MathUtils.clamp(pixelSnapAmount, 0, 1);
|
|
195
|
-
if (Number.isFinite(renderScale)) curRenderScale = THREE.MathUtils.clamp(renderScale, .33, 1);
|
|
196
|
-
if (colorMode) {
|
|
197
|
-
getColorQuantVector(colorMode, RETRO_UNIFORMS.uColorQuant.value);
|
|
198
|
-
RETRO_UNIFORMS.uPaletteLut.value = getPaletteLutTexture(colorMode === "crunchy16" || colorMode === "crunchy64" ? colorMode : "fallback");
|
|
199
|
-
}
|
|
200
|
-
if (typeof ditherScale === "number" && Number.isFinite(ditherScale)) curDitherScale = THREE.MathUtils.clamp(ditherScale, .5, 6);
|
|
201
|
-
if (typeof affineAmount === "number" && Number.isFinite(affineAmount)) RETRO_UNIFORMS.uAffineStrength.value = THREE.MathUtils.clamp(affineAmount, 0, 1);
|
|
202
|
-
if (typeof gouraudAmount === "number" && Number.isFinite(gouraudAmount)) RETRO_UNIFORMS.uGouraudStrength.value = THREE.MathUtils.clamp(gouraudAmount, 0, 1);
|
|
203
|
-
if (typeof n64FilterAmount === "number" && Number.isFinite(n64FilterAmount)) RETRO_UNIFORMS.uN64FilterStrength.value = THREE.MathUtils.clamp(n64FilterAmount, 0, 1);
|
|
204
|
-
recomputeSnapGrid();
|
|
205
|
-
}
|
|
206
|
-
function syncRetroViewport(fbW, fbH, effectiveDpr) {
|
|
207
|
-
if (!Number.isFinite(fbW) || !Number.isFinite(fbH) || fbW <= 0 || fbH <= 0) return;
|
|
208
|
-
vpWidth = fbW;
|
|
209
|
-
vpHeight = fbH;
|
|
210
|
-
if (Number.isFinite(effectiveDpr) && effectiveDpr > 0) vpDpr = effectiveDpr;
|
|
211
|
-
recomputeSnapGrid();
|
|
212
|
-
}
|
|
213
|
-
export { PALETTE_CRUNCHY_16, PALETTE_CRUNCHY_64, PS1_SNAP_RESOLUTION, RETRO_CLEAN_HD, RETRO_COLOR_MODES, RETRO_DREAMCAST, RETRO_PRESETS, RETRO_PS2_SHINOBI, RETRO_PSX_PLUS, RETRO_UNIFORMS, applyRetroFilteringToMaterial, applyRetroTextureFiltering, buildPaletteLutData, computeRetroDpr, getColorQuantVector, getPaletteLutTexture, getRetroPreset, getRetroShaderUniforms, syncRetroUniforms, syncRetroViewport };
|
|
214
|
-
|
|
215
|
-
//# sourceMappingURL=retroUniforms.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retroUniforms.js","names":[],"sources":["../../src/shaders/retroUniforms.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport {\n PALETTE_CRUNCHY_16,\n PALETTE_CRUNCHY_64,\n RETRO_COLOR_MODES,\n applyRetroFilteringToMaterial,\n applyRetroTextureFiltering,\n buildPaletteLutData,\n computeRetroDpr,\n getColorQuantVector,\n getPaletteLutTexture,\n type RetroColorMode,\n type RetroColorModeSpec,\n type RetroTextureOptions,\n} from \"./retroPalettes.js\";\n\nexport {\n PALETTE_CRUNCHY_16,\n PALETTE_CRUNCHY_64,\n RETRO_COLOR_MODES,\n applyRetroFilteringToMaterial,\n applyRetroTextureFiltering,\n buildPaletteLutData,\n computeRetroDpr,\n getColorQuantVector,\n getPaletteLutTexture,\n type RetroColorMode,\n type RetroColorModeSpec,\n type RetroTextureOptions,\n};\n\nexport const PS1_SNAP_RESOLUTION = new THREE.Vector2(320, 180);\n\nexport const RETRO_UNIFORMS = {\n uPs1Grid: { value: PS1_SNAP_RESOLUTION },\n uDitherMix: { value: 0.62 },\n uSnapStrength: { value: 0 },\n uDitherScale: { value: 2 },\n uColorQuant: { value: getColorQuantVector(\"rgb555\") },\n uPaletteLut: { value: getPaletteLutTexture(\"fallback\") },\n uAffineStrength: { value: 0 },\n uGouraudStrength: { value: 0 },\n uN64FilterStrength: { value: 0 },\n uN64TexSize: { value: 256 },\n};\n\nexport function getRetroShaderUniforms(): typeof RETRO_UNIFORMS {\n return {\n uPs1Grid: RETRO_UNIFORMS.uPs1Grid,\n uDitherMix: RETRO_UNIFORMS.uDitherMix,\n uSnapStrength: RETRO_UNIFORMS.uSnapStrength,\n uDitherScale: RETRO_UNIFORMS.uDitherScale,\n uColorQuant: RETRO_UNIFORMS.uColorQuant,\n uPaletteLut: RETRO_UNIFORMS.uPaletteLut,\n uAffineStrength: RETRO_UNIFORMS.uAffineStrength,\n uGouraudStrength: RETRO_UNIFORMS.uGouraudStrength,\n uN64FilterStrength: RETRO_UNIFORMS.uN64FilterStrength,\n uN64TexSize: RETRO_UNIFORMS.uN64TexSize,\n };\n}\n\nexport type RetroPresetId =\n | \"dreamcast\"\n | \"n64-emu-1080p\"\n | \"n64-psx-hybrid\"\n | \"psx-plus\"\n | \"ps2-shinobi\"\n | \"n64-ultra\"\n | \"dsi-crisp\"\n | \"psx-chonk\"\n | \"psx-raw-1995\"\n | \"clean-hd\";\n\nexport interface RetroPreset {\n id: RetroPresetId;\n label: string;\n renderScale: number;\n ditherAmount: number;\n pixelSnapAmount: number;\n colorMode: RetroColorMode;\n ditherScale: number;\n affineAmount: number;\n gouraudAmount: number;\n n64FilterAmount: number;\n fogEnabled: boolean;\n}\n\nexport const RETRO_PRESETS: readonly RetroPreset[] = [\n { id: \"dreamcast\", label: \"Nu-School Dreamcast\", renderScale: 0.67, ditherAmount: 0.62, pixelSnapAmount: 0, colorMode: \"rgb555\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0, n64FilterAmount: 0, fogEnabled: false },\n { id: \"n64-emu-1080p\", label: \"N64 Emu 1080p ('08)\", renderScale: 1, ditherAmount: 0.32, pixelSnapAmount: 0, colorMode: \"rgb555\", ditherScale: 1, affineAmount: 0, gouraudAmount: 0.9, n64FilterAmount: 1, fogEnabled: false },\n { id: \"n64-psx-hybrid\", label: \"N64 Bouba × PSX Kiki\", renderScale: 0.56, ditherAmount: 0.78, pixelSnapAmount: 0.55, colorMode: \"rgb555\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0.65, n64FilterAmount: 1, fogEnabled: false },\n { id: \"psx-plus\", label: \"PSX++ Pixel Snap\", renderScale: 0.5, ditherAmount: 0.85, pixelSnapAmount: 0.68, colorMode: \"rgb555\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0.45, n64FilterAmount: 0, fogEnabled: false },\n { id: \"ps2-shinobi\", label: \"PS2 Shinobi\", renderScale: 0.58, ditherAmount: 0.8, pixelSnapAmount: 0, colorMode: \"rgb555\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0.28, n64FilterAmount: 0, fogEnabled: false },\n { id: \"n64-ultra\", label: \"N64 3-Point RDP\", renderScale: 0.5, ditherAmount: 0.55, pixelSnapAmount: 0, colorMode: \"rgb555\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0.85, n64FilterAmount: 1, fogEnabled: false },\n { id: \"dsi-crisp\", label: \"DSi Crisp\", renderScale: 0.5, ditherAmount: 0.88, pixelSnapAmount: 0.35, colorMode: \"rgb444\", ditherScale: 2, affineAmount: 0, gouraudAmount: 0.2, n64FilterAmount: 0, fogEnabled: false },\n { id: \"psx-chonk\", label: \"PSX Full Chonk\", renderScale: 0.33, ditherAmount: 1, pixelSnapAmount: 1, colorMode: \"rgb555\", ditherScale: 2.5, affineAmount: 0, gouraudAmount: 0.65, n64FilterAmount: 0, fogEnabled: false },\n { id: \"psx-raw-1995\", label: \"PSX 1995 Raw Affine\", renderScale: 0.33, ditherAmount: 1, pixelSnapAmount: 1, colorMode: \"rgb555\", ditherScale: 2.5, affineAmount: 1, gouraudAmount: 1, n64FilterAmount: 0, fogEnabled: false },\n { id: \"clean-hd\", label: \"HD Remaster 1:1\", renderScale: 1, ditherAmount: 0, pixelSnapAmount: 0, colorMode: \"off\", ditherScale: 1, affineAmount: 0, gouraudAmount: 0, n64FilterAmount: 0, fogEnabled: false },\n];\n\nexport const RETRO_DREAMCAST: RetroPreset = RETRO_PRESETS[0];\nexport const RETRO_PSX_PLUS: RetroPreset = RETRO_PRESETS[3];\nexport const RETRO_PS2_SHINOBI: RetroPreset = RETRO_PRESETS[4];\nexport const RETRO_CLEAN_HD: RetroPreset = RETRO_PRESETS[9];\n\nexport function getRetroPreset(id: RetroPreset | RetroPresetId): RetroPreset {\n if (typeof id === \"object\") return id;\n return RETRO_PRESETS.find((p) => p.id === id) ?? RETRO_PRESETS[0];\n}\n\nlet vpWidth = 1280, vpHeight = 720, vpDpr = 1, curRenderScale = 0.67, curDitherScale = 2;\n\nfunction recomputeSnapGrid(): void {\n RETRO_UNIFORMS.uDitherScale.value = Math.max(1, Math.round(curDitherScale * vpDpr));\n const t = THREE.MathUtils.clamp((curRenderScale - 0.33) / 0.67, 0, 1);\n const snap = RETRO_UNIFORMS.uSnapStrength.value;\n const targetLines = (180 + t * 180) * (1.18 - snap * 0.46);\n const div = Math.max(1, Math.round(vpHeight / Math.max(90, targetLines)));\n const gx = vpWidth / (2 * div), gy = vpHeight / (2 * div);\n const minAxis = Math.min(gx, gy);\n const boost = minAxis > 0 && minAxis < 45 ? 45 / minAxis : 1;\n PS1_SNAP_RESOLUTION.set(Math.max(1, Math.round(gx * boost)), Math.max(1, Math.round(gy * boost)));\n}\n\nexport function syncRetroUniforms(preset: RetroPreset | RetroPresetId): RetroPreset;\nexport function syncRetroUniforms(\n ditherAmount: number, pixelSnapAmount?: number, renderScale?: number, colorMode?: RetroColorMode,\n ditherScale?: number, affineAmount?: number, gouraudAmount?: number, n64FilterAmount?: number,\n): void;\nexport function syncRetroUniforms(\n presetOrDither: RetroPreset | RetroPresetId | number, pixelSnapAmount = 0, renderScale = 0.67, colorMode?: RetroColorMode,\n ditherScale?: number, affineAmount?: number, gouraudAmount?: number, n64FilterAmount?: number,\n): RetroPreset | void {\n if (typeof presetOrDither === \"string\" || typeof presetOrDither === \"object\") {\n const preset = getRetroPreset(presetOrDither);\n syncRetroUniforms(\n preset.ditherAmount, preset.pixelSnapAmount, preset.renderScale, preset.colorMode,\n preset.ditherScale, preset.affineAmount, preset.gouraudAmount, preset.n64FilterAmount,\n );\n return preset;\n }\n if (Number.isFinite(presetOrDither)) RETRO_UNIFORMS.uDitherMix.value = THREE.MathUtils.clamp(presetOrDither, 0, 1);\n if (Number.isFinite(pixelSnapAmount)) RETRO_UNIFORMS.uSnapStrength.value = THREE.MathUtils.clamp(pixelSnapAmount, 0, 1);\n if (Number.isFinite(renderScale)) curRenderScale = THREE.MathUtils.clamp(renderScale, 0.33, 1);\n if (colorMode) {\n getColorQuantVector(colorMode, RETRO_UNIFORMS.uColorQuant.value);\n RETRO_UNIFORMS.uPaletteLut.value = getPaletteLutTexture(colorMode === \"crunchy16\" || colorMode === \"crunchy64\" ? colorMode : \"fallback\");\n }\n if (typeof ditherScale === \"number\" && Number.isFinite(ditherScale)) curDitherScale = THREE.MathUtils.clamp(ditherScale, 0.5, 6);\n if (typeof affineAmount === \"number\" && Number.isFinite(affineAmount)) RETRO_UNIFORMS.uAffineStrength.value = THREE.MathUtils.clamp(affineAmount, 0, 1);\n if (typeof gouraudAmount === \"number\" && Number.isFinite(gouraudAmount)) RETRO_UNIFORMS.uGouraudStrength.value = THREE.MathUtils.clamp(gouraudAmount, 0, 1);\n if (typeof n64FilterAmount === \"number\" && Number.isFinite(n64FilterAmount)) RETRO_UNIFORMS.uN64FilterStrength.value = THREE.MathUtils.clamp(n64FilterAmount, 0, 1);\n recomputeSnapGrid();\n}\n\nexport function syncRetroViewport(fbW: number, fbH: number, effectiveDpr: number): void {\n if (!Number.isFinite(fbW) || !Number.isFinite(fbH) || fbW <= 0 || fbH <= 0) return;\n vpWidth = fbW;\n vpHeight = fbH;\n if (Number.isFinite(effectiveDpr) && effectiveDpr > 0) vpDpr = effectiveDpr;\n recomputeSnapGrid();\n}\n"],"mappings":";;;AA+BA,IAAa,sBAAsB,IAAI,MAAM,QAAQ,KAAK,GAAG;AAE7D,IAAa,iBAAiB;CAC1B,UAAU,EAAE,OAAO,oBAAoB;CACvC,YAAY,EAAE,OAAO,IAAK;CAC1B,eAAe,EAAE,OAAO,EAAE;CAC1B,cAAc,EAAE,OAAO,EAAE;CACzB,aAAa,EAAE,OAAO,oBAAoB,QAAQ,EAAE;CACpD,aAAa,EAAE,OAAO,qBAAqB,UAAU,EAAE;CACvD,iBAAiB,EAAE,OAAO,EAAE;CAC5B,kBAAkB,EAAE,OAAO,EAAE;CAC7B,oBAAoB,EAAE,OAAO,EAAE;CAC/B,aAAa,EAAE,OAAO,IAAI;AAC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Y,OAAO,SAAS,aAAa,GAAG,eAAe,iBAAiB,QAAQ,MAAM,UAAU,MAAM,eAAe,GAAG,CAAC;CAC1J,IAAI,OAAO,oBAAoB,YAAY,OAAO,SAAS,eAAe,GAAG,eAAe,mBAAmB,QAAQ,MAAM,UAAU,MAAM,iBAAiB,GAAG,CAAC;CAClK,kBAAkB;AACtB;AAEA,SAAgB,kBAAkB,KAAa,KAAa,cAA4B;CACpF,IAAI,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,OAAO,KAAK,OAAO,GAAG;CAC5E,UAAU;CACV,WAAW;CACX,IAAI,OAAO,SAAS,YAAY,KAAK,eAAe,GAAG,QAAQ;CAC/D,kBAAkB;AACtB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
export declare const KEY_SUN_DIRECTION: THREE.Vector3;
|
|
4
|
-
export declare const RING_MOONLET_COUNT = 72;
|
|
5
|
-
export declare const ATMO_VERT = "\n uniform vec2 uPs1Grid; uniform float uSnapStrength; varying vec3 vNormalWorld, vWorldPos;\n void main() {\n vec4 wp = modelMatrix * vec4(position, 1.0); vWorldPos = wp.xyz; vNormalWorld = normalize(mat3(modelMatrix) * normal);\n vec4 clip = projectionMatrix * viewMatrix * wp;\n if (uSnapStrength > 0.001 && clip.w > 0.001) {\n vec4 snapped = clip; snapped.xyz = clip.xyz / clip.w;\n vec2 safeGrid = max(uPs1Grid * mix(2.5, 1.0, clamp(uSnapStrength, 0.0, 1.0)), vec2(1.0));\n snapped.xy = floor(safeGrid * snapped.xy + 0.5) / safeGrid; snapped.xyz *= clip.w; clip = snapped;\n }\n gl_Position = clip;\n }\n";
|
|
6
|
-
export declare const ATMO_FRAG = "\n uniform vec3 uSunDir, uColor; uniform float uDitherMix; varying vec3 vNormalWorld, vWorldPos;\n \nuniform float uDitherScale; uniform vec4 uColorQuant; uniform sampler2D uPaletteLut;\n\nvec3 ps1SrgbToLinear(vec3 s) { vec3 a = clamp(s, 0.0, 1.0); return a * (a * (a * 0.305306011 + 0.682171111) + 0.012522878); }\nvec3 ps1LinearToSrgb(vec3 l) { return max(1.055 * pow(clamp(l, 0.0, 1.0), vec3(0.416666667)) - 0.055, vec3(0.0)); }\nfloat ps1Bayer2(vec2 c) { return (c.y < 0.5) ? (c.x < 0.5 ? 0.0 : 2.0) : (c.x < 0.5 ? 3.0 : 1.0); }\nfloat ps1Bayer4x4(vec2 p) { vec2 f = floor(p); return (ps1Bayer2(mod(f, 2.0)) * 4.0 + ps1Bayer2(mod(floor(f * 0.5), 2.0)) + 0.5) / 16.0; }\nfloat ps1Bayer8x8(vec2 p) { vec2 f = floor(p); return (ps1Bayer2(mod(f, 2.0)) * 16.0 + ps1Bayer2(mod(floor(f * 0.5), 2.0)) * 4.0 + ps1Bayer2(mod(floor(f * 0.25), 2.0)) + 0.5) / 64.0; }\nvec3 ps1QuantizeRGB555Mix(vec3 col, vec2 fragCoord, float mixAmt) {\n if (mixAmt <= 0.001) return col;\n vec3 srgb = clamp(col, 0.0, 1.0); float bayer = ps1Bayer4x4(fragCoord * 0.5);\n vec3 c0 = floor(srgb * 31.0) / 31.0, c1 = min(c0 + 1.0 / 31.0, vec3(1.0));\n vec3 l0 = ps1SrgbToLinear(c0), l1 = ps1SrgbToLinear(c1);\n vec3 t = clamp((ps1SrgbToLinear(srgb) - l0) / max(l1 - l0, vec3(1e-5)), 0.0, 1.0);\n return mix(c0, c1, step(vec3(mix(0.5, bayer, clamp(mixAmt, 0.0, 1.0))), t));\n}\nvec3 ps1QuantizeRGB555(vec3 col, vec2 fragCoord) { return ps1QuantizeRGB555Mix(col, fragCoord, 1.0); }\n\nfloat ps1BayerDither(vec2 fragCoord) { return ps1Bayer4x4(fragCoord / max(uDitherScale, 0.5)); }\nvec3 ps1SamplePaletteLut(vec3 srgb) {\n vec3 c = clamp(srgb, 0.0, 1.0);\n return texture2D(uPaletteLut, vec2((floor(c.b * 31.0 + 0.5) * 32.0 + floor(c.r * 31.0 + 0.5) + 0.5) / 1024.0, (floor(c.g * 31.0 + 0.5) + 0.5) / 32.0)).rgb;\n}\nvec3 ps1QuantizeRetro(vec3 col, vec2 fragCoord, float ditherSpread) {\n if (uColorQuant.w < 0.5) return col;\n vec3 srgb = clamp(col, 0.0, 1.0); float bayer = ps1Bayer4x4(fragCoord / max(uDitherScale, 0.5)), spread = clamp(ditherSpread, 0.0, 1.0);\n if (uColorQuant.w > 1.5) return ps1SamplePaletteLut(ps1LinearToSrgb(clamp(ps1SrgbToLinear(srgb) + (bayer - 0.5) * (uColorQuant.y * spread), 0.0, 1.0)));\n vec3 levels = max(uColorQuant.rgb, vec3(1.0)), c0 = floor(srgb * levels) / levels, c1 = min(c0 + 1.0 / levels, vec3(1.0));\n vec3 l0 = ps1SrgbToLinear(c0), l1 = ps1SrgbToLinear(c1);\n vec3 t = clamp((ps1SrgbToLinear(srgb) - l0) / max(l1 - l0, vec3(1e-5)), 0.0, 1.0);\n return mix(c0, c1, step(vec3(mix(0.5, bayer, spread)), t));\n}\nvec4 ps1SampleN64ThreePoint(sampler2D tex, vec2 uv, float texSize, float mixStrength) {\n vec4 nearestSample = texture2D(tex, uv);\n if (mixStrength <= 0.001) return nearestSample;\n #if __VERSION__ >= 300\n vec2 ts = max(vec2(textureSize(tex, 0)), vec2(16.0));\n #else\n vec2 ts = vec2(max(16.0, texSize));\n #endif\n vec2 p = uv * ts - 0.5, i = floor(p), f = p - i, inv = 1.0 / ts;\n vec4 c10 = texture2D(tex, (i + vec2(1.5, 0.5)) * inv), c01 = texture2D(tex, (i + vec2(0.5, 1.5)) * inv);\n vec4 n64Col;\n if (f.x + f.y < 1.0) { vec4 c00 = texture2D(tex, (i + vec2(0.5, 0.5)) * inv); n64Col = c00 + f.x * (c10 - c00) + f.y * (c01 - c00); }\n else { vec4 c11 = texture2D(tex, (i + vec2(1.5, 1.5)) * inv); n64Col = c11 + (1.0 - f.y) * (c10 - c11) + (1.0 - f.x) * (c01 - c11); }\n return mix(nearestSample, n64Col, clamp(mixStrength, 0.0, 1.0));\n}\nfloat ps1ProcTexelHash(vec2 cell) { return fract(sin(dot(cell, vec2(127.1, 311.7))) * 43758.5453); }\nfloat ps1ProcN64ThreePoint(vec2 uv, float mixStrength) {\n vec2 p = uv * 8.0 - 0.5, i = floor(p), f = p - i;\n float nearestVal = ps1ProcTexelHash(floor(uv * 8.0));\n if (mixStrength <= 0.001) return nearestVal;\n float c10 = ps1ProcTexelHash(i + vec2(1.0, 0.0)), c01 = ps1ProcTexelHash(i + vec2(0.0, 1.0)), n64Val;\n if (f.x + f.y < 1.0) { float c00 = ps1ProcTexelHash(i); n64Val = c00 + f.x * (c10 - c00) + f.y * (c01 - c00); }\n else { float c11 = ps1ProcTexelHash(i + vec2(1.0, 1.0)); n64Val = c11 + (1.0 - f.y) * (c10 - c11) + (1.0 - f.x) * (c01 - c11); }\n return mix(nearestVal, n64Val, clamp(mixStrength, 0.0, 1.0));\n}\n\n void main() {\n vec3 viewDir = normalize(cameraPosition - vWorldPos);\n float rim = pow(1.0 - max(0.0, dot(viewDir, vNormalWorld)), 2.6), nl = dot(vNormalWorld, normalize(uSunDir));\n float sunLit = mix(smoothstep(-0.3, 0.7, nl), step(-0.25, nl), uDitherMix) * 0.72 + 0.28, alpha = rim * sunLit;\n if (alpha < (ps1BayerDither(gl_FragCoord.xy) * 0.65 + 0.14) * uDitherMix) discard;\n vec3 col = ps1QuantizeRetro(ps1LinearToSrgb(uColor * (0.8 + sunLit * 0.55)), gl_FragCoord.xy, uDitherMix);\n gl_FragColor = vec4(col, mix(alpha * 0.85, 0.75, uDitherMix));\n }\n";
|
|
7
|
-
export interface KolmoSkyboxProps {
|
|
8
|
-
sunDirection?: [number, number, number];
|
|
9
|
-
}
|
|
10
|
-
export declare function KolmoSkybox({ sunDirection }: KolmoSkyboxProps): React.JSX.Element;
|
|
11
|
-
export declare function createPlanetTextures(): {
|
|
12
|
-
planetMap: THREE.DataTexture;
|
|
13
|
-
ringMap: THREE.DataTexture;
|
|
14
|
-
};
|
|
15
|
-
export declare function buildMoonletGeo(): THREE.BufferGeometry;
|
|
16
|
-
export declare function populateMoonletMatrices(inst: THREE.InstancedMesh, innerR: number, outerR: number): void;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { RETRO_UNIFORMS } from "./retroUniforms.js";
|
|
2
|
-
import { GLSL_BAYER_RGB555, GLSL_RETRO_QUANTIZE } from "./retroShader.js";
|
|
3
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import * as THREE from "three";
|
|
5
|
-
import { useFrame } from "@react-three/fiber";
|
|
6
|
-
import { Stars } from "@react-three/drei";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
// src/shaders/skyboxShaders.tsx
|
|
9
|
-
var KEY_SUN_DIRECTION = new THREE.Vector3(-.62, .42, -.66).normalize();
|
|
10
|
-
var RING_MOONLET_COUNT = 72;
|
|
11
|
-
var SKYBOX_VERT = "varying vec3 vDir; void main() { vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }";
|
|
12
|
-
var SKYBOX_FRAG = `
|
|
13
|
-
uniform float uTime, uDitherMix; uniform vec3 uSunDir; varying vec3 vDir;
|
|
14
|
-
${GLSL_BAYER_RGB555}
|
|
15
|
-
float hash(vec3 p) { p = fract(p * 0.3183099 + 0.1) * 17.0; return fract(p.x * p.y * p.z * (p.x + p.y + p.z)); }
|
|
16
|
-
float noise(vec3 x) {
|
|
17
|
-
vec3 i = floor(x), f = fract(x);
|
|
18
|
-
return mix(
|
|
19
|
-
mix(mix(hash(i + vec3(0,0,0)), hash(i + vec3(1,0,0)), f.x), mix(hash(i + vec3(0,1,0)), hash(i + vec3(1,1,0)), f.x), f.y),
|
|
20
|
-
mix(mix(hash(i + vec3(0,0,1)), hash(i + vec3(1,0,1)), f.x), mix(hash(i + vec3(0,1,1)), hash(i + vec3(1,1,1)), f.x), f.y), f.z
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
float fbm(vec3 p) { float v = 0.0, a = 0.55; for (int i = 0; i < 3; i++) { v += a * noise(p); p = p * 2.05 + vec3(13.1, 7.7, 5.3); a *= 0.48; } return v; }
|
|
24
|
-
void main() {
|
|
25
|
-
vec3 dir = normalize(vDir);
|
|
26
|
-
float horizon = exp(-abs(dir.y + dir.x * 0.18) * 3.0);
|
|
27
|
-
vec3 col = mix(mix(vec3(0.015, 0.02, 0.055), vec3(0.02, 0.03, 0.08), dir.y * 0.5 + 0.5), vec3(0.08, 0.16, 0.27), horizon * 0.9);
|
|
28
|
-
float n1 = fbm(dir * 2.8 + vec3(0.0, uTime * 0.003, 0.0)), n2 = fbm(dir * 5.0 - vec3(uTime * 0.002, 0.0, 1.4));
|
|
29
|
-
float rawMask = clamp((n1 * 0.72 + n2 * 0.34 - 0.44) * 2.4, 0.0, 1.0) * (0.35 + horizon * 0.85);
|
|
30
|
-
float cloudMask = mix(rawMask, floor(rawMask * 5.0) / 5.0, uDitherMix);
|
|
31
|
-
float sunDot = max(0.0, dot(dir, normalize(uSunDir)));
|
|
32
|
-
vec3 tint = mix(vec3(0.06, 0.38, 0.50), vec3(0.28, 0.12, 0.40), mix(n2, step(0.52, n2), uDitherMix));
|
|
33
|
-
col += mix(tint, vec3(0.62, 0.26, 0.14), pow(sunDot, 2.0) * 0.9) * cloudMask * 0.85;
|
|
34
|
-
float corona = mix(pow(sunDot, 12.0), floor(pow(sunDot, 12.0) * 6.0) / 6.0, uDitherMix);
|
|
35
|
-
col += vec3(0.95, 0.55, 0.22) * corona * 0.65 + vec3(1.0, 0.90, 0.68) * step(0.9965, sunDot) * 1.1;
|
|
36
|
-
float s = hash(floor(dir * 165.0));
|
|
37
|
-
if (s > 0.995) col += mix(vec3(0.74, 0.90, 1.0), vec3(1.0, 0.86, 0.68), step(0.5, fract(s * 91.3))) * 0.95;
|
|
38
|
-
gl_FragColor = vec4(ps1QuantizeRGB555Mix(col, gl_FragCoord.xy, uDitherMix), 1.0);
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
var ATMO_VERT = `
|
|
42
|
-
uniform vec2 uPs1Grid; uniform float uSnapStrength; varying vec3 vNormalWorld, vWorldPos;
|
|
43
|
-
void main() {
|
|
44
|
-
vec4 wp = modelMatrix * vec4(position, 1.0); vWorldPos = wp.xyz; vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
45
|
-
vec4 clip = projectionMatrix * viewMatrix * wp;
|
|
46
|
-
if (uSnapStrength > 0.001 && clip.w > 0.001) {
|
|
47
|
-
vec4 snapped = clip; snapped.xyz = clip.xyz / clip.w;
|
|
48
|
-
vec2 safeGrid = max(uPs1Grid * mix(2.5, 1.0, clamp(uSnapStrength, 0.0, 1.0)), vec2(1.0));
|
|
49
|
-
snapped.xy = floor(safeGrid * snapped.xy + 0.5) / safeGrid; snapped.xyz *= clip.w; clip = snapped;
|
|
50
|
-
}
|
|
51
|
-
gl_Position = clip;
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
var ATMO_FRAG = `
|
|
55
|
-
uniform vec3 uSunDir, uColor; uniform float uDitherMix; varying vec3 vNormalWorld, vWorldPos;
|
|
56
|
-
${GLSL_RETRO_QUANTIZE}
|
|
57
|
-
void main() {
|
|
58
|
-
vec3 viewDir = normalize(cameraPosition - vWorldPos);
|
|
59
|
-
float rim = pow(1.0 - max(0.0, dot(viewDir, vNormalWorld)), 2.6), nl = dot(vNormalWorld, normalize(uSunDir));
|
|
60
|
-
float sunLit = mix(smoothstep(-0.3, 0.7, nl), step(-0.25, nl), uDitherMix) * 0.72 + 0.28, alpha = rim * sunLit;
|
|
61
|
-
if (alpha < (ps1BayerDither(gl_FragCoord.xy) * 0.65 + 0.14) * uDitherMix) discard;
|
|
62
|
-
vec3 col = ps1QuantizeRetro(ps1LinearToSrgb(uColor * (0.8 + sunLit * 0.55)), gl_FragCoord.xy, uDitherMix);
|
|
63
|
-
gl_FragColor = vec4(col, mix(alpha * 0.85, 0.75, uDitherMix));
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
function KolmoSkybox({ sunDirection }) {
|
|
67
|
-
const matRef = useRef(null);
|
|
68
|
-
const groupRef = useRef(null);
|
|
69
|
-
const uniforms = useMemo(() => ({
|
|
70
|
-
uTime: { value: 0 },
|
|
71
|
-
uSunDir: { value: KEY_SUN_DIRECTION.clone() },
|
|
72
|
-
uDitherMix: RETRO_UNIFORMS.uDitherMix
|
|
73
|
-
}), []);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (sunDirection) uniforms.uSunDir.value.set(sunDirection[0], sunDirection[1], sunDirection[2]).normalize();
|
|
76
|
-
else uniforms.uSunDir.value.copy(KEY_SUN_DIRECTION);
|
|
77
|
-
}, [
|
|
78
|
-
sunDirection?.[0],
|
|
79
|
-
sunDirection?.[1],
|
|
80
|
-
sunDirection?.[2],
|
|
81
|
-
uniforms
|
|
82
|
-
]);
|
|
83
|
-
useFrame((state, delta) => {
|
|
84
|
-
if (matRef.current) matRef.current.uniforms.uTime.value += Math.min(delta, .05);
|
|
85
|
-
if (groupRef.current) groupRef.current.position.copy(state.camera.position);
|
|
86
|
-
});
|
|
87
|
-
return /* @__PURE__ */ jsxs("group", {
|
|
88
|
-
ref: groupRef,
|
|
89
|
-
children: [/* @__PURE__ */ jsxs("mesh", {
|
|
90
|
-
renderOrder: -10,
|
|
91
|
-
frustumCulled: false,
|
|
92
|
-
children: [/* @__PURE__ */ jsx("icosahedronGeometry", { args: [3800, 2] }), /* @__PURE__ */ jsx("shaderMaterial", {
|
|
93
|
-
ref: matRef,
|
|
94
|
-
uniforms,
|
|
95
|
-
vertexShader: SKYBOX_VERT,
|
|
96
|
-
fragmentShader: SKYBOX_FRAG,
|
|
97
|
-
side: THREE.BackSide,
|
|
98
|
-
depthWrite: false
|
|
99
|
-
})]
|
|
100
|
-
}), /* @__PURE__ */ jsx(Stars, {
|
|
101
|
-
radius: 190,
|
|
102
|
-
depth: 130,
|
|
103
|
-
count: 2600,
|
|
104
|
-
factor: 4.5,
|
|
105
|
-
saturation: .35,
|
|
106
|
-
fade: false,
|
|
107
|
-
speed: .18
|
|
108
|
-
})]
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
var BAYER_4X4 = [
|
|
112
|
-
[
|
|
113
|
-
0,
|
|
114
|
-
8,
|
|
115
|
-
2,
|
|
116
|
-
10
|
|
117
|
-
],
|
|
118
|
-
[
|
|
119
|
-
12,
|
|
120
|
-
4,
|
|
121
|
-
14,
|
|
122
|
-
6
|
|
123
|
-
],
|
|
124
|
-
[
|
|
125
|
-
3,
|
|
126
|
-
11,
|
|
127
|
-
1,
|
|
128
|
-
9
|
|
129
|
-
],
|
|
130
|
-
[
|
|
131
|
-
15,
|
|
132
|
-
7,
|
|
133
|
-
13,
|
|
134
|
-
5
|
|
135
|
-
]
|
|
136
|
-
];
|
|
137
|
-
var BANDS = [
|
|
138
|
-
[
|
|
139
|
-
14,
|
|
140
|
-
30,
|
|
141
|
-
56
|
|
142
|
-
],
|
|
143
|
-
[
|
|
144
|
-
24,
|
|
145
|
-
58,
|
|
146
|
-
92
|
|
147
|
-
],
|
|
148
|
-
[
|
|
149
|
-
42,
|
|
150
|
-
98,
|
|
151
|
-
126
|
|
152
|
-
],
|
|
153
|
-
[
|
|
154
|
-
76,
|
|
155
|
-
134,
|
|
156
|
-
152
|
|
157
|
-
],
|
|
158
|
-
[
|
|
159
|
-
186,
|
|
160
|
-
128,
|
|
161
|
-
86
|
|
162
|
-
],
|
|
163
|
-
[
|
|
164
|
-
232,
|
|
165
|
-
160,
|
|
166
|
-
94
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
172,
|
|
170
|
-
108,
|
|
171
|
-
74
|
|
172
|
-
],
|
|
173
|
-
[
|
|
174
|
-
68,
|
|
175
|
-
108,
|
|
176
|
-
136
|
|
177
|
-
],
|
|
178
|
-
[
|
|
179
|
-
34,
|
|
180
|
-
62,
|
|
181
|
-
96
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
16,
|
|
185
|
-
28,
|
|
186
|
-
50
|
|
187
|
-
]
|
|
188
|
-
];
|
|
189
|
-
var quant8 = (v) => Math.min(255, Math.round(Math.max(0, Math.min(255, v)) / 8.225) * 8);
|
|
190
|
-
function createPlanetTextures() {
|
|
191
|
-
const pData = /* @__PURE__ */ new Uint8Array(131072);
|
|
192
|
-
for (let y = 0; y < 128; y++) for (let x = 0; x < 256; x++) {
|
|
193
|
-
const wave = Math.sin(x / 256 * Math.PI * 8 + y * .16) * 2.8 + Math.cos(x / 256 * Math.PI * 16 - y * .24) * 1.4;
|
|
194
|
-
const t = THREE.MathUtils.clamp((y + wave) / 128 * (BANDS.length - 1), 0, BANDS.length - 1.001);
|
|
195
|
-
const lo = Math.floor(t);
|
|
196
|
-
let [r, g, b] = t - lo > BAYER_4X4[y & 3][x & 3] / 16 ? BANDS[lo + 1] : BANDS[lo];
|
|
197
|
-
const sx = (x - 92.16) / 24, sy = (y - 71.68) / 11, spot = Math.hypot(sx, sy);
|
|
198
|
-
if (spot < 1) {
|
|
199
|
-
const w = (1 - spot) * (.65 + (Math.sin(spot * 10 - Math.atan2(sy, sx) * 2) * .5 + .5) * .35);
|
|
200
|
-
r = r * (1 - w) + 244 * w;
|
|
201
|
-
g = g * (1 - w) + 148 * w;
|
|
202
|
-
b = b * (1 - w) + 74 * w;
|
|
203
|
-
}
|
|
204
|
-
const grain = ((x * 19 + y * 29 & 15) - 8) * 1.1, idx = (y * 256 + x) * 4;
|
|
205
|
-
pData[idx] = quant8(r + grain);
|
|
206
|
-
pData[idx + 1] = quant8(g + grain);
|
|
207
|
-
pData[idx + 2] = quant8(b + grain);
|
|
208
|
-
pData[idx + 3] = 255;
|
|
209
|
-
}
|
|
210
|
-
const planetMap = new THREE.DataTexture(pData, 256, 128, THREE.RGBAFormat);
|
|
211
|
-
planetMap.colorSpace = THREE.SRGBColorSpace;
|
|
212
|
-
planetMap.wrapS = THREE.RepeatWrapping;
|
|
213
|
-
planetMap.minFilter = THREE.NearestFilter;
|
|
214
|
-
planetMap.magFilter = THREE.NearestFilter;
|
|
215
|
-
planetMap.needsUpdate = true;
|
|
216
|
-
const rData = /* @__PURE__ */ new Uint8Array(1024);
|
|
217
|
-
for (let x = 0; x < 256; x++) {
|
|
218
|
-
const u = x / 255, gap = Math.abs(u - .44) < .048 || Math.abs(u - .78) < .024 ? 0 : 1;
|
|
219
|
-
const a = (.62 + .38 * Math.sin(u * 78)) * Math.sin(u * Math.PI) * gap, idx = x * 4;
|
|
220
|
-
rData[idx] = quant8(168 + 68 * Math.sin(u * 11 + .4));
|
|
221
|
-
rData[idx + 1] = quant8(186 + 44 * Math.cos(u * 16));
|
|
222
|
-
rData[idx + 2] = quant8(204 + 42 * Math.sin(u * 13 + 1.8));
|
|
223
|
-
rData[idx + 3] = a > .14 ? Math.round(Math.min(.92, Math.round(a * 8) / 8) * 255) : 0;
|
|
224
|
-
}
|
|
225
|
-
const ringMap = new THREE.DataTexture(rData, 256, 1, THREE.RGBAFormat);
|
|
226
|
-
ringMap.colorSpace = THREE.SRGBColorSpace;
|
|
227
|
-
ringMap.minFilter = THREE.NearestFilter;
|
|
228
|
-
ringMap.magFilter = THREE.NearestFilter;
|
|
229
|
-
ringMap.needsUpdate = true;
|
|
230
|
-
return {
|
|
231
|
-
planetMap,
|
|
232
|
-
ringMap
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function buildMoonletGeo() {
|
|
236
|
-
const raw = new THREE.DodecahedronGeometry(1, 0);
|
|
237
|
-
const geo = raw.index ? raw.toNonIndexed() : raw.clone();
|
|
238
|
-
raw.dispose();
|
|
239
|
-
const pos = geo.attributes.position, cols = new Float32Array(pos.count * 3);
|
|
240
|
-
for (let i = 0; i < pos.count; i++) {
|
|
241
|
-
const shade = .48 + i * 17 % 10 * .032;
|
|
242
|
-
cols[i * 3] = shade * .92;
|
|
243
|
-
cols[i * 3 + 1] = shade * .96;
|
|
244
|
-
cols[i * 3 + 2] = shade;
|
|
245
|
-
}
|
|
246
|
-
geo.setAttribute("color", new THREE.BufferAttribute(cols, 3));
|
|
247
|
-
geo.computeVertexNormals();
|
|
248
|
-
return geo;
|
|
249
|
-
}
|
|
250
|
-
function populateMoonletMatrices(inst, innerR, outerR) {
|
|
251
|
-
const dummy = new THREE.Object3D();
|
|
252
|
-
for (let i = 0; i < 72; i++) {
|
|
253
|
-
const ang = i / 72 * Math.PI * 2 + i % 5 * .08;
|
|
254
|
-
const rad = THREE.MathUtils.lerp(innerR + 18, outerR - 18, i * 37 % 100 / 100);
|
|
255
|
-
const z = (i * 19 % 100 / 100 - .5) * 18, s = 4.5 + i * 13 % 100 / 100 * 14.5;
|
|
256
|
-
dummy.position.set(Math.cos(ang) * rad, Math.sin(ang) * rad, z);
|
|
257
|
-
dummy.rotation.set(i * .7, i * 1.1, i * .4);
|
|
258
|
-
dummy.scale.set(s * 1.2, s * .8, s);
|
|
259
|
-
dummy.updateMatrix();
|
|
260
|
-
inst.setMatrixAt(i, dummy.matrix);
|
|
261
|
-
}
|
|
262
|
-
inst.instanceMatrix.needsUpdate = true;
|
|
263
|
-
}
|
|
264
|
-
export { ATMO_FRAG, ATMO_VERT, KEY_SUN_DIRECTION, KolmoSkybox, RING_MOONLET_COUNT, buildMoonletGeo, createPlanetTextures, populateMoonletMatrices };
|
|
265
|
-
|
|
266
|
-
//# sourceMappingURL=skyboxShaders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skyboxShaders.js","names":[],"sources":["../../src/shaders/skyboxShaders.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from \"react\";\nimport { useFrame } from \"@react-three/fiber\";\nimport { Stars } from \"@react-three/drei\";\nimport * as THREE from \"three\";\nimport { GLSL_BAYER_RGB555, GLSL_RETRO_QUANTIZE, RETRO_UNIFORMS } from \"./retroShader.js\";\n\nexport const KEY_SUN_DIRECTION = new THREE.Vector3(-0.62, 0.42, -0.66).normalize();\nexport const RING_MOONLET_COUNT = 72;\n\nconst SKYBOX_VERT = \"varying vec3 vDir; void main() { vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }\";\nconst SKYBOX_FRAG = `\n uniform float uTime, uDitherMix; uniform vec3 uSunDir; varying vec3 vDir;\n ${GLSL_BAYER_RGB555}\n float hash(vec3 p) { p = fract(p * 0.3183099 + 0.1) * 17.0; return fract(p.x * p.y * p.z * (p.x + p.y + p.z)); }\n float noise(vec3 x) {\n vec3 i = floor(x), f = fract(x);\n return mix(\n mix(mix(hash(i + vec3(0,0,0)), hash(i + vec3(1,0,0)), f.x), mix(hash(i + vec3(0,1,0)), hash(i + vec3(1,1,0)), f.x), f.y),\n mix(mix(hash(i + vec3(0,0,1)), hash(i + vec3(1,0,1)), f.x), mix(hash(i + vec3(0,1,1)), hash(i + vec3(1,1,1)), f.x), f.y), f.z\n );\n }\n float fbm(vec3 p) { float v = 0.0, a = 0.55; for (int i = 0; i < 3; i++) { v += a * noise(p); p = p * 2.05 + vec3(13.1, 7.7, 5.3); a *= 0.48; } return v; }\n void main() {\n vec3 dir = normalize(vDir);\n float horizon = exp(-abs(dir.y + dir.x * 0.18) * 3.0);\n vec3 col = mix(mix(vec3(0.015, 0.02, 0.055), vec3(0.02, 0.03, 0.08), dir.y * 0.5 + 0.5), vec3(0.08, 0.16, 0.27), horizon * 0.9);\n float n1 = fbm(dir * 2.8 + vec3(0.0, uTime * 0.003, 0.0)), n2 = fbm(dir * 5.0 - vec3(uTime * 0.002, 0.0, 1.4));\n float rawMask = clamp((n1 * 0.72 + n2 * 0.34 - 0.44) * 2.4, 0.0, 1.0) * (0.35 + horizon * 0.85);\n float cloudMask = mix(rawMask, floor(rawMask * 5.0) / 5.0, uDitherMix);\n float sunDot = max(0.0, dot(dir, normalize(uSunDir)));\n vec3 tint = mix(vec3(0.06, 0.38, 0.50), vec3(0.28, 0.12, 0.40), mix(n2, step(0.52, n2), uDitherMix));\n col += mix(tint, vec3(0.62, 0.26, 0.14), pow(sunDot, 2.0) * 0.9) * cloudMask * 0.85;\n float corona = mix(pow(sunDot, 12.0), floor(pow(sunDot, 12.0) * 6.0) / 6.0, uDitherMix);\n col += vec3(0.95, 0.55, 0.22) * corona * 0.65 + vec3(1.0, 0.90, 0.68) * step(0.9965, sunDot) * 1.1;\n float s = hash(floor(dir * 165.0));\n if (s > 0.995) col += mix(vec3(0.74, 0.90, 1.0), vec3(1.0, 0.86, 0.68), step(0.5, fract(s * 91.3))) * 0.95;\n gl_FragColor = vec4(ps1QuantizeRGB555Mix(col, gl_FragCoord.xy, uDitherMix), 1.0);\n }\n`;\n\nexport const ATMO_VERT = `\n uniform vec2 uPs1Grid; uniform float uSnapStrength; varying vec3 vNormalWorld, vWorldPos;\n void main() {\n vec4 wp = modelMatrix * vec4(position, 1.0); vWorldPos = wp.xyz; vNormalWorld = normalize(mat3(modelMatrix) * normal);\n vec4 clip = projectionMatrix * viewMatrix * wp;\n if (uSnapStrength > 0.001 && clip.w > 0.001) {\n vec4 snapped = clip; snapped.xyz = clip.xyz / clip.w;\n vec2 safeGrid = max(uPs1Grid * mix(2.5, 1.0, clamp(uSnapStrength, 0.0, 1.0)), vec2(1.0));\n snapped.xy = floor(safeGrid * snapped.xy + 0.5) / safeGrid; snapped.xyz *= clip.w; clip = snapped;\n }\n gl_Position = clip;\n }\n`;\n\nexport const ATMO_FRAG = `\n uniform vec3 uSunDir, uColor; uniform float uDitherMix; varying vec3 vNormalWorld, vWorldPos;\n ${GLSL_RETRO_QUANTIZE}\n void main() {\n vec3 viewDir = normalize(cameraPosition - vWorldPos);\n float rim = pow(1.0 - max(0.0, dot(viewDir, vNormalWorld)), 2.6), nl = dot(vNormalWorld, normalize(uSunDir));\n float sunLit = mix(smoothstep(-0.3, 0.7, nl), step(-0.25, nl), uDitherMix) * 0.72 + 0.28, alpha = rim * sunLit;\n if (alpha < (ps1BayerDither(gl_FragCoord.xy) * 0.65 + 0.14) * uDitherMix) discard;\n vec3 col = ps1QuantizeRetro(ps1LinearToSrgb(uColor * (0.8 + sunLit * 0.55)), gl_FragCoord.xy, uDitherMix);\n gl_FragColor = vec4(col, mix(alpha * 0.85, 0.75, uDitherMix));\n }\n`;\n\nexport interface KolmoSkyboxProps {\n sunDirection?: [number, number, number];\n}\n\nexport function KolmoSkybox({ sunDirection }: KolmoSkyboxProps): React.JSX.Element {\n const matRef = useRef<THREE.ShaderMaterial | null>(null);\n const groupRef = useRef<THREE.Group | null>(null);\n const uniforms = useMemo(\n () => ({ uTime: { value: 0 }, uSunDir: { value: KEY_SUN_DIRECTION.clone() }, uDitherMix: RETRO_UNIFORMS.uDitherMix }),\n [],\n );\n\n useEffect(() => {\n if (sunDirection) uniforms.uSunDir.value.set(sunDirection[0], sunDirection[1], sunDirection[2]).normalize();\n else uniforms.uSunDir.value.copy(KEY_SUN_DIRECTION);\n }, [sunDirection?.[0], sunDirection?.[1], sunDirection?.[2], uniforms]);\n\n useFrame((state, delta) => {\n if (matRef.current) matRef.current.uniforms.uTime.value += Math.min(delta, 0.05);\n if (groupRef.current) groupRef.current.position.copy(state.camera.position);\n });\n\n return (\n <group ref={groupRef}>\n <mesh renderOrder={-10} frustumCulled={false}>\n <icosahedronGeometry args={[3800, 2]} />\n <shaderMaterial ref={matRef} uniforms={uniforms} vertexShader={SKYBOX_VERT} fragmentShader={SKYBOX_FRAG} side={THREE.BackSide} depthWrite={false} />\n </mesh>\n <Stars radius={190} depth={130} count={2600} factor={4.5} saturation={0.35} fade={false} speed={0.18} />\n </group>\n );\n}\n\nconst BAYER_4X4 = [[0, 8, 2, 10], [12, 4, 14, 6], [3, 11, 1, 9], [15, 7, 13, 5]];\nconst BANDS: [number, number, number][] = [\n [14, 30, 56], [24, 58, 92], [42, 98, 126], [76, 134, 152], [186, 128, 86],\n [232, 160, 94], [172, 108, 74], [68, 108, 136], [34, 62, 96], [16, 28, 50],\n];\nconst quant8 = (v: number) => Math.min(255, Math.round(Math.max(0, Math.min(255, v)) / 8.225) * 8);\n\nexport function createPlanetTextures(): { planetMap: THREE.DataTexture; ringMap: THREE.DataTexture } {\n const pData = new Uint8Array(256 * 128 * 4);\n for (let y = 0; y < 128; y++) {\n for (let x = 0; x < 256; x++) {\n const wave = Math.sin((x / 256) * Math.PI * 8 + y * 0.16) * 2.8 + Math.cos((x / 256) * Math.PI * 16 - y * 0.24) * 1.4;\n const t = THREE.MathUtils.clamp(((y + wave) / 128) * (BANDS.length - 1), 0, BANDS.length - 1.001);\n const lo = Math.floor(t);\n let [r, g, b] = t - lo > BAYER_4X4[y & 3][x & 3] / 16 ? BANDS[lo + 1] : BANDS[lo];\n const sx = (x - 92.16) / 24, sy = (y - 71.68) / 11, spot = Math.hypot(sx, sy);\n if (spot < 1) {\n const w = (1 - spot) * (0.65 + (Math.sin(spot * 10 - Math.atan2(sy, sx) * 2) * 0.5 + 0.5) * 0.35);\n r = r * (1 - w) + 244 * w; g = g * (1 - w) + 148 * w; b = b * (1 - w) + 74 * w;\n }\n const grain = (((x * 19 + y * 29) & 15) - 8) * 1.1, idx = (y * 256 + x) * 4;\n pData[idx] = quant8(r + grain); pData[idx + 1] = quant8(g + grain); pData[idx + 2] = quant8(b + grain); pData[idx + 3] = 255;\n }\n }\n const planetMap = new THREE.DataTexture(pData, 256, 128, THREE.RGBAFormat);\n planetMap.colorSpace = THREE.SRGBColorSpace;\n planetMap.wrapS = THREE.RepeatWrapping;\n planetMap.minFilter = THREE.NearestFilter;\n planetMap.magFilter = THREE.NearestFilter;\n planetMap.needsUpdate = true;\n\n const rData = new Uint8Array(256 * 4);\n for (let x = 0; x < 256; x++) {\n const u = x / 255, gap = Math.abs(u - 0.44) < 0.048 || Math.abs(u - 0.78) < 0.024 ? 0 : 1;\n const a = (0.62 + 0.38 * Math.sin(u * 78)) * Math.sin(u * Math.PI) * gap, idx = x * 4;\n rData[idx] = quant8(168 + 68 * Math.sin(u * 11 + 0.4));\n rData[idx + 1] = quant8(186 + 44 * Math.cos(u * 16));\n rData[idx + 2] = quant8(204 + 42 * Math.sin(u * 13 + 1.8));\n rData[idx + 3] = a > 0.14 ? Math.round(Math.min(0.92, Math.round(a * 8) / 8) * 255) : 0;\n }\n const ringMap = new THREE.DataTexture(rData, 256, 1, THREE.RGBAFormat);\n ringMap.colorSpace = THREE.SRGBColorSpace;\n ringMap.minFilter = THREE.NearestFilter;\n ringMap.magFilter = THREE.NearestFilter;\n ringMap.needsUpdate = true;\n return { planetMap, ringMap };\n}\n\nexport function buildMoonletGeo(): THREE.BufferGeometry {\n const raw = new THREE.DodecahedronGeometry(1, 0);\n const geo = raw.index ? raw.toNonIndexed() : raw.clone();\n raw.dispose();\n const pos = geo.attributes.position, cols = new Float32Array(pos.count * 3);\n for (let i = 0; i < pos.count; i++) {\n const shade = 0.48 + ((i * 17) % 10) * 0.032;\n cols[i * 3] = shade * 0.92; cols[i * 3 + 1] = shade * 0.96; cols[i * 3 + 2] = shade;\n }\n geo.setAttribute(\"color\", new THREE.BufferAttribute(cols, 3));\n geo.computeVertexNormals();\n return geo;\n}\n\nexport function populateMoonletMatrices(inst: THREE.InstancedMesh, innerR: number, outerR: number): void {\n const dummy = new THREE.Object3D();\n for (let i = 0; i < RING_MOONLET_COUNT; i++) {\n const ang = (i / RING_MOONLET_COUNT) * Math.PI * 2 + (i % 5) * 0.08;\n const rad = THREE.MathUtils.lerp(innerR + 18, outerR - 18, ((i * 37) % 100) / 100);\n const z = (((i * 19) % 100) / 100 - 0.5) * 18, s = 4.5 + (((i * 13) % 100) / 100) * 14.5;\n dummy.position.set(Math.cos(ang) * rad, Math.sin(ang) * rad, z);\n dummy.rotation.set(i * 0.7, i * 1.1, i * 0.4);\n dummy.scale.set(s * 1.2, s * 0.8, s);\n dummy.updateMatrix();\n inst.setMatrixAt(i, dummy.matrix);\n }\n inst.instanceMatrix.needsUpdate = true;\n}\n"],"mappings":";;;;;;;;AAMA,IAAa,oBAAoB,IAAI,MAAM,QAAQ,MAAO,KAAM,IAAK,CAAC,CA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AI,IAAI,MAAS,IAAI,KAAM,MAAO,MAAO;EACpF,MAAM,SAAS,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,KAAK,IAAI,GAAG,IAAI,KAAK,CAAC;EAC9D,MAAM,SAAS,IAAI,IAAI,IAAK,IAAI,KAAK,IAAI,EAAG;EAC5C,MAAM,MAAM,IAAI,IAAI,KAAK,IAAI,IAAK,CAAC;EACnC,MAAM,aAAa;EACnB,KAAK,YAAY,GAAG,MAAM,MAAM;CACpC;CACA,KAAK,eAAe,cAAc;AACtC"}
|
package/dist/shaders/tsl.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createPS2RoadMaterialTSL, createPS2TerrainMaterialTSL } from "./ps2MaterialsTSL.js";
|
package/dist/shaders/tsl.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createPS2RoadMaterialTSL, createPS2TerrainMaterialTSL } from "./ps2MaterialsTSL.js";
|
package/dist/shaders/tsl.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsl.js","sources":["../../src/shaders/tsl.ts"],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SuikaMergeArbiter } from "./suikaArbiter.js";
|
|
3
|
-
import { type OrbShape, type SuikaBurstEffect, type SuikaMergeEvent, type SuikaSpawnInput } from "./suikaTypes.js";
|
|
4
|
-
export interface OrbShapeGeometryProps {
|
|
5
|
-
readonly shape: OrbShape;
|
|
6
|
-
readonly radius: number;
|
|
7
|
-
readonly sphereSegments?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function OrbShapeGeometry({ shape, radius, sphereSegments }: OrbShapeGeometryProps): React.JSX.Element;
|
|
10
|
-
export declare function SuikaBurstMesh({ burst }: {
|
|
11
|
-
readonly burst: SuikaBurstEffect;
|
|
12
|
-
}): React.JSX.Element;
|
|
13
|
-
export interface KolmoSuikaOrbProps {
|
|
14
|
-
readonly id?: string;
|
|
15
|
-
readonly tier?: number;
|
|
16
|
-
readonly position?: [number, number, number];
|
|
17
|
-
readonly velocity?: [number, number, number];
|
|
18
|
-
readonly linearDamping?: number;
|
|
19
|
-
readonly angularDamping?: number;
|
|
20
|
-
readonly importedUrl?: string | null;
|
|
21
|
-
readonly arbiter?: SuikaMergeArbiter | null;
|
|
22
|
-
readonly managedBySystem?: boolean;
|
|
23
|
-
readonly minCoreRadius?: number;
|
|
24
|
-
}
|
|
25
|
-
export declare function KolmoSuikaOrb({ id, tier, position, velocity, linearDamping, angularDamping, importedUrl, arbiter, managedBySystem, minCoreRadius, }: KolmoSuikaOrbProps): React.JSX.Element;
|
|
26
|
-
export interface KolmoSuikaSystemProps {
|
|
27
|
-
readonly arbiter?: SuikaMergeArbiter;
|
|
28
|
-
readonly initialOrbs?: readonly SuikaSpawnInput[];
|
|
29
|
-
readonly minCoreRadius?: number;
|
|
30
|
-
readonly showBursts?: boolean;
|
|
31
|
-
readonly onMerge?: (event: SuikaMergeEvent) => void;
|
|
32
|
-
}
|
|
33
|
-
export declare function KolmoSuikaSystem({ arbiter, initialOrbs, minCoreRadius, showBursts, onMerge, }: KolmoSuikaSystemProps): React.JSX.Element;
|