@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Vector3 } from 'three';
|
|
2
|
+
import type { TimeSettings } from '@3driseai/3drise-core';
|
|
3
|
+
export interface MoonState {
|
|
4
|
+
/** Unit vector toward the moon (core sunUtils convention). */
|
|
5
|
+
direction: Vector3;
|
|
6
|
+
/** Lit fraction of the disc, 0 new … 1 full. */
|
|
7
|
+
illumination: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Where the moon is, for the key light and the moon disc.
|
|
11
|
+
*
|
|
12
|
+
* With time of day on it is the clock's moon — the sun's own arc, `moonPhase`
|
|
13
|
+
* of a day behind (see SkySystemManager.calculateMoon). With time off there are
|
|
14
|
+
* no hours to lag by, so it is a full moon opposite the sun: set the sun below
|
|
15
|
+
* the horizon and the moon stands above it on the other side.
|
|
16
|
+
*
|
|
17
|
+
* `sunDirection` is the resolved sun (useCloudSun), so the moon is always
|
|
18
|
+
* placed against the sun that is actually drawn and lit.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveMoon(timeSettings: TimeSettings | undefined, sunDirection: Vector3, out: MoonState): MoonState;
|
|
21
|
+
/** Night tint for moonlight (perceived, not physical — real moonlight is
|
|
22
|
+
* slightly red; at night the eye reads it blue). Shared by the key light and
|
|
23
|
+
* the water so the moon lights both the same colour. */
|
|
24
|
+
export declare const MOON_LIGHT_COLOR: {
|
|
25
|
+
readonly r: 0.62;
|
|
26
|
+
readonly g: 0.72;
|
|
27
|
+
readonly b: 1;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 0..1 strength of moonlight: the sun must be down (fades in from −1° to −8°),
|
|
31
|
+
* the moon up (−1° … 4°), scaled by how much of the disc is lit. The key light
|
|
32
|
+
* and the ocean's moon glitter both use this, so they come and go together.
|
|
33
|
+
*/
|
|
34
|
+
export declare function moonlightFactor(sunElevationDeg: number, moon: MoonState): number;
|
|
35
|
+
//# sourceMappingURL=skyMoon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skyMoon.d.ts","sourceRoot":"","sources":["../../src/utils/skyMoon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,WAAW,SAAS;IACtB,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,GAAG,SAAS,CAWpH;AAED;;yDAEyD;AACzD,eAAO,MAAM,gBAAgB;;;;CAAwC,CAAC;AAOtE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAGhF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { skySystemManager } from '@3driseai/3drise-core';
|
|
2
|
+
/**
|
|
3
|
+
* Where the moon is, for the key light and the moon disc.
|
|
4
|
+
*
|
|
5
|
+
* With time of day on it is the clock's moon — the sun's own arc, `moonPhase`
|
|
6
|
+
* of a day behind (see SkySystemManager.calculateMoon). With time off there are
|
|
7
|
+
* no hours to lag by, so it is a full moon opposite the sun: set the sun below
|
|
8
|
+
* the horizon and the moon stands above it on the other side.
|
|
9
|
+
*
|
|
10
|
+
* `sunDirection` is the resolved sun (useCloudSun), so the moon is always
|
|
11
|
+
* placed against the sun that is actually drawn and lit.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveMoon(timeSettings, sunDirection, out) {
|
|
14
|
+
if (timeSettings?.enabled) {
|
|
15
|
+
const s = skySystemManager.getState();
|
|
16
|
+
out.direction.copy(s.moonDirection);
|
|
17
|
+
out.illumination = s.moonIllumination;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
out.direction.copy(sunDirection).negate();
|
|
21
|
+
out.illumination = 1;
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
/** Night tint for moonlight (perceived, not physical — real moonlight is
|
|
26
|
+
* slightly red; at night the eye reads it blue). Shared by the key light and
|
|
27
|
+
* the water so the moon lights both the same colour. */
|
|
28
|
+
export const MOON_LIGHT_COLOR = { r: 0.62, g: 0.72, b: 1.0 };
|
|
29
|
+
const smooth01 = (edge0, edge1, x) => {
|
|
30
|
+
const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
|
|
31
|
+
return t * t * (3 - 2 * t);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 0..1 strength of moonlight: the sun must be down (fades in from −1° to −8°),
|
|
35
|
+
* the moon up (−1° … 4°), scaled by how much of the disc is lit. The key light
|
|
36
|
+
* and the ocean's moon glitter both use this, so they come and go together.
|
|
37
|
+
*/
|
|
38
|
+
export function moonlightFactor(sunElevationDeg, moon) {
|
|
39
|
+
const moonElevation = (Math.asin(Math.max(-1, Math.min(1, moon.direction.y))) * 180) / Math.PI;
|
|
40
|
+
return smooth01(-1, -8, sunElevationDeg) * smooth01(-1, 4, moonElevation) * moon.illumination;
|
|
41
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TerrainConfig } from '@3driseai/3drise-core';
|
|
2
|
+
/** World height of the terrain surface at world (x, z). */
|
|
3
|
+
export declare function terrainHeightAt(config: TerrainConfig, x: number, z: number, lodCell?: number): number;
|
|
4
|
+
//# sourceMappingURL=terrainHeight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrainHeight.d.ts","sourceRoot":"","sources":["../../src/utils/terrainHeight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA6E3D,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAmFhG"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terrain's height field on the CPU — a line-for-line port of
|
|
3
|
+
* `terrainHeightAt` in shaders/glsl/terrainCore.glsl.ts.
|
|
4
|
+
*
|
|
5
|
+
* Until this existed the shader was the only thing that knew where the ground
|
|
6
|
+
* was: nothing could stand on the terrain, and the studio camera could sit 200 m
|
|
7
|
+
* above it (or inside a hill) with no way to tell. Now the panel can put the
|
|
8
|
+
* camera on the ground and the agent can ask `env.terrain.heightAt(x, z)`.
|
|
9
|
+
*
|
|
10
|
+
* KEEP IT IN STEP WITH THE GLSL. Any change to the height field there — an
|
|
11
|
+
* octave rule, a shaping operator, a constant — must land here too, or a query
|
|
12
|
+
* and the rendered surface disagree.
|
|
13
|
+
*
|
|
14
|
+
* The hash runs through Math.fround so its fract() lands where the GPU's float32
|
|
15
|
+
* one does; everything else is plain double precision, which differs from the
|
|
16
|
+
* GPU by far less than a centimetre.
|
|
17
|
+
*
|
|
18
|
+
* `lodCell` is the shading cell, as in the shader: octaves finer than about two
|
|
19
|
+
* cells are faded out. The default is the finest clipmap cell, which is what the
|
|
20
|
+
* mesh under a camera standing on the ground is built from. Curvature is not
|
|
21
|
+
* applied — it is a view-relative bend, and is negligible within a kilometre.
|
|
22
|
+
*/
|
|
23
|
+
const f32 = Math.fround;
|
|
24
|
+
const fract = (x) => x - Math.floor(x);
|
|
25
|
+
const clamp = (x, lo, hi) => Math.min(hi, Math.max(lo, x));
|
|
26
|
+
const mix = (a, b, t) => a + (b - a) * t;
|
|
27
|
+
const smoothstep = (e0, e1, x) => {
|
|
28
|
+
const t = clamp((x - e0) / (e1 - e0), 0, 1);
|
|
29
|
+
return t * t * (3 - 2 * t);
|
|
30
|
+
};
|
|
31
|
+
/** tHash: Hoskins, float32. Returns two components in [-1, 1]. */
|
|
32
|
+
function tHash(px, py) {
|
|
33
|
+
let a = f32(fract(f32(px * 0.1031)));
|
|
34
|
+
let b = f32(fract(f32(py * 0.1030)));
|
|
35
|
+
let c = f32(fract(f32(px * 0.0973)));
|
|
36
|
+
const d = f32(f32(a * f32(b + 33.33)) + f32(b * f32(c + 33.33)) + f32(c * f32(a + 33.33)));
|
|
37
|
+
a = f32(a + d);
|
|
38
|
+
b = f32(b + d);
|
|
39
|
+
c = f32(c + d);
|
|
40
|
+
// fract((p3.xx + p3.yz) * p3.zy)
|
|
41
|
+
const x = f32(fract(f32(f32(a + b) * c)));
|
|
42
|
+
const y = f32(fract(f32(f32(a + c) * b)));
|
|
43
|
+
return [-1 + 2 * x, -1 + 2 * y];
|
|
44
|
+
}
|
|
45
|
+
/** tNoised: gradient noise with derivative. [value, d/dx, d/dy]. */
|
|
46
|
+
function tNoised(x, y) {
|
|
47
|
+
const ix = Math.floor(x), iy = Math.floor(y);
|
|
48
|
+
const fx = x - ix, fy = y - iy;
|
|
49
|
+
const ux = fx * fx * fx * (fx * (fx * 6 - 15) + 10);
|
|
50
|
+
const uy = fy * fy * fy * (fy * (fy * 6 - 15) + 10);
|
|
51
|
+
const dux = 30 * fx * fx * (fx * (fx - 2) + 1);
|
|
52
|
+
const duy = 30 * fy * fy * (fy * (fy - 2) + 1);
|
|
53
|
+
const ga = tHash(ix, iy);
|
|
54
|
+
const gb = tHash(ix + 1, iy);
|
|
55
|
+
const gc = tHash(ix, iy + 1);
|
|
56
|
+
const gd = tHash(ix + 1, iy + 1);
|
|
57
|
+
const va = ga[0] * fx + ga[1] * fy;
|
|
58
|
+
const vb = gb[0] * (fx - 1) + gb[1] * fy;
|
|
59
|
+
const vc = gc[0] * fx + gc[1] * (fy - 1);
|
|
60
|
+
const vd = gd[0] * (fx - 1) + gd[1] * (fy - 1);
|
|
61
|
+
const k = va - vb - vc + vd;
|
|
62
|
+
const v = va + ux * (vb - va) + uy * (vc - va) + ux * uy * k;
|
|
63
|
+
const dx = ga[0] + ux * (gb[0] - ga[0]) + uy * (gc[0] - ga[0]) + ux * uy * (ga[0] - gb[0] - gc[0] + gd[0])
|
|
64
|
+
+ dux * (uy * k + vb - va);
|
|
65
|
+
const dy = ga[1] + ux * (gb[1] - ga[1]) + uy * (gc[1] - ga[1]) + ux * uy * (ga[1] - gb[1] - gc[1] + gd[1])
|
|
66
|
+
+ duy * (ux * k + vc - va);
|
|
67
|
+
return [v, dx, dy];
|
|
68
|
+
}
|
|
69
|
+
const TYPE_INDEX = { mountains: 0, dunes: 1, hills: 2, canyon: 3 };
|
|
70
|
+
/** World height of the terrain surface at world (x, z). */
|
|
71
|
+
export function terrainHeightAt(config, x, z, lodCell = 2) {
|
|
72
|
+
const baseScale = 1 / (config.featureSize > 1e-6 ? config.featureSize : 2600);
|
|
73
|
+
const octaves = Math.round(clamp(config.octaves, 1, 12));
|
|
74
|
+
const lacunarity = config.lacunarity;
|
|
75
|
+
const gain = config.gain;
|
|
76
|
+
const ridge = config.ridgeSharpness;
|
|
77
|
+
const warpStrength = config.warpStrength;
|
|
78
|
+
const warpScale = config.warpSize;
|
|
79
|
+
const erosion = config.erosion;
|
|
80
|
+
const elevation = Math.max(config.elevation, 0.01);
|
|
81
|
+
const type = TYPE_INDEX[config.terrainType] ?? 2;
|
|
82
|
+
let qx = x * baseScale;
|
|
83
|
+
let qy = z * baseScale;
|
|
84
|
+
if (warpStrength > 0) {
|
|
85
|
+
const w0 = tNoised(qx * warpScale + 11.3, qy * warpScale + 5.7)[0];
|
|
86
|
+
const w1 = tNoised(qx * warpScale - 7.1, qy * warpScale + 19.2)[0];
|
|
87
|
+
qx += w0 * warpStrength;
|
|
88
|
+
qy += w1 * warpStrength;
|
|
89
|
+
}
|
|
90
|
+
let amp = 1, freq = 1, sum = 0, norm = 0;
|
|
91
|
+
let sx = 0, sy = 0;
|
|
92
|
+
let wl = 1 / Math.max(baseScale, 1e-9);
|
|
93
|
+
for (let i = 0; i < 12; i++) {
|
|
94
|
+
if (i >= octaves)
|
|
95
|
+
break;
|
|
96
|
+
const fade = clamp(wl / Math.max(2 * lodCell, 1e-4) - 1, 0, 1);
|
|
97
|
+
if (fade <= 0.001)
|
|
98
|
+
break;
|
|
99
|
+
const n = tNoised(qx * freq + i * 37.13, qy * freq + i * 61.91);
|
|
100
|
+
let v = n[0];
|
|
101
|
+
let gx = n[1], gy = n[2];
|
|
102
|
+
if (ridge > 0) {
|
|
103
|
+
const ridgeAmt = ridge * clamp(i * 0.5, 0, 1);
|
|
104
|
+
const sg = Math.sign(v);
|
|
105
|
+
const r = 1 - Math.abs(v);
|
|
106
|
+
v = mix(v, r * r * 2 - 1, ridgeAmt);
|
|
107
|
+
gx = mix(gx, -4 * r * sg * gx, ridgeAmt);
|
|
108
|
+
gy = mix(gy, -4 * r * sg * gy, ridgeAmt);
|
|
109
|
+
}
|
|
110
|
+
const damp = 1 / (1 + erosion * 1.5 * (sx * sx + sy * sy));
|
|
111
|
+
sum += amp * damp * fade * v;
|
|
112
|
+
norm += amp * fade;
|
|
113
|
+
sx += gx * amp * damp;
|
|
114
|
+
sy += gy * amp * damp;
|
|
115
|
+
amp *= gain;
|
|
116
|
+
freq *= lacunarity;
|
|
117
|
+
wl /= lacunarity;
|
|
118
|
+
}
|
|
119
|
+
const t = (sum / Math.max(norm, 1e-4)) * 3.2;
|
|
120
|
+
let h = 0.5 + 0.5 * t / Math.sqrt(1 + t * t);
|
|
121
|
+
if (type === 1) {
|
|
122
|
+
const a = (config.bearing * Math.PI) / 180;
|
|
123
|
+
let bx = Math.sin(a), by = Math.cos(a);
|
|
124
|
+
const bl = Math.hypot(bx, by) || 1;
|
|
125
|
+
bx /= bl;
|
|
126
|
+
by /= bl;
|
|
127
|
+
// d = vec2(bearingDir.y, -bearingDir.x)
|
|
128
|
+
const duneFreq = (Math.PI * 2) / Math.max(config.duneWavelength, 1);
|
|
129
|
+
const u = 0.5 + 0.5 * Math.sin((x * by + z * -bx) * duneFreq + 7 * h);
|
|
130
|
+
const s = Math.pow(Math.max(u, 1e-4), mix(1, 3.2, config.duneAsymmetry));
|
|
131
|
+
h = mix(0.15 + 0.5 * h, s * (0.45 + 0.55 * h), 0.8);
|
|
132
|
+
}
|
|
133
|
+
else if (type === 3) {
|
|
134
|
+
const om = 1 - h;
|
|
135
|
+
const mesa = mix(h, 1 - om * om * om, config.plateau);
|
|
136
|
+
const ch = 1 - Math.abs(tNoised(x * (baseScale * 1.7) + 4.2, z * (baseScale * 1.7) - 9.1)[0]);
|
|
137
|
+
h = mesa - config.valleyDepth * smoothstep(1 - config.valleyWidth, 1, ch);
|
|
138
|
+
}
|
|
139
|
+
const terraces = Math.round(config.terraces);
|
|
140
|
+
if (terraces >= 0.5) {
|
|
141
|
+
const n = terraces;
|
|
142
|
+
const featureSize = 1 / Math.max(baseScale, 1e-9);
|
|
143
|
+
const soft = clamp((lodCell * n * 8) / featureSize, 0, 1);
|
|
144
|
+
const w = Math.max(1 - 0.95 * config.terraceSharpness, 0.02);
|
|
145
|
+
const xh = h * n;
|
|
146
|
+
const fr = fract(xh);
|
|
147
|
+
h = (Math.floor(xh) + mix(smoothstep(0, w, fr), fr, soft)) / n;
|
|
148
|
+
}
|
|
149
|
+
return config.seaLevel + elevation * h;
|
|
150
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TerrainTextures } from '@3driseai/3drise-core';
|
|
2
|
+
/**
|
|
3
|
+
* Turns texture-set NAMES into map URLs for terrain textures that name a set but
|
|
4
|
+
* carry no URLs yet (a land object fresh from the catalog, a ground picked before
|
|
5
|
+
* the files were uploaded).
|
|
6
|
+
*
|
|
7
|
+
* The viewer does not know the app's file tree, so the client registers the
|
|
8
|
+
* resolver (it owns the texture library) and re-registers it when the library
|
|
9
|
+
* changes; renderers subscribe to the version so they re-resolve. Without one — an
|
|
10
|
+
* embed, a test harness — the stored URLs are used as they are. Must return the
|
|
11
|
+
* SAME object when nothing changes, so renderer memos hold.
|
|
12
|
+
*/
|
|
13
|
+
export type TerrainTextureResolver = (textures: TerrainTextures | undefined) => TerrainTextures | undefined;
|
|
14
|
+
export declare function setTerrainTextureResolver(fn: TerrainTextureResolver | null): void;
|
|
15
|
+
export declare function resolveTerrainTextureSets(textures: TerrainTextures | undefined): TerrainTextures | undefined;
|
|
16
|
+
/** Changes whenever the resolver does: a memo dependency for resolved textures. */
|
|
17
|
+
export declare function useTerrainTextureResolverVersion(): number;
|
|
18
|
+
//# sourceMappingURL=terrainTextureResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrainTextureResolver.d.ts","sourceRoot":"","sources":["../../src/utils/terrainTextureResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,KAAK,eAAe,GAAG,SAAS,CAAC;AAM5G,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAIjF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAE5G;AAED,mFAAmF;AACnF,wBAAgB,gCAAgC,IAAI,MAAM,CAMzD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
let resolver = null;
|
|
3
|
+
let version = 0;
|
|
4
|
+
const listeners = new Set();
|
|
5
|
+
export function setTerrainTextureResolver(fn) {
|
|
6
|
+
resolver = fn;
|
|
7
|
+
version++;
|
|
8
|
+
for (const l of listeners)
|
|
9
|
+
l();
|
|
10
|
+
}
|
|
11
|
+
export function resolveTerrainTextureSets(textures) {
|
|
12
|
+
return resolver ? (resolver(textures) ?? textures) : textures;
|
|
13
|
+
}
|
|
14
|
+
/** Changes whenever the resolver does: a memo dependency for resolved textures. */
|
|
15
|
+
export function useTerrainTextureResolverVersion() {
|
|
16
|
+
return useSyncExternalStore((l) => { listeners.add(l); return () => { listeners.delete(l); }; }, () => version, () => version);
|
|
17
|
+
}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import type { TerrainConfig, TerrainQualityConfig } from '@3driseai/3drise-core';
|
|
3
|
+
import type { TerrainTextureState } from '../hooks/useTerrainTextures';
|
|
3
4
|
import type { CloudSunState } from '../hooks/useCloudSun';
|
|
4
5
|
export declare function applyTerrainUniforms(material: THREE.ShaderMaterial, config: TerrainConfig, quality: TerrainQualityConfig): void;
|
|
5
6
|
export default applyTerrainUniforms;
|
|
7
|
+
/**
|
|
8
|
+
* The texture layer uniforms, and the TERRAIN_TEXTURED define.
|
|
9
|
+
*
|
|
10
|
+
* Called every frame after `applyTerrainUniforms`, like it, so tile size, tint,
|
|
11
|
+
* brightness and normal strength are live.
|
|
12
|
+
*
|
|
13
|
+
* A textured layer is the set's own colours, brought to the luminance of the
|
|
14
|
+
* layer's tuned colour, × tint × brightness. Its far colour —
|
|
15
|
+
* what the near field fades into past the texture distance — is the texture's mean
|
|
16
|
+
* × the same factors, so the fade has nothing to jump. An untextured layer is its
|
|
17
|
+
* flat hex colour, near and far.
|
|
18
|
+
*
|
|
19
|
+
* The define only flips when the arrays arrive or go, so the recompile happens
|
|
20
|
+
* once per texture change, never per frame.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyTerrainTextures(material: THREE.ShaderMaterial, config: TerrainConfig, tex: TerrainTextureState): void;
|
|
6
23
|
/** skyRadiance(rd), in the units the shader returns. */
|
|
7
24
|
export declare function skyRadianceAt(rd: THREE.Vector3, sun: CloudSunState, out: THREE.Color): THREE.Color;
|
|
8
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terrainUniforms.d.ts","sourceRoot":"","sources":["../../src/utils/terrainUniforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAe,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"terrainUniforms.d.ts","sourceRoot":"","sources":["../../src/utils/terrainUniforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAe,MAAM,uBAAuB,CAAC;AAE9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoD1D,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,oBAAoB,GAC9B,IAAI,CAwDN;AAED,eAAe,oBAAoB,CAAC;AAUpC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,mBAAmB,GACzB,IAAI,CAyDN;AAiCD,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CA4BlG;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAwC5F"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import { TERRAIN_LAYER_KEYS } from '@3driseai/3drise-core';
|
|
2
3
|
/**
|
|
3
4
|
* Config to uniform mapping for the terrain material.
|
|
4
5
|
*
|
|
@@ -98,6 +99,89 @@ export function applyTerrainUniforms(material, config, quality) {
|
|
|
98
99
|
}
|
|
99
100
|
export default applyTerrainUniforms;
|
|
100
101
|
// -----------------------------------------------------------------------------
|
|
102
|
+
// Ground textures
|
|
103
|
+
// -----------------------------------------------------------------------------
|
|
104
|
+
const _flat = new THREE.Color();
|
|
105
|
+
const luma = (r, g, b) => 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
106
|
+
const LAYER_COLOR_KEY = ['lowColor', 'midColor', 'rockColor', 'peakColor'];
|
|
107
|
+
/**
|
|
108
|
+
* The texture layer uniforms, and the TERRAIN_TEXTURED define.
|
|
109
|
+
*
|
|
110
|
+
* Called every frame after `applyTerrainUniforms`, like it, so tile size, tint,
|
|
111
|
+
* brightness and normal strength are live.
|
|
112
|
+
*
|
|
113
|
+
* A textured layer is the set's own colours, brought to the luminance of the
|
|
114
|
+
* layer's tuned colour, × tint × brightness. Its far colour —
|
|
115
|
+
* what the near field fades into past the texture distance — is the texture's mean
|
|
116
|
+
* × the same factors, so the fade has nothing to jump. An untextured layer is its
|
|
117
|
+
* flat hex colour, near and far.
|
|
118
|
+
*
|
|
119
|
+
* The define only flips when the arrays arrive or go, so the recompile happens
|
|
120
|
+
* once per texture change, never per frame.
|
|
121
|
+
*/
|
|
122
|
+
export function applyTerrainTextures(material, config, tex) {
|
|
123
|
+
const u = material.uniforms;
|
|
124
|
+
if (!u || !u.u_tFar)
|
|
125
|
+
return;
|
|
126
|
+
const textures = config.textures;
|
|
127
|
+
const far = u.u_tFar.value;
|
|
128
|
+
const layer = u.u_tLayer.value;
|
|
129
|
+
const tint = u.u_tTint.value;
|
|
130
|
+
let any = false;
|
|
131
|
+
TERRAIN_LAYER_KEYS.forEach((key, i) => {
|
|
132
|
+
const t = textures?.[key];
|
|
133
|
+
const textured = !!(tex.ready && tex.textured[i]);
|
|
134
|
+
any = any || textured;
|
|
135
|
+
if (textured) {
|
|
136
|
+
const m = tex.meanColor[i];
|
|
137
|
+
// Exposure: scans are photographed at any brightness, so a textured
|
|
138
|
+
// layer is first brought to the LUMINANCE of the layer's tuned colour
|
|
139
|
+
// (the biome sets it), keeping the scan's own hue and detail. Then the
|
|
140
|
+
// user's brightness and tint act on top of that.
|
|
141
|
+
_flat.setStyle(config[LAYER_COLOR_KEY[i]], THREE.SRGBColorSpace);
|
|
142
|
+
const auto = THREE.MathUtils.clamp(luma(_flat.r, _flat.g, _flat.b) / Math.max(luma(m.x, m.y, m.z), 1e-3), 0.25, 4);
|
|
143
|
+
_flat.setStyle(t?.tint || '#ffffff', THREE.SRGBColorSpace);
|
|
144
|
+
const k = Math.max(t?.brightness ?? 1, 0) * auto;
|
|
145
|
+
tint[i].setRGB(_flat.r * k, _flat.g * k, _flat.b * k);
|
|
146
|
+
far[i].setRGB(m.x * tint[i].r, m.y * tint[i].g, m.z * tint[i].b);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
_flat.setStyle(config[LAYER_COLOR_KEY[i]], THREE.SRGBColorSpace);
|
|
150
|
+
far[i].copy(_flat);
|
|
151
|
+
tint[i].setRGB(1, 1, 1);
|
|
152
|
+
}
|
|
153
|
+
layer[i].set(1 / Math.max(t?.tileSize ?? 3, 0.05), t?.normalStrength ?? 1, textured ? 1 : 0, 0);
|
|
154
|
+
});
|
|
155
|
+
if (any) {
|
|
156
|
+
u.u_tColor.value = tex.color;
|
|
157
|
+
u.u_tNormal.value = tex.normal;
|
|
158
|
+
u.u_tOrm.value = tex.orm;
|
|
159
|
+
const mc = u.u_tMeanC.value;
|
|
160
|
+
const mn = u.u_tMeanN.value;
|
|
161
|
+
const mo = u.u_tMeanO.value;
|
|
162
|
+
for (let i = 0; i < 4; i++) {
|
|
163
|
+
const c = tex.meanColor[i], n = tex.meanNormal[i], o = tex.meanOrm[i];
|
|
164
|
+
if (c)
|
|
165
|
+
mc[i].set(c.x, c.y, c.z, 1);
|
|
166
|
+
if (n)
|
|
167
|
+
mn[i].set(n.x, n.y, n.z, 0.5);
|
|
168
|
+
if (o)
|
|
169
|
+
mo[i].set(o.x, o.y, o.z, 1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
u.u_tDistance.value = Math.max(config.textureDistance ?? 1500, 1);
|
|
173
|
+
u.u_tHeightBlend.value = THREE.MathUtils.clamp(config.textureHeightBlend ?? 0.7, 0, 1);
|
|
174
|
+
const defines = (material.defines ??= {});
|
|
175
|
+
const has = 'TERRAIN_TEXTURED' in defines;
|
|
176
|
+
if (any !== has) {
|
|
177
|
+
if (any)
|
|
178
|
+
defines.TERRAIN_TEXTURED = '';
|
|
179
|
+
else
|
|
180
|
+
delete defines.TERRAIN_TEXTURED;
|
|
181
|
+
material.needsUpdate = true;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// -----------------------------------------------------------------------------
|
|
101
185
|
// Ambient
|
|
102
186
|
// -----------------------------------------------------------------------------
|
|
103
187
|
/**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare function loadArrayImage(url: string): Promise<HTMLImageElement>;
|
|
3
|
+
/** Loads a URL, or resolves to null for a missing / failing one — a layer with a
|
|
4
|
+
* missing map degrades to its fallback rather than taking the whole array down. */
|
|
5
|
+
export declare function loadArrayImageOrNull(url: string | undefined | null): Promise<HTMLImageElement | null>;
|
|
6
|
+
/** Where one output channel of one layer comes from. */
|
|
7
|
+
export interface ChannelSource {
|
|
8
|
+
image: HTMLImageElement | null;
|
|
9
|
+
/** Source channel to read, 0..3. Grayscale maps: 0. */
|
|
10
|
+
channel?: number;
|
|
11
|
+
/** Byte written when there is no image. */
|
|
12
|
+
fallback: number;
|
|
13
|
+
}
|
|
14
|
+
/** One layer: four channel sources, R G B A. */
|
|
15
|
+
export type LayerChannels = [ChannelSource, ChannelSource, ChannelSource, ChannelSource];
|
|
16
|
+
export interface ChannelArrayResult {
|
|
17
|
+
texture: THREE.DataArrayTexture;
|
|
18
|
+
/** Mean RGB per layer, in the space the shader samples it in: linear for an
|
|
19
|
+
* sRGB array, raw 0..1 otherwise. */
|
|
20
|
+
means: THREE.Vector3[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pack layers into one `DataArrayTexture`, each output channel taken from any
|
|
24
|
+
* channel of any image. Every image is redrawn at `size` — array layers must
|
|
25
|
+
* match and source maps never reliably do. An image used by several channels is
|
|
26
|
+
* read once.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildChannelArray(layers: LayerChannels[], size: number, colorSpace: THREE.ColorSpace): ChannelArrayResult;
|
|
29
|
+
//# sourceMappingURL=textureArrays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureArrays.d.ts","sourceRoot":"","sources":["../../src/utils/textureArrays.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAyB9B,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAerE;AAED;oFACoF;AACpF,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAQ3G;AA6BD,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC9B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAA;AAExF,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAA;IAC/B;0CACsC;IACtC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,aAAa,EAAE,EACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,KAAK,CAAC,UAAU,GAC7B,kBAAkB,CAwDpB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Texture arrays for splat-textured ground — shared by the terrain surface.
|
|
4
|
+
*
|
|
5
|
+
* Moved out of the landscape module (`landscapeTextures.ts`), which keeps its own
|
|
6
|
+
* copy until it is retired. Two changes on the way:
|
|
7
|
+
*
|
|
8
|
+
* - **Packing is per channel.** A layer's RGBA can be assembled from several
|
|
9
|
+
* source images — the normal map's RGB with the displacement map's red in
|
|
10
|
+
* alpha, or AO and roughness side by side in one ORM layer — so the terrain
|
|
11
|
+
* pays for three arrays instead of five.
|
|
12
|
+
* - **Means are linear.** An sRGB array is decoded to linear by the sampler, so
|
|
13
|
+
* the mean the variance-preserving stochastic blend subtracts from those samples
|
|
14
|
+
* has to be linear too. The landscape computed it in sRGB, which biases every
|
|
15
|
+
* stochastic blend toward a slightly wrong grey.
|
|
16
|
+
*
|
|
17
|
+
* Every image is read through a 2D canvas, so it must be CORS-clean: an image
|
|
18
|
+
* served without `Access-Control-Allow-Origin` taints the canvas and
|
|
19
|
+
* `getImageData` throws. The texture itself would render fine and only the
|
|
20
|
+
* packing fails, which is confusing — hence the explicit error.
|
|
21
|
+
*/
|
|
22
|
+
const imageCache = new Map();
|
|
23
|
+
export function loadArrayImage(url) {
|
|
24
|
+
const cached = imageCache.get(url);
|
|
25
|
+
if (cached)
|
|
26
|
+
return cached;
|
|
27
|
+
const promise = new Promise((resolve, reject) => {
|
|
28
|
+
const image = new window.Image();
|
|
29
|
+
image.crossOrigin = 'anonymous';
|
|
30
|
+
image.onload = () => resolve(image);
|
|
31
|
+
image.onerror = () => {
|
|
32
|
+
imageCache.delete(url);
|
|
33
|
+
reject(new Error(`texture array: failed to load ${url}`));
|
|
34
|
+
};
|
|
35
|
+
image.src = url;
|
|
36
|
+
});
|
|
37
|
+
imageCache.set(url, promise);
|
|
38
|
+
return promise;
|
|
39
|
+
}
|
|
40
|
+
/** Loads a URL, or resolves to null for a missing / failing one — a layer with a
|
|
41
|
+
* missing map degrades to its fallback rather than taking the whole array down. */
|
|
42
|
+
export async function loadArrayImageOrNull(url) {
|
|
43
|
+
if (!url)
|
|
44
|
+
return null;
|
|
45
|
+
try {
|
|
46
|
+
return await loadArrayImage(url);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.warn(String(error));
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function readPixels(image, size) {
|
|
54
|
+
const canvas = document.createElement('canvas');
|
|
55
|
+
canvas.width = size;
|
|
56
|
+
canvas.height = size;
|
|
57
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
58
|
+
if (!ctx)
|
|
59
|
+
throw new Error('texture array: no 2d context');
|
|
60
|
+
ctx.drawImage(image, 0, 0, size, size);
|
|
61
|
+
try {
|
|
62
|
+
return ctx.getImageData(0, 0, size, size).data;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
throw new Error(`texture array: cannot read pixels from ${image.src} — the canvas is tainted. `
|
|
66
|
+
+ 'The asset host must send Access-Control-Allow-Origin.');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** sRGB byte -> linear float, once. */
|
|
70
|
+
const SRGB_TO_LINEAR = (() => {
|
|
71
|
+
const lut = new Float32Array(256);
|
|
72
|
+
for (let i = 0; i < 256; i++) {
|
|
73
|
+
const c = i / 255;
|
|
74
|
+
lut[i] = c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
75
|
+
}
|
|
76
|
+
return lut;
|
|
77
|
+
})();
|
|
78
|
+
/**
|
|
79
|
+
* Pack layers into one `DataArrayTexture`, each output channel taken from any
|
|
80
|
+
* channel of any image. Every image is redrawn at `size` — array layers must
|
|
81
|
+
* match and source maps never reliably do. An image used by several channels is
|
|
82
|
+
* read once.
|
|
83
|
+
*/
|
|
84
|
+
export function buildChannelArray(layers, size, colorSpace) {
|
|
85
|
+
const stride = size * size * 4;
|
|
86
|
+
const data = new Uint8Array(stride * Math.max(layers.length, 1));
|
|
87
|
+
const means = [];
|
|
88
|
+
const pixelCache = new Map();
|
|
89
|
+
const pixelsOf = (image) => {
|
|
90
|
+
let px = pixelCache.get(image);
|
|
91
|
+
if (!px) {
|
|
92
|
+
px = readPixels(image, size);
|
|
93
|
+
pixelCache.set(image, px);
|
|
94
|
+
}
|
|
95
|
+
return px;
|
|
96
|
+
};
|
|
97
|
+
const srgb = colorSpace === THREE.SRGBColorSpace;
|
|
98
|
+
layers.forEach((channels, layer) => {
|
|
99
|
+
const offset = layer * stride;
|
|
100
|
+
for (let c = 0; c < 4; c++) {
|
|
101
|
+
const source = channels[c];
|
|
102
|
+
if (source.image) {
|
|
103
|
+
const px = pixelsOf(source.image);
|
|
104
|
+
const from = source.channel ?? 0;
|
|
105
|
+
for (let p = 0; p < stride; p += 4)
|
|
106
|
+
data[offset + p + c] = px[p + from];
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
for (let p = 0; p < stride; p += 4)
|
|
110
|
+
data[offset + p + c] = source.fallback;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
let r = 0, g = 0, b = 0;
|
|
114
|
+
for (let p = 0; p < stride; p += 4) {
|
|
115
|
+
if (srgb) {
|
|
116
|
+
r += SRGB_TO_LINEAR[data[offset + p]];
|
|
117
|
+
g += SRGB_TO_LINEAR[data[offset + p + 1]];
|
|
118
|
+
b += SRGB_TO_LINEAR[data[offset + p + 2]];
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
r += data[offset + p] / 255;
|
|
122
|
+
g += data[offset + p + 1] / 255;
|
|
123
|
+
b += data[offset + p + 2] / 255;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const n = size * size || 1;
|
|
127
|
+
means.push(new THREE.Vector3(r / n, g / n, b / n));
|
|
128
|
+
});
|
|
129
|
+
const texture = new THREE.DataArrayTexture(data, size, size, Math.max(layers.length, 1));
|
|
130
|
+
texture.format = THREE.RGBAFormat;
|
|
131
|
+
texture.type = THREE.UnsignedByteType;
|
|
132
|
+
texture.colorSpace = colorSpace;
|
|
133
|
+
texture.minFilter = THREE.LinearMipMapLinearFilter;
|
|
134
|
+
texture.magFilter = THREE.LinearFilter;
|
|
135
|
+
texture.wrapS = THREE.RepeatWrapping;
|
|
136
|
+
texture.wrapT = THREE.RepeatWrapping;
|
|
137
|
+
texture.generateMipmaps = true;
|
|
138
|
+
texture.needsUpdate = true;
|
|
139
|
+
return { texture, means };
|
|
140
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@3driseai/3drise-common": "^1.0.1",
|
|
42
|
-
"@3driseai/3drise-core": "^1.0.
|
|
42
|
+
"@3driseai/3drise-core": "^1.0.22"
|
|
43
43
|
}
|
|
44
44
|
}
|