@3driseai/3drise-viewer 0.1.28 → 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 +1 -1
- package/dist/components/ApollonianGrid.d.ts.map +1 -1
- package/dist/components/ApollonianGrid.js +3 -28
- 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 +1 -1
- package/dist/components/ConformalGrid.d.ts.map +1 -1
- package/dist/components/ConformalGrid.js +3 -34
- 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/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 +1 -1
- package/dist/components/HilbertGrid.d.ts.map +1 -1
- package/dist/components/HilbertGrid.js +3 -30
- 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 +1 -1
- package/dist/components/LensingGrid.d.ts.map +1 -1
- package/dist/components/LensingGrid.js +3 -29
- 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 +1 -1
- package/dist/components/ParastichyGrid.d.ts.map +1 -1
- package/dist/components/ParastichyGrid.js +3 -30
- package/dist/components/PhyllotaxisGrid.d.ts +1 -1
- package/dist/components/PhyllotaxisGrid.d.ts.map +1 -1
- package/dist/components/PhyllotaxisGrid.js +3 -32
- 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 +1 -1
- package/dist/components/TruchetGrid.d.ts.map +1 -1
- package/dist/components/TruchetGrid.js +3 -30
- 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 +10 -10
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -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.map +1 -1
- package/dist/constants.js +4 -0
- 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 +18 -23
- package/dist/types/gridConfigs.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
|
@@ -1,91 +1,116 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
3
|
-
import { useRef, useEffect, useCallback } from 'react';
|
|
4
|
-
import { useFrame } from '@react-three/fiber';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { cubeCameraManager } from '@3driseai/3drise-core';
|
|
3
|
+
import { useRef, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
+
import { useFrame, useThree } from '@react-three/fiber';
|
|
5
|
+
import { SKY_LIVE_KEY } from '../hooks/useSkyLive.js';
|
|
6
|
+
import { createSunPosition } from '../utils/utils3d.js';
|
|
7
|
+
import { applyConfigKeyframeAnimations, applyConfigMouseMove, hasConfigOverrides, resolveConfig, } from '../utils/configAnimations.js';
|
|
8
|
+
import { publishRenderedSky, clearRenderedSky } from '../utils/renderedSky.js';
|
|
9
|
+
import { cubeCameraManager, getAnimatableProperties, skySystemManager, atmosphereForSunElevation, skyBrightnessForSunElevation, nightAmount } from '@3driseai/3drise-core';
|
|
10
10
|
import SkyMesh from './SkyMesh.js';
|
|
11
|
-
|
|
11
|
+
/** The sky's animatable knobs, from the property registry — the same list the
|
|
12
|
+
* Animation and MouseMove panels offer, so a binding can never target a knob
|
|
13
|
+
* this loop does not push. */
|
|
14
|
+
const SKY_ANIMATABLE = new Set(getAnimatableProperties({ type: 'sky' }, 'sky').map(p => p.value));
|
|
15
|
+
/** While the sky is being driven, refresh the environment probe at most this often.
|
|
16
|
+
* Six cube faces per frame is the one thing an animated sky must never do. */
|
|
17
|
+
const ENV_REFRESH_MS = 500;
|
|
18
|
+
const renderedOf = (s) => ({
|
|
19
|
+
turbidity: s.turbidity ?? 2,
|
|
20
|
+
rayleigh: s.rayleigh ?? 1,
|
|
21
|
+
mieCoefficient: s.mieCoefficient ?? 0.005,
|
|
22
|
+
mieDirectionalG: s.mieDirectionalG ?? 0.7,
|
|
23
|
+
elevation: s.elevation ?? 0,
|
|
24
|
+
azimuth: s.azimuth ?? 0,
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* The analytic (Preetham) sky.
|
|
28
|
+
*
|
|
29
|
+
* What it draws, each frame, in order:
|
|
30
|
+
* 1. the stored settings — or, while time of day is enabled, the time-driven
|
|
31
|
+
* sun and atmosphere (time owns all six knobs then);
|
|
32
|
+
* 2. the `sky` keyframe domain (settings.animations.sky)
|
|
33
|
+
* 3. the `sky` pointer domain on top (settings.mouseMove.sky)
|
|
34
|
+
* 4. a controller's live drag (SKY_LIVE_KEY handle on the mesh)
|
|
35
|
+
* With time of day on, the clock owns the sun's position (elevation/azimuth), and
|
|
36
|
+
* 1–4 above are the DAY look: atmosphereForSunElevation blends them into golden
|
|
37
|
+
* hour, twilight and night by the sun's height. Sliders, keyframes and pointer
|
|
38
|
+
* bindings on the atmosphere keep working with the clock running.
|
|
39
|
+
*
|
|
40
|
+
* Whatever it draws is published per scene (renderedSky) so the key light, the
|
|
41
|
+
* clouds, the water and the terrain are lit by the same sun and atmosphere.
|
|
42
|
+
*
|
|
43
|
+
* It draws only. The sun LIGHT is SkySystem's SunLight, which reads what this
|
|
44
|
+
* publishes; a second light here used to double the sun (always white, always
|
|
45
|
+
* on, lit from below the ground at night).
|
|
46
|
+
*/
|
|
47
|
+
function SkyController({ settings, timeSettings, scale = 1000, onObjectReady, onObjectDispose }) {
|
|
12
48
|
const skyRef = useRef(null);
|
|
13
49
|
const rootRef = useRef(null);
|
|
14
50
|
useObjectReady(rootRef, settings, onObjectReady, onObjectDispose);
|
|
15
|
-
const sunLightRef = useRef(null);
|
|
16
|
-
const isAnimatingRef = useRef(false);
|
|
17
51
|
const previousSettings = useRef(null);
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
52
|
+
const scene = useThree(s => s.scene);
|
|
53
|
+
const timeOwns = !!(settings.visible && timeSettings?.enabled);
|
|
54
|
+
// Frame scratch, kept in refs so a keyframed turbidity does not re-render React.
|
|
55
|
+
const override = useRef({});
|
|
56
|
+
const startValues = useRef({});
|
|
57
|
+
const liveRef = useRef({});
|
|
58
|
+
const animStart = useRef(0);
|
|
59
|
+
const driving = useRef(false);
|
|
60
|
+
const lastEnvRefresh = useRef(0);
|
|
61
|
+
const envDirty = useRef(false);
|
|
62
|
+
const timeAtmos = useRef({ turbidity: 0, rayleigh: 0, mieCoefficient: 0, mieDirectionalG: 0 });
|
|
63
|
+
const timeApplied = useRef(null);
|
|
64
|
+
// Restart the keyframes from their beginning whenever they are edited.
|
|
21
65
|
useEffect(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
animStart.current = performance.now();
|
|
67
|
+
startValues.current = {};
|
|
68
|
+
}, [settings.animations]);
|
|
69
|
+
// A slider end commits the dragged value, which arrives here as new settings.
|
|
70
|
+
useEffect(() => { liveRef.current = {}; }, [settings]);
|
|
26
71
|
useEffect(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const handleTimeUpdate = useCallback((state) => {
|
|
30
|
-
const { sunAzimuth, sunElevation, timeInHours } = state;
|
|
31
|
-
const atmosphericParams = calculateSkyParamsForTime(timeInHours);
|
|
32
|
-
const newSettings = {
|
|
33
|
-
...settings,
|
|
34
|
-
elevation: sunElevation,
|
|
35
|
-
azimuth: sunAzimuth,
|
|
36
|
-
...atmosphericParams,
|
|
72
|
+
return () => {
|
|
73
|
+
clearRenderedSky(scene);
|
|
37
74
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
75
|
+
}, [scene]);
|
|
76
|
+
/** Push the six knobs into the sky shader. Writes this mesh, never a findById
|
|
77
|
+
* result, so a second canvas cannot drive the editor's sky. */
|
|
78
|
+
const applyUniforms = useCallback((values) => {
|
|
79
|
+
const uniforms = skyRef.current?.material?.uniforms;
|
|
80
|
+
if (!uniforms)
|
|
81
|
+
return;
|
|
82
|
+
if (values.turbidity !== undefined)
|
|
83
|
+
uniforms.turbidity.value = values.turbidity;
|
|
84
|
+
if (values.rayleigh !== undefined)
|
|
85
|
+
uniforms.rayleigh.value = values.rayleigh;
|
|
86
|
+
if (values.mieCoefficient !== undefined)
|
|
87
|
+
uniforms.mieCoefficient.value = values.mieCoefficient;
|
|
88
|
+
if (values.mieDirectionalG !== undefined)
|
|
89
|
+
uniforms.mieDirectionalG.value = values.mieDirectionalG;
|
|
90
|
+
if (values.elevation !== undefined && values.azimuth !== undefined && uniforms.sunPosition) {
|
|
91
|
+
uniforms.sunPosition.value.copy(createSunPosition(values.elevation, values.azimuth));
|
|
48
92
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
updateUniforms(settings);
|
|
58
|
-
previousSettings.current = { ...settings };
|
|
59
|
-
onObjectReady && onObjectReady(object, mesh);
|
|
60
|
-
}, [settings, updateUniforms, onObjectReady]);
|
|
93
|
+
// Darken the dome after sunset (see SkyMesh addNightDarkening). By the
|
|
94
|
+
// sun's height, so a hand-set sun below the horizon gets night too.
|
|
95
|
+
if (values.elevation !== undefined && uniforms.uSkyBrightness) {
|
|
96
|
+
uniforms.uSkyBrightness.value = skyBrightnessForSunElevation(values.elevation);
|
|
97
|
+
const n = nightAmount(values.elevation);
|
|
98
|
+
uniforms.uNightTint.value.set(0.0006 * n, 0.0016 * n, 0.0045 * n);
|
|
99
|
+
}
|
|
100
|
+
}, []);
|
|
61
101
|
const toggleSky = useCallback((show) => {
|
|
62
102
|
if (!skyRef.current)
|
|
63
103
|
return;
|
|
64
104
|
skyRef.current.visible = show;
|
|
65
|
-
if (sunLightRef.current)
|
|
66
|
-
sunLightRef.current.visible = show;
|
|
67
105
|
if (!show) {
|
|
68
106
|
cubeCameraManager.dispose();
|
|
107
|
+
clearRenderedSky(scene);
|
|
69
108
|
}
|
|
70
109
|
else {
|
|
71
110
|
cubeCameraManager.updateEnvironment();
|
|
72
111
|
}
|
|
73
|
-
}, []);
|
|
74
|
-
const
|
|
75
|
-
if (!skyRef.current?.material || !sunLightRef.current)
|
|
76
|
-
return;
|
|
77
|
-
const uniforms = skyRef.current.material.uniforms;
|
|
78
|
-
if (!uniforms?.sunPosition)
|
|
79
|
-
return;
|
|
80
|
-
const distance = 100;
|
|
81
|
-
const sp = uniforms.sunPosition.value;
|
|
82
|
-
sunLightRef.current.position.set(sp.x * distance, sp.y * distance, sp.z * distance);
|
|
83
|
-
sunLightRef.current.shadow.camera.updateProjectionMatrix();
|
|
84
|
-
const moon = findById('3drise-moon');
|
|
85
|
-
if (moon)
|
|
86
|
-
moon.position.set(sp.x * scale, sp.y * scale, sp.z * scale);
|
|
87
|
-
}, [scale]);
|
|
88
|
-
const hasActualChanges = useCallback((next, prev) => {
|
|
112
|
+
}, [scene]);
|
|
113
|
+
const hasActualChanges = (next, prev) => {
|
|
89
114
|
if (!prev)
|
|
90
115
|
return true;
|
|
91
116
|
return (next.visible !== prev.visible ||
|
|
@@ -95,16 +120,12 @@ function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange,
|
|
|
95
120
|
Math.abs(next.mieDirectionalG - prev.mieDirectionalG) > 0.001 ||
|
|
96
121
|
Math.abs(next.elevation - prev.elevation) > 0.1 ||
|
|
97
122
|
Math.abs(next.azimuth - prev.azimuth) > 0.1);
|
|
98
|
-
}, []);
|
|
99
|
-
const handleCompletedUniforms = (_finalValues) => {
|
|
100
|
-
isAnimatingRef.current = false;
|
|
101
|
-
cubeCameraManager.updateEnvironment();
|
|
102
123
|
};
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
124
|
+
/** Applies a settings object (stored or time-driven). Returns whether anything
|
|
125
|
+
* changed. `skipEnvUpdate` leaves the cube capture to whoever already
|
|
126
|
+
* schedules it (the probe re-captures on its own timer while time advances). */
|
|
106
127
|
const handleSettings = (newSettings, skipEnvUpdate = false) => {
|
|
107
|
-
if (!skyRef.current ||
|
|
128
|
+
if (!skyRef.current || !newSettings)
|
|
108
129
|
return false;
|
|
109
130
|
if (!hasActualChanges(newSettings, previousSettings.current))
|
|
110
131
|
return false;
|
|
@@ -115,68 +136,106 @@ function SkyController({ settings, timeSettings, scale = 1000, onSettingsChange,
|
|
|
115
136
|
previousSettings.current = { ...newSettings };
|
|
116
137
|
return false;
|
|
117
138
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (!skipEnvUpdate)
|
|
139
|
+
applyUniforms(newSettings);
|
|
140
|
+
publishRenderedSky(scene, renderedOf(newSettings));
|
|
141
|
+
if (!skipEnvUpdate)
|
|
121
142
|
cubeCameraManager.updateEnvironment();
|
|
122
|
-
}
|
|
123
143
|
previousSettings.current = { ...newSettings };
|
|
124
144
|
return true;
|
|
125
145
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
146
|
+
// With the clock on, the frame loop draws; applying stored elevation here would
|
|
147
|
+
// flash the authored sun for a frame. Re-runs when the clock is switched off so
|
|
148
|
+
// the stored sky comes back.
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (timeOwns)
|
|
129
151
|
return;
|
|
130
|
-
|
|
152
|
+
handleSettings(settings);
|
|
153
|
+
}, [settings, timeOwns]);
|
|
154
|
+
const liveHandle = useMemo(() => ({
|
|
155
|
+
set: (key, value) => { liveRef.current[key] = value; },
|
|
156
|
+
}), []);
|
|
157
|
+
const attachLive = (mesh) => {
|
|
158
|
+
if (mesh)
|
|
159
|
+
mesh.userData[SKY_LIVE_KEY] = liveHandle;
|
|
160
|
+
};
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
const mesh = skyRef.current;
|
|
163
|
+
attachLive(mesh);
|
|
164
|
+
return () => { if (mesh)
|
|
165
|
+
delete mesh.userData[SKY_LIVE_KEY]; };
|
|
166
|
+
}, [liveHandle]);
|
|
167
|
+
const handleSkyMeshReady = useCallback((object, mesh) => {
|
|
168
|
+
skyRef.current = mesh;
|
|
169
|
+
attachLive(mesh);
|
|
170
|
+
applyUniforms(settings);
|
|
171
|
+
if (settings.visible)
|
|
172
|
+
publishRenderedSky(scene, renderedOf(settings));
|
|
173
|
+
previousSettings.current = { ...settings };
|
|
174
|
+
onObjectReady && onObjectReady(object, mesh);
|
|
175
|
+
}, [settings, applyUniforms, onObjectReady, scene]);
|
|
176
|
+
/** Clock on: the clock's sun, the day look blended by the sun's height. Pushes
|
|
177
|
+
* only on a visible change, and leaves the cube capture to the probe while
|
|
178
|
+
* time is advancing (it refreshes on sun movement); a manual seek or a slider
|
|
179
|
+
* re-captures here, trailing-throttled so a scrub ends on a fresh capture. */
|
|
180
|
+
const drawTimeOfDay = (day) => {
|
|
181
|
+
const sky = skyRef.current;
|
|
182
|
+
if (!sky)
|
|
131
183
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
184
|
+
if (!sky.visible)
|
|
185
|
+
toggleSky(true);
|
|
186
|
+
const t = skySystemManager.getState();
|
|
187
|
+
const atmos = atmosphereForSunElevation(t.sunElevation, day, timeAtmos.current);
|
|
188
|
+
const next = { ...day, ...atmos, visible: true, elevation: t.sunElevation, azimuth: t.sunAzimuth };
|
|
189
|
+
if (hasActualChanges(next, timeApplied.current)) {
|
|
190
|
+
applyUniforms(next);
|
|
191
|
+
publishRenderedSky(scene, renderedOf(next));
|
|
192
|
+
timeApplied.current = next;
|
|
193
|
+
previousSettings.current = next;
|
|
194
|
+
if (!t.advancing)
|
|
195
|
+
envDirty.current = true;
|
|
196
|
+
}
|
|
197
|
+
const now = performance.now();
|
|
198
|
+
if (envDirty.current && now - lastEnvRefresh.current > ENV_REFRESH_MS) {
|
|
199
|
+
envDirty.current = false;
|
|
200
|
+
lastEnvRefresh.current = now;
|
|
201
|
+
cubeCameraManager.updateEnvironment();
|
|
202
|
+
}
|
|
149
203
|
};
|
|
150
204
|
useFrame((state) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
205
|
+
if (!skyRef.current || !settings.visible)
|
|
206
|
+
return;
|
|
207
|
+
const o = override.current;
|
|
208
|
+
const base = settings;
|
|
209
|
+
applyConfigKeyframeAnimations(settings.animations?.sky?.animations, startValues.current, base, o, performance.now() - animStart.current, SKY_ANIMATABLE);
|
|
210
|
+
const mm = settings.mouseMove;
|
|
211
|
+
if (mm?.enabled && mm.sky?.enabled) {
|
|
212
|
+
applyConfigMouseMove(mm.sky.properties, base, o, state.pointer, SKY_ANIMATABLE);
|
|
213
|
+
}
|
|
214
|
+
if (timeOwns) {
|
|
215
|
+
drawTimeOfDay(resolveConfig(settings, o, liveRef.current));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
timeApplied.current = null;
|
|
219
|
+
if (hasConfigOverrides(o) || hasConfigOverrides(liveRef.current)) {
|
|
220
|
+
const resolved = resolveConfig(settings, o, liveRef.current);
|
|
221
|
+
applyUniforms(resolved);
|
|
222
|
+
publishRenderedSky(scene, renderedOf(resolved));
|
|
223
|
+
driving.current = true;
|
|
224
|
+
const now = performance.now();
|
|
225
|
+
if (now - lastEnvRefresh.current > ENV_REFRESH_MS) {
|
|
226
|
+
lastEnvRefresh.current = now;
|
|
227
|
+
cubeCameraManager.updateEnvironment();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else if (driving.current) {
|
|
231
|
+
// A binding was removed or the pointer stopped mattering: go back to the
|
|
232
|
+
// stored sky once, including the probe.
|
|
233
|
+
driving.current = false;
|
|
234
|
+
applyUniforms(settings);
|
|
235
|
+
publishRenderedSky(scene, renderedOf(settings));
|
|
236
|
+
cubeCameraManager.updateEnvironment();
|
|
237
|
+
}
|
|
167
238
|
});
|
|
168
|
-
|
|
169
|
-
return nightParams;
|
|
170
|
-
if (timeInHours < 6.5)
|
|
171
|
-
return lerpP(nightParams, sunriseParams, (timeInHours - 5) / 1.5);
|
|
172
|
-
if (timeInHours < 8)
|
|
173
|
-
return lerpP(sunriseParams, dayParams, (timeInHours - 6.5) / 1.5);
|
|
174
|
-
if (timeInHours < 17)
|
|
175
|
-
return dayParams;
|
|
176
|
-
if (timeInHours < 19)
|
|
177
|
-
return lerpP(dayParams, sunsetParams, (timeInHours - 17) / 2);
|
|
178
|
-
if (timeInHours < 21)
|
|
179
|
-
return lerpP(sunsetParams, nightParams, (timeInHours - 19) / 2);
|
|
180
|
-
return nightParams;
|
|
239
|
+
return (_jsx("group", { ref: rootRef, children: _jsx(SkyMesh, { ref: skyRef, settings: settings, scale: scale, onObjectReady: handleSkyMeshReady, onObjectDispose: onObjectDispose }) }));
|
|
181
240
|
}
|
|
182
241
|
export default SkyController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkyMesh.d.ts","sourceRoot":"","sources":["../../src/components/SkyMesh.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"SkyMesh.d.ts","sourceRoot":"","sources":["../../src/components/SkyMesh.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IAClD,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAqBD,QAAA,MAAM,OAAO,EAgCP,GAAI,CAAC;AAEX,eAAe,OAAO,CAAC"}
|
|
@@ -2,12 +2,37 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
3
3
|
import React, { useRef, useMemo, useEffect } from 'react';
|
|
4
4
|
import { Sky } from 'three/examples/jsm/objects/Sky.js';
|
|
5
|
+
import { Vector3 } from "three";
|
|
6
|
+
import { SKY_ID } from "@3driseai/3drise-core";
|
|
7
|
+
/**
|
|
8
|
+
* Lets SkyController darken the dome after sunset. Preetham alone bottoms out at
|
|
9
|
+
* a flat grey (its constant 0.1 base term), which reads as overcast dusk, not
|
|
10
|
+
* night. `uSkyBrightness` scales the output (1 by day, core
|
|
11
|
+
* skyBrightnessForSunElevation), `uNightTint` adds a faint blue so the dark sky
|
|
12
|
+
* is not neutral grey. Patched by string: if a three upgrade changes the line,
|
|
13
|
+
* the sky simply stays undarkened rather than breaking.
|
|
14
|
+
*/
|
|
15
|
+
const SKY_OUT = 'gl_FragColor = vec4( retColor, 1.0 );';
|
|
16
|
+
function addNightDarkening(material) {
|
|
17
|
+
material.uniforms.uSkyBrightness = { value: 1 };
|
|
18
|
+
material.uniforms.uNightTint = { value: new Vector3(0, 0, 0) };
|
|
19
|
+
if (!material.fragmentShader.includes(SKY_OUT))
|
|
20
|
+
return;
|
|
21
|
+
material.fragmentShader = material.fragmentShader
|
|
22
|
+
.replace('void main() {', 'uniform float uSkyBrightness;\nuniform vec3 uNightTint;\nvoid main() {')
|
|
23
|
+
.replace(SKY_OUT, 'gl_FragColor = vec4( retColor * uSkyBrightness + uNightTint, 1.0 );');
|
|
24
|
+
}
|
|
5
25
|
const SkyMesh = React.forwardRef(({ settings, scale = 1000, onObjectReady, onObjectDispose }, ref) => {
|
|
6
26
|
const meshRef = useRef(null);
|
|
7
27
|
useObjectReady(meshRef, settings, onObjectReady, onObjectDispose);
|
|
8
28
|
const skyObject = useMemo(() => {
|
|
9
29
|
const sky = new Sky();
|
|
30
|
+
addNightDarkening(sky.material);
|
|
10
31
|
sky.scale.setScalar(scale);
|
|
32
|
+
// Set once on the object, never as a userData JSX prop: R3F replaces the
|
|
33
|
+
// whole userData object on every render, which would drop the live handle
|
|
34
|
+
// SkyController hangs here.
|
|
35
|
+
sky.userData.id = SKY_ID;
|
|
11
36
|
return sky;
|
|
12
37
|
}, [scale]);
|
|
13
38
|
useEffect(() => {
|
|
@@ -28,7 +53,7 @@ const SkyMesh = React.forwardRef(({ settings, scale = 1000, onObjectReady, onObj
|
|
|
28
53
|
else if (ref)
|
|
29
54
|
ref.current = node;
|
|
30
55
|
};
|
|
31
|
-
return (_jsx("primitive", { ref: combinedRef, object: skyObject, visible: settings.visible, scale: scale
|
|
56
|
+
return (_jsx("primitive", { ref: combinedRef, object: skyObject, visible: settings.visible, scale: scale }));
|
|
32
57
|
});
|
|
33
58
|
SkyMesh.displayName = 'SkyMesh';
|
|
34
59
|
export default SkyMesh;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SkySettings, SkyStarsSettings, TimeSettings } from '@3driseai/3drise-core';
|
|
3
|
+
export interface SkyStarsProps {
|
|
4
|
+
timeSettings: TimeSettings;
|
|
5
|
+
skySettings?: SkySettings;
|
|
6
|
+
/** The stars block of SkySettings; missing fields fill in from SKY_STARS_DEFAULTS. */
|
|
7
|
+
stars?: SkyStarsSettings | null;
|
|
8
|
+
}
|
|
9
|
+
declare const SkyStars: React.FC<SkyStarsProps>;
|
|
10
|
+
export default SkyStars;
|
|
11
|
+
//# sourceMappingURL=SkyStars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkyStars.d.ts","sourceRoot":"","sources":["../../src/components/SkyStars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGzF,MAAM,WAAW,aAAa;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,sFAAsF;IACtF,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACnC;AA4HD,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA8DrC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { useFrame } from '@react-three/fiber';
|
|
5
|
+
import { nightAmount, skySystemManager, normalizeSkyStars } from '@3driseai/3drise-core';
|
|
6
|
+
import { useCloudSun } from '../hooks/useCloudSun.js';
|
|
7
|
+
/**
|
|
8
|
+
* The night sky's stars, built into the sky for either renderer.
|
|
9
|
+
*
|
|
10
|
+
* A star dome centred on the camera just inside the far plane (the sky is drawn
|
|
11
|
+
* at the far plane, so stars sit in front of it and terrain occludes them).
|
|
12
|
+
* Brightness follows a magnitude-like distribution — a few bright stars, many
|
|
13
|
+
* faint ones — with a slight colour temperature spread and a gentle twinkle.
|
|
14
|
+
*
|
|
15
|
+
* With the clock on they appear with the night (nightAmount: by the SUN'S HEIGHT,
|
|
16
|
+
* the same phase keys as the atmosphere), fade toward the horizon where real air
|
|
17
|
+
* extinguishes them, and turn about the celestial pole with the clock: rising in
|
|
18
|
+
* the same quarter the sun rises, setting where it sets. With the clock off they
|
|
19
|
+
* are a stand-alone layer: on whenever `stars.visible` is, at full strength.
|
|
20
|
+
*/
|
|
21
|
+
/** Height of the celestial pole above the horizon = observer latitude. */
|
|
22
|
+
const LATITUDE_DEG = 40;
|
|
23
|
+
/** North is opposite the noon sun. The noon sun is toward +X in core's
|
|
24
|
+
* convention, so the pole leans toward −X. */
|
|
25
|
+
const POLE = new THREE.Vector3(-Math.cos(THREE.MathUtils.degToRad(LATITUDE_DEG)), Math.sin(THREE.MathUtils.degToRad(LATITUDE_DEG)), 0).normalize();
|
|
26
|
+
/** Sidereal day, hours: the sky turns once in this much clock time. */
|
|
27
|
+
const SIDEREAL_HOURS = 23.934;
|
|
28
|
+
const vertexShader = /* glsl */ `
|
|
29
|
+
attribute float aMag;
|
|
30
|
+
attribute float aPhase;
|
|
31
|
+
attribute vec3 aTint;
|
|
32
|
+
uniform float uTime;
|
|
33
|
+
uniform float uNight;
|
|
34
|
+
uniform float uPixelRatio;
|
|
35
|
+
uniform float uBrightness;
|
|
36
|
+
uniform float uSize;
|
|
37
|
+
uniform float uTwinkle;
|
|
38
|
+
uniform float uWarmth;
|
|
39
|
+
varying vec3 vColor;
|
|
40
|
+
varying float vAlpha;
|
|
41
|
+
void main() {
|
|
42
|
+
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
43
|
+
// direction from the camera: stars live on a camera-centred dome
|
|
44
|
+
vec3 dir = normalize(world.xyz - cameraPosition);
|
|
45
|
+
float horizon = smoothstep(-0.02, 0.18, dir.y); // extinction near the horizon
|
|
46
|
+
// twinkle depth: 0 = steady, 1 = the full 36% flicker
|
|
47
|
+
float twinkle = 1.0 - 0.36 * uTwinkle * (0.5 + 0.5 * sin(uTime * (1.3 + aPhase * 2.1) + aPhase * 37.0));
|
|
48
|
+
float b = aMag * twinkle * horizon * uNight * uBrightness;
|
|
49
|
+
// aTint holds the full-temperature colour; uWarmth blends it toward white
|
|
50
|
+
vColor = mix(vec3(1.0), aTint, uWarmth);
|
|
51
|
+
vAlpha = b;
|
|
52
|
+
gl_PointSize = (1.0 + 2.6 * aMag) * uPixelRatio * uSize;
|
|
53
|
+
gl_Position = projectionMatrix * viewMatrix * world;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const fragmentShader = /* glsl */ `
|
|
57
|
+
varying vec3 vColor;
|
|
58
|
+
varying float vAlpha;
|
|
59
|
+
void main() {
|
|
60
|
+
vec2 d = gl_PointCoord * 2.0 - 1.0;
|
|
61
|
+
float r2 = dot(d, d);
|
|
62
|
+
if (r2 > 1.0 || vAlpha < 0.003) discard;
|
|
63
|
+
float core = exp(-r2 * 4.0);
|
|
64
|
+
gl_FragColor = vec4(vColor * core * vAlpha, 1.0);
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
/** Great-circle normal of the Milky Way band: tilted ~60° from the celestial pole
|
|
68
|
+
* (the real galactic plane is ~63° off), so the band arches across the sky
|
|
69
|
+
* rather than circling the pole. */
|
|
70
|
+
const BAND_NORMAL = new THREE.Vector3(0.5, 0.55, 0.67).normalize();
|
|
71
|
+
const BAND_U = new THREE.Vector3().crossVectors(BAND_NORMAL, new THREE.Vector3(0, 1, 0)).normalize();
|
|
72
|
+
const BAND_V = new THREE.Vector3().crossVectors(BAND_NORMAL, BAND_U).normalize();
|
|
73
|
+
/** Box–Muller normal deviate. */
|
|
74
|
+
const gauss = () => Math.sqrt(-2 * Math.log(1 - Math.random())) * Math.cos(Math.random() * Math.PI * 2);
|
|
75
|
+
/**
|
|
76
|
+
* Builds the dome. `milkyWay` (0..1) moves that fraction (× 0.7) of the stars into a
|
|
77
|
+
* dense band of faint stars along a great circle, with a wider, sparser halo — the
|
|
78
|
+
* unresolved glow reads as the band even though every point is still a star. The
|
|
79
|
+
* full colour-temperature tint is baked per star; the shader scales it by warmth.
|
|
80
|
+
*/
|
|
81
|
+
function buildStars(count, milkyWay) {
|
|
82
|
+
const pos = new Float32Array(count * 3);
|
|
83
|
+
const mag = new Float32Array(count);
|
|
84
|
+
const phase = new Float32Array(count);
|
|
85
|
+
const tint = new Float32Array(count * 3);
|
|
86
|
+
const inBand = Math.round(count * 0.7 * THREE.MathUtils.clamp(milkyWay, 0, 1));
|
|
87
|
+
const p = new THREE.Vector3();
|
|
88
|
+
for (let i = 0; i < count; i++) {
|
|
89
|
+
if (i < inBand) {
|
|
90
|
+
// along the band: uniform angle; across it: gaussian, 60% in a tight core, 40% in a halo
|
|
91
|
+
const a = Math.random() * Math.PI * 2;
|
|
92
|
+
const sigma = Math.random() < 0.6 ? 0.07 : 0.22;
|
|
93
|
+
const lat = THREE.MathUtils.clamp(gauss() * sigma, -1.2, 1.2);
|
|
94
|
+
p.copy(BAND_U).multiplyScalar(Math.cos(a) * Math.cos(lat))
|
|
95
|
+
.addScaledVector(BAND_V, Math.sin(a) * Math.cos(lat))
|
|
96
|
+
.addScaledVector(BAND_NORMAL, Math.sin(lat));
|
|
97
|
+
// the band is dust: many faint stars, rarely a bright one
|
|
98
|
+
mag[i] = 0.06 + 0.3 * Math.pow(Math.random(), 3);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// uniform on the sphere
|
|
102
|
+
const u = Math.random() * 2 - 1;
|
|
103
|
+
const th = Math.random() * Math.PI * 2;
|
|
104
|
+
const sr = Math.sqrt(1 - u * u);
|
|
105
|
+
p.set(sr * Math.cos(th), u, sr * Math.sin(th));
|
|
106
|
+
// many faint, few bright
|
|
107
|
+
mag[i] = 0.12 + 0.88 * Math.pow(Math.random(), 6);
|
|
108
|
+
}
|
|
109
|
+
pos[i * 3] = p.x;
|
|
110
|
+
pos[i * 3 + 1] = p.y;
|
|
111
|
+
pos[i * 3 + 2] = p.z;
|
|
112
|
+
phase[i] = Math.random();
|
|
113
|
+
const t = Math.random();
|
|
114
|
+
// full temperature spread (warmth 1): blue giants, orange dwarfs, the rest near white
|
|
115
|
+
const c = t < 0.12 ? [0.62, 0.74, 1.0] : t < 0.25 ? [1.0, 0.8, 0.55] : [1.0, 0.97, 0.92];
|
|
116
|
+
tint.set(c, i * 3);
|
|
117
|
+
}
|
|
118
|
+
const g = new THREE.BufferGeometry();
|
|
119
|
+
g.setAttribute('position', new THREE.BufferAttribute(pos, 3));
|
|
120
|
+
g.setAttribute('aMag', new THREE.BufferAttribute(mag, 1));
|
|
121
|
+
g.setAttribute('aPhase', new THREE.BufferAttribute(phase, 1));
|
|
122
|
+
g.setAttribute('aTint', new THREE.BufferAttribute(tint, 3));
|
|
123
|
+
return g;
|
|
124
|
+
}
|
|
125
|
+
const SkyStars = ({ timeSettings, skySettings, stars }) => {
|
|
126
|
+
const pointsRef = useRef(null);
|
|
127
|
+
const { update } = useCloudSun({ skySettings, timeSettings });
|
|
128
|
+
const { count, milkyWay, brightness, size, twinkle, warmth } = normalizeSkyStars(stars);
|
|
129
|
+
// Structural: a new dome only when count or the band changes.
|
|
130
|
+
const geometry = useMemo(() => buildStars(count, milkyWay), [count, milkyWay]);
|
|
131
|
+
const material = useMemo(() => new THREE.ShaderMaterial({
|
|
132
|
+
uniforms: {
|
|
133
|
+
uTime: { value: 0 },
|
|
134
|
+
uNight: { value: 0 },
|
|
135
|
+
uPixelRatio: { value: 1 },
|
|
136
|
+
uBrightness: { value: 1 },
|
|
137
|
+
uSize: { value: 1 },
|
|
138
|
+
uTwinkle: { value: 0.5 },
|
|
139
|
+
uWarmth: { value: 0.5 },
|
|
140
|
+
},
|
|
141
|
+
vertexShader,
|
|
142
|
+
fragmentShader,
|
|
143
|
+
transparent: true,
|
|
144
|
+
depthWrite: false,
|
|
145
|
+
depthTest: true,
|
|
146
|
+
blending: THREE.AdditiveBlending,
|
|
147
|
+
fog: false,
|
|
148
|
+
toneMapped: false,
|
|
149
|
+
}), []);
|
|
150
|
+
useEffect(() => () => geometry.dispose(), [geometry]);
|
|
151
|
+
useEffect(() => () => material.dispose(), [material]);
|
|
152
|
+
const spin = useMemo(() => new THREE.Quaternion(), []);
|
|
153
|
+
useFrame(({ camera, gl, clock }) => {
|
|
154
|
+
const points = pointsRef.current;
|
|
155
|
+
if (!points)
|
|
156
|
+
return;
|
|
157
|
+
// With the clock on, the stars belong to the day cycle: they come out as the sun
|
|
158
|
+
// sets (nightAmount). With the clock off they stand alone — the user adds them
|
|
159
|
+
// whenever they want, at full strength, whatever the sun's elevation.
|
|
160
|
+
let night = 1;
|
|
161
|
+
if (timeSettings?.enabled) {
|
|
162
|
+
const sunDir = update().direction;
|
|
163
|
+
const sunElevation = THREE.MathUtils.radToDeg(Math.asin(THREE.MathUtils.clamp(sunDir.y, -1, 1)));
|
|
164
|
+
night = nightAmount(sunElevation);
|
|
165
|
+
}
|
|
166
|
+
if (night <= 0.001) {
|
|
167
|
+
points.visible = false;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
points.visible = true;
|
|
171
|
+
const far = camera.far ?? 1000;
|
|
172
|
+
points.position.copy(camera.position);
|
|
173
|
+
points.scale.setScalar(far * 0.85);
|
|
174
|
+
// Turn with the clock about the pole, same sense as the sun (rises −Z, sets +Z).
|
|
175
|
+
const hours = timeSettings?.enabled ? skySystemManager.getTimeInHours() : 0;
|
|
176
|
+
points.quaternion.copy(spin.setFromAxisAngle(POLE, -(hours / SIDEREAL_HOURS) * Math.PI * 2));
|
|
177
|
+
material.uniforms.uTime.value = clock.elapsedTime;
|
|
178
|
+
material.uniforms.uNight.value = night;
|
|
179
|
+
material.uniforms.uPixelRatio.value = gl.getPixelRatio();
|
|
180
|
+
material.uniforms.uBrightness.value = brightness;
|
|
181
|
+
material.uniforms.uSize.value = size;
|
|
182
|
+
material.uniforms.uTwinkle.value = twinkle;
|
|
183
|
+
material.uniforms.uWarmth.value = warmth;
|
|
184
|
+
});
|
|
185
|
+
return _jsx("points", { ref: pointsRef, geometry: geometry, material: material, frustumCulled: false, renderOrder: -2 });
|
|
186
|
+
};
|
|
187
|
+
export default SkyStars;
|
|
@@ -26,9 +26,9 @@ export interface SkySystemRef {
|
|
|
26
26
|
export interface SkySystemProps extends ObjectReadyProps {
|
|
27
27
|
timeSettings: TimeSettings;
|
|
28
28
|
visible?: boolean;
|
|
29
|
-
/** True mounts the
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
/** True mounts the sun rig background (skybox + lensflare); false mounts the
|
|
30
|
+
* analytic Preetham sky instead. The key light (SunLight) is the same in both
|
|
31
|
+
* and is mounted whenever either sky is active. */
|
|
32
32
|
sunSystemVisible?: boolean;
|
|
33
33
|
sunSize?: number;
|
|
34
34
|
moonSize?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SkySystem.d.ts","sourceRoot":"","sources":["../../src/components/SkySystem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAStE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;wDAEoD;IACpD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC/B;;;uBAGmB;IACnB,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC;wDACoD;IACpD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;;;;;;;;;gFAU4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,SAAS,qFAmLb,CAAC;AAGH,eAAe,SAAS,CAAC"}
|