@3driseai/3drise-viewer 0.1.26 → 0.1.27
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/dist/animationsV2/ClipPlayer.d.ts +3 -0
- package/dist/animationsV2/ClipPlayer.d.ts.map +1 -1
- package/dist/animationsV2/ClipPlayer.js +67 -8
- package/dist/animationsV2/ClipsRuntime.d.ts +39 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +245 -14
- package/dist/animationsV2/appliers.d.ts +5 -0
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +25 -7
- package/dist/animationsV2/index.d.ts +1 -1
- package/dist/animationsV2/index.d.ts.map +1 -1
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +18 -7
- package/dist/animationsV2/sequenceUtils.d.ts +42 -1
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
- package/dist/animationsV2/sequenceUtils.js +103 -3
- package/dist/animationsV2/types.d.ts +20 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.d.ts +8 -2
- package/dist/components/AdvancedGrid.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.js +31 -14
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +7 -5
- package/dist/components/Bubbles.d.ts +7 -1
- package/dist/components/Bubbles.d.ts.map +1 -1
- package/dist/components/Bubbles.js +42 -22
- package/dist/components/ChladniGrid.d.ts +8 -4
- package/dist/components/ChladniGrid.d.ts.map +1 -1
- package/dist/components/ChladniGrid.js +31 -13
- package/dist/components/CircuitGrid.d.ts +8 -11
- package/dist/components/CircuitGrid.d.ts.map +1 -1
- package/dist/components/CircuitGrid.js +31 -13
- package/dist/components/CloudsGenerator.d.ts +1 -1
- package/dist/components/CloudsGenerator.js +1 -1
- package/dist/components/ContourGrid.d.ts +8 -14
- package/dist/components/ContourGrid.d.ts.map +1 -1
- package/dist/components/ContourGrid.js +31 -13
- package/dist/components/EffectsGenerator.d.ts +7 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +39 -38
- package/dist/components/EnvironmentManager.d.ts +4 -4
- package/dist/components/EnvironmentManager.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.d.ts +8 -4
- package/dist/components/FlowNetGrid.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.js +31 -13
- package/dist/components/FractalGrid.d.ts +8 -12
- package/dist/components/FractalGrid.d.ts.map +1 -1
- package/dist/components/FractalGrid.js +31 -13
- package/dist/components/GirihGrid.d.ts +8 -1
- package/dist/components/GirihGrid.d.ts.map +1 -1
- package/dist/components/GirihGrid.js +31 -13
- package/dist/components/Glyphs.d.ts +7 -1
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +40 -34
- package/dist/components/GravWaveGrid.d.ts +8 -1
- package/dist/components/GravWaveGrid.d.ts.map +1 -1
- package/dist/components/GravWaveGrid.js +31 -13
- package/dist/components/GridsGenerator.d.ts +7 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +20 -18
- package/dist/components/HexGrid.d.ts +8 -10
- package/dist/components/HexGrid.d.ts.map +1 -1
- package/dist/components/HexGrid.js +31 -13
- package/dist/components/HyperbolicGrid.d.ts +8 -4
- package/dist/components/HyperbolicGrid.d.ts.map +1 -1
- package/dist/components/HyperbolicGrid.js +31 -13
- package/dist/components/LandscapeBuilder.d.ts +1 -1
- package/dist/components/LandscapeBuilder.d.ts.map +1 -1
- package/dist/components/LandscapeBuilder.js +1 -1
- package/dist/components/LandscapeObject.d.ts +1 -1
- package/dist/components/LandscapeObject.d.ts.map +1 -1
- package/dist/components/LandscapeObject.js +1 -1
- package/dist/components/MoireGrid.d.ts +8 -12
- package/dist/components/MoireGrid.d.ts.map +1 -1
- package/dist/components/MoireGrid.js +31 -13
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +2 -2
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +37 -3
- package/dist/components/OceanBuilder.d.ts +1 -1
- package/dist/components/OceanBuilder.js +1 -1
- package/dist/components/ParticlesGenerator.d.ts.map +1 -1
- package/dist/components/ParticlesGenerator.js +6 -0
- package/dist/components/QuasiGrid.d.ts +8 -11
- package/dist/components/QuasiGrid.d.ts.map +1 -1
- package/dist/components/QuasiGrid.js +31 -13
- package/dist/components/RadarGrid.d.ts +8 -13
- package/dist/components/RadarGrid.d.ts.map +1 -1
- package/dist/components/RadarGrid.js +31 -13
- package/dist/components/ReactionDiffusionGrid.d.ts +8 -1
- package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
- package/dist/components/ReactionDiffusionGrid.js +33 -139
- package/dist/components/SceneBuilder.js +1 -1
- package/dist/components/SkySystem.d.ts +1 -1
- package/dist/components/SparklesBurst.d.ts +7 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +31 -28
- package/dist/components/TerrainBuilder.d.ts +1 -1
- package/dist/components/TerrainBuilder.d.ts.map +1 -1
- package/dist/components/TerrainBuilder.js +1 -1
- package/dist/components/VoronoiGrid.d.ts +8 -10
- package/dist/components/VoronoiGrid.d.ts.map +1 -1
- package/dist/components/VoronoiGrid.js +31 -13
- package/dist/components/WallpaperGrid.d.ts +8 -1
- package/dist/components/WallpaperGrid.d.ts.map +1 -1
- package/dist/components/WallpaperGrid.js +33 -210
- package/dist/components/effects/AuraEffect.d.ts +8 -3
- package/dist/components/effects/AuraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuraEffect.js +49 -24
- package/dist/components/effects/AuroraEffect.d.ts +8 -3
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuroraEffect.js +45 -25
- package/dist/components/effects/BlackHoleEffect.d.ts +8 -3
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
- package/dist/components/effects/BlackHoleEffect.js +42 -21
- package/dist/components/effects/ConstellationEffect.d.ts +8 -3
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
- package/dist/components/effects/ConstellationEffect.js +49 -23
- package/dist/components/effects/DandelionSeedsEffect.d.ts +7 -2
- package/dist/components/effects/DandelionSeedsEffect.d.ts.map +1 -1
- package/dist/components/effects/DandelionSeedsEffect.js +19 -9
- package/dist/components/effects/DataStreamEffect.d.ts +8 -3
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
- package/dist/components/effects/DataStreamEffect.js +54 -26
- package/dist/components/effects/DnaHelixEffect.d.ts +8 -3
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
- package/dist/components/effects/DnaHelixEffect.js +62 -30
- package/dist/components/effects/FallingLeavesEffect.d.ts +7 -2
- package/dist/components/effects/FallingLeavesEffect.d.ts.map +1 -1
- package/dist/components/effects/FallingLeavesEffect.js +19 -9
- package/dist/components/effects/FieldLinesEffect.d.ts +8 -3
- package/dist/components/effects/FieldLinesEffect.d.ts.map +1 -1
- package/dist/components/effects/FieldLinesEffect.js +30 -20
- package/dist/components/effects/Fire.d.ts +8 -3
- package/dist/components/effects/Fire.d.ts.map +1 -1
- package/dist/components/effects/Fire.js +47 -10
- package/dist/components/effects/FireflySwarmEffect.d.ts +7 -2
- package/dist/components/effects/FireflySwarmEffect.d.ts.map +1 -1
- package/dist/components/effects/FireflySwarmEffect.js +19 -9
- package/dist/components/effects/Flares.d.ts +10 -3
- package/dist/components/effects/Flares.d.ts.map +1 -1
- package/dist/components/effects/Flares.js +53 -56
- package/dist/components/effects/ForcefieldEffect.d.ts +8 -3
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
- package/dist/components/effects/ForcefieldEffect.js +52 -33
- package/dist/components/effects/GalaxyEffect.d.ts +7 -2
- package/dist/components/effects/GalaxyEffect.d.ts.map +1 -1
- package/dist/components/effects/GalaxyEffect.js +19 -9
- package/dist/components/effects/HarmonicShellEffect.d.ts +8 -3
- package/dist/components/effects/HarmonicShellEffect.d.ts.map +1 -1
- package/dist/components/effects/HarmonicShellEffect.js +30 -22
- package/dist/components/effects/HologramEffect.d.ts +8 -3
- package/dist/components/effects/HologramEffect.d.ts.map +1 -1
- package/dist/components/effects/HologramEffect.js +52 -23
- package/dist/components/effects/IceCrystalsEffect.d.ts +8 -3
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
- package/dist/components/effects/IceCrystalsEffect.js +36 -21
- package/dist/components/effects/IceHaloEffect.d.ts +7 -2
- package/dist/components/effects/IceHaloEffect.d.ts.map +1 -1
- package/dist/components/effects/IceHaloEffect.js +19 -9
- package/dist/components/effects/LichtenbergEffect.d.ts +7 -2
- package/dist/components/effects/LichtenbergEffect.d.ts.map +1 -1
- package/dist/components/effects/LichtenbergEffect.js +19 -9
- package/dist/components/effects/LightningEffect.d.ts +8 -3
- package/dist/components/effects/LightningEffect.d.ts.map +1 -1
- package/dist/components/effects/LightningEffect.js +54 -32
- package/dist/components/effects/MoleculesEffect.d.ts +8 -3
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
- package/dist/components/effects/MoleculesEffect.js +31 -21
- package/dist/components/effects/MurmurationEffect.d.ts +7 -2
- package/dist/components/effects/MurmurationEffect.d.ts.map +1 -1
- package/dist/components/effects/MurmurationEffect.js +19 -9
- package/dist/components/effects/NeuralNetworkEffect.d.ts +8 -3
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
- package/dist/components/effects/NeuralNetworkEffect.js +66 -33
- package/dist/components/effects/OrbEffect.d.ts +8 -3
- package/dist/components/effects/OrbEffect.d.ts.map +1 -1
- package/dist/components/effects/OrbEffect.js +89 -42
- package/dist/components/effects/PlanetaryRingsEffect.d.ts +7 -2
- package/dist/components/effects/PlanetaryRingsEffect.d.ts.map +1 -1
- package/dist/components/effects/PlanetaryRingsEffect.js +19 -9
- package/dist/components/effects/PortalEffect.d.ts +8 -3
- package/dist/components/effects/PortalEffect.d.ts.map +1 -1
- package/dist/components/effects/PortalEffect.js +41 -25
- package/dist/components/effects/ShockwaveEffect.d.ts +7 -2
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +19 -9
- package/dist/components/effects/SmokePlumeEffect.d.ts +8 -3
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokePlumeEffect.js +30 -20
- package/dist/components/effects/SmokeRibbon.d.ts +8 -2
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +34 -24
- package/dist/components/effects/SmokeRingEffect.d.ts +8 -3
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokeRingEffect.js +33 -21
- package/dist/components/effects/StrangeAttractorEffect.d.ts +8 -3
- package/dist/components/effects/StrangeAttractorEffect.d.ts.map +1 -1
- package/dist/components/effects/StrangeAttractorEffect.js +30 -20
- package/dist/components/effects/VolumetricFogEffect.d.ts +8 -3
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
- package/dist/components/effects/VolumetricFogEffect.js +38 -20
- package/dist/components/effects/WaterCausticsEffect.d.ts +7 -2
- package/dist/components/effects/WaterCausticsEffect.d.ts.map +1 -1
- package/dist/components/effects/WaterCausticsEffect.js +19 -9
- package/dist/components/effects/index.d.ts +0 -1
- package/dist/components/effects/index.d.ts.map +1 -1
- package/dist/components/effects/index.js +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/landscape/LandscapeMesh.js +1 -1
- package/dist/components/landscape/types.d.ts +1 -1
- package/dist/components/landscape/types.d.ts.map +1 -1
- package/dist/components/particles/MagneticBottleParticles.d.ts +17 -0
- package/dist/components/particles/MagneticBottleParticles.d.ts.map +1 -0
- package/dist/components/particles/MagneticBottleParticles.js +618 -0
- package/dist/components/particles/ShapeBurstParticles.d.ts +17 -0
- package/dist/components/particles/ShapeBurstParticles.d.ts.map +1 -0
- package/dist/components/particles/ShapeBurstParticles.js +588 -0
- package/dist/components/particles/ShapeFlowParticles.d.ts +17 -0
- package/dist/components/particles/ShapeFlowParticles.d.ts.map +1 -0
- package/dist/components/particles/ShapeFlowParticles.js +755 -0
- package/dist/components/particles/index.d.ts +6 -0
- package/dist/components/particles/index.d.ts.map +1 -1
- package/dist/components/particles/index.js +3 -0
- package/dist/components/terrain/types.d.ts +1 -1
- package/dist/components/terrain/types.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/types.d.ts +1 -1
- package/dist/components/volumetricClouds/types.d.ts.map +1 -1
- package/dist/components/water/types.d.ts +1 -1
- package/dist/components/water/types.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useConfigDriver.d.ts +22 -0
- package/dist/hooks/useConfigDriver.d.ts.map +1 -0
- package/dist/hooks/useConfigDriver.js +43 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useLandscapeMaps.d.ts +1 -1
- package/dist/hooks/useLandscapeMaps.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.d.ts +1 -1
- package/dist/hooks/useThunder.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/interactions/index.d.ts +2 -1
- package/dist/interactions/index.d.ts.map +1 -1
- package/dist/interactions/index.js +1 -1
- package/dist/interactions/runner.d.ts +18 -3
- package/dist/interactions/runner.d.ts.map +1 -1
- package/dist/interactions/runner.js +25 -2
- package/dist/operations/catalogue/curlSmoke.d.ts +3 -0
- package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -0
- package/dist/operations/catalogue/curlSmoke.js +178 -0
- package/dist/operations/catalogue/displayImage.d.ts.map +1 -1
- package/dist/operations/catalogue/displayImage.js +1 -0
- package/dist/operations/catalogue/dissolve.d.ts +3 -0
- package/dist/operations/catalogue/dissolve.d.ts.map +1 -0
- package/dist/operations/catalogue/dissolve.js +57 -0
- package/dist/operations/catalogue/emberAsh.d.ts +3 -0
- package/dist/operations/catalogue/emberAsh.d.ts.map +1 -0
- package/dist/operations/catalogue/emberAsh.js +171 -0
- package/dist/operations/catalogue/fade.d.ts.map +1 -1
- package/dist/operations/catalogue/fade.js +1 -0
- package/dist/operations/catalogue/flip.d.ts +3 -0
- package/dist/operations/catalogue/flip.d.ts.map +1 -0
- package/dist/operations/catalogue/flip.js +69 -0
- package/dist/operations/catalogue/flock.d.ts +3 -0
- package/dist/operations/catalogue/flock.d.ts.map +1 -0
- package/dist/operations/catalogue/flock.js +163 -0
- package/dist/operations/catalogue/focus.d.ts.map +1 -1
- package/dist/operations/catalogue/focus.js +1 -0
- package/dist/operations/catalogue/frame.d.ts +3 -0
- package/dist/operations/catalogue/frame.d.ts.map +1 -0
- package/dist/operations/catalogue/frame.js +44 -0
- package/dist/operations/catalogue/frost.d.ts +3 -0
- package/dist/operations/catalogue/frost.d.ts.map +1 -0
- package/dist/operations/catalogue/frost.js +111 -0
- package/dist/operations/catalogue/fxInstances.d.ts +21 -0
- package/dist/operations/catalogue/fxInstances.d.ts.map +1 -0
- package/dist/operations/catalogue/fxInstances.js +47 -0
- package/dist/operations/catalogue/fxPoints.d.ts +22 -0
- package/dist/operations/catalogue/fxPoints.d.ts.map +1 -0
- package/dist/operations/catalogue/fxPoints.js +70 -0
- package/dist/operations/catalogue/glow.d.ts.map +1 -1
- package/dist/operations/catalogue/glow.js +2 -1
- package/dist/operations/catalogue/heatCracks.d.ts +3 -0
- package/dist/operations/catalogue/heatCracks.d.ts.map +1 -0
- package/dist/operations/catalogue/heatCracks.js +134 -0
- package/dist/operations/catalogue/hologram.d.ts +3 -0
- package/dist/operations/catalogue/hologram.d.ts.map +1 -0
- package/dist/operations/catalogue/hologram.js +118 -0
- package/dist/operations/catalogue/inkBloom.d.ts +3 -0
- package/dist/operations/catalogue/inkBloom.d.ts.map +1 -0
- package/dist/operations/catalogue/inkBloom.js +156 -0
- package/dist/operations/catalogue/ivy.d.ts +13 -0
- package/dist/operations/catalogue/ivy.d.ts.map +1 -0
- package/dist/operations/catalogue/ivy.js +469 -0
- package/dist/operations/catalogue/jelly.d.ts +3 -0
- package/dist/operations/catalogue/jelly.d.ts.map +1 -0
- package/dist/operations/catalogue/jelly.js +50 -0
- package/dist/operations/catalogue/kintsugi.d.ts +3 -0
- package/dist/operations/catalogue/kintsugi.d.ts.map +1 -0
- package/dist/operations/catalogue/kintsugi.js +173 -0
- package/dist/operations/catalogue/lidarScan.d.ts +3 -0
- package/dist/operations/catalogue/lidarScan.d.ts.map +1 -0
- package/dist/operations/catalogue/lidarScan.js +240 -0
- package/dist/operations/catalogue/liquidMetal.d.ts +3 -0
- package/dist/operations/catalogue/liquidMetal.d.ts.map +1 -0
- package/dist/operations/catalogue/liquidMetal.js +122 -0
- package/dist/operations/catalogue/metalize.d.ts +3 -0
- package/dist/operations/catalogue/metalize.d.ts.map +1 -0
- package/dist/operations/catalogue/metalize.js +135 -0
- package/dist/operations/catalogue/moveToFront.d.ts.map +1 -1
- package/dist/operations/catalogue/moveToFront.js +1 -0
- package/dist/operations/catalogue/orbit.d.ts +3 -0
- package/dist/operations/catalogue/orbit.d.ts.map +1 -0
- package/dist/operations/catalogue/orbit.js +29 -0
- package/dist/operations/catalogue/particleSwarm.d.ts +3 -0
- package/dist/operations/catalogue/particleSwarm.d.ts.map +1 -0
- package/dist/operations/catalogue/particleSwarm.js +138 -0
- package/dist/operations/catalogue/petalPeel.d.ts +3 -0
- package/dist/operations/catalogue/petalPeel.d.ts.map +1 -0
- package/dist/operations/catalogue/petalPeel.js +137 -0
- package/dist/operations/catalogue/petrify.d.ts +3 -0
- package/dist/operations/catalogue/petrify.d.ts.map +1 -0
- package/dist/operations/catalogue/petrify.js +94 -0
- package/dist/operations/catalogue/portal.d.ts +3 -0
- package/dist/operations/catalogue/portal.d.ts.map +1 -0
- package/dist/operations/catalogue/portal.js +224 -0
- package/dist/operations/catalogue/print3d.d.ts +3 -0
- package/dist/operations/catalogue/print3d.d.ts.map +1 -0
- package/dist/operations/catalogue/print3d.js +275 -0
- package/dist/operations/catalogue/rainBeads.d.ts +3 -0
- package/dist/operations/catalogue/rainBeads.d.ts.map +1 -0
- package/dist/operations/catalogue/rainBeads.js +223 -0
- package/dist/operations/catalogue/restPose.d.ts +21 -0
- package/dist/operations/catalogue/restPose.d.ts.map +1 -0
- package/dist/operations/catalogue/restPose.js +55 -0
- package/dist/operations/catalogue/rimLight.d.ts +3 -0
- package/dist/operations/catalogue/rimLight.d.ts.map +1 -0
- package/dist/operations/catalogue/rimLight.js +72 -0
- package/dist/operations/catalogue/sandErosion.d.ts +3 -0
- package/dist/operations/catalogue/sandErosion.d.ts.map +1 -0
- package/dist/operations/catalogue/sandErosion.js +167 -0
- package/dist/operations/catalogue/shaderLayers.d.ts +74 -0
- package/dist/operations/catalogue/shaderLayers.d.ts.map +1 -0
- package/dist/operations/catalogue/shaderLayers.js +322 -0
- package/dist/operations/catalogue/shatter.d.ts +3 -0
- package/dist/operations/catalogue/shatter.d.ts.map +1 -0
- package/dist/operations/catalogue/shatter.js +267 -0
- package/dist/operations/catalogue/silkDrape.d.ts +3 -0
- package/dist/operations/catalogue/silkDrape.d.ts.map +1 -0
- package/dist/operations/catalogue/silkDrape.js +340 -0
- package/dist/operations/catalogue/spin.d.ts +3 -0
- package/dist/operations/catalogue/spin.d.ts.map +1 -0
- package/dist/operations/catalogue/spin.js +42 -0
- package/dist/operations/catalogue/surfaceSample.d.ts +17 -0
- package/dist/operations/catalogue/surfaceSample.d.ts.map +1 -0
- package/dist/operations/catalogue/surfaceSample.js +187 -0
- package/dist/operations/catalogue/swirl.d.ts +3 -0
- package/dist/operations/catalogue/swirl.d.ts.map +1 -0
- package/dist/operations/catalogue/swirl.js +69 -0
- package/dist/operations/catalogue/teleport.d.ts +3 -0
- package/dist/operations/catalogue/teleport.d.ts.map +1 -0
- package/dist/operations/catalogue/teleport.js +213 -0
- package/dist/operations/catalogue/transitionField.d.ts +124 -0
- package/dist/operations/catalogue/transitionField.d.ts.map +1 -0
- package/dist/operations/catalogue/transitionField.js +278 -0
- package/dist/operations/catalogue/unweave.d.ts +3 -0
- package/dist/operations/catalogue/unweave.d.ts.map +1 -0
- package/dist/operations/catalogue/unweave.js +233 -0
- package/dist/operations/catalogue/visibility.d.ts.map +1 -1
- package/dist/operations/catalogue/visibility.js +1 -0
- package/dist/operations/catalogue/voxelize.d.ts +3 -0
- package/dist/operations/catalogue/voxelize.d.ts.map +1 -0
- package/dist/operations/catalogue/voxelize.js +148 -0
- package/dist/operations/catalogue/warmup.d.ts +22 -0
- package/dist/operations/catalogue/warmup.d.ts.map +1 -0
- package/dist/operations/catalogue/warmup.js +106 -0
- package/dist/operations/catalogue/zoom.d.ts.map +1 -1
- package/dist/operations/catalogue/zoom.js +1 -0
- package/dist/operations/index.d.ts +4 -2
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +4 -2
- package/dist/operations/objectEffects.d.ts +46 -0
- package/dist/operations/objectEffects.d.ts.map +1 -0
- package/dist/operations/objectEffects.js +136 -0
- package/dist/operations/registry.d.ts +7 -2
- package/dist/operations/registry.d.ts.map +1 -1
- package/dist/operations/registry.js +45 -3
- package/dist/operations/runtime.d.ts +40 -2
- package/dist/operations/runtime.d.ts.map +1 -1
- package/dist/operations/runtime.js +164 -8
- package/dist/operations/types.d.ts +29 -3
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +6 -0
- package/dist/operations/useObjectEffectLayers.d.ts +4 -0
- package/dist/operations/useObjectEffectLayers.d.ts.map +1 -0
- package/dist/operations/useObjectEffectLayers.js +42 -0
- package/dist/operations/useOperationsRuntime.d.ts.map +1 -1
- package/dist/operations/useOperationsRuntime.js +42 -4
- package/dist/presets/landscapePresets.d.ts +1 -1
- package/dist/presets/landscapePresets.d.ts.map +1 -1
- package/dist/presets/landscapePresets.js +1 -1
- package/dist/presets/landscapeTypes.d.ts +1 -1
- package/dist/presets/landscapeTypes.d.ts.map +1 -1
- package/dist/presets/landscapeTypes.js +1 -1
- package/dist/presets/oceanSurfacePresets.d.ts +1 -1
- package/dist/presets/terrainPresets.d.ts +1 -1
- package/dist/presets/terrainPresets.d.ts.map +1 -1
- package/dist/presets/volumetricCloudPresets.d.ts +1 -1
- package/dist/types/cloudConfigs.d.ts +2 -309
- package/dist/types/cloudConfigs.d.ts.map +1 -1
- package/dist/types/cloudConfigs.js +2 -339
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/landscapeConfigs.d.ts +2 -217
- package/dist/types/landscapeConfigs.d.ts.map +1 -1
- package/dist/types/landscapeConfigs.js +2 -256
- package/dist/types/oceanConfigs.d.ts +2 -289
- package/dist/types/oceanConfigs.d.ts.map +1 -1
- package/dist/types/oceanConfigs.js +2 -380
- package/dist/types/terrainConfigs.d.ts +2 -250
- package/dist/types/terrainConfigs.d.ts.map +1 -1
- package/dist/types/terrainConfigs.js +2 -292
- package/dist/utils/cloudUniforms.d.ts +1 -1
- package/dist/utils/configAnimations.d.ts +6 -0
- package/dist/utils/configAnimations.d.ts.map +1 -1
- package/dist/utils/configAnimations.js +14 -0
- package/dist/utils/gridConfig.d.ts +19 -0
- package/dist/utils/gridConfig.d.ts.map +1 -0
- package/dist/utils/gridConfig.js +52 -0
- package/dist/utils/handleCloudsAnimations.d.ts +1 -1
- package/dist/utils/handleCloudsAnimations.js +1 -1
- package/dist/utils/hasHoverAnimation.d.ts.map +1 -1
- package/dist/utils/hasHoverAnimation.js +0 -2
- package/dist/utils/landscapeUniforms.d.ts +1 -1
- package/dist/utils/landscapeUniforms.d.ts.map +1 -1
- package/dist/utils/oceanUniforms.d.ts +1 -1
- package/dist/utils/particleShape.d.ts +33 -0
- package/dist/utils/particleShape.d.ts.map +1 -0
- package/dist/utils/particleShape.js +207 -0
- package/dist/utils/particleTrails.d.ts.map +1 -1
- package/dist/utils/particleTrails.js +29 -14
- package/dist/utils/terrainUniforms.d.ts +1 -1
- package/dist/utils/terrainUniforms.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// Rain beads — the object gets wet. Water beads land on the surface (a 3D
|
|
2
|
+
// lattice of drops in the object's own space, each a dome whose normal bends
|
|
3
|
+
// the scene's lighting: glossy highlight, dark refraction rim, a caustic on the
|
|
4
|
+
// side away from the light), and the surface darkens and turns glossy where it
|
|
5
|
+
// is wet. On the steep sides some drops break loose and slide down with gravity
|
|
6
|
+
// (world down, whatever the object's rotation), wiping a wet trail behind them
|
|
7
|
+
// that leaves a few tiny beads. They keep sliding while it holds.
|
|
8
|
+
// A state, not an exit: reverting dries it — the beads shrink away and the wet
|
|
9
|
+
// sheen fades.
|
|
10
|
+
import { Color } from 'three';
|
|
11
|
+
import { defineOperation } from '../types.js';
|
|
12
|
+
import { GLSL_WORLEY, addLayer, forEachMeshMaterial, removeLayer } from './shaderLayers.js';
|
|
13
|
+
import { DIRECTION_OPTIONS, createFieldState, fieldGlsl, fieldUniforms, runProgress, setFieldParams } from './transitionField.js';
|
|
14
|
+
const P = 'Rain';
|
|
15
|
+
const KEY = 'rainBeads';
|
|
16
|
+
const STATE = '__opRainBeads';
|
|
17
|
+
/** Computed once per fragment in the first anchor it reaches, then shared. */
|
|
18
|
+
const COMPUTE = /* glsl */ `
|
|
19
|
+
float rainB = 0.0; // bead coverage (anti-aliased edge)
|
|
20
|
+
float rainT = 2.0; // position inside the bead: 0 centre, 1 rim
|
|
21
|
+
vec3 rainDelta = vec3(0.0); // root-space normal bend of the bead
|
|
22
|
+
float rainWet = 0.0, rainTrail = 0.0, rainRim = 0.0, rainCaus = 0.0;
|
|
23
|
+
bool rainDone = false;
|
|
24
|
+
void rainCompute() {
|
|
25
|
+
rainDone = true;
|
|
26
|
+
vec3 n = normalize(vRainN);
|
|
27
|
+
vec3 p = vRainR / uRainExtent * uRainDensity; // lattice units
|
|
28
|
+
vec3 g = normalize(mat3(uRainRootInv) * vec3(0.0, -1.0, 0.0)); // world down, in root space
|
|
29
|
+
vec3 gt = g - n * dot(g, n);
|
|
30
|
+
float vert = length(gt);
|
|
31
|
+
vec3 gd = vert > 1e-3 ? gt / vert : vec3(0.0);
|
|
32
|
+
float prog = clamp(uRainProgress, 0.0, 1.0);
|
|
33
|
+
float fq = RainField(vRainQ);
|
|
34
|
+
rainWet = smoothstep(fq * 0.5, fq * 0.5 + 0.35, prog) * uRainWetness;
|
|
35
|
+
// ---- sliding drops (steep sides only): one lane per column of a lattice across gravity
|
|
36
|
+
float slideT = 2.0; vec3 slideOff = vec3(0.0); float trail = 0.0;
|
|
37
|
+
float steep = smoothstep(0.3, 0.6, vert);
|
|
38
|
+
if (uRainSlide > 0.0 && steep > 0.0) {
|
|
39
|
+
vec3 a1 = normalize(abs(g.y) < 0.9 ? cross(g, vec3(0.0, 1.0, 0.0)) : cross(g, vec3(1.0, 0.0, 0.0)));
|
|
40
|
+
vec3 a2 = cross(g, a1);
|
|
41
|
+
vec2 uv = vec2(dot(p, a1), dot(p, a2)) * 0.6;
|
|
42
|
+
vec2 id = floor(uv);
|
|
43
|
+
vec3 hh = fxHash3(vec3(id, 7.0));
|
|
44
|
+
if (hh.x < uRainSlide * smoothstep(0.55, 1.0, prog)) {
|
|
45
|
+
float s = dot(p, g);
|
|
46
|
+
float period = 2.5 + 3.0 * hh.y;
|
|
47
|
+
float y = fract(s / period - uRainTime * (0.1 + 0.16 * hh.z) + hh.y);
|
|
48
|
+
float along = (y - 0.5) * period; // > 0 below the drop, < 0 behind it
|
|
49
|
+
// across the lane, measured along the surface's own horizontal
|
|
50
|
+
vec3 t1 = normalize(cross(n, g) + vec3(1e-5));
|
|
51
|
+
vec2 off2 = (fract(uv) - 0.5 - (hh.yz - 0.5) * 0.35) / 0.6;
|
|
52
|
+
float lateral = dot(off2, vec2(dot(t1, a1), dot(t1, a2))) - 0.12 * sin(s * 1.7 + hh.z * 6.28);
|
|
53
|
+
float rd = 0.2 * uRainBead;
|
|
54
|
+
float m = length(vec2(lateral / rd, along / (rd * (along < 0.0 ? 1.7 : 1.15))));
|
|
55
|
+
slideT = m;
|
|
56
|
+
slideOff = t1 * (lateral / rd) + gd * (along / (rd * 1.3));
|
|
57
|
+
// the wet trail it wipes, tapering behind it
|
|
58
|
+
float back = -along;
|
|
59
|
+
float tw = rd * 0.45 * (1.0 - smoothstep(0.0, period * 0.45, back));
|
|
60
|
+
trail = (1.0 - smoothstep(tw * 0.7, tw, abs(lateral))) * step(0.0, back) * (1.0 - smoothstep(period * 0.3, period * 0.48, back)) * steep;
|
|
61
|
+
// a few tiny beads left behind in the trail
|
|
62
|
+
float k = fract(back / (0.28 * uRainBead) + hh.x * 5.0);
|
|
63
|
+
float tb = length(vec2(lateral, (k - 0.5) * 0.28 * uRainBead)) / (0.045 * uRainBead * (0.6 + hh.y));
|
|
64
|
+
if (trail > 0.5 && tb < 1.0 && fxHash3(vec3(id, floor(back / (0.28 * uRainBead)))).x < 0.45) {
|
|
65
|
+
slideT = min(slideT, tb);
|
|
66
|
+
if (tb <= m) slideOff = t1 * (lateral / (0.045 * uRainBead)) + gd * ((k - 0.5) * 6.0);
|
|
67
|
+
}
|
|
68
|
+
slideT = mix(2.0, slideT, steep);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rainTrail = trail * uRainWetness;
|
|
72
|
+
// ---- static beads: one candidate drop per lattice cell
|
|
73
|
+
float bt = 2.0; vec3 bOff = vec3(0.0);
|
|
74
|
+
if (trail < 0.5) {
|
|
75
|
+
vec3 ic = floor(p);
|
|
76
|
+
for (int z = -1; z <= 1; z++) for (int y = -1; y <= 1; y++) for (int x = -1; x <= 1; x++) {
|
|
77
|
+
vec3 cell = ic + vec3(float(x), float(y), float(z));
|
|
78
|
+
vec3 h = fxHash3(cell);
|
|
79
|
+
vec3 h2 = fxHash3(cell + 31.7);
|
|
80
|
+
float birth = 0.62 * h2.x + 0.3 * fq;
|
|
81
|
+
float grow = smoothstep(birth, birth + 0.07, prog);
|
|
82
|
+
float rad = uRainBead * (0.13 + 0.3 * h2.y * h2.y) * grow;
|
|
83
|
+
if (rad < 1e-3) continue;
|
|
84
|
+
vec3 dv = p - (cell + h);
|
|
85
|
+
float dn = dot(dv, n);
|
|
86
|
+
if (abs(dn) >= rad) continue;
|
|
87
|
+
vec3 tv = dv - n * dn;
|
|
88
|
+
tv -= gd * dot(tv, gd) * 0.18; // a slight sag with gravity
|
|
89
|
+
float sr = sqrt(rad * rad - dn * dn);
|
|
90
|
+
float t = length(tv) / sr;
|
|
91
|
+
if (t < bt) { bt = t; bOff = tv / sr; }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (slideT < bt) { bt = slideT; bOff = slideOff; }
|
|
95
|
+
rainT = bt;
|
|
96
|
+
float aa = fwidth(bt) * 1.5 + 1e-3;
|
|
97
|
+
rainB = 1.0 - smoothstep(1.0 - aa, 1.0, bt);
|
|
98
|
+
float dome = sqrt(clamp(1.0 - bt * bt, 0.0, 1.0));
|
|
99
|
+
// a flat-ish drop: the bend grows towards the rim
|
|
100
|
+
vec3 nb = normalize(n * (0.35 + dome) + bOff * 0.9);
|
|
101
|
+
rainDelta = nb - n;
|
|
102
|
+
rainRim = smoothstep(0.72, 0.97, bt) * rainB;
|
|
103
|
+
rainCaus = smoothstep(0.1, 0.55, dot(bOff, gd)) * (1.0 - smoothstep(0.55, 0.85, bt)) * rainB;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
function layerFor(st) {
|
|
107
|
+
return {
|
|
108
|
+
uniforms: {
|
|
109
|
+
...fieldUniforms(P, st.field), uRainDensity: st.density, uRainBead: st.bead, uRainSlide: st.slide,
|
|
110
|
+
uRainWetness: st.wetness, uRainTint: st.tint,
|
|
111
|
+
},
|
|
112
|
+
common: `varying vec3 vRainQ;\nvarying vec3 vRainR;\nvarying vec3 vRainN;\nvarying vec3 vRainView;\nvarying vec3 vRainX;\nvarying vec3 vRainY;\nvarying vec3 vRainZ;\n${fieldGlsl(P)}\n${GLSL_WORLEY}`,
|
|
113
|
+
fragmentPars: COMPUTE,
|
|
114
|
+
vertex: /* glsl */ `
|
|
115
|
+
vRainR = (uRainRootInv * modelMatrix * vec4(transformed, 1.0)).xyz;
|
|
116
|
+
vRainQ = RainNorm(vRainR);
|
|
117
|
+
vRainN = (uRainRootInv * modelMatrix * vec4(normal, 0.0)).xyz;
|
|
118
|
+
vRainView = (modelViewMatrix * vec4(transformed, 1.0)).xyz;
|
|
119
|
+
{
|
|
120
|
+
// root axes in view space, to bend the lighting normal
|
|
121
|
+
mat3 rv = mat3(viewMatrix) * inverse(mat3(uRainRootInv));
|
|
122
|
+
vRainX = rv[0]; vRainY = rv[1]; vRainZ = rv[2];
|
|
123
|
+
}`,
|
|
124
|
+
diffuse: /* glsl */ `
|
|
125
|
+
{
|
|
126
|
+
if (!rainDone) rainCompute();
|
|
127
|
+
float wet = max(rainWet, rainTrail);
|
|
128
|
+
diffuseColor.rgb *= 1.0 - 0.42 * wet;
|
|
129
|
+
diffuseColor.rgb *= 1.0 - 0.18 * rainTrail; // a trail is wetter still
|
|
130
|
+
diffuseColor.rgb *= 1.0 - rainB * (0.18 + 0.45 * rainRim);
|
|
131
|
+
}`,
|
|
132
|
+
material: /* glsl */ `
|
|
133
|
+
{
|
|
134
|
+
if (!rainDone) rainCompute();
|
|
135
|
+
float wet = max(rainWet, rainTrail);
|
|
136
|
+
roughnessFactor = mix(roughnessFactor, roughnessFactor * 0.3, wet);
|
|
137
|
+
roughnessFactor = mix(roughnessFactor, 0.07, rainTrail);
|
|
138
|
+
roughnessFactor = mix(roughnessFactor, 0.03, rainB);
|
|
139
|
+
metalnessFactor = mix(metalnessFactor, 0.0, rainB);
|
|
140
|
+
}`,
|
|
141
|
+
emissive: /* glsl */ `
|
|
142
|
+
{
|
|
143
|
+
if (!rainDone) rainCompute();
|
|
144
|
+
vec3 dv = rainDelta.x * vRainX + rainDelta.y * vRainY + rainDelta.z * vRainZ;
|
|
145
|
+
normal = normalize(normal + dv * rainB);
|
|
146
|
+
}`,
|
|
147
|
+
fragment: /* glsl */ `
|
|
148
|
+
{
|
|
149
|
+
if (!rainDone) rainCompute();
|
|
150
|
+
if (rainB > 0.001) {
|
|
151
|
+
vec3 pos = vRainView;
|
|
152
|
+
vec3 gn = normalize(cross(dFdx(pos), dFdy(pos)));
|
|
153
|
+
vec3 dv = rainDelta.x * vRainX + rainDelta.y * vRainY + rainDelta.z * vRainZ;
|
|
154
|
+
vec3 n = normalize(gn + dv);
|
|
155
|
+
vec3 v = normalize(pos);
|
|
156
|
+
vec3 rw = normalize((vec4(reflect(v, n), 0.0) * viewMatrix).xyz);
|
|
157
|
+
float up = rw.y;
|
|
158
|
+
vec3 env = mix(vec3(0.03), vec3(0.75, 0.82, 0.9), smoothstep(-0.2, 0.7, up));
|
|
159
|
+
env += vec3(1.6) * exp(-abs(up - 0.03) * 40.0);
|
|
160
|
+
env += vec3(6.0) * pow(max(dot(rw, normalize(vec3(0.6, 0.55, 0.6))), 0.0), 240.0);
|
|
161
|
+
env += vec3(2.5) * pow(max(dot(rw, normalize(vec3(-0.7, 0.35, -0.3))), 0.0), 120.0);
|
|
162
|
+
float ndv = abs(dot(n, v));
|
|
163
|
+
float fres = 0.03 + 0.97 * pow(1.0 - ndv, 5.0);
|
|
164
|
+
outgoingLight += uRainTint * env * fres * rainB * 1.4;
|
|
165
|
+
outgoingLight += uRainTint * rainCaus * 0.35;
|
|
166
|
+
}
|
|
167
|
+
}`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export default defineOperation({
|
|
171
|
+
value: 'rainBeads',
|
|
172
|
+
label: 'Rain beads',
|
|
173
|
+
description: 'Bead the targets with water drops that catch the light, some sliding down in wet trails — reverting dries them',
|
|
174
|
+
channel: 'visual',
|
|
175
|
+
multi: true,
|
|
176
|
+
toggles: true,
|
|
177
|
+
usableIn: ['interaction', 'action', 'object'],
|
|
178
|
+
params: {
|
|
179
|
+
direction: { type: 'select', label: 'Rain arrives', default: 'down', options: DIRECTION_OPTIONS },
|
|
180
|
+
density: { type: 'number', label: 'Drops', default: 22, min: 5, max: 80, step: 1, hint: 'Drops across the object' },
|
|
181
|
+
size: { type: 'number', label: 'Drop size', default: 1, min: 0.3, max: 2.2, step: 0.05, unit: '×' },
|
|
182
|
+
slide: { type: 'number', label: 'Sliding drops', default: 0.45, min: 0, max: 1, step: 0.01 },
|
|
183
|
+
wetness: { type: 'number', label: 'Wetness', default: 0.7, min: 0, max: 1, step: 0.01, hint: 'How much the surface darkens and shines' },
|
|
184
|
+
tint: { type: 'color', label: 'Water', default: '#e6f2ff' },
|
|
185
|
+
duration: { type: 'number', label: 'Duration', default: 3, min: 0.3, max: 12, step: 0.1, unit: 's' },
|
|
186
|
+
},
|
|
187
|
+
apply(target, p, ctx) {
|
|
188
|
+
let st = target.userData[STATE];
|
|
189
|
+
if (!st) {
|
|
190
|
+
const field = createFieldState(target);
|
|
191
|
+
st = {
|
|
192
|
+
field, density: { value: 22 }, bead: { value: 1 }, slide: { value: 0.45 }, wetness: { value: 0.7 }, tint: { value: new Color() },
|
|
193
|
+
mats: new Set(),
|
|
194
|
+
};
|
|
195
|
+
const own = st;
|
|
196
|
+
const layer = layerFor(own);
|
|
197
|
+
forEachMeshMaterial(target, (mat, mesh) => {
|
|
198
|
+
if (mesh.userData?.__opFxHelper)
|
|
199
|
+
return;
|
|
200
|
+
if (addLayer(mat, KEY, layer))
|
|
201
|
+
own.mats.add(mat);
|
|
202
|
+
});
|
|
203
|
+
target.userData[STATE] = st;
|
|
204
|
+
}
|
|
205
|
+
const s = st;
|
|
206
|
+
setFieldParams(s.field, p, target, ctx);
|
|
207
|
+
s.density.value = Number(p.density);
|
|
208
|
+
s.bead.value = Number(p.size);
|
|
209
|
+
s.slide.value = Number(p.slide);
|
|
210
|
+
s.wetness.value = Number(p.wetness);
|
|
211
|
+
s.tint.value.set(String(p.tint));
|
|
212
|
+
return runProgress(target, s.field, 1, { duration: Number(p.duration), ease: 'power1.out', hold: true });
|
|
213
|
+
},
|
|
214
|
+
revert(target, p) {
|
|
215
|
+
const s = target.userData[STATE];
|
|
216
|
+
if (!s)
|
|
217
|
+
return;
|
|
218
|
+
return runProgress(target, s.field, 0, {
|
|
219
|
+
duration: Number(p.duration), ease: 'power1.in',
|
|
220
|
+
onComplete: () => { s.mats.forEach(m => removeLayer(m, KEY)); delete target.userData[STATE]; },
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
import type { Object3D } from 'three';
|
|
3
|
+
export interface RestPose {
|
|
4
|
+
position: Vector3;
|
|
5
|
+
quaternion: Quaternion;
|
|
6
|
+
scale: Vector3;
|
|
7
|
+
/** Bounds centre and bottom in the object's own local space (unscaled). */
|
|
8
|
+
centerLocal: Vector3;
|
|
9
|
+
bottomLocal: Vector3;
|
|
10
|
+
/** World-space size at rest. */
|
|
11
|
+
size: Vector3;
|
|
12
|
+
users: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function acquireRest(target: Object3D): RestPose;
|
|
15
|
+
export declare function releaseRest(target: Object3D): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pose the object as rest ∘ (rotation `q` and non-uniform scale `s` about the local
|
|
18
|
+
* `pivot`), then offset by `worldOffset`. The pivot stays where it is at rest.
|
|
19
|
+
*/
|
|
20
|
+
export declare function poseAbout(target: Object3D, r: RestPose, pivot: Vector3, q: Quaternion, s: Vector3, worldOffset?: Vector3): void;
|
|
21
|
+
//# sourceMappingURL=restPose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restPose.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/restPose.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,WAAW,QAAQ;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAgBtD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,QAQ3C;AAGD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,QAaxH"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Rest pose for transform operations: captured once when the first transform
|
|
2
|
+
// effect starts on an object, released when the last one ends, so effects that
|
|
3
|
+
// overlap (a jelly during a flip) always return to the authored pose.
|
|
4
|
+
import { Box3, Vector3 } from 'three';
|
|
5
|
+
const KEY = '__opRestPose';
|
|
6
|
+
export function acquireRest(target) {
|
|
7
|
+
let r = target.userData[KEY];
|
|
8
|
+
if (!r) {
|
|
9
|
+
target.updateWorldMatrix(true, true);
|
|
10
|
+
const box = new Box3().setFromObject(target);
|
|
11
|
+
const c = box.getCenter(new Vector3());
|
|
12
|
+
const bottom = new Vector3(c.x, box.min.y, c.z);
|
|
13
|
+
r = {
|
|
14
|
+
position: target.position.clone(), quaternion: target.quaternion.clone(), scale: target.scale.clone(),
|
|
15
|
+
centerLocal: target.worldToLocal(c.clone()), bottomLocal: target.worldToLocal(bottom),
|
|
16
|
+
size: box.getSize(new Vector3()), users: 0,
|
|
17
|
+
};
|
|
18
|
+
target.userData[KEY] = r;
|
|
19
|
+
}
|
|
20
|
+
r.users++;
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
export function releaseRest(target) {
|
|
24
|
+
const r = target.userData[KEY];
|
|
25
|
+
if (!r)
|
|
26
|
+
return;
|
|
27
|
+
r.users--;
|
|
28
|
+
if (r.users <= 0) {
|
|
29
|
+
target.position.copy(r.position);
|
|
30
|
+
target.quaternion.copy(r.quaternion);
|
|
31
|
+
target.scale.copy(r.scale);
|
|
32
|
+
delete target.userData[KEY];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const _v = new Vector3();
|
|
36
|
+
/**
|
|
37
|
+
* Pose the object as rest ∘ (rotation `q` and non-uniform scale `s` about the local
|
|
38
|
+
* `pivot`), then offset by `worldOffset`. The pivot stays where it is at rest.
|
|
39
|
+
*/
|
|
40
|
+
export function poseAbout(target, r, pivot, q, s, worldOffset) {
|
|
41
|
+
// local pivot → parent space at rest, and under the new rotation/scale
|
|
42
|
+
const restP = _v.copy(pivot).multiply(r.scale).applyQuaternion(r.quaternion);
|
|
43
|
+
const newQ = r.quaternion.clone().multiply(q);
|
|
44
|
+
const newS = r.scale.clone().multiply(s);
|
|
45
|
+
const nowP = pivot.clone().multiply(newS).applyQuaternion(newQ);
|
|
46
|
+
target.quaternion.copy(newQ);
|
|
47
|
+
target.scale.copy(newS);
|
|
48
|
+
target.position.copy(r.position).add(restP).sub(nowP);
|
|
49
|
+
if (worldOffset && target.parent) {
|
|
50
|
+
const w = target.parent.localToWorld(target.position.clone()).add(worldOffset);
|
|
51
|
+
target.position.copy(target.parent.worldToLocal(w));
|
|
52
|
+
}
|
|
53
|
+
else if (worldOffset)
|
|
54
|
+
target.position.add(worldOffset);
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rimLight.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/rimLight.ts"],"names":[],"mappings":";AAgBA,wBAwDG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Rim light — a Fresnel edge light over the object's own material: the
|
|
2
|
+
// silhouette catches light, faces turned to the camera stay as they are. It
|
|
3
|
+
// sweeps on along the chosen direction (a soft front in the object's own space)
|
|
4
|
+
// and sweeps off the same way when reverted. Lit materials only.
|
|
5
|
+
import { Color } from 'three';
|
|
6
|
+
import { defineOperation } from '../types.js';
|
|
7
|
+
import { addLayer, forEachMeshMaterial, removeLayer } from './shaderLayers.js';
|
|
8
|
+
import { DIRECTION_OPTIONS, createFieldState, fieldGlsl, fieldUniforms, runProgress, setFieldParams } from './transitionField.js';
|
|
9
|
+
const P = 'Rim';
|
|
10
|
+
const KEY = 'rimLight';
|
|
11
|
+
const STATE = '__opRim';
|
|
12
|
+
const LIT = (m) => m.isMeshStandardMaterial || m.isMeshPhongMaterial || m.isMeshLambertMaterial || m.isMeshToonMaterial;
|
|
13
|
+
export default defineOperation({
|
|
14
|
+
value: 'rimLight',
|
|
15
|
+
label: 'Rim light',
|
|
16
|
+
description: 'Light the edges of the targets, like a backlight catching the silhouette — sweeping on in a direction',
|
|
17
|
+
channel: 'visual',
|
|
18
|
+
multi: true,
|
|
19
|
+
toggles: true,
|
|
20
|
+
usableIn: ['interaction', 'action', 'object'],
|
|
21
|
+
params: {
|
|
22
|
+
direction: { type: 'select', label: 'Direction', default: 'up', options: DIRECTION_OPTIONS },
|
|
23
|
+
color: { type: 'color', label: 'Colour', default: '#8fd8ff' },
|
|
24
|
+
intensity: { type: 'number', label: 'Intensity', default: 2.5, min: 0, max: 10, step: 0.1 },
|
|
25
|
+
sharpness: { type: 'number', label: 'Sharpness', default: 3, min: 1, max: 8, step: 0.1, hint: 'Higher = a thinner edge' },
|
|
26
|
+
softness: { type: 'number', label: 'Front softness', default: 0.25, min: 0.02, max: 0.6, step: 0.01, hint: 'How soft the sweeping front is' },
|
|
27
|
+
duration: { type: 'number', label: 'Duration', default: 0.8, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
28
|
+
},
|
|
29
|
+
apply(target, p, ctx) {
|
|
30
|
+
let st = target.userData[STATE];
|
|
31
|
+
if (!st) {
|
|
32
|
+
const field = createFieldState(target);
|
|
33
|
+
st = { field, color: { value: new Color() }, intensity: { value: 0 }, power: { value: 3 }, mats: new Set() };
|
|
34
|
+
const own = st;
|
|
35
|
+
const layer = {
|
|
36
|
+
uniforms: { ...fieldUniforms(P, field), uRimColor: own.color, uRimIntensity: own.intensity, uRimPower: own.power },
|
|
37
|
+
common: `varying vec3 vRimQ;\n${fieldGlsl(P)}`,
|
|
38
|
+
vertex: `vRimQ = RimNorm((uRimRootInv * modelMatrix * vec4(transformed, 1.0)).xyz);`,
|
|
39
|
+
fragment: /* glsl */ `
|
|
40
|
+
{
|
|
41
|
+
// on behind the front, a soft ramp across it
|
|
42
|
+
float on = smoothstep(0.0, uRimEdgeWidth, RimThreshold() - RimField(vRimQ));
|
|
43
|
+
float facing = clamp(abs(dot(normalize(normal), normalize(vViewPosition))), 0.0, 1.0);
|
|
44
|
+
outgoingLight += uRimColor * (uRimIntensity * on * pow(1.0 - facing, uRimPower));
|
|
45
|
+
}`,
|
|
46
|
+
};
|
|
47
|
+
forEachMeshMaterial(target, (mat, mesh) => {
|
|
48
|
+
if (mesh.userData?.__opFxHelper || !LIT(mat))
|
|
49
|
+
return;
|
|
50
|
+
if (addLayer(mat, KEY, layer))
|
|
51
|
+
own.mats.add(mat);
|
|
52
|
+
});
|
|
53
|
+
target.userData[STATE] = st;
|
|
54
|
+
}
|
|
55
|
+
const s = st;
|
|
56
|
+
setFieldParams(s.field, p, target, ctx);
|
|
57
|
+
s.field.edgeWidth.value = Number(p.softness);
|
|
58
|
+
s.color.value.set(String(p.color));
|
|
59
|
+
s.intensity.value = Number(p.intensity);
|
|
60
|
+
s.power.value = Number(p.sharpness);
|
|
61
|
+
return runProgress(target, s.field, 1, { duration: Number(p.duration), ease: 'power1.out', hold: true });
|
|
62
|
+
},
|
|
63
|
+
revert(target, p) {
|
|
64
|
+
const s = target.userData[STATE];
|
|
65
|
+
if (!s)
|
|
66
|
+
return;
|
|
67
|
+
return runProgress(target, s.field, 0, {
|
|
68
|
+
duration: Number(p.duration), ease: 'power1.in',
|
|
69
|
+
onComplete: () => { s.mats.forEach(m => removeLayer(m, KEY)); delete target.userData[STATE]; },
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandErosion.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/sandErosion.ts"],"names":[],"mappings":";AAyEA,wBAkGG"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Sand erosion — first the surface turns to sand (a warm, grainy, matte crust
|
|
2
|
+
// that keeps a trace of the object's colour), then it crumbles grain by grain
|
|
3
|
+
// along a granular edge — no glow, just a darker, damp-looking lip where it is
|
|
4
|
+
// breaking. Each grain slides off, then drops under gravity (accelerating) onto
|
|
5
|
+
// a cone-shaped mound around the base; grains that fell earlier lie lower, so the pile
|
|
6
|
+
// really builds up. The pile stays while the effect is on; reverting sends every
|
|
7
|
+
// grain back up to its exact spot and the surface closes.
|
|
8
|
+
import { Color } from 'three';
|
|
9
|
+
import { defineOperation } from '../types.js';
|
|
10
|
+
import { addLayer, forEachMeshMaterial, removeLayer } from './shaderLayers.js';
|
|
11
|
+
import { DIRECTION_OPTIONS, createFieldState, fieldGlsl, fieldUniforms, hideMeshes, runProgress, setFieldParams, } from './transitionField.js';
|
|
12
|
+
import { sampleSurfaceCached } from './surfaceSample.js';
|
|
13
|
+
import { GLSL_POINT_SIZE, createFxPoints, disposeFxPoints } from './fxPoints.js';
|
|
14
|
+
const P = 'Snd';
|
|
15
|
+
const KEY = 'sandErosion';
|
|
16
|
+
const STATE = '__opSand';
|
|
17
|
+
/** The crumble trails the sand crust by LAG; grains fall for LIFE (progress units). */
|
|
18
|
+
const LAG = 0.25;
|
|
19
|
+
const LIFE = 0.55;
|
|
20
|
+
const END = 1 + LAG + LIFE;
|
|
21
|
+
/** Grains across the object's extent, for the granular crumble edge. */
|
|
22
|
+
const GRAIN_CELLS = 140.0;
|
|
23
|
+
const HASH1 = /* glsl */ `
|
|
24
|
+
#ifndef FX_HASH1
|
|
25
|
+
#define FX_HASH1
|
|
26
|
+
float fxHash1(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }
|
|
27
|
+
#endif
|
|
28
|
+
`;
|
|
29
|
+
/**
|
|
30
|
+
* The surface: a sand crust spreads with the front (colour, grain, matte), then
|
|
31
|
+
* the crumble front eats it away with a per-grain jitter, so the edge breaks
|
|
32
|
+
* up into grains instead of a smooth line — darker right at the breaking lip.
|
|
33
|
+
*/
|
|
34
|
+
function sandLayer(field, sand, tint) {
|
|
35
|
+
const crust = /* glsl */ `
|
|
36
|
+
float f = SndField(vSndQ);
|
|
37
|
+
float crust = smoothstep(0.0, 0.1, SndThreshold() - f);
|
|
38
|
+
float pc = clamp(uSndProgress - ${LAG}, 0.0, 1.0);
|
|
39
|
+
float tc = pc * (1.0 + 2.0 * uSndEdgeWidth) - uSndEdgeWidth;
|
|
40
|
+
float jit = (fxHash1(floor(vSndR / uSndExtent * ${GRAIN_CELLS.toFixed(1)})) - 0.5) * 0.06;
|
|
41
|
+
float d = f + jit - tc;`;
|
|
42
|
+
return {
|
|
43
|
+
uniforms: { ...fieldUniforms(P, field), uSndSand: sand, uSndTint: tint },
|
|
44
|
+
common: `varying vec3 vSndQ;\nvarying vec3 vSndR;\n${fieldGlsl(P)}\n${HASH1}`,
|
|
45
|
+
vertex: /* glsl */ `
|
|
46
|
+
vSndR = (uSndRootInv * modelMatrix * vec4(transformed, 1.0)).xyz;
|
|
47
|
+
vSndQ = SndNorm(vSndR);`,
|
|
48
|
+
diffuse: /* glsl */ `
|
|
49
|
+
{
|
|
50
|
+
${crust}
|
|
51
|
+
if (d < 0.0) discard;
|
|
52
|
+
float g = fxHash1(floor(vSndR / uSndExtent * ${GRAIN_CELLS.toFixed(1)} * 2.3));
|
|
53
|
+
vec3 sandC = mix(uSndSand, diffuseColor.rgb, uSndTint) * (0.8 + 0.3 * g);
|
|
54
|
+
diffuseColor.rgb = mix(diffuseColor.rgb, sandC, crust);
|
|
55
|
+
// the breaking lip is darker, like damp sand under the fall
|
|
56
|
+
diffuseColor.rgb *= 1.0 - 0.45 * (1.0 - smoothstep(0.0, 0.05, d)) * step(0.0001, pc);
|
|
57
|
+
}`,
|
|
58
|
+
material: /* glsl */ `
|
|
59
|
+
{
|
|
60
|
+
${crust}
|
|
61
|
+
roughnessFactor = mix(roughnessFactor, 0.97, crust);
|
|
62
|
+
metalnessFactor = mix(metalnessFactor, 0.0, crust);
|
|
63
|
+
}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export default defineOperation({
|
|
67
|
+
value: 'sandErosion',
|
|
68
|
+
label: 'Sand erosion',
|
|
69
|
+
description: 'Crumble the targets into grains that pour down into a mound — reverting pours them back up',
|
|
70
|
+
channel: 'visual',
|
|
71
|
+
multi: true,
|
|
72
|
+
toggles: true,
|
|
73
|
+
usableIn: ['interaction', 'action'],
|
|
74
|
+
params: {
|
|
75
|
+
direction: { type: 'select', label: 'Direction', default: 'down', options: DIRECTION_OPTIONS },
|
|
76
|
+
grains: { type: 'number', label: 'Grains', default: 45000, min: 5000, max: 150000, step: 1000 },
|
|
77
|
+
grainSize: { type: 'number', label: 'Grain size', default: 1, min: 0.3, max: 4, step: 0.1, unit: '×' },
|
|
78
|
+
pile: { type: 'number', label: 'Mound height', default: 1, min: 0, max: 3, step: 0.05, unit: '×' },
|
|
79
|
+
spread: { type: 'number', label: 'Mound width', default: 1, min: 0.3, max: 3, step: 0.05, unit: '×' },
|
|
80
|
+
sand: { type: 'color', label: 'Sand', default: '#d8b98a' },
|
|
81
|
+
tint: { type: 'number', label: 'Object colour', default: 0.35, min: 0, max: 1, step: 0.05, hint: 'How much of the object’s own colour the sand keeps' },
|
|
82
|
+
scale: { type: 'number', label: 'Grain pattern', default: 3, min: 0.5, max: 12, step: 0.1 },
|
|
83
|
+
duration: { type: 'number', label: 'Duration', default: 3.2, min: 0.3, max: 12, step: 0.1, unit: 's' },
|
|
84
|
+
},
|
|
85
|
+
apply(target, p, ctx) {
|
|
86
|
+
let st = target.userData[STATE];
|
|
87
|
+
if (!st) {
|
|
88
|
+
const field = createFieldState(target);
|
|
89
|
+
field.edgeWidth.value = 0.05;
|
|
90
|
+
const life = { value: LIFE }, pile = { value: 1 }, spread = { value: 1 }, grain = { value: 1 }, sand = { value: new Color() }, tint = { value: 0.35 };
|
|
91
|
+
const sample = sampleSurfaceCached(target, Math.round(Number(p.grains)), 21);
|
|
92
|
+
const points = createFxPoints(target, sample, {
|
|
93
|
+
additive: false,
|
|
94
|
+
uniforms: { ...fieldUniforms(P, field), uSndLife: life, uSndPile: pile, uSndSpread: spread, uSndGrain: grain, uSndSand: sand, uSndTint: tint },
|
|
95
|
+
vertexPars: fieldGlsl(P) + GLSL_POINT_SIZE + HASH1,
|
|
96
|
+
vertexMain: /* glsl */ `
|
|
97
|
+
float f = ${P}Field(${P}Norm(aP));
|
|
98
|
+
// grains leave when the crumble reaches them (same granular jitter as the edge)
|
|
99
|
+
float jit = (fxHash1(floor(aP / uSndExtent * ${GRAIN_CELLS.toFixed(1)})) - 0.5) * 0.06;
|
|
100
|
+
float birth = ${LAG} + ${P}BirthOf(f + jit);
|
|
101
|
+
float a = (uSndProgress - birth) / uSndLife;
|
|
102
|
+
if (a <= 0.0) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; vColor = vec3(0.0); vAlpha = 0.0; return; }
|
|
103
|
+
a = min(a, 1.0);
|
|
104
|
+
float E = uSndExtent;
|
|
105
|
+
vec3 C = u${P}Min + u${P}Size * 0.5;
|
|
106
|
+
float ground = u${P}Min.y;
|
|
107
|
+
// resting spot on a cone around the base; early grains lie low, late ones on top
|
|
108
|
+
float R = 0.42 * max(u${P}Size.x, u${P}Size.z) * uSndSpread + 0.08 * E;
|
|
109
|
+
float rr = R * sqrt(aR.x);
|
|
110
|
+
float th = aR.y * 6.2832;
|
|
111
|
+
float H = u${P}Size.y * 0.34 * uSndPile;
|
|
112
|
+
float layer = mix(0.12, 1.0, clamp(birth, 0.0, 1.0));
|
|
113
|
+
// a slightly rounded cone, with a little noise so the mound isn't a perfect solid of revolution
|
|
114
|
+
float cone = pow(1.0 - rr / R, 1.25) * (0.9 + 0.2 * fxNoise(vec3(cos(th), sin(th), 0.0) * 3.0));
|
|
115
|
+
vec3 rest = vec3(C.x + cos(th) * rr, ground + H * cone * layer * (0.8 + 0.4 * aR.z) + 0.002 * E, C.z + sin(th) * rr);
|
|
116
|
+
// slide off the surface, then fall: horizontal glide, vertical t² (gravity)
|
|
117
|
+
float glide = smoothstep(0.0, 1.0, a);
|
|
118
|
+
vec3 kick = aN * (0.035 * E) * sin(3.14159 * min(a * 2.5, 1.0));
|
|
119
|
+
vec3 local = vec3(mix(aP.x, rest.x, glide), mix(aP.y, rest.y, a * a), mix(aP.z, rest.z, glide)) + kick;
|
|
120
|
+
vec4 mv = modelViewMatrix * vec4(local, 1.0);
|
|
121
|
+
gl_Position = projectionMatrix * mv;
|
|
122
|
+
// the colour of the spot it left; grains deeper in the mound a little darker
|
|
123
|
+
float depthShade = 0.72 + 0.28 * clamp((local.y - ground) / max(H, 1e-3), 0.0, 1.0);
|
|
124
|
+
vec3 grainC = mix(uSndSand, aC, uSndTint) * (0.72 + 0.36 * aR.w);
|
|
125
|
+
vColor = grainC * mix(1.0, depthShade, a);
|
|
126
|
+
vAlpha = 1.0;
|
|
127
|
+
gl_PointSize = clamp(fxPointPx(E * 0.0032 * uSndGrain * (0.7 + 0.6 * aR.w), mv), 1.0, 10.0);`,
|
|
128
|
+
});
|
|
129
|
+
st = { field, life, pile, spread, grain, sand, points, mats: new Set() };
|
|
130
|
+
st.tint = tint;
|
|
131
|
+
const own = st;
|
|
132
|
+
const layer = sandLayer(field, sand, tint);
|
|
133
|
+
forEachMeshMaterial(target, (mat, mesh) => {
|
|
134
|
+
if (mesh.userData?.__opFxHelper)
|
|
135
|
+
return;
|
|
136
|
+
if (addLayer(mat, KEY, layer))
|
|
137
|
+
own.mats.add(mat);
|
|
138
|
+
});
|
|
139
|
+
target.userData[STATE] = st;
|
|
140
|
+
}
|
|
141
|
+
const s = st;
|
|
142
|
+
setFieldParams(s.field, p, target, ctx);
|
|
143
|
+
s.pile.value = Number(p.pile);
|
|
144
|
+
s.spread.value = Number(p.spread);
|
|
145
|
+
s.grain.value = Number(p.grainSize);
|
|
146
|
+
s.sand.value.set(String(p.sand));
|
|
147
|
+
s.tint.value = Number(p.tint);
|
|
148
|
+
return runProgress(target, s.field, END, {
|
|
149
|
+
duration: Number(p.duration), ease: 'none',
|
|
150
|
+
onComplete: () => hideMeshes(target, KEY, true),
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
revert(target, p) {
|
|
154
|
+
const s = target.userData[STATE];
|
|
155
|
+
if (!s)
|
|
156
|
+
return;
|
|
157
|
+
hideMeshes(target, KEY, false);
|
|
158
|
+
return runProgress(target, s.field, 0, {
|
|
159
|
+
duration: Number(p.duration), ease: 'none',
|
|
160
|
+
onComplete: () => {
|
|
161
|
+
s.mats.forEach(m => removeLayer(m, KEY));
|
|
162
|
+
disposeFxPoints(s.points);
|
|
163
|
+
delete target.userData[STATE];
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Material, Object3D } from 'three';
|
|
2
|
+
export interface ShaderLayer {
|
|
3
|
+
/** Uniform objects — keep the references and write `.value` to animate. */
|
|
4
|
+
uniforms: Record<string, {
|
|
5
|
+
value: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
/** Declarations, both stages (varyings go here). */
|
|
8
|
+
common?: string;
|
|
9
|
+
vertexPars?: string;
|
|
10
|
+
/**
|
|
11
|
+
* After beginnormal_vertex: `objectNormal` (vec3, local) can be rewritten.
|
|
12
|
+
* Only reached where the material computes normals (lit materials; basic ones
|
|
13
|
+
* with an env map or skinning).
|
|
14
|
+
*/
|
|
15
|
+
normal?: string;
|
|
16
|
+
/** After begin_vertex: `transformed` (vec3, local) is in scope. */
|
|
17
|
+
vertex?: string;
|
|
18
|
+
fragmentPars?: string;
|
|
19
|
+
/**
|
|
20
|
+
* After color_fragment, BEFORE lighting: rewrite `diffuseColor` (rgba) so the new
|
|
21
|
+
* base colour is lit by the scene. `discard` is fine here too.
|
|
22
|
+
*/
|
|
23
|
+
diffuse?: string;
|
|
24
|
+
/**
|
|
25
|
+
* After metalnessmap_fragment (MeshStandard / MeshPhysical only — skipped
|
|
26
|
+
* elsewhere): rewrite `roughnessFactor` / `metalnessFactor`.
|
|
27
|
+
*/
|
|
28
|
+
material?: string;
|
|
29
|
+
/** After emissivemap_fragment: add to `totalEmissiveRadiance` (lit materials with emission). */
|
|
30
|
+
emissive?: string;
|
|
31
|
+
/** Before opaque_fragment: `outgoingLight` and `diffuseColor` are in scope; `discard` is fine. */
|
|
32
|
+
fragment?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Can this material take a layer? Built-in shaders only (checked by type, before compile). */
|
|
35
|
+
export declare const canLayer: (mat: Material) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Add a layer to a material. On a live scene the layer is STAGED: nothing changes
|
|
38
|
+
* on screen until commitPendingLayers() has compiled the new program in the
|
|
39
|
+
* background (runProgress does that before an effect starts). Pass
|
|
40
|
+
* `{ immediate: true }` for materials that are not on screen yet (an effect's own
|
|
41
|
+
* helpers), or when there is no renderer.
|
|
42
|
+
*/
|
|
43
|
+
export declare function addLayer(mat: Material, key: string, layer: ShaderLayer, opts?: {
|
|
44
|
+
immediate?: boolean;
|
|
45
|
+
}): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Compile, in the background, the programs that the staged layers of `root`'s
|
|
48
|
+
* materials will need, then commit the layers. three keys programs by their
|
|
49
|
+
* cache key, so when the live material switches to the layered code it finds the
|
|
50
|
+
* finished program and uses it straight away — no compile, no freeze.
|
|
51
|
+
*/
|
|
52
|
+
export declare function commitPendingLayers(root: Object3D): Promise<void>;
|
|
53
|
+
/** The material's own shader hooks, before any layer (for cloning a layered material). */
|
|
54
|
+
export declare function ownHooks(mat: Material): Pick<Material, 'onBeforeCompile' | 'customProgramCacheKey'>;
|
|
55
|
+
/**
|
|
56
|
+
* Take a layer off. The wrapper hooks stay installed (with no layers they add no
|
|
57
|
+
* GLSL and return the material's own cache key): any later recompile — new
|
|
58
|
+
* lights, a new effect — must still register every proxy, see "Uniform binding".
|
|
59
|
+
*/
|
|
60
|
+
export declare function removeLayer(mat: Material, key: string): void;
|
|
61
|
+
/** Does the material carry any layer right now? */
|
|
62
|
+
export declare const hasLayers: (mat: Material) => boolean;
|
|
63
|
+
export declare const hasLayer: (mat: Material, key: string) => boolean;
|
|
64
|
+
/** Every mesh material under a root (points, lines and sprites have no surface to layer). */
|
|
65
|
+
export declare function forEachMeshMaterial(root: Object3D, fn: (mat: Material, mesh: any) => void): void;
|
|
66
|
+
/** `uniform <type> <name>;` from a uniform's current value. */
|
|
67
|
+
export declare function uniformDecl(name: string, v: any): string;
|
|
68
|
+
/** Calm 3D value noise + 3-octave fBm (GLSL). */
|
|
69
|
+
export declare const GLSL_NOISE = "\n#ifndef FX_NOISE\n#define FX_NOISE\nfloat fxHash(vec3 p) { p = fract(p * 0.3183099 + 0.1); p *= 17.0; return fract(p.x * p.y * p.z * (p.x + p.y + p.z)); }\nfloat fxNoise(vec3 x) {\n vec3 i = floor(x); vec3 f = fract(x); f = f * f * (3.0 - 2.0 * f);\n return mix(mix(mix(fxHash(i), fxHash(i + vec3(1,0,0)), f.x), mix(fxHash(i + vec3(0,1,0)), fxHash(i + vec3(1,1,0)), f.x), f.y),\n mix(mix(fxHash(i + vec3(0,0,1)), fxHash(i + vec3(1,0,1)), f.x), mix(fxHash(i + vec3(0,1,1)), fxHash(i + vec3(1,1,1)), f.x), f.y), f.z);\n}\nfloat fxFbm(vec3 p) { float a = 0.5, s = 0.0; for (int i = 0; i < 3; i++) { s += a * fxNoise(p); p = p * 2.03 + 11.7; a *= 0.5; } return s / 0.875; }\n#endif\n";
|
|
70
|
+
/** Rotation about a unit axis (GLSL), include-guarded. */
|
|
71
|
+
export declare const GLSL_ROT = "\n#ifndef FX_ROT\n#define FX_ROT\nmat3 fxRot(vec3 ax, float an) {\n float s = sin(an), c = cos(an), oc = 1.0 - c;\n return mat3(oc*ax.x*ax.x + c, oc*ax.x*ax.y + ax.z*s, oc*ax.z*ax.x - ax.y*s,\n oc*ax.x*ax.y - ax.z*s, oc*ax.y*ax.y + c, oc*ax.y*ax.z + ax.x*s,\n oc*ax.z*ax.x + ax.y*s, oc*ax.y*ax.z - ax.x*s, oc*ax.z*ax.z + c);\n}\n#endif\n";
|
|
72
|
+
/** 3D cellular noise (GLSL): returns vec3(F1, F2, cell hash) for p, include-guarded. */
|
|
73
|
+
export declare const GLSL_WORLEY = "\n#ifndef FX_WORLEY\n#define FX_WORLEY\nvec3 fxHash3(vec3 p) {\n p = vec3(dot(p, vec3(127.1, 311.7, 74.7)), dot(p, vec3(269.5, 183.3, 246.1)), dot(p, vec3(113.5, 271.9, 124.6)));\n return fract(sin(p) * 43758.5453123);\n}\nvec3 fxWorley(vec3 p) {\n vec3 i = floor(p); vec3 f = fract(p);\n float f1 = 8.0, f2 = 8.0; float id = 0.0;\n for (int z = -1; z <= 1; z++) for (int y = -1; y <= 1; y++) for (int x = -1; x <= 1; x++) {\n vec3 g = vec3(float(x), float(y), float(z));\n vec3 h = fxHash3(i + g);\n vec3 r = g + h - f;\n float d = dot(r, r);\n if (d < f1) { f2 = f1; f1 = d; id = h.x; } else if (d < f2) { f2 = d; }\n }\n return vec3(sqrt(f1), sqrt(f2), id);\n}\n#endif\n";
|
|
74
|
+
//# sourceMappingURL=shaderLayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderLayers.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/shaderLayers.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,WAAW,WAAW;IACxB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC7C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAmCD,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,KAAK,QAAQ,KAAG,OAEmE,CAAC;AAO7G;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAOhH;AA6BD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE;AA8CD,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,uBAAuB,CAAC,CAKnG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAM5D;AAED,mDAAmD;AACnD,eAAO,MAAM,SAAS,GAAI,KAAK,QAAQ,KAAG,OACiC,CAAC;AAE5E,eAAO,MAAM,QAAQ,GAAI,KAAK,QAAQ,EAAE,KAAK,MAAM,KAAG,OACgB,CAAC;AAEvE,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,QAMzF;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAUxD;AAED,iDAAiD;AACjD,eAAO,MAAM,UAAU,4rBAWtB,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,QAAQ,4XAUpB,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,WAAW,4rBAoBvB,CAAC"}
|