@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,469 @@
|
|
|
1
|
+
// Ivy — vines grow over the object. The growth is space colonisation (the
|
|
2
|
+
// branching algorithm used for trees and leaf veins): surface samples are the
|
|
3
|
+
// attractors, each vine tip steps towards the attractors nearest to it and
|
|
4
|
+
// consumes them, and every new node is snapped back onto the surface, so the
|
|
5
|
+
// vines creep over the object's real shape, branching where there is room.
|
|
6
|
+
// Stems are lit tubes that thicken towards the root (pipe model); ivy leaves
|
|
7
|
+
// (five-lobed, cupped, veined) unfurl from folded as the tip passes, and sway
|
|
8
|
+
// gently while it holds. A state, not an exit: reverting withers the ivy — the
|
|
9
|
+
// leaves brown, droop and fall away, and the vines draw back to their roots.
|
|
10
|
+
import { gsap } from 'gsap';
|
|
11
|
+
import { BufferAttribute, BufferGeometry, Color, Matrix4, Mesh, MeshStandardMaterial, Shape, ShapeGeometry, SplineCurve, Vector2, Vector3, } from 'three';
|
|
12
|
+
import { defineOperation } from '../types.js';
|
|
13
|
+
import { GLSL_ROT, addLayer } from './shaderLayers.js';
|
|
14
|
+
import { createFieldState, fieldUniforms, runProgress } from './transitionField.js';
|
|
15
|
+
import { mulberry32, sampleSurfaceCached } from './surfaceSample.js';
|
|
16
|
+
import { createFxInstances, disposeFxInstances } from './fxInstances.js';
|
|
17
|
+
import { hideUntilWarm } from './warmup.js';
|
|
18
|
+
const P = 'Ivy';
|
|
19
|
+
const STATE = '__opIvy';
|
|
20
|
+
/** Growth runs over progress 0..GROW; the last leaves unfurl by 1. */
|
|
21
|
+
const GROW = 0.8;
|
|
22
|
+
const UNFURL = 0.14;
|
|
23
|
+
class Grid {
|
|
24
|
+
size;
|
|
25
|
+
cells = new Map();
|
|
26
|
+
constructor(size) {
|
|
27
|
+
this.size = size;
|
|
28
|
+
}
|
|
29
|
+
k(x, y, z) { return `${Math.floor(x / this.size)},${Math.floor(y / this.size)},${Math.floor(z / this.size)}`; }
|
|
30
|
+
add(i, x, y, z) { const k = this.k(x, y, z); const c = this.cells.get(k); if (c)
|
|
31
|
+
c.push(i);
|
|
32
|
+
else
|
|
33
|
+
this.cells.set(k, [i]); }
|
|
34
|
+
near(x, y, z, fn) {
|
|
35
|
+
const cx = Math.floor(x / this.size), cy = Math.floor(y / this.size), cz = Math.floor(z / this.size);
|
|
36
|
+
for (let a = -1; a <= 1; a++)
|
|
37
|
+
for (let b = -1; b <= 1; b++)
|
|
38
|
+
for (let c = -1; c <= 1; c++) {
|
|
39
|
+
const l = this.cells.get(`${cx + a},${cy + b},${cz + c}`);
|
|
40
|
+
if (l)
|
|
41
|
+
for (const i of l)
|
|
42
|
+
fn(i);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function grow(sample, extent, attractors, from, seed) {
|
|
47
|
+
const rnd = mulberry32(seed);
|
|
48
|
+
const E = extent, D = 0.02 * E, DI = 0.11 * E, DK = 0.036 * E, OFF = 0.006 * E;
|
|
49
|
+
const S = sample.position, SN = sample.normal, N = sample.count;
|
|
50
|
+
const snapGrid = new Grid(0.05 * E);
|
|
51
|
+
for (let i = 0; i < N; i++)
|
|
52
|
+
snapGrid.add(i, S[i * 3], S[i * 3 + 1], S[i * 3 + 2]);
|
|
53
|
+
const A = Math.min(N, attractors);
|
|
54
|
+
// samples come mesh by mesh: take a random subset so every part of the object attracts
|
|
55
|
+
const AI = new Int32Array(N).map((_, i) => i);
|
|
56
|
+
for (let i = N - 1; i > 0; i--) {
|
|
57
|
+
const j = Math.floor(rnd() * (i + 1));
|
|
58
|
+
const t = AI[i];
|
|
59
|
+
AI[i] = AI[j];
|
|
60
|
+
AI[j] = t;
|
|
61
|
+
}
|
|
62
|
+
const alive = new Uint8Array(A).fill(1);
|
|
63
|
+
// each attractor remembers its nearest node within reach; only new nodes can change that
|
|
64
|
+
const nearest = new Int32Array(A).fill(-1);
|
|
65
|
+
const nearD = new Float32Array(A).fill(Infinity);
|
|
66
|
+
const attGrid = new Grid(DI);
|
|
67
|
+
for (let i = 0; i < A; i++)
|
|
68
|
+
attGrid.add(i, S[AI[i] * 3], S[AI[i] * 3 + 1], S[AI[i] * 3 + 2]);
|
|
69
|
+
const g = { pos: [], nrm: [], parent: [], birth: [], desc: [], count: 0 };
|
|
70
|
+
const len = [];
|
|
71
|
+
const addNode = (p, n, parent, l) => {
|
|
72
|
+
const i = g.count++;
|
|
73
|
+
g.pos.push(p.x, p.y, p.z);
|
|
74
|
+
g.nrm.push(n.x, n.y, n.z);
|
|
75
|
+
g.parent.push(parent);
|
|
76
|
+
len.push(l);
|
|
77
|
+
attGrid.near(p.x, p.y, p.z, (a) => {
|
|
78
|
+
if (!alive[a])
|
|
79
|
+
return;
|
|
80
|
+
const s = AI[a];
|
|
81
|
+
const d = (S[s * 3] - p.x) ** 2 + (S[s * 3 + 1] - p.y) ** 2 + (S[s * 3 + 2] - p.z) ** 2;
|
|
82
|
+
if (d < DK * DK) {
|
|
83
|
+
alive[a] = 0;
|
|
84
|
+
nearest[a] = -1;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (d >= DI * DI || d >= nearD[a])
|
|
88
|
+
return;
|
|
89
|
+
// only along the surface: never through the volume to the far side of a wall or tube
|
|
90
|
+
if (SN[s * 3] * n.x + SN[s * 3 + 1] * n.y + SN[s * 3 + 2] * n.z < 0.3)
|
|
91
|
+
return;
|
|
92
|
+
const dl = Math.sqrt(d) || 1;
|
|
93
|
+
if (Math.abs(((S[s * 3] - p.x) * n.x + (S[s * 3 + 1] - p.y) * n.y + (S[s * 3 + 2] - p.z) * n.z) / dl) > 0.6)
|
|
94
|
+
return;
|
|
95
|
+
nearD[a] = d;
|
|
96
|
+
nearest[a] = i;
|
|
97
|
+
});
|
|
98
|
+
return i;
|
|
99
|
+
};
|
|
100
|
+
const snap = (p, n) => {
|
|
101
|
+
let best = -1, bd = Infinity;
|
|
102
|
+
snapGrid.near(p.x, p.y, p.z, (i) => {
|
|
103
|
+
const d = (S[i * 3] - p.x) ** 2 + (S[i * 3 + 1] - p.y) ** 2 + (S[i * 3 + 2] - p.z) ** 2;
|
|
104
|
+
if (d < bd) {
|
|
105
|
+
bd = d;
|
|
106
|
+
best = i;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
if (best < 0)
|
|
110
|
+
return false;
|
|
111
|
+
const s = new Vector3(S[best * 3], S[best * 3 + 1], S[best * 3 + 2]);
|
|
112
|
+
n.set(SN[best * 3], SN[best * 3 + 1], SN[best * 3 + 2]);
|
|
113
|
+
const d = p.clone().sub(s);
|
|
114
|
+
p.copy(s).add(d.sub(n.clone().multiplyScalar(d.dot(n)))).addScaledVector(n, OFF);
|
|
115
|
+
return true;
|
|
116
|
+
};
|
|
117
|
+
// roots: spread apart among the lowest (or highest, or any) samples
|
|
118
|
+
let minY = Infinity, maxY = -Infinity;
|
|
119
|
+
for (let i = 0; i < N; i++) {
|
|
120
|
+
minY = Math.min(minY, S[i * 3 + 1]);
|
|
121
|
+
maxY = Math.max(maxY, S[i * 3 + 1]);
|
|
122
|
+
}
|
|
123
|
+
const band = (maxY - minY) * 0.08;
|
|
124
|
+
const cand = [];
|
|
125
|
+
for (let i = 0; i < N; i++) {
|
|
126
|
+
const y = S[i * 3 + 1];
|
|
127
|
+
if (SN[i * 3 + 1] > -0.3 && (from === 'up' ? y < minY + band : from === 'down' ? y > maxY - band : rnd() < 0.02))
|
|
128
|
+
cand.push(i);
|
|
129
|
+
}
|
|
130
|
+
const roots = [];
|
|
131
|
+
const want = from === 'noise' ? 6 : 4;
|
|
132
|
+
if (cand.length)
|
|
133
|
+
roots.push(cand[Math.floor(rnd() * cand.length)]);
|
|
134
|
+
while (roots.length < want && roots.length < cand.length) {
|
|
135
|
+
let bi = -1, bd = -1;
|
|
136
|
+
for (const c of cand) {
|
|
137
|
+
let dm = Infinity;
|
|
138
|
+
for (const r of roots)
|
|
139
|
+
dm = Math.min(dm, (S[c * 3] - S[r * 3]) ** 2 + (S[c * 3 + 1] - S[r * 3 + 1]) ** 2 + (S[c * 3 + 2] - S[r * 3 + 2]) ** 2);
|
|
140
|
+
if (dm > bd) {
|
|
141
|
+
bd = dm;
|
|
142
|
+
bi = c;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
roots.push(bi);
|
|
146
|
+
}
|
|
147
|
+
for (const r of roots)
|
|
148
|
+
addNode(new Vector3(S[r * 3], S[r * 3 + 1], S[r * 3 + 2]).addScaledVector(new Vector3(SN[r * 3], SN[r * 3 + 1], SN[r * 3 + 2]), OFF), new Vector3(SN[r * 3], SN[r * 3 + 1], SN[r * 3 + 2]), -1, 0);
|
|
149
|
+
const trop = from === 'up' ? 0.25 : from === 'down' ? -0.35 : 0;
|
|
150
|
+
const MAX = 4200;
|
|
151
|
+
// a node never grows two children the same way (the classic stuck-node repeat)
|
|
152
|
+
const childDirs = new Map();
|
|
153
|
+
for (let it = 0; it < 500 && g.count < MAX; it++) {
|
|
154
|
+
const pull = new Map();
|
|
155
|
+
for (let a = 0; a < A; a++) {
|
|
156
|
+
const bn = nearest[a];
|
|
157
|
+
if (bn < 0 || !alive[a])
|
|
158
|
+
continue;
|
|
159
|
+
const sa = AI[a];
|
|
160
|
+
const v = new Vector3(S[sa * 3] - g.pos[bn * 3], S[sa * 3 + 1] - g.pos[bn * 3 + 1], S[sa * 3 + 2] - g.pos[bn * 3 + 2]).normalize();
|
|
161
|
+
const acc = pull.get(bn);
|
|
162
|
+
if (acc)
|
|
163
|
+
acc.add(v);
|
|
164
|
+
else
|
|
165
|
+
pull.set(bn, v);
|
|
166
|
+
}
|
|
167
|
+
if (!pull.size)
|
|
168
|
+
break;
|
|
169
|
+
let grew = 0;
|
|
170
|
+
for (const [i, v] of pull) {
|
|
171
|
+
if (g.count >= MAX)
|
|
172
|
+
break;
|
|
173
|
+
const n = new Vector3(g.nrm[i * 3], g.nrm[i * 3 + 1], g.nrm[i * 3 + 2]);
|
|
174
|
+
const d = v.normalize().add(new Vector3(0, trop, 0)).add(new Vector3(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5).multiplyScalar(0.3));
|
|
175
|
+
d.sub(n.clone().multiplyScalar(d.dot(n)));
|
|
176
|
+
if (d.lengthSq() < 1e-8)
|
|
177
|
+
continue;
|
|
178
|
+
d.normalize();
|
|
179
|
+
const dirs = childDirs.get(i) ?? [];
|
|
180
|
+
if (dirs.length >= 3 || dirs.some(c => c.dot(d) > 0.94))
|
|
181
|
+
continue;
|
|
182
|
+
dirs.push(d.clone());
|
|
183
|
+
childDirs.set(i, dirs);
|
|
184
|
+
const p = new Vector3(g.pos[i * 3], g.pos[i * 3 + 1], g.pos[i * 3 + 2]).addScaledVector(d.normalize(), D);
|
|
185
|
+
const nn = new Vector3();
|
|
186
|
+
if (!snap(p, nn))
|
|
187
|
+
continue;
|
|
188
|
+
// a snap that jumps a gap (onto another part) would draw a vine through the air
|
|
189
|
+
const step = Math.hypot(p.x - g.pos[i * 3], p.y - g.pos[i * 3 + 1], p.z - g.pos[i * 3 + 2]);
|
|
190
|
+
if (step > D * 1.8 || nn.dot(n) < 0.2)
|
|
191
|
+
continue;
|
|
192
|
+
addNode(p, nn, i, len[i] + D);
|
|
193
|
+
grew++;
|
|
194
|
+
}
|
|
195
|
+
if (!grew)
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
let maxLen = 1e-6;
|
|
199
|
+
for (const l of len)
|
|
200
|
+
maxLen = Math.max(maxLen, l);
|
|
201
|
+
g.birth = len.map(l => (l / maxLen) * GROW);
|
|
202
|
+
g.desc = new Array(g.count).fill(0);
|
|
203
|
+
for (let i = g.count - 1; i >= 0; i--)
|
|
204
|
+
if (g.parent[i] >= 0)
|
|
205
|
+
g.desc[g.parent[i]] += g.desc[i] + 1;
|
|
206
|
+
return g;
|
|
207
|
+
}
|
|
208
|
+
const growthCache = new WeakMap();
|
|
209
|
+
// ---------------------------------------------------------------- geometry
|
|
210
|
+
const SIDES = 6;
|
|
211
|
+
function stemGeometry(g, E) {
|
|
212
|
+
// short side stubs carry a leaf but no vine (ivy runs in long vines, not twigs)
|
|
213
|
+
const kids = new Array(g.count).fill(0);
|
|
214
|
+
for (const p of g.parent)
|
|
215
|
+
if (p >= 0)
|
|
216
|
+
kids[p]++;
|
|
217
|
+
const stub = new Uint8Array(g.count);
|
|
218
|
+
const segs = [];
|
|
219
|
+
for (let i = 0; i < g.count; i++) {
|
|
220
|
+
const p = g.parent[i];
|
|
221
|
+
if (p < 0)
|
|
222
|
+
continue;
|
|
223
|
+
stub[i] = stub[p] || (g.desc[i] < 3 && kids[p] > 1) ? 1 : 0; // parents come first
|
|
224
|
+
if (!stub[i])
|
|
225
|
+
segs.push(i);
|
|
226
|
+
}
|
|
227
|
+
const vc = segs.length * 2 * SIDES;
|
|
228
|
+
const pos = new Float32Array(vc * 3), nrm = new Float32Array(vc * 3), ctr = new Float32Array(vc * 3), from = new Float32Array(vc * 3);
|
|
229
|
+
const rad = new Float32Array(vc * 3), bir = new Float32Array(vc * 2);
|
|
230
|
+
const idx = [];
|
|
231
|
+
const radius = (i) => Math.min(E * 0.0015 * Math.pow(1 + g.desc[i], 0.33), E * 0.0075);
|
|
232
|
+
const a = new Vector3(), b = new Vector3(), t = new Vector3(), n = new Vector3(), u = new Vector3(), w = new Vector3(), o = new Vector3();
|
|
233
|
+
let v = 0;
|
|
234
|
+
segs.forEach((c, si) => {
|
|
235
|
+
const pi = g.parent[c];
|
|
236
|
+
a.set(g.pos[pi * 3], g.pos[pi * 3 + 1], g.pos[pi * 3 + 2]);
|
|
237
|
+
b.set(g.pos[c * 3], g.pos[c * 3 + 1], g.pos[c * 3 + 2]);
|
|
238
|
+
t.subVectors(b, a).normalize();
|
|
239
|
+
n.set(g.nrm[c * 3], g.nrm[c * 3 + 1], g.nrm[c * 3 + 2]);
|
|
240
|
+
u.crossVectors(t, n);
|
|
241
|
+
if (u.lengthSq() < 1e-8)
|
|
242
|
+
u.set(1, 0, 0).cross(t);
|
|
243
|
+
u.normalize();
|
|
244
|
+
w.crossVectors(u, t).normalize();
|
|
245
|
+
for (let end = 0; end < 2; end++) {
|
|
246
|
+
const node = end ? c : pi;
|
|
247
|
+
const r = radius(node);
|
|
248
|
+
const cen = end ? b : a;
|
|
249
|
+
for (let k = 0; k < SIDES; k++) {
|
|
250
|
+
const ang = (k / SIDES) * Math.PI * 2;
|
|
251
|
+
o.copy(u).multiplyScalar(Math.cos(ang)).addScaledVector(w, Math.sin(ang));
|
|
252
|
+
pos.set([cen.x + o.x * r, cen.y + o.y * r, cen.z + o.z * r], v * 3);
|
|
253
|
+
nrm.set([o.x, o.y, o.z], v * 3);
|
|
254
|
+
ctr.set([cen.x, cen.y, cen.z], v * 3);
|
|
255
|
+
from.set([a.x, a.y, a.z], v * 3);
|
|
256
|
+
rad.set([o.x * r, o.y * r, o.z * r], v * 3);
|
|
257
|
+
bir.set([g.birth[pi], g.birth[c]], v * 2);
|
|
258
|
+
v++;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const base = si * 2 * SIDES;
|
|
262
|
+
for (let k = 0; k < SIDES; k++) {
|
|
263
|
+
const k2 = (k + 1) % SIDES;
|
|
264
|
+
idx.push(base + k, base + k2, base + SIDES + k, base + k2, base + SIDES + k2, base + SIDES + k);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
const geo = new BufferGeometry();
|
|
268
|
+
geo.setAttribute('position', new BufferAttribute(pos, 3));
|
|
269
|
+
geo.setAttribute('normal', new BufferAttribute(nrm, 3));
|
|
270
|
+
geo.setAttribute('aIvyCtr', new BufferAttribute(ctr, 3));
|
|
271
|
+
geo.setAttribute('aIvyFrom', new BufferAttribute(from, 3));
|
|
272
|
+
geo.setAttribute('aIvyRad', new BufferAttribute(rad, 3));
|
|
273
|
+
geo.setAttribute('aIvyB', new BufferAttribute(bir, 2));
|
|
274
|
+
geo.setIndex(idx);
|
|
275
|
+
return geo;
|
|
276
|
+
}
|
|
277
|
+
/** A five-lobed ivy leaf in the XY plane, petiole at the origin, blade along +Y (length 1). */
|
|
278
|
+
function leafGeometry() {
|
|
279
|
+
const lobes = [
|
|
280
|
+
[180, 0.14], [150, 0.52], [124, 0.5], [98, 0.72], [72, 0.6], [44, 0.84], [22, 0.76], [0, 1.0],
|
|
281
|
+
];
|
|
282
|
+
const pts = [];
|
|
283
|
+
const add = (deg, r) => { const a = (deg * Math.PI) / 180; pts.push(new Vector2(Math.sin(a) * r * 0.55, 0.42 + Math.cos(a) * r * 0.58)); };
|
|
284
|
+
for (const [d, r] of lobes)
|
|
285
|
+
add(d, r);
|
|
286
|
+
for (let i = lobes.length - 2; i >= 1; i--)
|
|
287
|
+
add(-lobes[i][0], lobes[i][1]);
|
|
288
|
+
add(-180, 0.12);
|
|
289
|
+
const curve = new SplineCurve(pts);
|
|
290
|
+
const shape = new Shape(curve.getPoints(44));
|
|
291
|
+
const geo = new ShapeGeometry(shape, 1);
|
|
292
|
+
geo.translate(0, -0.05, 0);
|
|
293
|
+
geo.computeVertexNormals();
|
|
294
|
+
return geo;
|
|
295
|
+
}
|
|
296
|
+
// ---------------------------------------------------------------- the operation
|
|
297
|
+
export default defineOperation({
|
|
298
|
+
value: 'ivy',
|
|
299
|
+
label: 'Ivy',
|
|
300
|
+
description: 'Grow ivy over the targets — vines creep along the surface and leaves unfurl; reverting withers it away',
|
|
301
|
+
channel: 'visual',
|
|
302
|
+
multi: true,
|
|
303
|
+
toggles: true,
|
|
304
|
+
usableIn: ['interaction', 'action', 'object'],
|
|
305
|
+
params: {
|
|
306
|
+
from: { type: 'select', label: 'Grows from', default: 'up', options: [{ value: 'up', label: 'The base' }, { value: 'down', label: 'The top' }, { value: 'noise', label: 'Scattered roots' }] },
|
|
307
|
+
coverage: { type: 'number', label: 'Coverage', default: 0.55, min: 0.05, max: 1, step: 0.01 },
|
|
308
|
+
leafSize: { type: 'number', label: 'Leaf size', default: 1, min: 0.3, max: 3, step: 0.05, unit: '×' },
|
|
309
|
+
leaves: { type: 'number', label: 'Leaves', default: 0.6, min: 0, max: 1, step: 0.01, hint: 'Share of the nodes that carry a leaf' },
|
|
310
|
+
leafColor: { type: 'color', label: 'Leaves', default: '#2f5a1f' },
|
|
311
|
+
stemColor: { type: 'color', label: 'Vines', default: '#4a3a24' },
|
|
312
|
+
duration: { type: 'number', label: 'Duration', default: 5, min: 0.3, max: 20, step: 0.1, unit: 's' },
|
|
313
|
+
},
|
|
314
|
+
apply(target, p) {
|
|
315
|
+
const key = `${p.from}|${p.coverage}|${p.leafSize}|${p.leaves}`;
|
|
316
|
+
let st = target.userData[STATE];
|
|
317
|
+
let keep;
|
|
318
|
+
if (st && st.key !== key) {
|
|
319
|
+
// the shape of the growth changed (object-effect edit): rebuild on the same field (same progress, same clock)
|
|
320
|
+
disposeIvy(st);
|
|
321
|
+
keep = st.field;
|
|
322
|
+
delete target.userData[STATE];
|
|
323
|
+
st = undefined;
|
|
324
|
+
}
|
|
325
|
+
if (!st) {
|
|
326
|
+
const field = keep ?? createFieldState(target);
|
|
327
|
+
const E = field.extent.value;
|
|
328
|
+
const sample = sampleSurfaceCached(target, 9000, 61);
|
|
329
|
+
const cached = growthCache.get(target);
|
|
330
|
+
const gkey = `${p.from}|${p.coverage}|${sample.count}|${E.toFixed(4)}`;
|
|
331
|
+
const g = cached?.key === gkey ? cached.g : grow(sample, E, Math.round(500 + Number(p.coverage) * 3500), String(p.from), 71);
|
|
332
|
+
growthCache.set(target, { key: gkey, g });
|
|
333
|
+
const own = {
|
|
334
|
+
field, key, leaf: { value: new Color() }, stem: { value: new Color() }, wither: { value: 0 }, sway: { value: 1 },
|
|
335
|
+
};
|
|
336
|
+
// stems
|
|
337
|
+
const stemMat = new MeshStandardMaterial({ roughness: 0.75, metalness: 0 });
|
|
338
|
+
addLayer(stemMat, 'ivyStem', {
|
|
339
|
+
uniforms: { ...fieldUniforms(P, field), uIvyStem: own.stem, uIvyWither: own.wither },
|
|
340
|
+
common: 'varying float vIvyYoung;',
|
|
341
|
+
vertexPars: 'attribute vec3 aIvyCtr; attribute vec3 aIvyFrom; attribute vec3 aIvyRad; attribute vec2 aIvyB;',
|
|
342
|
+
vertex: /* glsl */ `
|
|
343
|
+
{
|
|
344
|
+
float pr = uIvyProgress;
|
|
345
|
+
float gr = clamp((pr - aIvyB.x) / max(aIvyB.y - aIvyB.x, 1e-5), 0.0, 1.0);
|
|
346
|
+
float thick = pr <= aIvyB.x ? 0.0 : (0.35 + 0.65 * smoothstep(aIvyB.x, aIvyB.x + 0.25, pr));
|
|
347
|
+
transformed = mix(aIvyFrom, aIvyCtr, gr) + aIvyRad * thick;
|
|
348
|
+
vIvyYoung = 1.0 - smoothstep(0.0, 0.3, pr - aIvyB.y);
|
|
349
|
+
}`,
|
|
350
|
+
// fresh growth is green, older vine woody
|
|
351
|
+
diffuse: `diffuseColor.rgb = mix(mix(uIvyStem, vec3(0.2, 0.3, 0.08), vIvyYoung * 0.8), uIvyStem * vec3(0.7, 0.6, 0.5), uIvyWither);`,
|
|
352
|
+
}, { immediate: true });
|
|
353
|
+
own.stems = new Mesh(stemGeometry(g, E), stemMat);
|
|
354
|
+
own.stems.castShadow = true;
|
|
355
|
+
own.stems.receiveShadow = true;
|
|
356
|
+
own.stems.frustumCulled = false;
|
|
357
|
+
own.stems.userData.__opFxHelper = true;
|
|
358
|
+
own.stems.raycast = () => { };
|
|
359
|
+
target.add(own.stems);
|
|
360
|
+
hideUntilWarm(own.stems);
|
|
361
|
+
// leaves: on a share of the nodes, oriented along the growth, lifted off the surface
|
|
362
|
+
const rnd = mulberry32(83);
|
|
363
|
+
const picks = [];
|
|
364
|
+
for (let i = 0; i < g.count; i++)
|
|
365
|
+
if (g.parent[i] >= 0 && rnd() < Number(p.leaves))
|
|
366
|
+
picks.push(i);
|
|
367
|
+
const count = Math.max(1, picks.length);
|
|
368
|
+
const positions = new Float32Array(count * 3), colors = new Float32Array(count * 3), births = new Float32Array(count), rands = new Float32Array(count * 4);
|
|
369
|
+
const mats = [];
|
|
370
|
+
const t = new Vector3(), n = new Vector3(), x = new Vector3(), y = new Vector3(), z = new Vector3(), side = new Vector3();
|
|
371
|
+
picks.forEach((i, k) => {
|
|
372
|
+
const pi = g.parent[i];
|
|
373
|
+
t.set(g.pos[i * 3] - g.pos[pi * 3], g.pos[i * 3 + 1] - g.pos[pi * 3 + 1], g.pos[i * 3 + 2] - g.pos[pi * 3 + 2]).normalize();
|
|
374
|
+
n.set(g.nrm[i * 3], g.nrm[i * 3 + 1], g.nrm[i * 3 + 2]);
|
|
375
|
+
side.crossVectors(n, t);
|
|
376
|
+
const th = (rnd() - 0.5) * 2.4;
|
|
377
|
+
y.copy(t).multiplyScalar(Math.cos(th)).addScaledVector(side, Math.sin(th)).addScaledVector(n, 0.55 + 0.4 * rnd()).normalize();
|
|
378
|
+
x.crossVectors(y, n).normalize();
|
|
379
|
+
z.crossVectors(x, y).normalize();
|
|
380
|
+
const young = 1 - g.birth[i] / GROW;
|
|
381
|
+
const s = E * 0.052 * Number(p.leafSize) * (0.55 + 0.5 * rnd()) * (0.75 + 0.4 * young);
|
|
382
|
+
const m = new Matrix4().makeBasis(x.multiplyScalar(s), y.multiplyScalar(s), z.multiplyScalar(s));
|
|
383
|
+
m.setPosition(g.pos[i * 3] + n.x * E * 0.004, g.pos[i * 3 + 1] + n.y * E * 0.004, g.pos[i * 3 + 2] + n.z * E * 0.004);
|
|
384
|
+
mats.push(m);
|
|
385
|
+
positions.set([g.pos[i * 3], g.pos[i * 3 + 1], g.pos[i * 3 + 2]], k * 3);
|
|
386
|
+
const v = 0.75 + 0.45 * rnd();
|
|
387
|
+
colors.set([v * (0.9 + 0.2 * rnd()), v, v * (0.85 + 0.2 * rnd())], k * 3);
|
|
388
|
+
births[k] = g.birth[i] + 0.02;
|
|
389
|
+
rands.set([rnd(), rnd(), rnd(), rnd()], k * 4);
|
|
390
|
+
});
|
|
391
|
+
own.leaves = createFxInstances(target, {
|
|
392
|
+
geometry: leafGeometry(), count, positions, colors,
|
|
393
|
+
attributes: { aIvyLB: [births, 1], aIvyLR: [rands, 4] },
|
|
394
|
+
layerKey: 'ivyLeaves', roughness: 0.42, metalness: 0, doubleSided: true,
|
|
395
|
+
layer: {
|
|
396
|
+
uniforms: { ...fieldUniforms(P, field), uIvyLeaf: own.leaf, uIvyWither: own.wither, uIvySway: own.sway },
|
|
397
|
+
common: `varying vec2 vIvyUv;\nvarying float vIvyAge;\n${GLSL_ROT}`,
|
|
398
|
+
vertexPars: /* glsl */ `
|
|
399
|
+
attribute float aIvyLB; attribute vec4 aIvyLR;
|
|
400
|
+
mat3 ivyPose(vec3 p) {
|
|
401
|
+
float g = smoothstep(aIvyLB, aIvyLB + ${UNFURL.toFixed(2)}, uIvyProgress);
|
|
402
|
+
// unfurl: the halves open about the midrib, the blade lifts from the stem
|
|
403
|
+
float fold = (1.0 - g) * 1.25 * sign(p.x);
|
|
404
|
+
float sway = uIvySway * (sin(uIvyTime * (1.1 + aIvyLR.x) + aIvyLR.y * 6.28) * 0.07 + sin(uIvyTime * 2.7 + aIvyLR.z * 6.28) * 0.03);
|
|
405
|
+
float droop = uIvyWither * (0.6 + 0.6 * aIvyLR.w);
|
|
406
|
+
return fxRot(vec3(1.0, 0.0, 0.0), (1.0 - g) * 0.9 + sway + droop) * fxRot(vec3(0.0, 1.0, 0.0), fold);
|
|
407
|
+
}`,
|
|
408
|
+
normal: `objectNormal = ivyPose(position) * objectNormal;`,
|
|
409
|
+
vertex: /* glsl */ `
|
|
410
|
+
{
|
|
411
|
+
vIvyUv = position.xy;
|
|
412
|
+
float g = smoothstep(aIvyLB, aIvyLB + ${UNFURL.toFixed(2)}, uIvyProgress);
|
|
413
|
+
vIvyAge = g;
|
|
414
|
+
vec3 p = transformed;
|
|
415
|
+
p.z += 0.09 * p.x * p.x - 0.04 * p.y; // cupped across the midrib
|
|
416
|
+
transformed = ivyPose(position) * p * g;
|
|
417
|
+
}`,
|
|
418
|
+
diffuse: /* glsl */ `
|
|
419
|
+
{
|
|
420
|
+
// veins: a pale midrib and lateral veins running out to the lobes
|
|
421
|
+
vec2 u = vIvyUv;
|
|
422
|
+
float mid = 1.0 - smoothstep(0.0, 0.018, abs(u.x)) ;
|
|
423
|
+
float ang = atan(u.x, u.y - 0.05);
|
|
424
|
+
float lat = 1.0 - smoothstep(0.0, 0.05, abs(fract(ang / 0.62 + 0.5) - 0.5) * length(u));
|
|
425
|
+
float vein = max(mid * step(0.0, u.y), lat * 0.6) * smoothstep(0.02, 0.2, length(u - vec2(0.0, 0.05)));
|
|
426
|
+
vec3 leaf = uIvyLeaf * diffuseColor.rgb; // instance colour carries the variation
|
|
427
|
+
leaf = mix(leaf, leaf * 1.7 + vec3(0.05, 0.06, 0.02), vein * 0.55);
|
|
428
|
+
// young leaves are lighter and fresher
|
|
429
|
+
leaf = mix(leaf * vec3(1.25, 1.35, 1.0), leaf, vIvyAge);
|
|
430
|
+
vec3 dry = mix(vec3(0.13, 0.08, 0.035), vec3(0.24, 0.15, 0.06), diffuseColor.g);
|
|
431
|
+
diffuseColor.rgb = mix(leaf, dry, uIvyWither);
|
|
432
|
+
}`,
|
|
433
|
+
},
|
|
434
|
+
});
|
|
435
|
+
mats.forEach((m, k) => own.leaves.setMatrixAt(k, m));
|
|
436
|
+
own.leaves.instanceMatrix.needsUpdate = true;
|
|
437
|
+
st = own;
|
|
438
|
+
target.userData[STATE] = st;
|
|
439
|
+
}
|
|
440
|
+
const s = st;
|
|
441
|
+
s.leaf.value.set(String(p.leafColor));
|
|
442
|
+
s.stem.value.set(String(p.stemColor));
|
|
443
|
+
gsap.killTweensOf(s.wither);
|
|
444
|
+
s.wither.value = 0;
|
|
445
|
+
return runProgress(target, s.field, 1, { duration: Number(p.duration), ease: 'power1.inOut', hold: true });
|
|
446
|
+
},
|
|
447
|
+
revert(target, p) {
|
|
448
|
+
const s = target.userData[STATE];
|
|
449
|
+
if (!s)
|
|
450
|
+
return;
|
|
451
|
+
const d = Number(p.duration);
|
|
452
|
+
gsap.killTweensOf(s.wither);
|
|
453
|
+
if (d > 0)
|
|
454
|
+
gsap.to(s.wither, { value: 1, duration: d * 0.35, ease: 'power1.out' });
|
|
455
|
+
else
|
|
456
|
+
s.wither.value = 1;
|
|
457
|
+
return runProgress(target, s.field, 0, {
|
|
458
|
+
duration: d, ease: 'power1.in',
|
|
459
|
+
onComplete: () => { disposeIvy(s); delete target.userData[STATE]; },
|
|
460
|
+
});
|
|
461
|
+
},
|
|
462
|
+
});
|
|
463
|
+
function disposeIvy(s) {
|
|
464
|
+
gsap.killTweensOf(s.wither);
|
|
465
|
+
s.stems.removeFromParent();
|
|
466
|
+
s.stems.geometry.dispose();
|
|
467
|
+
s.stems.material.dispose();
|
|
468
|
+
disposeFxInstances(s.leaves);
|
|
469
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jelly.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/jelly.ts"],"names":[],"mappings":";AAWA,wBAqCG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Jelly — a volume-preserving squash-and-stretch spring, anchored at the base:
|
|
2
|
+
// it squashes first, then rings out like soft rubber (critically tuned so it
|
|
3
|
+
// settles exactly at rest when the duration ends). One-shot.
|
|
4
|
+
import { gsap } from 'gsap';
|
|
5
|
+
import { Quaternion, Vector3 } from 'three';
|
|
6
|
+
import { defineOperation } from '../types.js';
|
|
7
|
+
import { acquireRest, poseAbout, releaseRest } from './restPose.js';
|
|
8
|
+
const KEY = '__opJelly';
|
|
9
|
+
const NO_TURN = new Quaternion();
|
|
10
|
+
export default defineOperation({
|
|
11
|
+
value: 'jelly',
|
|
12
|
+
label: 'Jelly',
|
|
13
|
+
description: 'Squash and wobble like soft rubber, keeping its volume — settles back to rest',
|
|
14
|
+
channel: 'transform',
|
|
15
|
+
multi: true,
|
|
16
|
+
toggles: false,
|
|
17
|
+
usableIn: ['interaction', 'action'],
|
|
18
|
+
params: {
|
|
19
|
+
strength: { type: 'number', label: 'Squash', default: 0.28, min: 0.02, max: 0.7, step: 0.01 },
|
|
20
|
+
wobbles: { type: 'number', label: 'Wobbles', default: 3, min: 1, max: 8, step: 0.5 },
|
|
21
|
+
duration: { type: 'number', label: 'Duration', default: 1.1, min: 0.2, max: 5, step: 0.05, unit: 's' },
|
|
22
|
+
},
|
|
23
|
+
apply(target, p) {
|
|
24
|
+
const running = target.userData[KEY];
|
|
25
|
+
if (running) {
|
|
26
|
+
gsap.killTweensOf(running.proxy);
|
|
27
|
+
releaseRest(target);
|
|
28
|
+
}
|
|
29
|
+
const rest = acquireRest(target);
|
|
30
|
+
const proxy = { t: 0 };
|
|
31
|
+
target.userData[KEY] = { proxy };
|
|
32
|
+
const A = Number(p.strength);
|
|
33
|
+
const D = Number(p.duration);
|
|
34
|
+
const w = 2 * Math.PI * (Number(p.wobbles) / D); // rad/s
|
|
35
|
+
const k = 4.6 / D; // decays to 1% by the end
|
|
36
|
+
const s = new Vector3();
|
|
37
|
+
gsap.to(proxy, {
|
|
38
|
+
t: D, duration: D, ease: 'none',
|
|
39
|
+
onUpdate: () => {
|
|
40
|
+
const t = proxy.t;
|
|
41
|
+
// damped spring, squash first
|
|
42
|
+
const sy = 1 - A * Math.exp(-k * t) * Math.sin(w * t);
|
|
43
|
+
const sxz = 1 / Math.sqrt(Math.max(sy, 0.05)); // keep the volume
|
|
44
|
+
s.set(sxz, sy, sxz);
|
|
45
|
+
poseAbout(target, rest, rest.bottomLocal, NO_TURN, s);
|
|
46
|
+
},
|
|
47
|
+
onComplete: () => { delete target.userData[KEY]; releaseRest(target); },
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kintsugi.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/kintsugi.ts"],"names":[],"mappings":";AAmIA,wBA+CG"}
|