@3driseai/3drise-viewer 0.1.25 → 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 +16 -0
- package/dist/animationsV2/ClipPlayer.d.ts.map +1 -0
- package/dist/animationsV2/ClipPlayer.js +199 -0
- package/dist/animationsV2/ClipsRuntime.d.ts +150 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -0
- package/dist/animationsV2/ClipsRuntime.js +707 -0
- package/dist/animationsV2/appliers.d.ts +21 -0
- package/dist/animationsV2/appliers.d.ts.map +1 -0
- package/dist/animationsV2/appliers.js +222 -0
- package/dist/animationsV2/clipUtils.d.ts +33 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -0
- package/dist/animationsV2/clipUtils.js +164 -0
- package/dist/animationsV2/elementSettings.d.ts +15 -0
- package/dist/animationsV2/elementSettings.d.ts.map +1 -0
- package/dist/animationsV2/elementSettings.js +16 -0
- package/dist/animationsV2/index.d.ts +16 -0
- package/dist/animationsV2/index.d.ts.map +1 -0
- package/dist/animationsV2/index.js +12 -0
- package/dist/animationsV2/nodeTracks.d.ts +13 -0
- package/dist/animationsV2/nodeTracks.d.ts.map +1 -0
- package/dist/animationsV2/nodeTracks.js +165 -0
- package/dist/animationsV2/normalize.d.ts +4 -0
- package/dist/animationsV2/normalize.d.ts.map +1 -0
- package/dist/animationsV2/normalize.js +60 -0
- package/dist/animationsV2/sequenceUtils.d.ts +98 -0
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -0
- package/dist/animationsV2/sequenceUtils.js +220 -0
- package/dist/animationsV2/types.d.ts +115 -0
- package/dist/animationsV2/types.d.ts.map +1 -0
- package/dist/animationsV2/types.js +8 -0
- package/dist/api/sceneHandle.d.ts +56 -17
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +154 -77
- 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/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +0 -44
- 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/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +0 -34
- 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/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +19 -1
- 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/EnvironmentManager.js +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 +4 -1
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +57 -3
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +0 -63
- 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.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +19 -4
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +0 -39
- 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/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +3 -47
- 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/TerrainSurface.d.ts.map +1 -1
- package/dist/components/terrain/TerrainSurface.js +0 -5
- 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/VolumetricCloudsPass.js +0 -6
- 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 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -2
- 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/useInteraction.d.ts +6 -7
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +87 -268
- package/dist/hooks/useLandscapeMaps.d.ts +1 -1
- package/dist/hooks/useLandscapeMaps.d.ts.map +1 -1
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
- package/dist/hooks/useObjectAnimation.js +0 -2
- package/dist/hooks/useOceanMaterial.d.ts +1 -1
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.js +0 -5
- package/dist/hooks/useRuntimeSettings.d.ts +1 -1
- package/dist/hooks/useRuntimeSettings.js +1 -1
- package/dist/hooks/useThunder.d.ts +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/interactions/index.d.ts +4 -0
- package/dist/interactions/index.d.ts.map +1 -0
- package/dist/interactions/index.js +1 -0
- package/dist/interactions/runner.d.ts +24 -0
- package/dist/interactions/runner.d.ts.map +1 -0
- package/dist/interactions/runner.js +46 -0
- 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 +3 -0
- package/dist/operations/catalogue/displayImage.d.ts.map +1 -0
- package/dist/operations/catalogue/displayImage.js +40 -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 +3 -0
- package/dist/operations/catalogue/fade.d.ts.map +1 -0
- package/dist/operations/catalogue/fade.js +45 -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 +3 -0
- package/dist/operations/catalogue/focus.d.ts.map +1 -0
- package/dist/operations/catalogue/focus.js +23 -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 +3 -0
- package/dist/operations/catalogue/glow.d.ts.map +1 -0
- package/dist/operations/catalogue/glow.js +50 -0
- 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/materialFx.d.ts +6 -0
- package/dist/operations/catalogue/materialFx.d.ts.map +1 -0
- package/dist/operations/catalogue/materialFx.js +13 -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 +3 -0
- package/dist/operations/catalogue/moveToFront.d.ts.map +1 -0
- package/dist/operations/catalogue/moveToFront.js +26 -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 +3 -0
- package/dist/operations/catalogue/visibility.d.ts.map +1 -0
- package/dist/operations/catalogue/visibility.js +25 -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 +3 -0
- package/dist/operations/catalogue/zoom.d.ts.map +1 -0
- package/dist/operations/catalogue/zoom.js +33 -0
- package/dist/operations/index.d.ts +7 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +6 -0
- 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 +16 -0
- package/dist/operations/registry.d.ts.map +1 -0
- package/dist/operations/registry.js +63 -0
- package/dist/operations/runtime.d.ts +60 -0
- package/dist/operations/runtime.d.ts.map +1 -0
- package/dist/operations/runtime.js +317 -0
- package/dist/operations/types.d.ts +122 -0
- package/dist/operations/types.d.ts.map +1 -0
- package/dist/operations/types.js +9 -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 +3 -0
- package/dist/operations/useOperationsRuntime.d.ts.map +1 -0
- package/dist/operations/useOperationsRuntime.js +69 -0
- 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,60 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { ActionSequence, OperationEffect, OperationName } from '@3driseai/3drise-core';
|
|
3
|
+
import type { OperationDefinition, OperationParams, OperationTools } from './types';
|
|
4
|
+
/** Register the mounted scene's tools. Returns the unregister. */
|
|
5
|
+
export declare function registerOperationTools(t: OperationTools): () => void;
|
|
6
|
+
export declare function isOperationOn(op: OperationName, target: Object3D): boolean;
|
|
7
|
+
export declare function applyOperation(def: OperationDefinition, target: Object3D, params: OperationParams, self?: Object3D | null, opts?: {
|
|
8
|
+
bare?: boolean;
|
|
9
|
+
}): boolean;
|
|
10
|
+
/** The last run (apply or revert) of an op on a target — resolves when it has really finished. */
|
|
11
|
+
export declare const runOf: (op: OperationName, target: Object3D) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Undo an operation that is on. `params` overrides the ones it was applied with
|
|
14
|
+
* (e.g. a zero duration to take it off at once); `bare` runs it with no scene tools.
|
|
15
|
+
*/
|
|
16
|
+
export declare function revertOperation(def: OperationDefinition, target: Object3D, opts?: {
|
|
17
|
+
params?: Partial<OperationParams>;
|
|
18
|
+
bare?: boolean;
|
|
19
|
+
}): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Undo an operation's effect on a target even when the runtime no longer tracks
|
|
22
|
+
* it as on (its scene tools were unregistered first, on unmount). Reverts of
|
|
23
|
+
* operations that are not on do nothing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function forceRevert(def: OperationDefinition, target: Object3D, params: OperationParams): void;
|
|
26
|
+
/** The objects an effect acts on: 'self', object ids, narrowed to model nodes. */
|
|
27
|
+
export declare function resolveEffectTargets(effect: OperationEffect, self?: Object3D | null): Object3D[];
|
|
28
|
+
/**
|
|
29
|
+
* Run one effect.
|
|
30
|
+
* trigger interactions: toggle when the operation toggles, else apply
|
|
31
|
+
* apply / revert / toggle explicit
|
|
32
|
+
*/
|
|
33
|
+
export declare function runEffect(effect: OperationEffect, mode: 'trigger' | 'apply' | 'revert' | 'toggle', self?: Object3D | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Play an effect for the studio and put everything back: apply, wait for the run
|
|
36
|
+
* to REALLY finish (it may first compile its shaders in the background), hold a
|
|
37
|
+
* moment, revert and wait for that too. One-shot operations (spin, jelly, flip)
|
|
38
|
+
* just play; orbit plays and flies home. An effect that is already on is replayed
|
|
39
|
+
* (revert, then apply) so the scene ends as it was.
|
|
40
|
+
* Pressing play again on the same row — also after switching its operation —
|
|
41
|
+
* replaces the running preview: the old one is put back and the new one plays.
|
|
42
|
+
*/
|
|
43
|
+
export declare function previewEffect(effect: OperationEffect, self?: Object3D | null): Promise<boolean>;
|
|
44
|
+
/** Preview several effects together (an interaction's "Try it"). */
|
|
45
|
+
export declare function previewEffects(effects: OperationEffect[], self?: Object3D | null): Promise<boolean>;
|
|
46
|
+
export declare const isPreviewing: (effectId: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Compile an effect's shaders ahead of time, without showing anything, so its
|
|
49
|
+
* first real play starts instantly. Visual effects only (the others have no
|
|
50
|
+
* shaders). Runs one at a time, in the background; each (effect, target) once.
|
|
51
|
+
* Used when an effect is picked in the editor and, for every effect a scene's
|
|
52
|
+
* interactions and actions use, when the scene loads.
|
|
53
|
+
*/
|
|
54
|
+
export declare function prewarmEffect(effect: OperationEffect, self?: Object3D | null): Promise<void>;
|
|
55
|
+
/** Apply or undo an action's effects directly (the editor's "Try it"). */
|
|
56
|
+
export declare function runActionEffects(action: ActionSequence, mode: 'apply' | 'revert'): void;
|
|
57
|
+
export declare const areActionEffectsOn: (actionId: string) => boolean;
|
|
58
|
+
/** Subscribe to action-effects on/off changes (studio badges). */
|
|
59
|
+
export declare function subscribeActionEffects(fn: () => void): () => void;
|
|
60
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/operations/runtime.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAgB,MAAM,uBAAuB,CAAC;AAI1G,OAAO,KAAK,EAAoB,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAwCtG,kEAAkE;AAClE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,IAAI,CAQpE;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAE1E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAkB9J;AAcD,kGAAkG;AAClG,eAAO,MAAM,KAAK,GAAI,IAAI,aAAa,EAAE,QAAQ,QAAQ,kBAAqD,CAAC;AAE/G;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAUjJ;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAIrG;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,EAAE,CAahG;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAWhI;AASD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAoCrG;AAED,oEAAoE;AACpE,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAGzG;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,YAA2B,CAAC;AASzE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5F;AAQD,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAQvF;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,YAAkC,CAAC;AAEtF,kEAAkE;AAClE,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAGjE"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { SceneActions, findNodesByName } from '@3driseai/3drise-core';
|
|
2
|
+
import { findById } from '../utils/sceneQuery.js';
|
|
3
|
+
import { getOperation, resolveParams } from './registry.js';
|
|
4
|
+
import { warmMode } from './catalogue/warmup.js';
|
|
5
|
+
const active = new Map(); // `${op}:${uuid}`
|
|
6
|
+
const slots = new Map(); // exclusive group → active key
|
|
7
|
+
const toolsStack = [];
|
|
8
|
+
let cameraHome = null;
|
|
9
|
+
const keyOf = (op, target) => `${op}:${target.uuid}`;
|
|
10
|
+
const tools = () => toolsStack[toolsStack.length - 1];
|
|
11
|
+
/**
|
|
12
|
+
* Stand-in tools for object effects that run before (or after) a scene has
|
|
13
|
+
* registered its tools — visual state effects only read the camera pose (for a
|
|
14
|
+
* left / right sweep), and fall back to world axes without one.
|
|
15
|
+
*/
|
|
16
|
+
const BARE_TOOLS = {
|
|
17
|
+
animateCamera: async () => undefined,
|
|
18
|
+
cameraPose: () => null,
|
|
19
|
+
orbitCamera: async () => undefined,
|
|
20
|
+
moveToFront: () => undefined,
|
|
21
|
+
restoreTransform: () => undefined,
|
|
22
|
+
};
|
|
23
|
+
function context(self, bare = false) {
|
|
24
|
+
const t = tools() ?? (bare ? BARE_TOOLS : undefined);
|
|
25
|
+
if (!t)
|
|
26
|
+
return null;
|
|
27
|
+
return {
|
|
28
|
+
tools: t,
|
|
29
|
+
self,
|
|
30
|
+
saveCameraHome: () => { if (!cameraHome)
|
|
31
|
+
cameraHome = t.cameraPose(); },
|
|
32
|
+
restoreCameraHome: (duration, ease) => {
|
|
33
|
+
const home = cameraHome;
|
|
34
|
+
cameraHome = null;
|
|
35
|
+
if (home)
|
|
36
|
+
void t.animateCamera({ position: home.position }, duration, ease, home.target);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Register the mounted scene's tools. Returns the unregister. */
|
|
41
|
+
export function registerOperationTools(t) {
|
|
42
|
+
toolsStack.push(t);
|
|
43
|
+
ensureActionsSubscription();
|
|
44
|
+
return () => {
|
|
45
|
+
const i = toolsStack.lastIndexOf(t);
|
|
46
|
+
if (i >= 0)
|
|
47
|
+
toolsStack.splice(i, 1);
|
|
48
|
+
if (toolsStack.length === 0) {
|
|
49
|
+
active.clear();
|
|
50
|
+
slots.clear();
|
|
51
|
+
cameraHome = null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function isOperationOn(op, target) {
|
|
56
|
+
return active.has(keyOf(op, target));
|
|
57
|
+
}
|
|
58
|
+
export function applyOperation(def, target, params, self, opts) {
|
|
59
|
+
const ctx = context(self, opts?.bare);
|
|
60
|
+
if (!ctx)
|
|
61
|
+
return false;
|
|
62
|
+
const key = keyOf(def.value, target);
|
|
63
|
+
if (def.exclusive) {
|
|
64
|
+
const prevKey = slots.get(def.exclusive.group);
|
|
65
|
+
if (prevKey && prevKey !== key) {
|
|
66
|
+
const prev = active.get(prevKey);
|
|
67
|
+
active.delete(prevKey);
|
|
68
|
+
const prevDef = prev && getOperation(prev.op);
|
|
69
|
+
// `revert` puts the previous one back; `handover` leaves it to the new one.
|
|
70
|
+
if (prev && prevDef?.revert && def.exclusive.release === 'revert')
|
|
71
|
+
prevDef.revert(prev.target, prev.params, ctx);
|
|
72
|
+
}
|
|
73
|
+
slots.set(def.exclusive.group, key);
|
|
74
|
+
}
|
|
75
|
+
runs.set(key, finished(def.apply(target, params, ctx), params));
|
|
76
|
+
if (def.revert)
|
|
77
|
+
active.set(key, { op: def.value, target, params });
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
// ---------------------------------------------------------------- run completion
|
|
81
|
+
/** The last run (apply or revert) of each op on each target — resolves when it has really finished. */
|
|
82
|
+
const runs = new Map();
|
|
83
|
+
const wait = (s) => new Promise(r => setTimeout(r, Math.max(0, s) * 1000));
|
|
84
|
+
const durationOf = (params) => (Number.isFinite(Number(params.duration)) ? Number(params.duration) : 1);
|
|
85
|
+
/** Visual transitions return their run; others (transform / camera tweens) take their duration. */
|
|
86
|
+
function finished(res, params) {
|
|
87
|
+
return res && typeof res.then === 'function'
|
|
88
|
+
? res.then(() => undefined, () => undefined)
|
|
89
|
+
: wait(durationOf(params));
|
|
90
|
+
}
|
|
91
|
+
/** The last run (apply or revert) of an op on a target — resolves when it has really finished. */
|
|
92
|
+
export const runOf = (op, target) => runs.get(keyOf(op, target)) ?? Promise.resolve();
|
|
93
|
+
/**
|
|
94
|
+
* Undo an operation that is on. `params` overrides the ones it was applied with
|
|
95
|
+
* (e.g. a zero duration to take it off at once); `bare` runs it with no scene tools.
|
|
96
|
+
*/
|
|
97
|
+
export function revertOperation(def, target, opts) {
|
|
98
|
+
const key = keyOf(def.value, target);
|
|
99
|
+
const entry = active.get(key);
|
|
100
|
+
const ctx = context(undefined, opts?.bare);
|
|
101
|
+
if (!entry || !ctx || !def.revert)
|
|
102
|
+
return false;
|
|
103
|
+
active.delete(key);
|
|
104
|
+
if (def.exclusive && slots.get(def.exclusive.group) === key)
|
|
105
|
+
slots.delete(def.exclusive.group);
|
|
106
|
+
const params = opts?.params ? { ...entry.params, ...opts.params } : entry.params;
|
|
107
|
+
runs.set(key, finished(def.revert(target, params, ctx), params));
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Undo an operation's effect on a target even when the runtime no longer tracks
|
|
112
|
+
* it as on (its scene tools were unregistered first, on unmount). Reverts of
|
|
113
|
+
* operations that are not on do nothing.
|
|
114
|
+
*/
|
|
115
|
+
export function forceRevert(def, target, params) {
|
|
116
|
+
if (revertOperation(def, target, { bare: true, params }) || !def.revert)
|
|
117
|
+
return;
|
|
118
|
+
const ctx = context(undefined, true);
|
|
119
|
+
runs.set(keyOf(def.value, target), finished(def.revert(target, params, ctx), params));
|
|
120
|
+
}
|
|
121
|
+
/** The objects an effect acts on: 'self', object ids, narrowed to model nodes. */
|
|
122
|
+
export function resolveEffectTargets(effect, self) {
|
|
123
|
+
const out = [];
|
|
124
|
+
for (const t of effect.targets ?? []) {
|
|
125
|
+
const root = t === 'self' ? self : findById(t);
|
|
126
|
+
if (!root)
|
|
127
|
+
continue;
|
|
128
|
+
const names = t === 'self' ? undefined : effect.meshNames?.[t];
|
|
129
|
+
if (names?.length) {
|
|
130
|
+
for (const name of names)
|
|
131
|
+
out.push(...findNodesByName(root, name).filter(n => n !== root));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
out.push(root);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Run one effect.
|
|
141
|
+
* trigger interactions: toggle when the operation toggles, else apply
|
|
142
|
+
* apply / revert / toggle explicit
|
|
143
|
+
*/
|
|
144
|
+
export function runEffect(effect, mode, self) {
|
|
145
|
+
const def = getOperation(effect.operation);
|
|
146
|
+
if (!def)
|
|
147
|
+
return;
|
|
148
|
+
const targets = resolveEffectTargets(effect, self);
|
|
149
|
+
const params = resolveParams(def, effect.params);
|
|
150
|
+
for (const target of def.multi ? targets : targets.slice(0, 1)) {
|
|
151
|
+
const on = isOperationOn(def.value, target);
|
|
152
|
+
const m = mode === 'trigger' ? (def.toggles ? 'toggle' : 'apply') : mode;
|
|
153
|
+
if (m === 'revert' || (m === 'toggle' && on))
|
|
154
|
+
revertOperation(def, target);
|
|
155
|
+
else if (m === 'apply' || m === 'toggle')
|
|
156
|
+
applyOperation(def, target, params, self);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// ---------------------------------------------------------------- preview
|
|
160
|
+
const PREVIEW_HOLD = 0.7; // s the finished state is held before it comes back
|
|
161
|
+
/** The running preview of each effect row (by effect id): a newer one replaces it. */
|
|
162
|
+
const previews = new Map();
|
|
163
|
+
/**
|
|
164
|
+
* Play an effect for the studio and put everything back: apply, wait for the run
|
|
165
|
+
* to REALLY finish (it may first compile its shaders in the background), hold a
|
|
166
|
+
* moment, revert and wait for that too. One-shot operations (spin, jelly, flip)
|
|
167
|
+
* just play; orbit plays and flies home. An effect that is already on is replayed
|
|
168
|
+
* (revert, then apply) so the scene ends as it was.
|
|
169
|
+
* Pressing play again on the same row — also after switching its operation —
|
|
170
|
+
* replaces the running preview: the old one is put back and the new one plays.
|
|
171
|
+
*/
|
|
172
|
+
export async function previewEffect(effect, self) {
|
|
173
|
+
const def = getOperation(effect.operation);
|
|
174
|
+
if (!def || !tools())
|
|
175
|
+
return false;
|
|
176
|
+
const targets = resolveEffectTargets(effect, self);
|
|
177
|
+
if (!targets.length)
|
|
178
|
+
return false;
|
|
179
|
+
const list = def.multi ? targets : targets.slice(0, 1);
|
|
180
|
+
const prev = previews.get(effect.id);
|
|
181
|
+
if (prev) {
|
|
182
|
+
const pd = getOperation(prev.op);
|
|
183
|
+
if (pd)
|
|
184
|
+
for (const t of prev.targets)
|
|
185
|
+
if (isOperationOn(pd.value, t))
|
|
186
|
+
revertOperation(pd, t);
|
|
187
|
+
}
|
|
188
|
+
const token = (prev?.token ?? 0) + 1;
|
|
189
|
+
previews.set(effect.id, { token, op: def.value, targets: list });
|
|
190
|
+
const alive = () => previews.get(effect.id)?.token === token;
|
|
191
|
+
const params = resolveParams(def, effect.params);
|
|
192
|
+
const applyAll = () => Promise.all(list.map(t => { applyOperation(def, t, params, self); return runOf(def.value, t); }));
|
|
193
|
+
const revertAll = () => Promise.all(list.map(t => { revertOperation(def, t); return runOf(def.value, t); }));
|
|
194
|
+
try {
|
|
195
|
+
const wasOn = list.some(t => isOperationOn(def.value, t));
|
|
196
|
+
if (wasOn) {
|
|
197
|
+
await revertAll();
|
|
198
|
+
if (!alive())
|
|
199
|
+
return true;
|
|
200
|
+
await wait(PREVIEW_HOLD);
|
|
201
|
+
if (!alive())
|
|
202
|
+
return true;
|
|
203
|
+
await applyAll();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
await applyAll();
|
|
207
|
+
if (!alive())
|
|
208
|
+
return true;
|
|
209
|
+
await wait(PREVIEW_HOLD);
|
|
210
|
+
if (!alive())
|
|
211
|
+
return true;
|
|
212
|
+
if (def.revert)
|
|
213
|
+
await revertAll();
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
if (alive())
|
|
219
|
+
previews.delete(effect.id);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/** Preview several effects together (an interaction's "Try it"). */
|
|
223
|
+
export async function previewEffects(effects, self) {
|
|
224
|
+
const results = await Promise.all(effects.map(e => previewEffect(e, self)));
|
|
225
|
+
return results.some(Boolean);
|
|
226
|
+
}
|
|
227
|
+
export const isPreviewing = (effectId) => previews.has(effectId);
|
|
228
|
+
// ---------------------------------------------------------------- pre-warm
|
|
229
|
+
/** Visual operations with no shaders of their own — nothing to warm (and a warm-only run would show). */
|
|
230
|
+
const NO_SHADERS = new Set(['glow', 'fade', 'visibility', 'displayImage']);
|
|
231
|
+
const warmed = new Set();
|
|
232
|
+
let warmQueue = Promise.resolve();
|
|
233
|
+
/**
|
|
234
|
+
* Compile an effect's shaders ahead of time, without showing anything, so its
|
|
235
|
+
* first real play starts instantly. Visual effects only (the others have no
|
|
236
|
+
* shaders). Runs one at a time, in the background; each (effect, target) once.
|
|
237
|
+
* Used when an effect is picked in the editor and, for every effect a scene's
|
|
238
|
+
* interactions and actions use, when the scene loads.
|
|
239
|
+
*/
|
|
240
|
+
export function prewarmEffect(effect, self) {
|
|
241
|
+
const def = getOperation(effect.operation);
|
|
242
|
+
if (!def || def.channel !== 'visual' || !def.revert || NO_SHADERS.has(def.value))
|
|
243
|
+
return Promise.resolve();
|
|
244
|
+
const params = resolveParams(def, effect.params);
|
|
245
|
+
const job = async () => {
|
|
246
|
+
const ctx = context(self);
|
|
247
|
+
if (!ctx)
|
|
248
|
+
return;
|
|
249
|
+
const targets = resolveEffectTargets(effect, self);
|
|
250
|
+
for (const t of def.multi ? targets : targets.slice(0, 1)) {
|
|
251
|
+
const k = `${def.value}:${t.uuid}`;
|
|
252
|
+
if (warmed.has(k) || isOperationOn(def.value, t))
|
|
253
|
+
continue;
|
|
254
|
+
warmed.add(k);
|
|
255
|
+
// a warm-only run: stages and compiles everything, animates nothing…
|
|
256
|
+
warmMode.on = true;
|
|
257
|
+
let res;
|
|
258
|
+
try {
|
|
259
|
+
res = def.apply(t, params, ctx);
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
warmMode.on = false;
|
|
263
|
+
}
|
|
264
|
+
await finished(res, { duration: 0 });
|
|
265
|
+
// …then quietly take it off again, unless the user started it meanwhile
|
|
266
|
+
if (!isOperationOn(def.value, t))
|
|
267
|
+
await finished(def.revert(t, { ...params, duration: 0.001 }, ctx), { duration: 0 });
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
warmQueue = warmQueue.then(job, job);
|
|
271
|
+
return warmQueue;
|
|
272
|
+
}
|
|
273
|
+
// ---------------------------------------------------------------- actions
|
|
274
|
+
const actionEffectsOn = new Set();
|
|
275
|
+
const listeners = new Set();
|
|
276
|
+
const notify = () => listeners.forEach(l => { try {
|
|
277
|
+
l();
|
|
278
|
+
}
|
|
279
|
+
catch { /* listener error */ } });
|
|
280
|
+
/** Apply or undo an action's effects directly (the editor's "Try it"). */
|
|
281
|
+
export function runActionEffects(action, mode) {
|
|
282
|
+
const on = actionEffectsOn.has(action.id);
|
|
283
|
+
if (mode === 'apply' && on)
|
|
284
|
+
return;
|
|
285
|
+
if (mode === 'revert' && !on)
|
|
286
|
+
return;
|
|
287
|
+
for (const effect of action.effects ?? [])
|
|
288
|
+
runEffect(effect, mode);
|
|
289
|
+
if (mode === 'apply')
|
|
290
|
+
actionEffectsOn.add(action.id);
|
|
291
|
+
else
|
|
292
|
+
actionEffectsOn.delete(action.id);
|
|
293
|
+
notify();
|
|
294
|
+
}
|
|
295
|
+
export const areActionEffectsOn = (actionId) => actionEffectsOn.has(actionId);
|
|
296
|
+
/** Subscribe to action-effects on/off changes (studio badges). */
|
|
297
|
+
export function subscribeActionEffects(fn) {
|
|
298
|
+
listeners.add(fn);
|
|
299
|
+
return () => { listeners.delete(fn); };
|
|
300
|
+
}
|
|
301
|
+
let unsubscribeActions = null;
|
|
302
|
+
function ensureActionsSubscription() {
|
|
303
|
+
if (unsubscribeActions)
|
|
304
|
+
return;
|
|
305
|
+
unsubscribeActions = SceneActions.onEvent((e) => {
|
|
306
|
+
if (e.type === 'applied') {
|
|
307
|
+
if (e.runEffects)
|
|
308
|
+
runActionEffects(e.action, 'apply');
|
|
309
|
+
}
|
|
310
|
+
else if (e.type === 'reverted') {
|
|
311
|
+
runActionEffects(e.action, 'revert');
|
|
312
|
+
}
|
|
313
|
+
else if (e.type === 'reset') {
|
|
314
|
+
e.actions.forEach(a => runActionEffects(a, 'revert'));
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { OperationChannel, OperationName, OperationParamValue, Vector3Array } from '@3driseai/3drise-core';
|
|
3
|
+
/** A parameter the studio shows under the effect, with its default. */
|
|
4
|
+
export type OperationParamSpec = {
|
|
5
|
+
type: 'number';
|
|
6
|
+
label: string;
|
|
7
|
+
default: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
step?: number;
|
|
11
|
+
unit?: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'color';
|
|
15
|
+
label: string;
|
|
16
|
+
default: string;
|
|
17
|
+
hint?: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'select';
|
|
20
|
+
label: string;
|
|
21
|
+
default: string;
|
|
22
|
+
options: Array<{
|
|
23
|
+
value: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
hint?: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'boolean';
|
|
29
|
+
label: string;
|
|
30
|
+
default: boolean;
|
|
31
|
+
hint?: string;
|
|
32
|
+
};
|
|
33
|
+
export type OperationParams = Record<string, OperationParamValue>;
|
|
34
|
+
/** interaction / action: triggered. object: layered on the object (CreatedObject.effects), switched on / off. */
|
|
35
|
+
export type OperationSource = 'interaction' | 'action' | 'object';
|
|
36
|
+
/** Scene tools the runtime hands an operation (built from the viewer's hooks). */
|
|
37
|
+
export interface OperationTools {
|
|
38
|
+
/** Animate the camera; `lookAt` moves the orbit target. */
|
|
39
|
+
animateCamera: (to: {
|
|
40
|
+
position?: Vector3Array;
|
|
41
|
+
}, duration: number, ease: string, lookAt?: Vector3Array) => Promise<void>;
|
|
42
|
+
/** Where the camera is and looks right now. */
|
|
43
|
+
cameraPose: () => {
|
|
44
|
+
position: Vector3Array;
|
|
45
|
+
target: Vector3Array;
|
|
46
|
+
} | null;
|
|
47
|
+
/**
|
|
48
|
+
* Circle the camera around `center` (world Y axis) by `degrees`, keeping its
|
|
49
|
+
* distance and height; the orbit target eases onto `center` on the way.
|
|
50
|
+
*/
|
|
51
|
+
orbitCamera: (center: Vector3Array, degrees: number, duration: number, ease: string) => Promise<void>;
|
|
52
|
+
moveToFront: (object: Object3D, options: {
|
|
53
|
+
distance: number;
|
|
54
|
+
scale: [number, number];
|
|
55
|
+
duration: number;
|
|
56
|
+
ease: string;
|
|
57
|
+
}) => void;
|
|
58
|
+
restoreTransform: (object: Object3D, options: {
|
|
59
|
+
duration: number;
|
|
60
|
+
ease: string;
|
|
61
|
+
}) => void;
|
|
62
|
+
}
|
|
63
|
+
export interface OperationContext {
|
|
64
|
+
tools: OperationTools;
|
|
65
|
+
/** The object an interaction is on (interactions only). */
|
|
66
|
+
self?: Object3D | null;
|
|
67
|
+
/** Remember the camera pose once, before the first camera operation. */
|
|
68
|
+
saveCameraHome: () => void;
|
|
69
|
+
/** Fly back to the remembered pose and forget it. */
|
|
70
|
+
restoreCameraHome: (duration: number, ease: string) => void;
|
|
71
|
+
}
|
|
72
|
+
export interface OperationDefinition {
|
|
73
|
+
value: OperationName;
|
|
74
|
+
label: string;
|
|
75
|
+
/** One line for the studio (tooltip). */
|
|
76
|
+
description: string;
|
|
77
|
+
/** What it acts on — an interaction holds one effect per channel (see OperationChannel). */
|
|
78
|
+
channel: OperationChannel;
|
|
79
|
+
/** More than one target allowed. */
|
|
80
|
+
multi: boolean;
|
|
81
|
+
/** An interaction triggered again undoes it. */
|
|
82
|
+
toggles: boolean;
|
|
83
|
+
/** Where the operation can be used. */
|
|
84
|
+
usableIn: OperationSource[];
|
|
85
|
+
/** Only on gallery objects. */
|
|
86
|
+
galleryOnly?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* One target of this group is "on" at a time, scene-wide. Applying another:
|
|
89
|
+
* `revert` undoes the previous one first (bring to front), `handover` just
|
|
90
|
+
* takes over (camera moves — the remembered home pose stays).
|
|
91
|
+
*/
|
|
92
|
+
exclusive?: {
|
|
93
|
+
group: string;
|
|
94
|
+
release: 'revert' | 'handover';
|
|
95
|
+
};
|
|
96
|
+
params?: Record<string, OperationParamSpec>;
|
|
97
|
+
/**
|
|
98
|
+
* Object effects only: parameters forced to these values (the studio hides
|
|
99
|
+
* them), e.g. a hologram that must stay visible.
|
|
100
|
+
*/
|
|
101
|
+
objectParams?: OperationParams;
|
|
102
|
+
/**
|
|
103
|
+
* Object effects only: one effect of a stack per object — `surface` effects
|
|
104
|
+
* replace the whole look of the surface (frost, metalize, petrify), so two
|
|
105
|
+
* never run together. Effects without a stack add on top of anything.
|
|
106
|
+
*/
|
|
107
|
+
stack?: 'surface';
|
|
108
|
+
/** Visual transitions return a promise that resolves when the run has finished. */
|
|
109
|
+
apply: (target: Object3D, params: OperationParams, ctx: OperationContext) => void | Promise<void>;
|
|
110
|
+
/** No revert = one-way (applies only). */
|
|
111
|
+
revert?: (target: Object3D, params: OperationParams, ctx: OperationContext) => void | Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/** Type helper for catalogue files. */
|
|
114
|
+
export declare const defineOperation: (def: OperationDefinition) => OperationDefinition;
|
|
115
|
+
export declare const DEFAULT_EASE = "power2.out";
|
|
116
|
+
/** The channels in studio order, with their labels. */
|
|
117
|
+
export declare const OPERATION_CHANNELS: Array<{
|
|
118
|
+
value: OperationChannel;
|
|
119
|
+
label: string;
|
|
120
|
+
description: string;
|
|
121
|
+
}>;
|
|
122
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/operations/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Type helper for catalogue files. */
|
|
2
|
+
export const defineOperation = (def) => def;
|
|
3
|
+
export const DEFAULT_EASE = 'power2.out';
|
|
4
|
+
/** The channels in studio order, with their labels. */
|
|
5
|
+
export const OPERATION_CHANNELS = [
|
|
6
|
+
{ value: 'transform', label: 'Transform', description: "Moves, turns or scales the object itself" },
|
|
7
|
+
{ value: 'visual', label: 'Visual', description: 'Changes how the object looks — never where it is' },
|
|
8
|
+
{ value: 'camera', label: 'Camera', description: 'Moves or turns the camera' },
|
|
9
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { ObjectEffect } from '@3driseai/3drise-core';
|
|
3
|
+
export declare function useObjectEffectLayers(ref: React.RefObject<Object3D | null>, effects: ObjectEffect[] | undefined): void;
|
|
4
|
+
//# sourceMappingURL=useObjectEffectLayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useObjectEffectLayers.d.ts","sourceRoot":"","sources":["../../src/operations/useObjectEffectLayers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,SAAS,QAkC/G"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Runs an object's effects (CreatedObject.effects) on its group — see ./objectEffects.ts.
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import { ObjectEffectsController, surfaceSignature } from './objectEffects.js';
|
|
5
|
+
/** How often (frames) the object's meshes / materials are checked for replacement. */
|
|
6
|
+
const CHECK_EVERY = 20;
|
|
7
|
+
export function useObjectEffectLayers(ref, effects) {
|
|
8
|
+
const ctrl = useRef(null);
|
|
9
|
+
const signature = useRef('');
|
|
10
|
+
const latest = useRef(effects);
|
|
11
|
+
latest.current = effects;
|
|
12
|
+
const has = !!effects?.length;
|
|
13
|
+
// Changes after the first sync play their transitions; the first lands at once.
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const root = ref.current;
|
|
16
|
+
if (!root)
|
|
17
|
+
return;
|
|
18
|
+
if (!ctrl.current) {
|
|
19
|
+
if (!has)
|
|
20
|
+
return;
|
|
21
|
+
ctrl.current = new ObjectEffectsController(root);
|
|
22
|
+
signature.current = surfaceSignature(root);
|
|
23
|
+
ctrl.current.sync(effects, 'instant');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
ctrl.current.sync(effects, 'animate');
|
|
27
|
+
}, [effects, has, ref]);
|
|
28
|
+
useEffect(() => () => { ctrl.current?.dispose(); ctrl.current = null; }, []);
|
|
29
|
+
// A model that finished loading, a material swapped by an edit: move the effects over.
|
|
30
|
+
const frame = useRef(0);
|
|
31
|
+
useFrame(() => {
|
|
32
|
+
const c = ctrl.current;
|
|
33
|
+
const root = ref.current;
|
|
34
|
+
if (!c || !root || ++frame.current % CHECK_EVERY)
|
|
35
|
+
return;
|
|
36
|
+
const sig = surfaceSignature(root);
|
|
37
|
+
if (sig === signature.current)
|
|
38
|
+
return;
|
|
39
|
+
signature.current = sig;
|
|
40
|
+
void c.refresh();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOperationsRuntime.d.ts","sourceRoot":"","sources":["../../src/operations/useOperationsRuntime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAQvE,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,WAAW,QAsD/D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Mounts the operations runtime on the scene: builds the scene tools from the
|
|
2
|
+
// viewer's hooks and registers them. Called once, in ObjectsRenderer.
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { gsap } from 'gsap';
|
|
5
|
+
import { Vector3 } from 'three';
|
|
6
|
+
import cameraManager from '../utils/CameraSingleton.js';
|
|
7
|
+
import useCameraAnimation from '../hooks/useCameraAnimation.js';
|
|
8
|
+
import { useFrameAnimations } from '../hooks/useFrameAnimations.js';
|
|
9
|
+
import { useOrbitControls } from '../hooks/useOrbitControls.js';
|
|
10
|
+
import { registerOperationTools } from './runtime.js';
|
|
11
|
+
export function useOperationsRuntime(cameraSettings) {
|
|
12
|
+
const { animateCamera, killAnimation } = useCameraAnimation({ autoAnimate: false, defaultDuration: 1, defaultEase: 'power2.out' });
|
|
13
|
+
const { moveToFront, restoreOriginalTransform } = useFrameAnimations(cameraSettings);
|
|
14
|
+
const controls = useOrbitControls();
|
|
15
|
+
// Latest hook functions, read at call time (the registration itself is stable).
|
|
16
|
+
const latest = useRef({ animateCamera, killAnimation, moveToFront, restoreOriginalTransform, controls, cameraSettings });
|
|
17
|
+
latest.current = { animateCamera, killAnimation, moveToFront, restoreOriginalTransform, controls, cameraSettings };
|
|
18
|
+
// One camera move at a time: a new move stops a running orbit, an orbit stops a running move.
|
|
19
|
+
const orbit = useRef(null);
|
|
20
|
+
const stopOrbit = () => { orbit.current?.kill(); orbit.current = null; };
|
|
21
|
+
useEffect(() => registerOperationTools({
|
|
22
|
+
animateCamera: (to, duration, ease, lookAt) => { stopOrbit(); return latest.current.animateCamera(to, duration, ease, lookAt); },
|
|
23
|
+
orbitCamera: (center, degrees, duration, ease) => {
|
|
24
|
+
const cam = cameraManager.getCamera();
|
|
25
|
+
const controls = latest.current.controls;
|
|
26
|
+
if (!cam)
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
stopOrbit();
|
|
29
|
+
latest.current.killAnimation();
|
|
30
|
+
const c = new Vector3(...center);
|
|
31
|
+
const offset = cam.position.clone().sub(c);
|
|
32
|
+
const fromTarget = controls?.target?.clone() ?? c.clone();
|
|
33
|
+
const up = new Vector3(0, 1, 0);
|
|
34
|
+
const total = (degrees * Math.PI) / 180;
|
|
35
|
+
const proxy = { t: 0 };
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
orbit.current = gsap.to(proxy, {
|
|
38
|
+
t: 1, duration, ease,
|
|
39
|
+
onUpdate: () => {
|
|
40
|
+
cam.position.copy(c).add(offset.clone().applyAxisAngle(up, total * proxy.t));
|
|
41
|
+
// the look-at point settles on the centre over the first third
|
|
42
|
+
const k = Math.min(1, proxy.t * 3);
|
|
43
|
+
const s = k * k * (3 - 2 * k);
|
|
44
|
+
if (controls?.target) {
|
|
45
|
+
controls.target.lerpVectors(fromTarget, c, s);
|
|
46
|
+
controls.update?.();
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
cam.lookAt(c);
|
|
50
|
+
},
|
|
51
|
+
onComplete: () => { orbit.current = null; resolve(); },
|
|
52
|
+
onInterrupt: () => resolve(),
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
cameraPose: () => {
|
|
57
|
+
const pos = cameraManager.getPosition();
|
|
58
|
+
if (!pos)
|
|
59
|
+
return null;
|
|
60
|
+
const t = latest.current.controls?.target;
|
|
61
|
+
const target = t
|
|
62
|
+
? [t.x, t.y, t.z]
|
|
63
|
+
: latest.current.cameraSettings?.controls?.target ?? [0, 0, 0];
|
|
64
|
+
return { position: [pos.x, pos.y, pos.z], target };
|
|
65
|
+
},
|
|
66
|
+
moveToFront: (object, o) => latest.current.moveToFront(object, o),
|
|
67
|
+
restoreTransform: (object, o) => latest.current.restoreOriginalTransform(object, o),
|
|
68
|
+
}), []);
|
|
69
|
+
}
|