@3driseai/3drise-viewer 0.1.27 → 0.1.29
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.map +1 -1
- package/dist/animationsV2/ClipPlayer.js +13 -9
- package/dist/animationsV2/ClipsRuntime.d.ts +44 -3
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +173 -55
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +21 -5
- 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 +7 -3
- package/dist/animationsV2/sequenceUtils.d.ts +44 -6
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
- package/dist/animationsV2/sequenceUtils.js +58 -12
- package/dist/animationsV2/types.d.ts +22 -12
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.d.ts +35 -1
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +88 -17
- package/dist/components/AdvancedGrid.d.ts +1 -5
- package/dist/components/AdvancedGrid.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.js +6 -35
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +9 -4
- package/dist/components/ApollonianGrid.d.ts +25 -0
- package/dist/components/ApollonianGrid.d.ts.map +1 -0
- package/dist/components/ApollonianGrid.js +55 -0
- package/dist/components/ChladniGrid.d.ts +1 -1
- package/dist/components/ChladniGrid.d.ts.map +1 -1
- package/dist/components/ChladniGrid.js +6 -35
- package/dist/components/CircuitGrid.d.ts +1 -1
- package/dist/components/CircuitGrid.d.ts.map +1 -1
- package/dist/components/CircuitGrid.js +6 -34
- package/dist/components/ConformalGrid.d.ts +25 -0
- package/dist/components/ConformalGrid.d.ts.map +1 -0
- package/dist/components/ConformalGrid.js +66 -0
- package/dist/components/ContourGrid.d.ts +1 -1
- package/dist/components/ContourGrid.d.ts.map +1 -1
- package/dist/components/ContourGrid.js +6 -34
- package/dist/components/CustomPrimitive.js +1 -1
- package/dist/components/EnvironmentObject.d.ts.map +1 -1
- package/dist/components/EnvironmentObject.js +9 -7
- package/dist/components/FlowNetGrid.d.ts +1 -1
- package/dist/components/FlowNetGrid.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.js +6 -34
- package/dist/components/FractalGrid.d.ts +1 -1
- package/dist/components/FractalGrid.d.ts.map +1 -1
- package/dist/components/FractalGrid.js +6 -37
- package/dist/components/Galaxy.d.ts.map +1 -1
- package/dist/components/Galaxy.js +9 -23
- package/dist/components/GirihGrid.d.ts +1 -1
- package/dist/components/GirihGrid.d.ts.map +1 -1
- package/dist/components/GirihGrid.js +6 -35
- package/dist/components/GravWaveGrid.d.ts +1 -1
- package/dist/components/GravWaveGrid.d.ts.map +1 -1
- package/dist/components/GravWaveGrid.js +6 -35
- package/dist/components/GridsGenerator.d.ts +2 -2
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +21 -0
- package/dist/components/HexGrid.d.ts +1 -5
- package/dist/components/HexGrid.d.ts.map +1 -1
- package/dist/components/HexGrid.js +6 -36
- package/dist/components/HilbertGrid.d.ts +25 -0
- package/dist/components/HilbertGrid.d.ts.map +1 -0
- package/dist/components/HilbertGrid.js +66 -0
- package/dist/components/HyperbolicGrid.d.ts +1 -1
- package/dist/components/HyperbolicGrid.d.ts.map +1 -1
- package/dist/components/HyperbolicGrid.js +6 -34
- package/dist/components/LandObject.d.ts +9 -0
- package/dist/components/LandObject.d.ts.map +1 -0
- package/dist/components/LandObject.js +15 -0
- package/dist/components/LensingGrid.d.ts +25 -0
- package/dist/components/LensingGrid.d.ts.map +1 -0
- package/dist/components/LensingGrid.js +55 -0
- package/dist/components/LightsManager.d.ts.map +1 -1
- package/dist/components/LightsManager.js +8 -0
- package/dist/components/ModelBoundary.d.ts +2 -0
- package/dist/components/ModelBoundary.d.ts.map +1 -1
- package/dist/components/ModelBoundary.js +3 -0
- package/dist/components/ModelPrimitive.d.ts.map +1 -1
- package/dist/components/ModelPrimitive.js +6 -0
- package/dist/components/MoireGrid.d.ts +1 -1
- package/dist/components/MoireGrid.d.ts.map +1 -1
- package/dist/components/MoireGrid.js +6 -35
- package/dist/components/MoonDisc.d.ts +11 -0
- package/dist/components/MoonDisc.d.ts.map +1 -0
- package/dist/components/MoonDisc.js +128 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +15 -4
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +7 -5
- package/dist/components/OceanBuilder.d.ts.map +1 -1
- package/dist/components/OceanBuilder.js +2 -0
- package/dist/components/ParastichyGrid.d.ts +25 -0
- package/dist/components/ParastichyGrid.d.ts.map +1 -0
- package/dist/components/ParastichyGrid.js +55 -0
- package/dist/components/PhyllotaxisGrid.d.ts +25 -0
- package/dist/components/PhyllotaxisGrid.d.ts.map +1 -0
- package/dist/components/PhyllotaxisGrid.js +66 -0
- package/dist/components/ProjectLoader.d.ts +5 -3
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +6 -3
- package/dist/components/QuasiGrid.d.ts +1 -1
- package/dist/components/QuasiGrid.d.ts.map +1 -1
- package/dist/components/QuasiGrid.js +6 -33
- package/dist/components/RadarGrid.d.ts +1 -1
- package/dist/components/RadarGrid.d.ts.map +1 -1
- package/dist/components/RadarGrid.js +6 -34
- package/dist/components/ReactionDiffusionGrid.d.ts +1 -1
- package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
- package/dist/components/ReactionDiffusionGrid.js +6 -35
- package/dist/components/SceneBuilder.d.ts +25 -3
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +68 -38
- package/dist/components/SkyController.d.ts +25 -1
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +189 -130
- package/dist/components/SkyMesh.d.ts.map +1 -1
- package/dist/components/SkyMesh.js +26 -1
- package/dist/components/SkyStars.d.ts +11 -0
- package/dist/components/SkyStars.d.ts.map +1 -0
- package/dist/components/SkyStars.js +187 -0
- package/dist/components/SkySystem.d.ts +3 -3
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +8 -2
- package/dist/components/Sun.d.ts +15 -1
- package/dist/components/Sun.d.ts.map +1 -1
- package/dist/components/Sun.js +64 -3
- package/dist/components/SunLight.d.ts +6 -1
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +96 -44
- package/dist/components/TerrainBuilder.d.ts.map +1 -1
- package/dist/components/TerrainBuilder.js +2 -0
- package/dist/components/TextGenerator.d.ts +9 -0
- package/dist/components/TextGenerator.d.ts.map +1 -0
- package/dist/components/TextGenerator.js +29 -0
- package/dist/components/TruchetGrid.d.ts +25 -0
- package/dist/components/TruchetGrid.d.ts.map +1 -0
- package/dist/components/TruchetGrid.js +55 -0
- package/dist/components/VoronoiGrid.d.ts +1 -1
- package/dist/components/VoronoiGrid.d.ts.map +1 -1
- package/dist/components/VoronoiGrid.js +6 -33
- package/dist/components/WallpaperGrid.d.ts +1 -1
- package/dist/components/WallpaperGrid.d.ts.map +1 -1
- package/dist/components/WallpaperGrid.js +6 -35
- package/dist/components/environment/Rain.d.ts +15 -0
- package/dist/components/environment/Rain.d.ts.map +1 -0
- package/dist/components/environment/Rain.js +110 -0
- package/dist/components/environment/Rainbow.d.ts +20 -0
- package/dist/components/environment/Rainbow.d.ts.map +1 -0
- package/dist/components/environment/Rainbow.js +974 -0
- package/dist/components/environment/Sandstorm.d.ts +20 -0
- package/dist/components/environment/Sandstorm.d.ts.map +1 -0
- package/dist/components/environment/Sandstorm.js +776 -0
- package/dist/components/environment/Snow.d.ts +20 -0
- package/dist/components/environment/Snow.d.ts.map +1 -0
- package/dist/components/environment/Snow.js +609 -0
- package/dist/components/environment/Thunderstorm.d.ts +20 -0
- package/dist/components/environment/Thunderstorm.d.ts.map +1 -0
- package/dist/components/environment/Thunderstorm.js +731 -0
- package/dist/components/environment/Tornado.d.ts +20 -0
- package/dist/components/environment/Tornado.d.ts.map +1 -0
- package/dist/components/environment/Tornado.js +762 -0
- package/dist/components/environment/index.d.ts +13 -0
- package/dist/components/environment/index.d.ts.map +1 -0
- package/dist/components/environment/index.js +7 -0
- package/dist/components/index.d.ts +24 -10
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +15 -6
- package/dist/components/land/LandPatch.d.ts +15 -0
- package/dist/components/land/LandPatch.d.ts.map +1 -0
- package/dist/components/land/LandPatch.js +170 -0
- package/dist/components/land/index.d.ts +3 -0
- package/dist/components/land/index.d.ts.map +1 -0
- package/dist/components/land/index.js +1 -0
- package/dist/components/space/Earth.d.ts +16 -0
- package/dist/components/space/Earth.d.ts.map +1 -0
- package/dist/components/space/Earth.js +75 -0
- package/dist/components/space/ShootingStar.d.ts +21 -0
- package/dist/components/space/ShootingStar.d.ts.map +1 -0
- package/dist/components/space/ShootingStar.js +101 -0
- package/dist/components/space/ShootingStars.d.ts +16 -0
- package/dist/components/space/ShootingStars.d.ts.map +1 -0
- package/dist/components/space/ShootingStars.js +71 -0
- package/dist/components/space/SolarSystem.d.ts +16 -0
- package/dist/components/space/SolarSystem.d.ts.map +1 -0
- package/dist/components/space/SolarSystem.js +141 -0
- package/dist/components/space/Stars.d.ts +20 -0
- package/dist/components/space/Stars.d.ts.map +1 -0
- package/dist/components/space/Stars.js +160 -0
- package/dist/components/space/index.d.ts +11 -0
- package/dist/components/space/index.d.ts.map +1 -0
- package/dist/components/space/index.js +8 -0
- package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
- package/dist/components/terrain/TerrainSurface.js +27 -3
- package/dist/components/terrain/types.d.ts +5 -1
- package/dist/components/terrain/types.d.ts.map +1 -1
- package/dist/components/text/BurnAwayText.d.ts +15 -0
- package/dist/components/text/BurnAwayText.d.ts.map +1 -0
- package/dist/components/text/BurnAwayText.js +4 -0
- package/dist/components/text/ChalkboardText.d.ts +15 -0
- package/dist/components/text/ChalkboardText.d.ts.map +1 -0
- package/dist/components/text/ChalkboardText.js +4 -0
- package/dist/components/text/ConstellationText.d.ts +15 -0
- package/dist/components/text/ConstellationText.d.ts.map +1 -0
- package/dist/components/text/ConstellationText.js +4 -0
- package/dist/components/text/EmbroideryText.d.ts +15 -0
- package/dist/components/text/EmbroideryText.d.ts.map +1 -0
- package/dist/components/text/EmbroideryText.js +4 -0
- package/dist/components/text/FourierSketchText.d.ts +15 -0
- package/dist/components/text/FourierSketchText.d.ts.map +1 -0
- package/dist/components/text/FourierSketchText.js +4 -0
- package/dist/components/text/FrostGrowthText.d.ts +15 -0
- package/dist/components/text/FrostGrowthText.d.ts.map +1 -0
- package/dist/components/text/FrostGrowthText.js +4 -0
- package/dist/components/text/HandwritingText.d.ts +15 -0
- package/dist/components/text/HandwritingText.d.ts.map +1 -0
- package/dist/components/text/HandwritingText.js +4 -0
- package/dist/components/text/InkBleedText.d.ts +15 -0
- package/dist/components/text/InkBleedText.d.ts.map +1 -0
- package/dist/components/text/InkBleedText.js +4 -0
- package/dist/components/text/LightPaintingText.d.ts +15 -0
- package/dist/components/text/LightPaintingText.d.ts.map +1 -0
- package/dist/components/text/LightPaintingText.js +4 -0
- package/dist/components/text/LiquidMetalText.d.ts +15 -0
- package/dist/components/text/LiquidMetalText.d.ts.map +1 -0
- package/dist/components/text/LiquidMetalText.js +4 -0
- package/dist/components/text/NeonTubeText.d.ts +15 -0
- package/dist/components/text/NeonTubeText.d.ts.map +1 -0
- package/dist/components/text/NeonTubeText.js +4 -0
- package/dist/components/text/PlasmaDischargeText.d.ts +15 -0
- package/dist/components/text/PlasmaDischargeText.d.ts.map +1 -0
- package/dist/components/text/PlasmaDischargeText.js +4 -0
- package/dist/components/text/TextObjectView.d.ts +12 -0
- package/dist/components/text/TextObjectView.d.ts.map +1 -0
- package/dist/components/text/TextObjectView.js +11 -0
- package/dist/components/text/engine/fieldkit.d.ts +24 -0
- package/dist/components/text/engine/fieldkit.d.ts.map +1 -0
- package/dist/components/text/engine/fieldkit.js +201 -0
- package/dist/components/text/engine/glyphs.d.ts +19 -0
- package/dist/components/text/engine/glyphs.d.ts.map +1 -0
- package/dist/components/text/engine/glyphs.js +269 -0
- package/dist/components/text/engine/looks/burnAway.d.ts +144 -0
- package/dist/components/text/engine/looks/burnAway.d.ts.map +1 -0
- package/dist/components/text/engine/looks/burnAway.js +593 -0
- package/dist/components/text/engine/looks/chalkboard.d.ts +135 -0
- package/dist/components/text/engine/looks/chalkboard.d.ts.map +1 -0
- package/dist/components/text/engine/looks/chalkboard.js +426 -0
- package/dist/components/text/engine/looks/constellation.d.ts +111 -0
- package/dist/components/text/engine/looks/constellation.d.ts.map +1 -0
- package/dist/components/text/engine/looks/constellation.js +496 -0
- package/dist/components/text/engine/looks/embroidery.d.ts +165 -0
- package/dist/components/text/engine/looks/embroidery.d.ts.map +1 -0
- package/dist/components/text/engine/looks/embroidery.js +645 -0
- package/dist/components/text/engine/looks/frostGrowth.d.ts +109 -0
- package/dist/components/text/engine/looks/frostGrowth.d.ts.map +1 -0
- package/dist/components/text/engine/looks/frostGrowth.js +727 -0
- package/dist/components/text/engine/looks/index.d.ts +2 -0
- package/dist/components/text/engine/looks/index.d.ts.map +1 -0
- package/dist/components/text/engine/looks/index.js +48 -0
- package/dist/components/text/engine/looks/inkBleed.d.ts +103 -0
- package/dist/components/text/engine/looks/inkBleed.d.ts.map +1 -0
- package/dist/components/text/engine/looks/inkBleed.js +590 -0
- package/dist/components/text/engine/looks/lightPainting.d.ts +132 -0
- package/dist/components/text/engine/looks/lightPainting.d.ts.map +1 -0
- package/dist/components/text/engine/looks/lightPainting.js +567 -0
- package/dist/components/text/engine/looks/liquidMetal.d.ts +135 -0
- package/dist/components/text/engine/looks/liquidMetal.d.ts.map +1 -0
- package/dist/components/text/engine/looks/liquidMetal.js +655 -0
- package/dist/components/text/engine/looks/plasmaDischarge.d.ts +126 -0
- package/dist/components/text/engine/looks/plasmaDischarge.d.ts.map +1 -0
- package/dist/components/text/engine/looks/plasmaDischarge.js +763 -0
- package/dist/components/text/engine/methods.d.ts +19 -0
- package/dist/components/text/engine/methods.d.ts.map +1 -0
- package/dist/components/text/engine/methods.js +126 -0
- package/dist/components/text/engine/playback.d.ts +40 -0
- package/dist/components/text/engine/playback.d.ts.map +1 -0
- package/dist/components/text/engine/playback.js +114 -0
- package/dist/components/text/engine/ribbon.d.ts +58 -0
- package/dist/components/text/engine/ribbon.d.ts.map +1 -0
- package/dist/components/text/engine/ribbon.js +250 -0
- package/dist/components/text/engine/variants.d.ts +159 -0
- package/dist/components/text/engine/variants.d.ts.map +1 -0
- package/dist/components/text/engine/variants.js +378 -0
- package/dist/components/text/fonts/architects-daughter.outline.d.ts +3 -0
- package/dist/components/text/fonts/architects-daughter.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/architects-daughter.outline.js +4 -0
- package/dist/components/text/fonts/architects-daughter.strokes.d.ts +3 -0
- package/dist/components/text/fonts/architects-daughter.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/architects-daughter.strokes.js +4 -0
- package/dist/components/text/fonts/caveat.outline.d.ts +3 -0
- package/dist/components/text/fonts/caveat.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/caveat.outline.js +4 -0
- package/dist/components/text/fonts/caveat.strokes.d.ts +3 -0
- package/dist/components/text/fonts/caveat.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/caveat.strokes.js +4 -0
- package/dist/components/text/fonts/courgette.outline.d.ts +3 -0
- package/dist/components/text/fonts/courgette.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/courgette.outline.js +4 -0
- package/dist/components/text/fonts/courgette.strokes.d.ts +3 -0
- package/dist/components/text/fonts/courgette.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/courgette.strokes.js +4 -0
- package/dist/components/text/fonts/dancing-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/dancing-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/dancing-script.outline.js +4 -0
- package/dist/components/text/fonts/dancing-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/dancing-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/dancing-script.strokes.js +4 -0
- package/dist/components/text/fonts/gochi-hand.outline.d.ts +3 -0
- package/dist/components/text/fonts/gochi-hand.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/gochi-hand.outline.js +4 -0
- package/dist/components/text/fonts/gochi-hand.strokes.d.ts +3 -0
- package/dist/components/text/fonts/gochi-hand.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/gochi-hand.strokes.js +4 -0
- package/dist/components/text/fonts/handlee.outline.d.ts +3 -0
- package/dist/components/text/fonts/handlee.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/handlee.outline.js +4 -0
- package/dist/components/text/fonts/handlee.strokes.d.ts +3 -0
- package/dist/components/text/fonts/handlee.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/handlee.strokes.js +4 -0
- package/dist/components/text/fonts/index.d.ts +5 -0
- package/dist/components/text/fonts/index.d.ts.map +1 -0
- package/dist/components/text/fonts/index.js +44 -0
- package/dist/components/text/fonts/indie-flower.outline.d.ts +3 -0
- package/dist/components/text/fonts/indie-flower.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/indie-flower.outline.js +4 -0
- package/dist/components/text/fonts/indie-flower.strokes.d.ts +3 -0
- package/dist/components/text/fonts/indie-flower.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/indie-flower.strokes.js +4 -0
- package/dist/components/text/fonts/kalam.outline.d.ts +3 -0
- package/dist/components/text/fonts/kalam.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/kalam.outline.js +4 -0
- package/dist/components/text/fonts/kalam.strokes.d.ts +3 -0
- package/dist/components/text/fonts/kalam.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/kalam.strokes.js +4 -0
- package/dist/components/text/fonts/kaushan-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/kaushan-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/kaushan-script.outline.js +4 -0
- package/dist/components/text/fonts/kaushan-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/kaushan-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/kaushan-script.strokes.js +4 -0
- package/dist/components/text/fonts/mynerve.outline.d.ts +3 -0
- package/dist/components/text/fonts/mynerve.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/mynerve.outline.js +4 -0
- package/dist/components/text/fonts/mynerve.strokes.d.ts +3 -0
- package/dist/components/text/fonts/mynerve.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/mynerve.strokes.js +4 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.d.ts +3 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/nanum-pen-script.outline.js +4 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts +3 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/nanum-pen-script.strokes.js +4 -0
- package/dist/components/text/fonts/pacifico.outline.d.ts +3 -0
- package/dist/components/text/fonts/pacifico.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/pacifico.outline.js +4 -0
- package/dist/components/text/fonts/pacifico.strokes.d.ts +3 -0
- package/dist/components/text/fonts/pacifico.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/pacifico.strokes.js +4 -0
- package/dist/components/text/fonts/patrick-hand.outline.d.ts +3 -0
- package/dist/components/text/fonts/patrick-hand.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/patrick-hand.outline.js +4 -0
- package/dist/components/text/fonts/patrick-hand.strokes.d.ts +3 -0
- package/dist/components/text/fonts/patrick-hand.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/patrick-hand.strokes.js +4 -0
- package/dist/components/text/fonts/poppins.outline.d.ts +3 -0
- package/dist/components/text/fonts/poppins.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/poppins.outline.js +4 -0
- package/dist/components/text/fonts/poppins.strokes.d.ts +3 -0
- package/dist/components/text/fonts/poppins.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/poppins.strokes.js +4 -0
- package/dist/components/text/fonts/satisfy.outline.d.ts +3 -0
- package/dist/components/text/fonts/satisfy.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/satisfy.outline.js +4 -0
- package/dist/components/text/fonts/satisfy.strokes.d.ts +3 -0
- package/dist/components/text/fonts/satisfy.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/satisfy.strokes.js +4 -0
- package/dist/components/text/fonts/sriracha.outline.d.ts +3 -0
- package/dist/components/text/fonts/sriracha.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/sriracha.outline.js +4 -0
- package/dist/components/text/fonts/sriracha.strokes.d.ts +3 -0
- package/dist/components/text/fonts/sriracha.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/sriracha.strokes.js +4 -0
- package/dist/components/text/index.d.ts +27 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +13 -0
- package/dist/components/text/useTextObject.d.ts +21 -0
- package/dist/components/text/useTextObject.d.ts.map +1 -0
- package/dist/components/text/useTextObject.js +118 -0
- package/dist/components/water/OceanSurface.d.ts.map +1 -1
- package/dist/components/water/OceanSurface.js +3 -1
- package/dist/components/water/WaterBody.d.ts.map +1 -1
- package/dist/components/water/WaterBody.js +3 -1
- package/dist/components/water/types.d.ts +5 -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 +5 -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/useCloudSun.d.ts +9 -4
- package/dist/hooks/useCloudSun.d.ts.map +1 -1
- package/dist/hooks/useCloudSun.js +17 -7
- package/dist/hooks/useConfigLive.d.ts +3 -2
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +4 -10
- package/dist/hooks/useEnvironmentProbe.d.ts +3 -22
- package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -1
- package/dist/hooks/useEnvironmentProbe.js +47 -8
- package/dist/hooks/useGridSurface.d.ts +3 -10
- package/dist/hooks/useGridSurface.d.ts.map +1 -1
- package/dist/hooks/useGridSurface.js +5 -31
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +19 -72
- package/dist/hooks/useLightConfig.d.ts +2 -1
- package/dist/hooks/useLightConfig.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.d.ts +6 -2
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.js +37 -2
- package/dist/hooks/useSkyLive.d.ts +23 -0
- package/dist/hooks/useSkyLive.d.ts.map +1 -0
- package/dist/hooks/useSkyLive.js +30 -0
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
- package/dist/hooks/useSkyUniforms.js +2 -10
- package/dist/hooks/useTerrainLive.d.ts +3 -1
- package/dist/hooks/useTerrainLive.d.ts.map +1 -1
- package/dist/hooks/useTerrainTextures.d.ts +38 -0
- package/dist/hooks/useTerrainTextures.d.ts.map +1 -0
- package/dist/hooks/useTerrainTextures.js +149 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/operations/catalogue/blastOff.d.ts +3 -0
- package/dist/operations/catalogue/blastOff.d.ts.map +1 -0
- package/dist/operations/catalogue/blastOff.js +118 -0
- package/dist/operations/catalogue/bounce.d.ts +3 -0
- package/dist/operations/catalogue/bounce.d.ts.map +1 -0
- package/dist/operations/catalogue/bounce.js +34 -0
- package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -1
- package/dist/operations/catalogue/curlSmoke.js +3 -1
- package/dist/operations/catalogue/dissolve.d.ts.map +1 -1
- package/dist/operations/catalogue/dissolve.js +2 -1
- package/dist/operations/catalogue/driftUp.d.ts +3 -0
- package/dist/operations/catalogue/driftUp.d.ts.map +1 -0
- package/dist/operations/catalogue/driftUp.js +57 -0
- package/dist/operations/catalogue/emberAsh.d.ts.map +1 -1
- package/dist/operations/catalogue/emberAsh.js +2 -1
- package/dist/operations/catalogue/flip.d.ts.map +1 -1
- package/dist/operations/catalogue/flip.js +19 -9
- package/dist/operations/catalogue/float.d.ts +3 -0
- package/dist/operations/catalogue/float.d.ts.map +1 -0
- package/dist/operations/catalogue/float.js +39 -0
- package/dist/operations/catalogue/flyBy.d.ts +3 -0
- package/dist/operations/catalogue/flyBy.d.ts.map +1 -0
- package/dist/operations/catalogue/flyBy.js +79 -0
- package/dist/operations/catalogue/frost.d.ts.map +1 -1
- package/dist/operations/catalogue/frost.js +10 -3
- package/dist/operations/catalogue/grow.d.ts +3 -0
- package/dist/operations/catalogue/grow.d.ts.map +1 -0
- package/dist/operations/catalogue/grow.js +19 -0
- package/dist/operations/catalogue/hologram.d.ts.map +1 -1
- package/dist/operations/catalogue/hologram.js +11 -5
- package/dist/operations/catalogue/jelly.d.ts.map +1 -1
- package/dist/operations/catalogue/jelly.js +18 -8
- package/dist/operations/catalogue/knockAway.d.ts +3 -0
- package/dist/operations/catalogue/knockAway.d.ts.map +1 -0
- package/dist/operations/catalogue/knockAway.js +74 -0
- package/dist/operations/catalogue/leafFall.d.ts +3 -0
- package/dist/operations/catalogue/leafFall.d.ts.map +1 -0
- package/dist/operations/catalogue/leafFall.js +74 -0
- package/dist/operations/catalogue/lidarScan.d.ts.map +1 -1
- package/dist/operations/catalogue/lidarScan.js +4 -1
- package/dist/operations/catalogue/metalize.d.ts.map +1 -1
- package/dist/operations/catalogue/metalize.js +8 -2
- package/dist/operations/catalogue/motionTrail.d.ts +6 -0
- package/dist/operations/catalogue/motionTrail.d.ts.map +1 -0
- package/dist/operations/catalogue/motionTrail.js +221 -0
- package/dist/operations/catalogue/petrify.d.ts.map +1 -1
- package/dist/operations/catalogue/petrify.js +9 -3
- package/dist/operations/catalogue/physicalExit.d.ts +55 -0
- package/dist/operations/catalogue/physicalExit.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalExit.js +165 -0
- package/dist/operations/catalogue/physicalHeld.d.ts +41 -0
- package/dist/operations/catalogue/physicalHeld.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalHeld.js +78 -0
- package/dist/operations/catalogue/physicalMix.d.ts +45 -0
- package/dist/operations/catalogue/physicalMix.d.ts.map +1 -0
- package/dist/operations/catalogue/physicalMix.js +144 -0
- package/dist/operations/catalogue/pop.d.ts +3 -0
- package/dist/operations/catalogue/pop.d.ts.map +1 -0
- package/dist/operations/catalogue/pop.js +44 -0
- package/dist/operations/catalogue/print3d.d.ts.map +1 -1
- package/dist/operations/catalogue/print3d.js +5 -1
- package/dist/operations/catalogue/pulse.d.ts +3 -0
- package/dist/operations/catalogue/pulse.d.ts.map +1 -0
- package/dist/operations/catalogue/pulse.js +29 -0
- package/dist/operations/catalogue/restPose.d.ts +5 -7
- package/dist/operations/catalogue/restPose.d.ts.map +1 -1
- package/dist/operations/catalogue/restPose.js +18 -48
- package/dist/operations/catalogue/rotate.d.ts +3 -0
- package/dist/operations/catalogue/rotate.d.ts.map +1 -0
- package/dist/operations/catalogue/rotate.js +49 -0
- package/dist/operations/catalogue/shake.d.ts +3 -0
- package/dist/operations/catalogue/shake.d.ts.map +1 -0
- package/dist/operations/catalogue/shake.js +31 -0
- package/dist/operations/catalogue/shatter.d.ts.map +1 -1
- package/dist/operations/catalogue/shatter.js +5 -1
- package/dist/operations/catalogue/slam.d.ts +3 -0
- package/dist/operations/catalogue/slam.d.ts.map +1 -0
- package/dist/operations/catalogue/slam.js +89 -0
- package/dist/operations/catalogue/slingshot.d.ts +3 -0
- package/dist/operations/catalogue/slingshot.d.ts.map +1 -0
- package/dist/operations/catalogue/slingshot.js +88 -0
- package/dist/operations/catalogue/spin.d.ts.map +1 -1
- package/dist/operations/catalogue/spin.js +24 -13
- package/dist/operations/catalogue/sway.d.ts +3 -0
- package/dist/operations/catalogue/sway.d.ts.map +1 -0
- package/dist/operations/catalogue/sway.js +23 -0
- package/dist/operations/catalogue/swirl.d.ts.map +1 -1
- package/dist/operations/catalogue/swirl.js +6 -5
- package/dist/operations/catalogue/trailCore.d.ts +89 -0
- package/dist/operations/catalogue/trailCore.d.ts.map +1 -0
- package/dist/operations/catalogue/trailCore.js +190 -0
- package/dist/operations/catalogue/trailGhosts.d.ts +5 -0
- package/dist/operations/catalogue/trailGhosts.d.ts.map +1 -0
- package/dist/operations/catalogue/trailGhosts.js +179 -0
- package/dist/operations/catalogue/trailStampStyles.d.ts +11 -0
- package/dist/operations/catalogue/trailStampStyles.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStampStyles.js +479 -0
- package/dist/operations/catalogue/trailStamps.d.ts +57 -0
- package/dist/operations/catalogue/trailStamps.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStamps.js +349 -0
- package/dist/operations/catalogue/trailStreaks.d.ts +3 -0
- package/dist/operations/catalogue/trailStreaks.d.ts.map +1 -0
- package/dist/operations/catalogue/trailStreaks.js +147 -0
- package/dist/operations/catalogue/transitionField.d.ts +30 -0
- package/dist/operations/catalogue/transitionField.d.ts.map +1 -1
- package/dist/operations/catalogue/transitionField.js +21 -0
- package/dist/operations/catalogue/turnAway.d.ts +3 -0
- package/dist/operations/catalogue/turnAway.d.ts.map +1 -0
- package/dist/operations/catalogue/turnAway.js +54 -0
- package/dist/operations/catalogue/vortexDrain.d.ts +3 -0
- package/dist/operations/catalogue/vortexDrain.d.ts.map +1 -0
- package/dist/operations/catalogue/vortexDrain.js +68 -0
- package/dist/operations/catalogue/warp.d.ts +3 -0
- package/dist/operations/catalogue/warp.d.ts.map +1 -0
- package/dist/operations/catalogue/warp.js +73 -0
- package/dist/operations/catalogue/whoosh.d.ts +3 -0
- package/dist/operations/catalogue/whoosh.d.ts.map +1 -0
- package/dist/operations/catalogue/whoosh.js +84 -0
- package/dist/operations/catalogue/wobble.d.ts +3 -0
- package/dist/operations/catalogue/wobble.d.ts.map +1 -0
- package/dist/operations/catalogue/wobble.js +23 -0
- package/dist/operations/clipPreview.d.ts +3 -0
- package/dist/operations/clipPreview.d.ts.map +1 -0
- package/dist/operations/clipPreview.js +20 -0
- package/dist/operations/groupFanout.d.ts +96 -0
- package/dist/operations/groupFanout.d.ts.map +1 -0
- package/dist/operations/groupFanout.js +365 -0
- package/dist/operations/groups.d.ts +20 -0
- package/dist/operations/groups.d.ts.map +1 -0
- package/dist/operations/groups.js +66 -0
- package/dist/operations/index.d.ts +5 -2
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +5 -2
- package/dist/operations/objectEffects.d.ts +161 -6
- package/dist/operations/objectEffects.d.ts.map +1 -1
- package/dist/operations/objectEffects.js +1091 -17
- package/dist/operations/registry.d.ts.map +1 -1
- package/dist/operations/registry.js +24 -2
- package/dist/operations/runtime.d.ts +57 -2
- package/dist/operations/runtime.d.ts.map +1 -1
- package/dist/operations/runtime.js +161 -18
- package/dist/operations/types.d.ts +60 -3
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +5 -1
- package/dist/operations/useObjectEffectLayers.d.ts +2 -2
- package/dist/operations/useObjectEffectLayers.d.ts.map +1 -1
- package/dist/operations/useObjectEffectLayers.js +31 -10
- package/dist/operations/usePresentedVisibility.d.ts +10 -0
- package/dist/operations/usePresentedVisibility.d.ts.map +1 -0
- package/dist/operations/usePresentedVisibility.js +53 -0
- package/dist/presets/terrainBiomes.d.ts +67 -0
- package/dist/presets/terrainBiomes.d.ts.map +1 -0
- package/dist/presets/terrainBiomes.js +294 -0
- package/dist/presets/terrainPresets.d.ts +6 -0
- package/dist/presets/terrainPresets.d.ts.map +1 -1
- package/dist/presets/terrainPresets.js +26 -38
- package/dist/shaders/glsl/oceanCore.glsl.d.ts +2 -2
- package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -1
- package/dist/shaders/glsl/oceanCore.glsl.js +17 -0
- package/dist/shaders/glsl/surfaceCore.glsl.d.ts +21 -0
- package/dist/shaders/glsl/surfaceCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/surfaceCore.glsl.js +120 -0
- package/dist/shaders/glsl/terrainCore.glsl.d.ts +16 -3
- package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -1
- package/dist/shaders/glsl/terrainCore.glsl.js +266 -20
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +2 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
- package/dist/shaders/ocean/OceanSurfaceMaterial.js +3 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts +17 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
- package/dist/shaders/terrain/TerrainMaterial.js +107 -8
- package/dist/triggers/engine.d.ts +44 -0
- package/dist/triggers/engine.d.ts.map +1 -0
- package/dist/triggers/engine.js +165 -0
- package/dist/triggers/hosts/actions.d.ts +8 -0
- package/dist/triggers/hosts/actions.d.ts.map +1 -0
- package/dist/triggers/hosts/actions.js +22 -0
- package/dist/triggers/hosts/interactions.d.ts +6 -0
- package/dist/triggers/hosts/interactions.d.ts.map +1 -0
- package/dist/triggers/hosts/interactions.js +4 -0
- package/dist/triggers/hosts/timelineCues.d.ts +2 -0
- package/dist/triggers/hosts/timelineCues.d.ts.map +1 -0
- package/dist/triggers/hosts/timelineCues.js +22 -0
- package/dist/triggers/index.d.ts +13 -0
- package/dist/triggers/index.d.ts.map +1 -0
- package/dist/triggers/index.js +9 -0
- package/dist/triggers/kinds/action.d.ts +2 -0
- package/dist/triggers/kinds/action.d.ts.map +1 -0
- package/dist/triggers/kinds/action.js +31 -0
- package/dist/triggers/kinds/animations.d.ts +2 -0
- package/dist/triggers/kinds/animations.d.ts.map +1 -0
- package/dist/triggers/kinds/animations.js +75 -0
- package/dist/triggers/kinds/effects.d.ts +2 -0
- package/dist/triggers/kinds/effects.d.ts.map +1 -0
- package/dist/triggers/kinds/effects.js +27 -0
- package/dist/triggers/kinds/index.d.ts +4 -0
- package/dist/triggers/kinds/index.d.ts.map +1 -0
- package/dist/triggers/kinds/index.js +4 -0
- package/dist/triggers/log.d.ts +21 -0
- package/dist/triggers/log.d.ts.map +1 -0
- package/dist/triggers/log.js +43 -0
- package/dist/triggers/readiness.d.ts +40 -0
- package/dist/triggers/readiness.d.ts.map +1 -0
- package/dist/triggers/readiness.js +158 -0
- package/dist/triggers/registry.d.ts +41 -0
- package/dist/triggers/registry.d.ts.map +1 -0
- package/dist/triggers/registry.js +7 -0
- package/dist/types/gridConfigs.d.ts +117 -19
- package/dist/types/gridConfigs.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/UiAnchorUpdater.d.ts +10 -0
- package/dist/ui/UiAnchorUpdater.d.ts.map +1 -0
- package/dist/ui/UiAnchorUpdater.js +111 -0
- package/dist/ui/UiLayers.d.ts +20 -0
- package/dist/ui/UiLayers.d.ts.map +1 -0
- package/dist/ui/UiLayers.js +57 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/uiAnchors.d.ts +21 -0
- package/dist/ui/uiAnchors.d.ts.map +1 -0
- package/dist/ui/uiAnchors.js +22 -0
- package/dist/ui/uiBaseStyles.d.ts +2 -0
- package/dist/ui/uiBaseStyles.d.ts.map +1 -0
- package/dist/ui/uiBaseStyles.js +100 -0
- package/dist/ui/uiBinder.d.ts +30 -0
- package/dist/ui/uiBinder.d.ts.map +1 -0
- package/dist/ui/uiBinder.js +344 -0
- package/dist/utils/configAnimations.d.ts.map +1 -1
- package/dist/utils/configAnimations.js +5 -1
- package/dist/utils/gridConfig.d.ts +1 -1
- package/dist/utils/gridConfig.d.ts.map +1 -1
- package/dist/utils/gridConfig.js +1 -1
- package/dist/utils/landPatch.d.ts +33 -0
- package/dist/utils/landPatch.d.ts.map +1 -0
- package/dist/utils/landPatch.js +114 -0
- package/dist/utils/renderedSky.d.ts +32 -0
- package/dist/utils/renderedSky.d.ts.map +1 -0
- package/dist/utils/renderedSky.js +57 -0
- package/dist/utils/skyMoon.d.ts +35 -0
- package/dist/utils/skyMoon.d.ts.map +1 -0
- package/dist/utils/skyMoon.js +41 -0
- package/dist/utils/terrainHeight.d.ts +4 -0
- package/dist/utils/terrainHeight.d.ts.map +1 -0
- package/dist/utils/terrainHeight.js +150 -0
- package/dist/utils/terrainTextureResolver.d.ts +18 -0
- package/dist/utils/terrainTextureResolver.d.ts.map +1 -0
- package/dist/utils/terrainTextureResolver.js +17 -0
- package/dist/utils/terrainUniforms.d.ts +17 -0
- package/dist/utils/terrainUniforms.d.ts.map +1 -1
- package/dist/utils/terrainUniforms.js +84 -0
- package/dist/utils/textureArrays.d.ts +29 -0
- package/dist/utils/textureArrays.d.ts.map +1 -0
- package/dist/utils/textureArrays.js +140 -0
- package/package.json +2 -2
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
3
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
4
|
+
import { useFrame } from '@react-three/fiber';
|
|
5
|
+
import { Vector3, BufferGeometry, BufferAttribute, AdditiveBlending } from 'three';
|
|
6
|
+
import { ShootingStarMaterial } from '@3driseai/3drise-core';
|
|
7
|
+
const ShootingStar = ({ position = [0, 0, 0], direction = [1, -1, 0], speed = 0.05, color = '#ffffff', colorRef, trailLength = 30, size = 0.1, opacity = 1.0, onComplete, maxDistance = 50, followMouse = true, onObjectReady, onObjectDispose, }) => {
|
|
8
|
+
const starRef = useRef(null);
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
useObjectReady(rootRef, { position, direction, speed, color, size, opacity, maxDistance, followMouse }, onObjectReady, onObjectDispose);
|
|
11
|
+
const glowRef = useRef(null);
|
|
12
|
+
const trailRef = useRef(null);
|
|
13
|
+
// One trail material per meteor (it was re-created on every render and never faded).
|
|
14
|
+
const trailMaterial = useMemo(() => new ShootingStarMaterial(), []);
|
|
15
|
+
const starMaterialRef = useRef(null);
|
|
16
|
+
const glowMaterialRef = useRef(null);
|
|
17
|
+
const trailPositions = useRef([]);
|
|
18
|
+
const currentPosition = useRef(new Vector3(...position));
|
|
19
|
+
const directionVector = useRef(new Vector3(...direction).normalize());
|
|
20
|
+
const distanceTraveled = useRef(0);
|
|
21
|
+
const fadeInDistance = maxDistance * 0.15;
|
|
22
|
+
const fadeOutDistance = maxDistance * 0.15;
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const validTrailLength = Math.max(2, trailLength);
|
|
25
|
+
trailPositions.current = Array(validTrailLength).fill(null).map(() => currentPosition.current.clone());
|
|
26
|
+
currentPosition.current.set(...position);
|
|
27
|
+
directionVector.current.set(...direction).normalize();
|
|
28
|
+
distanceTraveled.current = 0;
|
|
29
|
+
if (starRef.current)
|
|
30
|
+
starRef.current.position.set(...position);
|
|
31
|
+
}, [trailLength, position, direction]);
|
|
32
|
+
const trailGeometry = useMemo(() => {
|
|
33
|
+
const validTrailLength = Math.max(2, trailLength);
|
|
34
|
+
const geometry = new BufferGeometry();
|
|
35
|
+
const positions = new Float32Array(validTrailLength * 3);
|
|
36
|
+
const progress = new Float32Array(validTrailLength);
|
|
37
|
+
const indices = [];
|
|
38
|
+
for (let i = 0; i < validTrailLength - 1; i++)
|
|
39
|
+
indices.push(i, i + 1);
|
|
40
|
+
for (let i = 0; i < validTrailLength; i++) {
|
|
41
|
+
positions[i * 3] = position[0];
|
|
42
|
+
positions[i * 3 + 1] = position[1];
|
|
43
|
+
positions[i * 3 + 2] = position[2];
|
|
44
|
+
progress[i] = i / (validTrailLength - 1);
|
|
45
|
+
}
|
|
46
|
+
geometry.setAttribute('position', new BufferAttribute(positions, 3));
|
|
47
|
+
geometry.setAttribute('progress', new BufferAttribute(progress, 1));
|
|
48
|
+
geometry.setIndex(indices);
|
|
49
|
+
return geometry;
|
|
50
|
+
}, [trailLength, position]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
return () => {
|
|
53
|
+
trailGeometry.dispose();
|
|
54
|
+
starMaterialRef.current?.dispose();
|
|
55
|
+
glowMaterialRef.current?.dispose();
|
|
56
|
+
};
|
|
57
|
+
}, [trailGeometry]);
|
|
58
|
+
useEffect(() => () => trailMaterial.dispose(), [trailMaterial]);
|
|
59
|
+
useFrame((state, delta) => {
|
|
60
|
+
if (!trailRef.current || !starRef.current)
|
|
61
|
+
return;
|
|
62
|
+
if (colorRef) {
|
|
63
|
+
const c = colorRef.current;
|
|
64
|
+
starMaterialRef.current?.color.copy(c);
|
|
65
|
+
glowMaterialRef.current?.color.copy(c);
|
|
66
|
+
trailMaterial.color.copy(c);
|
|
67
|
+
}
|
|
68
|
+
if (followMouse) {
|
|
69
|
+
directionVector.current.set(-state.pointer.x, state.pointer.y, direction[2]).normalize();
|
|
70
|
+
}
|
|
71
|
+
const movement = directionVector.current.clone().multiplyScalar(speed);
|
|
72
|
+
currentPosition.current.add(movement);
|
|
73
|
+
distanceTraveled.current += speed;
|
|
74
|
+
let starOpacity = opacity;
|
|
75
|
+
if (distanceTraveled.current < fadeInDistance) {
|
|
76
|
+
starOpacity = opacity * (distanceTraveled.current / fadeInDistance);
|
|
77
|
+
}
|
|
78
|
+
else if (distanceTraveled.current > maxDistance - fadeOutDistance) {
|
|
79
|
+
starOpacity = opacity * ((maxDistance - distanceTraveled.current) / fadeOutDistance);
|
|
80
|
+
}
|
|
81
|
+
starRef.current.position.copy(currentPosition.current);
|
|
82
|
+
if (starMaterialRef.current)
|
|
83
|
+
starMaterialRef.current.opacity = starOpacity;
|
|
84
|
+
if (glowMaterialRef.current)
|
|
85
|
+
glowMaterialRef.current.opacity = starOpacity * 0.3;
|
|
86
|
+
trailMaterial.opacity = starOpacity;
|
|
87
|
+
trailPositions.current.unshift(currentPosition.current.clone());
|
|
88
|
+
if (trailPositions.current.length > trailLength)
|
|
89
|
+
trailPositions.current.pop();
|
|
90
|
+
const posAttr = trailGeometry.getAttribute('position');
|
|
91
|
+
for (let i = 0; i < trailPositions.current.length; i++) {
|
|
92
|
+
const pos = trailPositions.current[i];
|
|
93
|
+
posAttr.setXYZ(i, pos.x, pos.y, pos.z);
|
|
94
|
+
}
|
|
95
|
+
posAttr.needsUpdate = true;
|
|
96
|
+
if (distanceTraveled.current > maxDistance)
|
|
97
|
+
onComplete?.();
|
|
98
|
+
});
|
|
99
|
+
return (_jsxs("group", { ref: rootRef, children: [_jsx("lineSegments", { ref: trailRef, geometry: trailGeometry, children: _jsx("primitive", { object: trailMaterial, attach: "material", transparent: true, blending: AdditiveBlending, depthWrite: false }) }), _jsxs("mesh", { ref: starRef, children: [_jsx("sphereGeometry", { args: [size, 8, 8] }), _jsx("meshBasicMaterial", { ref: starMaterialRef, color: color, transparent: true, opacity: opacity, blending: AdditiveBlending, depthWrite: false }), _jsxs("mesh", { ref: glowRef, children: [_jsx("sphereGeometry", { args: [size * 2, 8, 8] }), _jsx("meshBasicMaterial", { ref: glowMaterialRef, color: color, transparent: true, opacity: opacity * 0.3, blending: AdditiveBlending, depthWrite: false })] })] })] }));
|
|
100
|
+
};
|
|
101
|
+
export default ShootingStar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
2
|
+
import type { AnimationOptions, MouseMoveDomain, ShootingStarsSpaceConfig } from '@3driseai/3drise-core';
|
|
3
|
+
import React from "react";
|
|
4
|
+
export interface ShootingStarsProps extends ObjectReadyProps {
|
|
5
|
+
/** The object's config (config.type 'shootingStars'); missing keys fall back to DEFAULT_SPACE_OBJECTS.shootingStars. */
|
|
6
|
+
config?: Partial<ShootingStarsSpaceConfig>;
|
|
7
|
+
/** Scene object id: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on the config knobs (animations.space.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on the config knobs (mouseMove.space). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
13
|
+
}
|
|
14
|
+
declare const ShootingStars: React.FC<ShootingStarsProps>;
|
|
15
|
+
export default ShootingStars;
|
|
16
|
+
//# sourceMappingURL=ShootingStars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShootingStars.d.ts","sourceRoot":"","sources":["../../../src/components/space/ShootingStars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAyB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAIhI,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,wHAAwH;IACxH,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3C,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+C/C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
3
|
+
import { useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect } from 'react';
|
|
4
|
+
import { Color } from 'three';
|
|
5
|
+
import { generateShootingStar, generateShootingStars, DEFAULT_SPACE_OBJECTS, SPACE_OBJECTS_ANIMATABLE } from '@3driseai/3drise-core';
|
|
6
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
7
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
8
|
+
import ShootingStar from './ShootingStar.js';
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// ShootingStars — meteors relaunched after a random pause (space object 'shootingStars')
|
|
11
|
+
// =============================================================================
|
|
12
|
+
//
|
|
13
|
+
// count / ranges are committed values (a new count regenerates the meteors). The
|
|
14
|
+
// colour reaches every meteor only through `push`, the one door live drag,
|
|
15
|
+
// keyframes (animations.space) and pointer bindings (mouseMove.space) go through:
|
|
16
|
+
// it writes one shared Color the meteors copy into their materials each frame.
|
|
17
|
+
//
|
|
18
|
+
const DEFAULTS = DEFAULT_SPACE_OBJECTS.shootingStars;
|
|
19
|
+
const STRUCTURAL = ['count'];
|
|
20
|
+
const ANIMATABLE = new Set(SPACE_OBJECTS_ANIMATABLE.shootingStars.map((p) => p.value));
|
|
21
|
+
const ShootingStars = ({ config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
22
|
+
const rootRef = useRef(null);
|
|
23
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULTS, config), [config]);
|
|
24
|
+
const gen = cfg;
|
|
25
|
+
useObjectReady(rootRef, cfg, onObjectReady, onObjectDispose);
|
|
26
|
+
const [shootingStars, setShootingStars] = useState(() => (cfg.enabled ? generateShootingStars(cfg.count, gen) : []));
|
|
27
|
+
const nextIdRef = useRef(cfg.count || 0);
|
|
28
|
+
const cfgRef = useRef(cfg);
|
|
29
|
+
useEffect(() => { cfgRef.current = cfg; }, [cfg]);
|
|
30
|
+
// Relaunch timers, cleared when the meteors are regenerated or the object goes.
|
|
31
|
+
const timers = useRef(new Set());
|
|
32
|
+
const clearTimers = useCallback(() => { for (const t of timers.current)
|
|
33
|
+
clearTimeout(t); timers.current.clear(); }, []);
|
|
34
|
+
useEffect(() => clearTimers, [clearTimers]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
clearTimers();
|
|
37
|
+
if (cfg.enabled) {
|
|
38
|
+
setShootingStars(generateShootingStars(cfg.count, gen));
|
|
39
|
+
nextIdRef.current = cfg.count;
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
setShootingStars([]);
|
|
43
|
+
}, [cfg.enabled, cfg.count]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
44
|
+
const handleComplete = useCallback((starId) => {
|
|
45
|
+
setShootingStars(prev => prev.filter(star => star.id !== starId));
|
|
46
|
+
const [lo, hi] = cfgRef.current.intervalRange ?? [0, 0];
|
|
47
|
+
const delay = Math.max(0, lo + Math.random() * Math.max(0, hi - lo));
|
|
48
|
+
const t = setTimeout(() => {
|
|
49
|
+
timers.current.delete(t);
|
|
50
|
+
const c = cfgRef.current;
|
|
51
|
+
if (!c.enabled)
|
|
52
|
+
return;
|
|
53
|
+
setShootingStars(prev => prev.length >= c.count ? prev : [...prev, generateShootingStar(nextIdRef.current++, c)]);
|
|
54
|
+
}, delay * 1000);
|
|
55
|
+
timers.current.add(t);
|
|
56
|
+
}, []);
|
|
57
|
+
const colorRef = useRef(new Color(cfg.color));
|
|
58
|
+
const push = useCallback((m) => {
|
|
59
|
+
const c = m.color;
|
|
60
|
+
if (c === undefined)
|
|
61
|
+
return;
|
|
62
|
+
if (c?.isColor)
|
|
63
|
+
colorRef.current.copy(c);
|
|
64
|
+
else
|
|
65
|
+
colorRef.current.set(c);
|
|
66
|
+
}, []);
|
|
67
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
68
|
+
useConfigDriver({ rootRef, id, family: 'space', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
69
|
+
return (_jsx("group", { ref: rootRef, children: cfg.enabled && shootingStars.map(star => (_jsx(ShootingStar, { position: star.position, direction: star.direction, speed: star.speed, colorRef: colorRef, trailLength: star.trailLength, size: 0.08, opacity: 0.9, maxDistance: star.length, onComplete: () => handleComplete(star.id), followMouse: cfg.followMouse }, star.id))) }));
|
|
70
|
+
};
|
|
71
|
+
export default ShootingStars;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { AnimationOptions, MouseMoveDomain, SolarSystemSpaceConfig } from "@3driseai/3drise-core";
|
|
4
|
+
export type SolarSystemProps = ObjectReadyProps & {
|
|
5
|
+
/** The object's config (config.type 'solarSystem'); missing keys fall back to DEFAULT_SPACE_OBJECTS.solarSystem. */
|
|
6
|
+
config?: Partial<SolarSystemSpaceConfig>;
|
|
7
|
+
/** Scene object id: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on the config knobs (animations.space.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on the config knobs (mouseMove.space). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
13
|
+
};
|
|
14
|
+
declare const SolarSystem: React.FC<SolarSystemProps>;
|
|
15
|
+
export default SolarSystem;
|
|
16
|
+
//# sourceMappingURL=SolarSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolarSystem.d.ts","sourceRoot":"","sources":["../../../src/components/space/SolarSystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAWhE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AA4EvG,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG;IAC9C,oHAAoH;IACpH,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsD3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
3
|
+
import { useRef, useMemo, useState, useCallback, useLayoutEffect } from 'react';
|
|
4
|
+
import { BufferGeometry, BufferAttribute, Vector3, Color } from 'three';
|
|
5
|
+
import { useFrame } from '@react-three/fiber';
|
|
6
|
+
import Planet from '../Planet.js';
|
|
7
|
+
import Earth from './Earth.js';
|
|
8
|
+
import Sun from '../Sun.js';
|
|
9
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
10
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
11
|
+
import { DEFAULT_SPACE_OBJECTS, SPACE_OBJECTS_ANIMATABLE } from "@3driseai/3drise-core";
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// SolarSystem — sun, eight planets on circular orbits (space object 'solarSystem')
|
|
14
|
+
// =============================================================================
|
|
15
|
+
//
|
|
16
|
+
// Orbits and planet spins are internal motion (sub-bodies moving inside the
|
|
17
|
+
// object); the system as a whole never turns. The orbit time scale, the sun's
|
|
18
|
+
// tint / brightness and the rings' colour / opacity reach the scene only through
|
|
19
|
+
// `push`, the one door live drag, keyframes (animations.space) and pointer
|
|
20
|
+
// bindings (mouseMove.space) go through. The time scale is integrated per frame
|
|
21
|
+
// (phase += delta * rate), so animating it never makes a planet jump.
|
|
22
|
+
//
|
|
23
|
+
const DEFAULTS = DEFAULT_SPACE_OBJECTS.solarSystem;
|
|
24
|
+
const STRUCTURAL = ['sunRadius'];
|
|
25
|
+
const ANIMATABLE = new Set(SPACE_OBJECTS_ANIMATABLE.solarSystem.map((p) => p.value));
|
|
26
|
+
// Stylized constants — distances compressed, sizes exaggerated for legibility.
|
|
27
|
+
const PLANETS = [
|
|
28
|
+
{ body: { name: 'mercury', kind: 'planet', type: 'mercury' }, radius: 0.6, orbitRadius: 18, periodYears: 0.24, axialTilt: 0.03, spinRate: 1.0, initialPhase: 0.2 },
|
|
29
|
+
{ body: { name: 'venus', kind: 'planet', type: 'venus' }, radius: 1.2, orbitRadius: 26, periodYears: 0.62, axialTilt: 3.10, spinRate: -0.4, initialPhase: 1.1 },
|
|
30
|
+
{ body: { name: 'earth', kind: 'earth' }, radius: 1.3, orbitRadius: 36, periodYears: 1.00, axialTilt: 0.41, spinRate: 1.0, initialPhase: 2.3 },
|
|
31
|
+
{ body: { name: 'mars', kind: 'planet', type: 'mars' }, radius: 0.9, orbitRadius: 46, periodYears: 1.88, axialTilt: 0.44, spinRate: 0.97, initialPhase: 3.7 },
|
|
32
|
+
{ body: { name: 'jupiter', kind: 'planet', type: 'jupiter' }, radius: 3.6, orbitRadius: 70, periodYears: 11.86, axialTilt: 0.05, spinRate: 2.4, initialPhase: 0.8 },
|
|
33
|
+
{ body: { name: 'saturn', kind: 'planet', type: 'saturn' }, radius: 3.2, orbitRadius: 92, periodYears: 29.46, axialTilt: 0.47, spinRate: 2.2, initialPhase: 4.2 },
|
|
34
|
+
{ body: { name: 'uranus', kind: 'planet', type: 'uranus' }, radius: 2.0, orbitRadius: 114, periodYears: 84.0, axialTilt: 1.71, spinRate: 1.4, initialPhase: 5.5 },
|
|
35
|
+
{ body: { name: 'neptune', kind: 'planet', type: 'neptune' }, radius: 2.0, orbitRadius: 134, periodYears: 164.8, axialTilt: 0.49, spinRate: 1.5, initialPhase: 1.9 },
|
|
36
|
+
];
|
|
37
|
+
// Default: one Earth-year = 8 scene-seconds.
|
|
38
|
+
const EARTH_YEAR_SECONDS = 8;
|
|
39
|
+
const setColor = (target, v) => { if (v?.isColor)
|
|
40
|
+
target.copy(v);
|
|
41
|
+
else
|
|
42
|
+
target.set(v); };
|
|
43
|
+
const OrbitRing = ({ radius, rings }) => {
|
|
44
|
+
const matRef = useRef(null);
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
const m = matRef.current;
|
|
47
|
+
if (!m)
|
|
48
|
+
return;
|
|
49
|
+
rings.add(m);
|
|
50
|
+
return () => rings.remove(m);
|
|
51
|
+
}, [rings]);
|
|
52
|
+
const geometry = useMemo(() => {
|
|
53
|
+
const segments = 128;
|
|
54
|
+
const points = new Float32Array((segments + 1) * 3);
|
|
55
|
+
for (let i = 0; i <= segments; i++) {
|
|
56
|
+
const t = (i / segments) * Math.PI * 2;
|
|
57
|
+
points[i * 3 + 0] = Math.cos(t) * radius;
|
|
58
|
+
points[i * 3 + 1] = 0;
|
|
59
|
+
points[i * 3 + 2] = Math.sin(t) * radius;
|
|
60
|
+
}
|
|
61
|
+
const geom = new BufferGeometry();
|
|
62
|
+
geom.setAttribute('position', new BufferAttribute(points, 3));
|
|
63
|
+
return geom;
|
|
64
|
+
}, [radius]);
|
|
65
|
+
return (_jsx("lineLoop", { geometry: geometry, children: _jsx("lineBasicMaterial", { ref: matRef, transparent: true, depthWrite: false }) }));
|
|
66
|
+
};
|
|
67
|
+
const OrbitedBody = ({ orbitRadius, orbitRate, spinRate, axialTilt, enableOrbit, enableSelfRotation, initialPhase, rateRef, onWorldPositionChange, children, }) => {
|
|
68
|
+
const orbitRef = useRef(null);
|
|
69
|
+
const spinRef = useRef(null);
|
|
70
|
+
const worldPosRef = useRef(new Vector3());
|
|
71
|
+
useFrame((_, delta) => {
|
|
72
|
+
const dt = Math.min(delta, 0.1) * rateRef.current;
|
|
73
|
+
if (enableOrbit && orbitRef.current)
|
|
74
|
+
orbitRef.current.rotation.y += dt * orbitRate;
|
|
75
|
+
if (enableSelfRotation && spinRef.current)
|
|
76
|
+
spinRef.current.rotation.y += dt * spinRate;
|
|
77
|
+
if (onWorldPositionChange && spinRef.current) {
|
|
78
|
+
spinRef.current.getWorldPosition(worldPosRef.current);
|
|
79
|
+
onWorldPositionChange(worldPosRef.current);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return (_jsx("group", { ref: orbitRef, "rotation-y": initialPhase, children: _jsx("group", { position: [orbitRadius, 0, 0], "rotation-z": axialTilt, children: _jsx("group", { ref: spinRef, children: children }) }) }));
|
|
83
|
+
};
|
|
84
|
+
const SolarSystem = ({ config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
85
|
+
const { enableOrbit, enableSelfRotation, showOrbitRings, orbitSpeedMultiplier, sunColor, sunRadius, sunIntensity, orbitRingColor, orbitRingOpacity } = config ?? {};
|
|
86
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULTS, { enableOrbit, enableSelfRotation, showOrbitRings, orbitSpeedMultiplier, sunColor, sunRadius, sunIntensity, orbitRingColor, orbitRingOpacity }), [enableOrbit, enableSelfRotation, showOrbitRings, orbitSpeedMultiplier, sunColor, sunRadius, sunIntensity, orbitRingColor, orbitRingOpacity]);
|
|
87
|
+
const [earthSunPos, setEarthSunPos] = useState([1, 0, 0]);
|
|
88
|
+
const lastEarthSyncRef = useRef(0);
|
|
89
|
+
const ref = useRef(null);
|
|
90
|
+
// Stable identity: an inline userData object is re-applied on every render and wipes the live handle stored on it.
|
|
91
|
+
const userData = useMemo(() => ({ id: '3drise-solar-system' }), []);
|
|
92
|
+
useObjectReady(ref, cfg, onObjectReady, onObjectDispose);
|
|
93
|
+
// Live state the push point writes and the frame loops read.
|
|
94
|
+
const rateRef = useRef(cfg.orbitSpeedMultiplier);
|
|
95
|
+
const sunControl = useRef({ color: new Color(cfg.sunColor), intensity: cfg.sunIntensity });
|
|
96
|
+
const ringMats = useRef(new Set());
|
|
97
|
+
const ringStyle = useRef({ color: new Color(cfg.orbitRingColor), opacity: cfg.orbitRingOpacity });
|
|
98
|
+
const applyRings = useCallback(() => {
|
|
99
|
+
for (const m of ringMats.current) {
|
|
100
|
+
m.color.copy(ringStyle.current.color);
|
|
101
|
+
m.opacity = ringStyle.current.opacity;
|
|
102
|
+
}
|
|
103
|
+
}, []);
|
|
104
|
+
const rings = useMemo(() => ({
|
|
105
|
+
add(m) { ringMats.current.add(m); m.color.copy(ringStyle.current.color); m.opacity = ringStyle.current.opacity; },
|
|
106
|
+
remove(m) { ringMats.current.delete(m); },
|
|
107
|
+
}), []);
|
|
108
|
+
const push = useCallback((m) => {
|
|
109
|
+
if (typeof m.orbitSpeedMultiplier === 'number')
|
|
110
|
+
rateRef.current = m.orbitSpeedMultiplier;
|
|
111
|
+
if (m.sunColor !== undefined)
|
|
112
|
+
setColor(sunControl.current.color, m.sunColor);
|
|
113
|
+
if (typeof m.sunIntensity === 'number')
|
|
114
|
+
sunControl.current.intensity = m.sunIntensity;
|
|
115
|
+
if (m.orbitRingColor !== undefined)
|
|
116
|
+
setColor(ringStyle.current.color, m.orbitRingColor);
|
|
117
|
+
if (typeof m.orbitRingOpacity === 'number')
|
|
118
|
+
ringStyle.current.opacity = m.orbitRingOpacity;
|
|
119
|
+
applyRings();
|
|
120
|
+
}, [applyRings]);
|
|
121
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
122
|
+
useConfigDriver({ rootRef: ref, id, family: 'space', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
123
|
+
const handleEarthWorld = useCallback((p) => {
|
|
124
|
+
const now = performance.now();
|
|
125
|
+
if (now - lastEarthSyncRef.current < 100)
|
|
126
|
+
return;
|
|
127
|
+
lastEarthSyncRef.current = now;
|
|
128
|
+
setEarthSunPos([-p.x, -p.y, -p.z]);
|
|
129
|
+
}, []);
|
|
130
|
+
return (_jsxs("group", { userData: userData, ref: ref, children: [_jsx(Sun, { radius: cfg.sunRadius, control: sunControl }), cfg.showOrbitRings &&
|
|
131
|
+
PLANETS.map((p) => (_jsx(OrbitRing, { radius: p.orbitRadius, rings: rings }, `ring-${p.body.name}`))), PLANETS.map((p) => {
|
|
132
|
+
const orbitRate = (2 * Math.PI) / (p.periodYears * EARTH_YEAR_SECONDS);
|
|
133
|
+
const common = { orbitRadius: p.orbitRadius, orbitRate, spinRate: p.spinRate, axialTilt: p.axialTilt, enableOrbit: cfg.enableOrbit, enableSelfRotation: cfg.enableSelfRotation, initialPhase: p.initialPhase, rateRef };
|
|
134
|
+
if (p.body.kind === 'earth') {
|
|
135
|
+
return (_jsx(OrbitedBody, { ...common, onWorldPositionChange: handleEarthWorld, children: _jsx(Earth, { config: { radius: p.radius, sunPosition: earthSunPos, atmosphereDayColor: '#6db3f2', atmosphereTwilightColor: '#d97e54' } }) }, "earth"));
|
|
136
|
+
}
|
|
137
|
+
return (_jsx(OrbitedBody, { ...common, children: _jsx(Planet, { type: p.body.type, scale: p.radius }) }, p.body.name));
|
|
138
|
+
})] }));
|
|
139
|
+
};
|
|
140
|
+
SolarSystem.displayName = 'SolarSystem';
|
|
141
|
+
export default SolarSystem;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
2
|
+
import { BufferGeometry } from 'three';
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { AnimationOptions, MouseMoveDomain, StarsSpaceConfig, TimeSettings } from "@3driseai/3drise-core";
|
|
5
|
+
export interface StarsProps extends ObjectReadyProps {
|
|
6
|
+
/** The object's config (config.type 'stars'); missing keys fall back to DEFAULT_SPACE_OBJECTS.stars. */
|
|
7
|
+
config?: Partial<StarsSpaceConfig>;
|
|
8
|
+
timeSettings?: TimeSettings;
|
|
9
|
+
sunSystemEnabled?: boolean;
|
|
10
|
+
/** Scene object id: the live-edit handle is found by it. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Keyframes on the config knobs (animations.space.animations). */
|
|
13
|
+
keyframes?: AnimationOptions[];
|
|
14
|
+
/** Pointer bindings on the config knobs (mouseMove.space). */
|
|
15
|
+
mouseMove?: MouseMoveDomain;
|
|
16
|
+
}
|
|
17
|
+
export declare function generateStarsGeometry(count: number): BufferGeometry;
|
|
18
|
+
declare const Stars: React.FC<StarsProps>;
|
|
19
|
+
export default Stars;
|
|
20
|
+
//# sourceMappingURL=Stars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stars.d.ts","sourceRoot":"","sources":["../../../src/components/space/Stars.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAqC,MAAM,OAAO,CAAC;AAM1E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAe/G,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,wGAAwG;IACxG,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAQD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAuDnE;AAYD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA0E/B,CAAC;AACF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
3
|
+
import { useRef, useMemo, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
4
|
+
import { BufferGeometry, BufferAttribute, AdditiveBlending } from 'three';
|
|
5
|
+
import { useFrame } from '@react-three/fiber';
|
|
6
|
+
import { useSkySystem } from '../../hooks/useSkySystem.js';
|
|
7
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
8
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
9
|
+
import { DEFAULT_SPACE_OBJECTS, SPACE_OBJECTS_ANIMATABLE } from "@3driseai/3drise-core";
|
|
10
|
+
const DEFAULTS = DEFAULT_SPACE_OBJECTS.stars;
|
|
11
|
+
/** Knobs that rebuild the field: never live, they change once, on commit. */
|
|
12
|
+
const STRUCTURAL = ['count'];
|
|
13
|
+
/** Knobs a keyframe or pointer binding may drive per frame — exactly what push applies. */
|
|
14
|
+
const ANIMATABLE = new Set(SPACE_OBJECTS_ANIMATABLE.stars.map((p) => p.value));
|
|
15
|
+
export function generateStarsGeometry(count) {
|
|
16
|
+
const halfCount = Math.floor(count / 2);
|
|
17
|
+
const geometry = new BufferGeometry();
|
|
18
|
+
const topPositions = new Float32Array(halfCount * 3);
|
|
19
|
+
for (let i = 0; i < halfCount; i++) {
|
|
20
|
+
const u = Math.random();
|
|
21
|
+
const v = Math.random() * 0.5 + 0.5;
|
|
22
|
+
const theta = 2 * Math.PI * u;
|
|
23
|
+
const phi = Math.acos(2 * v - 1);
|
|
24
|
+
topPositions.set([
|
|
25
|
+
Math.sin(phi) * Math.cos(theta),
|
|
26
|
+
Math.cos(phi),
|
|
27
|
+
Math.sin(phi) * Math.sin(theta),
|
|
28
|
+
], i * 3);
|
|
29
|
+
}
|
|
30
|
+
const positions = new Float32Array(halfCount * 6);
|
|
31
|
+
positions.set(topPositions, 0);
|
|
32
|
+
for (let i = 0; i < halfCount; i++) {
|
|
33
|
+
positions.set([topPositions[i * 3], -topPositions[i * 3 + 1], topPositions[i * 3 + 2]], (i + halfCount) * 3);
|
|
34
|
+
}
|
|
35
|
+
const colors = new Float32Array(halfCount * 3);
|
|
36
|
+
for (let i = 0; i < halfCount; i++) {
|
|
37
|
+
const v = Math.random();
|
|
38
|
+
const c = v < 0.15 ? [0.8, 0.85, 1.0] : v < 0.3 ? [1.0, 0.95, 0.8] : [1.0, 1.0, 1.0];
|
|
39
|
+
colors.set(c, i * 3);
|
|
40
|
+
}
|
|
41
|
+
const mirroredColors = new Float32Array(halfCount * 6);
|
|
42
|
+
mirroredColors.set(colors, 0);
|
|
43
|
+
mirroredColors.set(colors, colors.length);
|
|
44
|
+
const sizes = new Float32Array(halfCount);
|
|
45
|
+
for (let i = 0; i < halfCount; i++) {
|
|
46
|
+
const v = Math.random();
|
|
47
|
+
sizes[i] = v < 0.01 ? 40 + Math.random() * 20 : v < 0.05 ? 25 + Math.random() * 15 : v < 0.2 ? 15 + Math.random() * 10 : 5 + Math.random() * 5;
|
|
48
|
+
}
|
|
49
|
+
const mirroredSizes = new Float32Array(halfCount * 2);
|
|
50
|
+
mirroredSizes.set(sizes, 0);
|
|
51
|
+
mirroredSizes.set(sizes, sizes.length);
|
|
52
|
+
const phases = new Float32Array(halfCount);
|
|
53
|
+
for (let i = 0; i < halfCount; i++)
|
|
54
|
+
phases[i] = Math.random() * Math.PI * 2;
|
|
55
|
+
const mirroredPhases = new Float32Array(halfCount * 2);
|
|
56
|
+
mirroredPhases.set(phases, 0);
|
|
57
|
+
mirroredPhases.set(phases, phases.length);
|
|
58
|
+
const freqs = new Float32Array(halfCount);
|
|
59
|
+
for (let i = 0; i < halfCount; i++)
|
|
60
|
+
freqs[i] = 1.0 + Math.random() * 2.0;
|
|
61
|
+
const mirroredFreqs = new Float32Array(halfCount * 2);
|
|
62
|
+
mirroredFreqs.set(freqs, 0);
|
|
63
|
+
mirroredFreqs.set(freqs, freqs.length);
|
|
64
|
+
geometry.setAttribute('position', new BufferAttribute(positions, 3));
|
|
65
|
+
geometry.setAttribute('color', new BufferAttribute(mirroredColors, 3));
|
|
66
|
+
geometry.setAttribute('size', new BufferAttribute(mirroredSizes, 1));
|
|
67
|
+
geometry.setAttribute('phase', new BufferAttribute(mirroredPhases, 1));
|
|
68
|
+
geometry.setAttribute('freq', new BufferAttribute(mirroredFreqs, 1));
|
|
69
|
+
return geometry;
|
|
70
|
+
}
|
|
71
|
+
// Module-scoped so the reference is stable across renders. A new object per
|
|
72
|
+
// render would make useSkySystem's [timeSettings] effect re-fire on every
|
|
73
|
+
// Stars re-render, stomping skySystemManager.enabled back to false between parent ticks.
|
|
74
|
+
const DEFAULT_TIME_SETTINGS = {
|
|
75
|
+
enabled: false,
|
|
76
|
+
timeOfDay: 12,
|
|
77
|
+
timescale: 60,
|
|
78
|
+
autoAnimate: false,
|
|
79
|
+
syncWithRealTime: false,
|
|
80
|
+
};
|
|
81
|
+
const Stars = ({ config, timeSettings, sunSystemEnabled = false, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
82
|
+
const pointsRef = useRef(null);
|
|
83
|
+
const materialRef = useRef(null);
|
|
84
|
+
// Stable identity: an inline userData object is re-applied on every render and wipes the live handle stored on it.
|
|
85
|
+
const userData = useMemo(() => ({ id: '3drise-stars' }), []);
|
|
86
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULTS, config), [config]);
|
|
87
|
+
useObjectReady(pointsRef, cfg, onObjectReady, onObjectDispose);
|
|
88
|
+
const geometry = useMemo(() => generateStarsGeometry(cfg.count), [cfg.count]);
|
|
89
|
+
useEffect(() => () => { geometry.dispose(); }, [geometry]);
|
|
90
|
+
// The configured opacity (push) times the day / night fade (sky system).
|
|
91
|
+
const opacityRef = useRef(cfg.opacity);
|
|
92
|
+
const fadeRef = useRef(1);
|
|
93
|
+
const targetFadeRef = useRef(1);
|
|
94
|
+
const push = useCallback((m) => {
|
|
95
|
+
const mat = materialRef.current;
|
|
96
|
+
if (typeof m.opacity === 'number')
|
|
97
|
+
opacityRef.current = m.opacity;
|
|
98
|
+
if (!mat)
|
|
99
|
+
return;
|
|
100
|
+
if (typeof m.starSize === 'number')
|
|
101
|
+
mat.sizeScale = m.starSize;
|
|
102
|
+
const c = m.color;
|
|
103
|
+
if (c !== undefined && mat.uColor) {
|
|
104
|
+
if (c?.isColor)
|
|
105
|
+
mat.uColor.copy(c);
|
|
106
|
+
else
|
|
107
|
+
mat.uColor.set(c);
|
|
108
|
+
mat.targetColor.copy(mat.uColor);
|
|
109
|
+
}
|
|
110
|
+
}, []);
|
|
111
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
112
|
+
useConfigDriver({ rootRef: pointsRef, id, family: 'space', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!sunSystemEnabled) {
|
|
115
|
+
fadeRef.current = 1;
|
|
116
|
+
targetFadeRef.current = 1;
|
|
117
|
+
}
|
|
118
|
+
}, [sunSystemEnabled]);
|
|
119
|
+
const handleTimeUpdate = useCallback((state) => {
|
|
120
|
+
// Not gated on autoAnimate: scrubbing the time slider to midnight brings the
|
|
121
|
+
// stars up the same way playing into midnight does.
|
|
122
|
+
const { normalizedTime, isDaytime, delta } = state;
|
|
123
|
+
if (!sunSystemEnabled)
|
|
124
|
+
return;
|
|
125
|
+
if (!isDaytime) {
|
|
126
|
+
targetFadeRef.current = 1;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const sunriseEnd = 0.15;
|
|
130
|
+
const sunsetStart = 0.85;
|
|
131
|
+
if (normalizedTime <= sunriseEnd)
|
|
132
|
+
targetFadeRef.current = 1 - normalizedTime / sunriseEnd;
|
|
133
|
+
else if (normalizedTime >= sunsetStart)
|
|
134
|
+
targetFadeRef.current = (normalizedTime - sunsetStart) / (1 - sunsetStart);
|
|
135
|
+
else
|
|
136
|
+
targetFadeRef.current = 0;
|
|
137
|
+
}
|
|
138
|
+
const lerp = Math.min(1, 1.5 * (delta !== 0 ? delta : 1));
|
|
139
|
+
fadeRef.current += (targetFadeRef.current - fadeRef.current) * lerp;
|
|
140
|
+
}, [sunSystemEnabled]);
|
|
141
|
+
useSkySystem({
|
|
142
|
+
timeSettings: timeSettings ?? DEFAULT_TIME_SETTINGS,
|
|
143
|
+
onTimeUpdate: handleTimeUpdate,
|
|
144
|
+
enabled: sunSystemEnabled && !!timeSettings,
|
|
145
|
+
});
|
|
146
|
+
useFrame((_, delta) => {
|
|
147
|
+
const mat = materialRef.current;
|
|
148
|
+
const points = pointsRef.current;
|
|
149
|
+
if (!mat || !points)
|
|
150
|
+
return;
|
|
151
|
+
const alpha = opacityRef.current * fadeRef.current;
|
|
152
|
+
points.visible = alpha > 0.01;
|
|
153
|
+
mat.opacity = alpha;
|
|
154
|
+
// Twinkle clock.
|
|
155
|
+
mat.time += Math.min(delta, 0.1);
|
|
156
|
+
});
|
|
157
|
+
// No scale on <points>: the CreatedObject wrapper applies meshSettings.scale.
|
|
158
|
+
return (_jsx("points", { ref: pointsRef, geometry: geometry, renderOrder: -1, frustumCulled: false, userData: userData, children: _jsx("starsMaterial", { ref: materialRef, transparent: true, depthWrite: false, depthTest: true, blending: AdditiveBlending, colorMix: 0 }) }));
|
|
159
|
+
};
|
|
160
|
+
export default Stars;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { StarsProps } from './Stars';
|
|
2
|
+
export { default as Stars, generateStarsGeometry } from './Stars';
|
|
3
|
+
export type { EarthProps } from './Earth';
|
|
4
|
+
export { default as Earth } from './Earth';
|
|
5
|
+
export type { SolarSystemProps } from './SolarSystem';
|
|
6
|
+
export { default as SolarSystem } from './SolarSystem';
|
|
7
|
+
export type { ShootingStarsProps } from './ShootingStars';
|
|
8
|
+
export { default as ShootingStars } from './ShootingStars';
|
|
9
|
+
export type { ShootingStarProps } from './ShootingStar';
|
|
10
|
+
export { default as ShootingStar } from './ShootingStar';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/space/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Space objects (object type 'space'): celestial bodies and sky backdrops.
|
|
2
|
+
// Rendered by Galaxy.tsx from its FAMILY table; each takes the uniform contract
|
|
3
|
+
// (config, id, keyframes, mouseMove, onObjectReady, onObjectDispose).
|
|
4
|
+
export { default as Stars, generateStarsGeometry } from './Stars.js';
|
|
5
|
+
export { default as Earth } from './Earth.js';
|
|
6
|
+
export { default as SolarSystem } from './SolarSystem.js';
|
|
7
|
+
export { default as ShootingStars } from './ShootingStars.js';
|
|
8
|
+
export { default as ShootingStar } from './ShootingStar.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainSurface.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/TerrainSurface.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TerrainSurface.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/TerrainSurface.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAkB1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkI/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -7,7 +7,10 @@ import { useCloudSun } from '../../hooks/useCloudSun.js';
|
|
|
7
7
|
import { TERRAIN_LIVE_KEY } from '../../hooks/useTerrainLive.js';
|
|
8
8
|
import { TerrainMaterial } from '../../shaders/terrain/TerrainMaterial.js';
|
|
9
9
|
import { applySunUniforms } from '../../utils/cloudUniforms.js';
|
|
10
|
-
import { applyTerrainAmbient, applyTerrainUniforms } from '../../utils/terrainUniforms.js';
|
|
10
|
+
import { applyTerrainAmbient, applyTerrainTextures, applyTerrainUniforms } from '../../utils/terrainUniforms.js';
|
|
11
|
+
import { useTerrainTextures } from '../../hooks/useTerrainTextures.js';
|
|
12
|
+
import { getAnimatableProperties } from '@3driseai/3drise-core';
|
|
13
|
+
import { applyConfigKeyframeAnimations, applyConfigMouseMove, } from '../../utils/configAnimations.js';
|
|
11
14
|
/**
|
|
12
15
|
* The terrain renderer. One clipmap, one material, four landforms — they differ
|
|
13
16
|
* by the shaping operator the height field applies, not by having separate
|
|
@@ -25,10 +28,13 @@ import { applyTerrainAmbient, applyTerrainUniforms } from '../../utils/terrainUn
|
|
|
25
28
|
* three together), pushes the config into uniforms, and re-snaps the clipmap to
|
|
26
29
|
* the camera. Nothing here re-renders React.
|
|
27
30
|
*/
|
|
28
|
-
const TerrainSurface = ({ id = '3drise-terrain', config, quality, skySettings, timeSettings, sunIntensity = 1, onObjectReady, onObjectDispose, }) => {
|
|
31
|
+
const TerrainSurface = ({ id = '3drise-terrain', config, quality, skySettings, timeSettings, sunIntensity = 1, animations, mouseMove, onObjectReady, onObjectDispose, }) => {
|
|
29
32
|
const clipmap = useTerrainClipmap(quality.levels, quality.segments, quality.cellSize);
|
|
30
33
|
const { state: sun, update: updateSun } = useCloudSun({ skySettings, timeSettings });
|
|
31
34
|
const material = useMemo(() => new TerrainMaterial(), []);
|
|
35
|
+
// The four ground textures, packed into arrays. Repacks only when a map URL
|
|
36
|
+
// changes; tile size, tint and strength are uniforms, applied per frame.
|
|
37
|
+
const textures = useTerrainTextures(config.textures);
|
|
32
38
|
useEffect(() => () => { material.dispose(); }, [material]);
|
|
33
39
|
// Live controller overrides. A slider drag writes here every pointer-move and
|
|
34
40
|
// the frame loop reads it on top of the config, so the terrain responds without
|
|
@@ -39,6 +45,18 @@ const TerrainSurface = ({ id = '3drise-terrain', config, quality, skySettings, t
|
|
|
39
45
|
const liveQuality = useRef({});
|
|
40
46
|
useEffect(() => { liveConfig.current = {}; }, [config]);
|
|
41
47
|
useEffect(() => { liveQuality.current = {}; }, [quality]);
|
|
48
|
+
// The `terrain` keyframe / pointer domains: config -> keyframes -> pointer ->
|
|
49
|
+
// live drag, the clouds' order. Only the surface's lighting and colour knobs are
|
|
50
|
+
// in the set — the registry marks every land-shape knob non-animatable, so the
|
|
51
|
+
// ground itself never moves.
|
|
52
|
+
const animatable = useMemo(() => new Set(getAnimatableProperties({ type: 'terrain', config }, 'terrain').map(p => p.value)), [config.terrainType]);
|
|
53
|
+
const override = useRef({});
|
|
54
|
+
const startValues = useRef({});
|
|
55
|
+
const animStart = useRef(0);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
animStart.current = performance.now();
|
|
58
|
+
startValues.current = {};
|
|
59
|
+
}, [animations]);
|
|
42
60
|
const rootRef = useRef(null);
|
|
43
61
|
const meshRefs = useRef([]);
|
|
44
62
|
// The handle a controller reaches through findById(id).userData. Set in an
|
|
@@ -67,9 +85,15 @@ const TerrainSurface = ({ id = '3drise-terrain', config, quality, skySettings, t
|
|
|
67
85
|
// the sky that is actually being drawn behind it or a sunset landscape
|
|
68
86
|
// comes out black under a blazing sky.
|
|
69
87
|
applyTerrainAmbient(material, sun);
|
|
70
|
-
const
|
|
88
|
+
const o = override.current;
|
|
89
|
+
applyConfigKeyframeAnimations(animations?.terrain?.animations, startValues.current, config, o, performance.now() - animStart.current, animatable);
|
|
90
|
+
if (mouseMove?.enabled && mouseMove.terrain?.enabled) {
|
|
91
|
+
applyConfigMouseMove(mouseMove.terrain.properties, config, o, state.pointer, animatable);
|
|
92
|
+
}
|
|
93
|
+
const cfg = { ...config, ...o, ...liveConfig.current };
|
|
71
94
|
const qual = { ...quality, ...liveQuality.current };
|
|
72
95
|
applyTerrainUniforms(material, cfg, qual);
|
|
96
|
+
applyTerrainTextures(material, cfg, textures);
|
|
73
97
|
// ONE origin for the whole pyramid, snapped to twice the finest cell.
|
|
74
98
|
//
|
|
75
99
|
// Snapping each ring to its own cell grid is the textbook clipmap and it is
|