@3driseai/3drise-viewer 0.1.42 → 0.1.43
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/ClipsRuntime.d.ts +16 -1
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +144 -25
- package/dist/animationsV2/appliers.d.ts +9 -0
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +62 -2
- package/dist/animationsV2/clipUtils.d.ts +30 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -1
- package/dist/animationsV2/clipUtils.js +163 -17
- package/dist/animationsV2/elementSettings.d.ts +5 -0
- package/dist/animationsV2/elementSettings.d.ts.map +1 -1
- package/dist/animationsV2/elementSettings.js +6 -3
- package/dist/animationsV2/sequenceUtils.js +4 -4
- package/dist/animationsV2/types.d.ts +23 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +2 -2
- package/dist/components/CreatedObject.d.ts +3 -0
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +6 -2
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +1 -10
- package/dist/components/EnvironmentManager.d.ts.map +1 -1
- package/dist/components/EnvironmentManager.js +11 -5
- package/dist/components/GeometryShape.d.ts +5 -2
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +71 -10
- package/dist/components/LandObject.d.ts.map +1 -1
- package/dist/components/LandObject.js +1 -1
- package/dist/components/LayoutInstances.d.ts +2 -1
- package/dist/components/LayoutInstances.d.ts.map +1 -1
- package/dist/components/LayoutInstances.js +39 -6
- package/dist/components/LightObject.d.ts.map +1 -1
- package/dist/components/LightObject.js +3 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +62 -13
- package/dist/components/OceanBuilder.d.ts +2 -0
- package/dist/components/OceanBuilder.d.ts.map +1 -1
- package/dist/components/OceanBuilder.js +2 -1
- package/dist/components/RenderEffects.d.ts +8 -0
- package/dist/components/RenderEffects.d.ts.map +1 -0
- package/dist/components/RenderEffects.js +120 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +18 -9
- package/dist/components/SportsObject.d.ts +9 -0
- package/dist/components/SportsObject.d.ts.map +1 -0
- package/dist/components/SportsObject.js +20 -0
- package/dist/components/UrbanObject.d.ts +9 -0
- package/dist/components/UrbanObject.d.ts.map +1 -0
- package/dist/components/UrbanObject.js +28 -0
- package/dist/components/VegetationObject.d.ts +9 -0
- package/dist/components/VegetationObject.d.ts.map +1 -0
- package/dist/components/VegetationObject.js +26 -0
- package/dist/components/WaterObject.d.ts +15 -0
- package/dist/components/WaterObject.d.ts.map +1 -0
- package/dist/components/WaterObject.js +29 -0
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6 -1
- package/dist/components/land/LandPatch.d.ts +3 -1
- package/dist/components/land/LandPatch.d.ts.map +1 -1
- package/dist/components/land/LandPatch.js +80 -7
- package/dist/components/layout/InstancedLayout.d.ts +19 -0
- package/dist/components/layout/InstancedLayout.d.ts.map +1 -0
- package/dist/components/layout/InstancedLayout.js +154 -0
- package/dist/components/layout/LayoutGrounds.d.ts +19 -0
- package/dist/components/layout/LayoutGrounds.d.ts.map +1 -0
- package/dist/components/layout/LayoutGrounds.js +104 -0
- package/dist/components/layout/LinkProxies.d.ts +5 -0
- package/dist/components/layout/LinkProxies.d.ts.map +1 -0
- package/dist/components/layout/LinkProxies.js +51 -0
- package/dist/components/layout/LinkedSource.d.ts +14 -0
- package/dist/components/layout/LinkedSource.d.ts.map +1 -0
- package/dist/components/layout/LinkedSource.js +129 -0
- package/dist/components/projector/Projector.d.ts +14 -0
- package/dist/components/projector/Projector.d.ts.map +1 -0
- package/dist/components/projector/Projector.js +44 -0
- package/dist/components/projector/index.d.ts +4 -0
- package/dist/components/projector/index.d.ts.map +1 -0
- package/dist/components/projector/index.js +2 -0
- package/dist/components/projector/projectorCore.d.ts +19 -0
- package/dist/components/projector/projectorCore.d.ts.map +1 -0
- package/dist/components/projector/projectorCore.js +545 -0
- package/dist/components/sports/SportsBall.d.ts +9 -0
- package/dist/components/sports/SportsBall.d.ts.map +1 -0
- package/dist/components/sports/SportsBall.js +23 -0
- package/dist/components/sports/SportsCourt.d.ts +9 -0
- package/dist/components/sports/SportsCourt.d.ts.map +1 -0
- package/dist/components/sports/SportsCourt.js +23 -0
- package/dist/components/sports/SportsEquipment.d.ts +9 -0
- package/dist/components/sports/SportsEquipment.d.ts.map +1 -0
- package/dist/components/sports/SportsEquipment.js +23 -0
- package/dist/components/sports/SportsGoal.d.ts +9 -0
- package/dist/components/sports/SportsGoal.d.ts.map +1 -0
- package/dist/components/sports/SportsGoal.js +23 -0
- package/dist/components/sports/core/ball.d.ts +166 -0
- package/dist/components/sports/core/ball.d.ts.map +1 -0
- package/dist/components/sports/core/ball.js +402 -0
- package/dist/components/sports/core/court.d.ts +442 -0
- package/dist/components/sports/core/court.d.ts.map +1 -0
- package/dist/components/sports/core/court.js +658 -0
- package/dist/components/sports/core/equipment.d.ts +103 -0
- package/dist/components/sports/core/equipment.d.ts.map +1 -0
- package/dist/components/sports/core/equipment.js +403 -0
- package/dist/components/sports/core/goal.d.ts +98 -0
- package/dist/components/sports/core/goal.d.ts.map +1 -0
- package/dist/components/sports/core/goal.js +44 -0
- package/dist/components/sports/index.d.ts +11 -0
- package/dist/components/sports/index.d.ts.map +1 -0
- package/dist/components/sports/index.js +8 -0
- package/dist/components/sports/sportsCore.d.ts +195 -0
- package/dist/components/sports/sportsCore.d.ts.map +1 -0
- package/dist/components/sports/sportsCore.js +758 -0
- package/dist/components/sports/useSportsInstance.d.ts +35 -0
- package/dist/components/sports/useSportsInstance.d.ts.map +1 -0
- package/dist/components/sports/useSportsInstance.js +47 -0
- package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
- package/dist/components/terrain/TerrainSurface.js +14 -0
- package/dist/components/urban/UrbanBlock.d.ts +9 -0
- package/dist/components/urban/UrbanBlock.d.ts.map +1 -0
- package/dist/components/urban/UrbanBlock.js +23 -0
- package/dist/components/urban/UrbanBuilding.d.ts +9 -0
- package/dist/components/urban/UrbanBuilding.d.ts.map +1 -0
- package/dist/components/urban/UrbanBuilding.js +23 -0
- package/dist/components/urban/UrbanJunction.d.ts +9 -0
- package/dist/components/urban/UrbanJunction.d.ts.map +1 -0
- package/dist/components/urban/UrbanJunction.js +23 -0
- package/dist/components/urban/UrbanPark.d.ts +9 -0
- package/dist/components/urban/UrbanPark.d.ts.map +1 -0
- package/dist/components/urban/UrbanPark.js +23 -0
- package/dist/components/urban/UrbanParkingLot.d.ts +9 -0
- package/dist/components/urban/UrbanParkingLot.d.ts.map +1 -0
- package/dist/components/urban/UrbanParkingLot.js +23 -0
- package/dist/components/urban/UrbanPlaza.d.ts +9 -0
- package/dist/components/urban/UrbanPlaza.d.ts.map +1 -0
- package/dist/components/urban/UrbanPlaza.js +23 -0
- package/dist/components/urban/UrbanRoad.d.ts +9 -0
- package/dist/components/urban/UrbanRoad.d.ts.map +1 -0
- package/dist/components/urban/UrbanRoad.js +23 -0
- package/dist/components/urban/UrbanSignage.d.ts +9 -0
- package/dist/components/urban/UrbanSignage.d.ts.map +1 -0
- package/dist/components/urban/UrbanSignage.js +23 -0
- package/dist/components/urban/UrbanSkyline.d.ts +9 -0
- package/dist/components/urban/UrbanSkyline.d.ts.map +1 -0
- package/dist/components/urban/UrbanSkyline.js +23 -0
- package/dist/components/urban/UrbanStreetFurniture.d.ts +9 -0
- package/dist/components/urban/UrbanStreetFurniture.d.ts.map +1 -0
- package/dist/components/urban/UrbanStreetFurniture.js +23 -0
- package/dist/components/urban/UrbanStreetGrid.d.ts +9 -0
- package/dist/components/urban/UrbanStreetGrid.d.ts.map +1 -0
- package/dist/components/urban/UrbanStreetGrid.js +34 -0
- package/dist/components/urban/UrbanTraffic.d.ts +9 -0
- package/dist/components/urban/UrbanTraffic.d.ts.map +1 -0
- package/dist/components/urban/UrbanTraffic.js +23 -0
- package/dist/components/urban/core/block.d.ts +119 -0
- package/dist/components/urban/core/block.d.ts.map +1 -0
- package/dist/components/urban/core/block.js +266 -0
- package/dist/components/urban/core/building.d.ts +128 -0
- package/dist/components/urban/core/building.d.ts.map +1 -0
- package/dist/components/urban/core/building.js +741 -0
- package/dist/components/urban/core/junction.d.ts +152 -0
- package/dist/components/urban/core/junction.d.ts.map +1 -0
- package/dist/components/urban/core/junction.js +617 -0
- package/dist/components/urban/core/park.d.ts +67 -0
- package/dist/components/urban/core/park.d.ts.map +1 -0
- package/dist/components/urban/core/park.js +176 -0
- package/dist/components/urban/core/parkingLot.d.ts +82 -0
- package/dist/components/urban/core/parkingLot.d.ts.map +1 -0
- package/dist/components/urban/core/parkingLot.js +284 -0
- package/dist/components/urban/core/plaza.d.ts +24 -0
- package/dist/components/urban/core/plaza.d.ts.map +1 -0
- package/dist/components/urban/core/plaza.js +243 -0
- package/dist/components/urban/core/road.d.ts +113 -0
- package/dist/components/urban/core/road.d.ts.map +1 -0
- package/dist/components/urban/core/road.js +347 -0
- package/dist/components/urban/core/signage.d.ts +83 -0
- package/dist/components/urban/core/signage.d.ts.map +1 -0
- package/dist/components/urban/core/signage.js +209 -0
- package/dist/components/urban/core/skyline.d.ts +100 -0
- package/dist/components/urban/core/skyline.d.ts.map +1 -0
- package/dist/components/urban/core/skyline.js +89 -0
- package/dist/components/urban/core/streetFurniture.d.ts +75 -0
- package/dist/components/urban/core/streetFurniture.d.ts.map +1 -0
- package/dist/components/urban/core/streetFurniture.js +193 -0
- package/dist/components/urban/core/streetGrid.d.ts +134 -0
- package/dist/components/urban/core/streetGrid.d.ts.map +1 -0
- package/dist/components/urban/core/streetGrid.js +422 -0
- package/dist/components/urban/core/traffic.d.ts +125 -0
- package/dist/components/urban/core/traffic.d.ts.map +1 -0
- package/dist/components/urban/core/traffic.js +305 -0
- package/dist/components/urban/index.d.ts +29 -0
- package/dist/components/urban/index.d.ts.map +1 -0
- package/dist/components/urban/index.js +16 -0
- package/dist/components/urban/textureSetResolver.d.ts +8 -0
- package/dist/components/urban/textureSetResolver.d.ts.map +1 -0
- package/dist/components/urban/textureSetResolver.js +16 -0
- package/dist/components/urban/urbanCore.d.ts +262 -0
- package/dist/components/urban/urbanCore.d.ts.map +1 -0
- package/dist/components/urban/urbanCore.js +928 -0
- package/dist/components/urban/useUrbanInstance.d.ts +53 -0
- package/dist/components/urban/useUrbanInstance.d.ts.map +1 -0
- package/dist/components/urban/useUrbanInstance.js +100 -0
- package/dist/components/vegetation/VegetationBush.d.ts +9 -0
- package/dist/components/vegetation/VegetationBush.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationBush.js +23 -0
- package/dist/components/vegetation/VegetationCrops.d.ts +9 -0
- package/dist/components/vegetation/VegetationCrops.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationCrops.js +23 -0
- package/dist/components/vegetation/VegetationFlowers.d.ts +9 -0
- package/dist/components/vegetation/VegetationFlowers.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationFlowers.js +23 -0
- package/dist/components/vegetation/VegetationForest.d.ts +9 -0
- package/dist/components/vegetation/VegetationForest.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationForest.js +23 -0
- package/dist/components/vegetation/VegetationFruit.d.ts +9 -0
- package/dist/components/vegetation/VegetationFruit.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationFruit.js +23 -0
- package/dist/components/vegetation/VegetationGrass.d.ts +9 -0
- package/dist/components/vegetation/VegetationGrass.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationGrass.js +23 -0
- package/dist/components/vegetation/VegetationHedge.d.ts +9 -0
- package/dist/components/vegetation/VegetationHedge.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationHedge.js +23 -0
- package/dist/components/vegetation/VegetationIvy.d.ts +9 -0
- package/dist/components/vegetation/VegetationIvy.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationIvy.js +23 -0
- package/dist/components/vegetation/VegetationTree.d.ts +9 -0
- package/dist/components/vegetation/VegetationTree.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationTree.js +23 -0
- package/dist/components/vegetation/VegetationVegetable.d.ts +9 -0
- package/dist/components/vegetation/VegetationVegetable.d.ts.map +1 -0
- package/dist/components/vegetation/VegetationVegetable.js +23 -0
- package/dist/components/vegetation/core/bush.d.ts +1256 -0
- package/dist/components/vegetation/core/bush.d.ts.map +1 -0
- package/dist/components/vegetation/core/bush.js +376 -0
- package/dist/components/vegetation/core/crops.d.ts +1033 -0
- package/dist/components/vegetation/core/crops.d.ts.map +1 -0
- package/dist/components/vegetation/core/crops.js +378 -0
- package/dist/components/vegetation/core/flowers.d.ts +648 -0
- package/dist/components/vegetation/core/flowers.d.ts.map +1 -0
- package/dist/components/vegetation/core/flowers.js +225 -0
- package/dist/components/vegetation/core/forest.d.ts +138 -0
- package/dist/components/vegetation/core/forest.d.ts.map +1 -0
- package/dist/components/vegetation/core/forest.js +310 -0
- package/dist/components/vegetation/core/fruit.d.ts +99 -0
- package/dist/components/vegetation/core/fruit.d.ts.map +1 -0
- package/dist/components/vegetation/core/fruit.js +77 -0
- package/dist/components/vegetation/core/grass.d.ts +103 -0
- package/dist/components/vegetation/core/grass.d.ts.map +1 -0
- package/dist/components/vegetation/core/grass.js +102 -0
- package/dist/components/vegetation/core/hedge.d.ts +193 -0
- package/dist/components/vegetation/core/hedge.d.ts.map +1 -0
- package/dist/components/vegetation/core/hedge.js +243 -0
- package/dist/components/vegetation/core/ivy.d.ts +213 -0
- package/dist/components/vegetation/core/ivy.d.ts.map +1 -0
- package/dist/components/vegetation/core/ivy.js +173 -0
- package/dist/components/vegetation/core/tree.d.ts +1117 -0
- package/dist/components/vegetation/core/tree.d.ts.map +1 -0
- package/dist/components/vegetation/core/tree.js +408 -0
- package/dist/components/vegetation/core/vegetable.d.ts +99 -0
- package/dist/components/vegetation/core/vegetable.d.ts.map +1 -0
- package/dist/components/vegetation/core/vegetable.js +76 -0
- package/dist/components/vegetation/index.d.ts +23 -0
- package/dist/components/vegetation/index.d.ts.map +1 -0
- package/dist/components/vegetation/index.js +14 -0
- package/dist/components/vegetation/produceCore.d.ts +929 -0
- package/dist/components/vegetation/produceCore.d.ts.map +1 -0
- package/dist/components/vegetation/produceCore.js +723 -0
- package/dist/components/vegetation/useVegetationInstance.d.ts +39 -0
- package/dist/components/vegetation/useVegetationInstance.d.ts.map +1 -0
- package/dist/components/vegetation/useVegetationInstance.js +45 -0
- package/dist/components/vegetation/vegetationCore.d.ts +412 -0
- package/dist/components/vegetation/vegetationCore.d.ts.map +1 -0
- package/dist/components/vegetation/vegetationCore.js +1728 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +5 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +39 -13
- package/dist/components/water/OceanSurface.d.ts.map +1 -1
- package/dist/components/water/OceanSurface.js +3 -2
- package/dist/components/water/WaterBody.d.ts.map +1 -1
- package/dist/components/water/WaterBody.js +31 -10
- package/dist/components/water/WaterFountain.d.ts +9 -0
- package/dist/components/water/WaterFountain.d.ts.map +1 -0
- package/dist/components/water/WaterFountain.js +24 -0
- package/dist/components/water/WaterStream.d.ts +9 -0
- package/dist/components/water/WaterStream.d.ts.map +1 -0
- package/dist/components/water/WaterStream.js +24 -0
- package/dist/components/water/WaterWaterfall.d.ts +9 -0
- package/dist/components/water/WaterWaterfall.d.ts.map +1 -0
- package/dist/components/water/WaterWaterfall.js +24 -0
- package/dist/components/water/core/fountain.d.ts +70 -0
- package/dist/components/water/core/fountain.d.ts.map +1 -0
- package/dist/components/water/core/fountain.js +619 -0
- package/dist/components/water/core/stream.d.ts +72 -0
- package/dist/components/water/core/stream.d.ts.map +1 -0
- package/dist/components/water/core/stream.js +167 -0
- package/dist/components/water/core/waterfall.d.ts +78 -0
- package/dist/components/water/core/waterfall.d.ts.map +1 -0
- package/dist/components/water/core/waterfall.js +325 -0
- package/dist/components/water/index.d.ts +8 -0
- package/dist/components/water/index.d.ts.map +1 -1
- package/dist/components/water/index.js +7 -0
- package/dist/components/water/types.d.ts +3 -0
- package/dist/components/water/types.d.ts.map +1 -1
- package/dist/components/water/useWaterInstance.d.ts +43 -0
- package/dist/components/water/useWaterInstance.d.ts.map +1 -0
- package/dist/components/water/useWaterInstance.js +89 -0
- package/dist/components/water/waterCore.d.ts +179 -0
- package/dist/components/water/waterCore.d.ts.map +1 -0
- package/dist/components/water/waterCore.js +516 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +9 -1
- package/dist/hooks/index.d.ts +7 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -2
- package/dist/hooks/useActionPatch.d.ts +23 -0
- package/dist/hooks/useActionPatch.d.ts.map +1 -0
- package/dist/hooks/useActionPatch.js +38 -0
- package/dist/hooks/useCloudSun.d.ts.map +1 -1
- package/dist/hooks/useCloudSun.js +3 -2
- package/dist/hooks/useCommittedInstance.d.ts +6 -0
- package/dist/hooks/useCommittedInstance.d.ts.map +1 -0
- package/dist/hooks/useCommittedInstance.js +42 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +36 -20
- package/dist/hooks/useGridLayout.d.ts +7 -0
- package/dist/hooks/useGridLayout.d.ts.map +1 -0
- package/dist/hooks/useGridLayout.js +10 -0
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
- package/dist/hooks/useInteractionEffects.js +48 -9
- package/dist/hooks/useLightLive.d.ts.map +1 -1
- package/dist/hooks/useLightLive.js +2 -0
- package/dist/hooks/useLinkStatus.d.ts +7 -0
- package/dist/hooks/useLinkStatus.d.ts.map +1 -0
- package/dist/hooks/useLinkStatus.js +20 -0
- package/dist/hooks/useMaterialApplication.d.ts +6 -1
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
- package/dist/hooks/useMaterialApplication.js +7 -2
- package/dist/hooks/useOceanMaterial.d.ts +11 -1
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.js +185 -27
- package/dist/hooks/usePathAnimation.d.ts +8 -0
- package/dist/hooks/usePathAnimation.d.ts.map +1 -1
- package/dist/hooks/usePathAnimation.js +140 -59
- package/dist/hooks/useResolvedLayout.d.ts +10 -0
- package/dist/hooks/useResolvedLayout.d.ts.map +1 -0
- package/dist/hooks/useResolvedLayout.js +17 -0
- package/dist/hooks/useTimeLighting.d.ts +36 -0
- package/dist/hooks/useTimeLighting.d.ts.map +1 -0
- package/dist/hooks/useTimeLighting.js +67 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/operations/catalogue/shaderLayers.d.ts.map +1 -1
- package/dist/operations/catalogue/shaderLayers.js +26 -3
- package/dist/render/renderLive.d.ts +11 -0
- package/dist/render/renderLive.d.ts.map +1 -0
- package/dist/render/renderLive.js +57 -0
- 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 +35 -5
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +12 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
- package/dist/shaders/ocean/OceanSurfaceMaterial.js +55 -7
- package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
- package/dist/shaders/terrain/TerrainMaterial.js +28 -0
- package/dist/triggers/kinds/change.js +1 -1
- package/dist/utils/composerHostedPass.d.ts +74 -0
- package/dist/utils/composerHostedPass.d.ts.map +1 -0
- package/dist/utils/composerHostedPass.js +63 -0
- package/dist/utils/geometryScript.d.ts +17 -0
- package/dist/utils/geometryScript.d.ts.map +1 -0
- package/dist/utils/geometryScript.js +92 -0
- package/dist/utils/geometryScript.worker.d.ts +2 -0
- package/dist/utils/geometryScript.worker.d.ts.map +1 -0
- package/dist/utils/geometryScript.worker.js +42 -0
- package/dist/utils/groundRegistry.d.ts +11 -0
- package/dist/utils/groundRegistry.d.ts.map +1 -0
- package/dist/utils/groundRegistry.js +39 -0
- package/dist/utils/instancingSupport.d.ts +9 -0
- package/dist/utils/instancingSupport.d.ts.map +1 -0
- package/dist/utils/instancingSupport.js +13 -0
- package/dist/utils/landPatch.d.ts +26 -5
- package/dist/utils/landPatch.d.ts.map +1 -1
- package/dist/utils/landPatch.js +124 -9
- package/dist/utils/layoutPlacement.d.ts +30 -0
- package/dist/utils/layoutPlacement.d.ts.map +1 -0
- package/dist/utils/layoutPlacement.js +113 -0
- package/dist/utils/linkRegistry.d.ts +15 -0
- package/dist/utils/linkRegistry.d.ts.map +1 -0
- package/dist/utils/linkRegistry.js +11 -0
- package/dist/utils/shapes.d.ts +28 -2
- package/dist/utils/shapes.d.ts.map +1 -1
- package/dist/utils/shapes.js +32 -3
- package/dist/utils/sharedParts.d.ts +61 -0
- package/dist/utils/sharedParts.d.ts.map +1 -0
- package/dist/utils/sharedParts.js +268 -0
- package/dist/utils/svgAsset.d.ts +6 -0
- package/dist/utils/svgAsset.d.ts.map +1 -0
- package/dist/utils/svgAsset.js +46 -0
- package/dist/utils/waterLight.d.ts +29 -0
- package/dist/utils/waterLight.d.ts.map +1 -0
- package/dist/utils/waterLight.js +67 -0
- package/dist/utils/waterReflection.d.ts +185 -0
- package/dist/utils/waterReflection.d.ts.map +1 -0
- package/dist/utils/waterReflection.js +616 -0
- package/package.json +4 -3
|
@@ -59,6 +59,17 @@ varying float vDist;
|
|
|
59
59
|
varying float vShadow;
|
|
60
60
|
|
|
61
61
|
#ifdef TERRAIN_PATCH
|
|
62
|
+
#ifdef LAND_LAYOUT
|
|
63
|
+
// A land kept to a layout (config.shapeLayout; viewer utils/landPatch landLayoutGeometry), per
|
|
64
|
+
// vertex on the unit grid: the layout's mask (0 at its edge -> 1 past the band) with its slope per
|
|
65
|
+
// grid unit, and its lift (the layout's height, its metres) with its slope per grid unit. Brought
|
|
66
|
+
// into terrain metres here (/ u_patchSize, x u_scaleY), so the grid never depends on the scale.
|
|
67
|
+
// They replace the rectangle's band (u_edgeWidth is 0) and apply to the height AND its gradient.
|
|
68
|
+
attribute vec3 aLayoutMask;
|
|
69
|
+
attribute vec3 aLayoutLift;
|
|
70
|
+
varying vec3 vLayoutMask;
|
|
71
|
+
varying vec3 vLayoutLift;
|
|
72
|
+
#endif
|
|
62
73
|
// A land object. The mesh is a unit grid on XZ (-0.5..0.5) that the object's
|
|
63
74
|
// transform places, rotates and sizes. The field is sampled in terrain space —
|
|
64
75
|
// metres from the object's origin, plus the seed offset — so a wider footprint
|
|
@@ -71,6 +82,13 @@ void main(){
|
|
|
71
82
|
|
|
72
83
|
vec2 grad;
|
|
73
84
|
float h = terrainSurfaceAt(tp, cellLod, grad);
|
|
85
|
+
#ifdef LAND_LAYOUT
|
|
86
|
+
float hb = h - u_seaLevel;
|
|
87
|
+
grad = grad * aLayoutMask.x + hb * aLayoutMask.yz / u_patchSize + aLayoutLift.yz * u_scaleY / u_patchSize;
|
|
88
|
+
h = u_seaLevel + hb * aLayoutMask.x + aLayoutLift.x * u_scaleY;
|
|
89
|
+
vLayoutMask = aLayoutMask;
|
|
90
|
+
vLayoutLift = aLayoutLift;
|
|
91
|
+
#endif
|
|
74
92
|
|
|
75
93
|
vec3 wp = vec3(tp.x, h, tp.y);
|
|
76
94
|
float camDist = distance(wp, TERRAIN_CAM);
|
|
@@ -180,6 +198,10 @@ varying vec3 vWorld;
|
|
|
180
198
|
varying float vCell;
|
|
181
199
|
varying float vDist;
|
|
182
200
|
varying float vShadow;
|
|
201
|
+
#if defined(TERRAIN_PATCH) && defined(LAND_LAYOUT)
|
|
202
|
+
varying vec3 vLayoutMask;
|
|
203
|
+
varying vec3 vLayoutLift;
|
|
204
|
+
#endif
|
|
183
205
|
|
|
184
206
|
void main(){
|
|
185
207
|
vec3 viewDir = normalize(vWorld - TERRAIN_CAM);
|
|
@@ -200,6 +222,12 @@ void main(){
|
|
|
200
222
|
// them on every pixel.
|
|
201
223
|
vec2 grad;
|
|
202
224
|
float shadeHeight = terrainSurfaceAt(vWorld.xz, lod, grad);
|
|
225
|
+
#if defined(TERRAIN_PATCH) && defined(LAND_LAYOUT)
|
|
226
|
+
// the layout's mask and lift, as the vertex applied them (interpolated across the cell)
|
|
227
|
+
float shb = shadeHeight - u_seaLevel;
|
|
228
|
+
grad = grad * vLayoutMask.x + shb * vLayoutMask.yz / u_patchSize + vLayoutLift.yz * u_scaleY / u_patchSize;
|
|
229
|
+
shadeHeight = u_seaLevel + shb * vLayoutMask.x + vLayoutLift.x * u_scaleY;
|
|
230
|
+
#endif
|
|
203
231
|
vec3 nBase = terrainNormal(grad);
|
|
204
232
|
vec3 n = terrainDetailNormal(nBase, vWorld, vDist);
|
|
205
233
|
|
|
@@ -10,7 +10,7 @@ import { SceneActions } from '@3driseai/3drise-core';
|
|
|
10
10
|
import { defineTriggerable } from '../registry.js';
|
|
11
11
|
import { logTrigger } from '../log.js';
|
|
12
12
|
import { currentChain } from '../engine.js';
|
|
13
|
-
const ENV = new Set(['camera', 'sky', 'clouds', 'ocean', 'terrain']);
|
|
13
|
+
const ENV = new Set(['camera', 'sky', 'clouds', 'ocean', 'terrain', 'time', 'render']);
|
|
14
14
|
export const changeLayerId = (c) => `change:${c.id}`;
|
|
15
15
|
const ownerName = (o) => (o.startsWith('layer:change:') ? `change ${o.slice(13)}` : o === 'layer:timeline' ? 'a switch track' : `action ${o}`);
|
|
16
16
|
const patchesOf = (c) => {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* A full-screen pass that can be hosted by the post-processing composer.
|
|
4
|
+
*
|
|
5
|
+
* VolumetricCloudsPass owns the frame: it draws the scene into its own target and
|
|
6
|
+
* composites the clouds to the canvas. The post-processing EffectComposer owns the
|
|
7
|
+
* frame too: its RenderPass draws the scene, its effects run on top. With both
|
|
8
|
+
* mounted, both drew the whole scene every frame — measured on a city scene as
|
|
9
|
+
* twice the draw calls and triangles, 60 fps down to 40.
|
|
10
|
+
*
|
|
11
|
+
* So when a composer is mounted it HOSTS the pass instead: the pass is inserted
|
|
12
|
+
* right after the composer's RenderPass, reads that render (colour + depth) and
|
|
13
|
+
* writes the scene-with-clouds for the effects that follow. The scene is drawn
|
|
14
|
+
* once, bloom and the rest see the clouds, and tone mapping happens once, at the
|
|
15
|
+
* end of the chain. With no composer the pass renders the frame itself, as before.
|
|
16
|
+
*
|
|
17
|
+
* The two meet through this registry (keyed on the renderer, like frameRenderer)
|
|
18
|
+
* because they live in unrelated parts of the tree: the clouds under the
|
|
19
|
+
* environment, the composer under SceneBuilder.
|
|
20
|
+
*
|
|
21
|
+
* The object is shaped for `postprocessing`'s EffectComposer.addPass rather than
|
|
22
|
+
* extending its Pass class: the viewer reaches postprocessing only through
|
|
23
|
+
* @react-three/postprocessing, which does not export Pass. The composer calls only
|
|
24
|
+
* the members below.
|
|
25
|
+
*/
|
|
26
|
+
export interface HostedPass {
|
|
27
|
+
name: string;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
renderer: THREE.WebGLRenderer | null;
|
|
30
|
+
/** Writes to outputBuffer, so the composer swaps buffers after it. */
|
|
31
|
+
needsSwap: boolean;
|
|
32
|
+
needsDepthBlit: boolean;
|
|
33
|
+
/** Makes the composer keep the stable copy of the RenderPass's depth. */
|
|
34
|
+
needsDepthTexture: boolean;
|
|
35
|
+
renderToScreen: boolean;
|
|
36
|
+
mainScene: THREE.Scene | null;
|
|
37
|
+
mainCamera: THREE.Camera | null;
|
|
38
|
+
/** True while a composer has it in its chain; the owner must not draw the frame itself then. */
|
|
39
|
+
hosted: boolean;
|
|
40
|
+
setSize(width: number, height: number): void;
|
|
41
|
+
initialize(renderer: THREE.WebGLRenderer, alpha: boolean, frameBufferType: number): void;
|
|
42
|
+
setDepthTexture(depthTexture: THREE.Texture | null): void;
|
|
43
|
+
getDepthTexture(): THREE.Texture | null;
|
|
44
|
+
render(renderer: THREE.WebGLRenderer, inputBuffer: THREE.WebGLRenderTarget, outputBuffer: THREE.WebGLRenderTarget, deltaTime?: number): void;
|
|
45
|
+
/** No-op. The composer disposes every pass it holds when it is torn down; this
|
|
46
|
+
* pass's resources belong to the component that created it. */
|
|
47
|
+
dispose(): void;
|
|
48
|
+
}
|
|
49
|
+
/** What the owner draws when hosted: the composer's scene render in, its next buffer out. */
|
|
50
|
+
export interface HostedInput {
|
|
51
|
+
scene: THREE.Texture;
|
|
52
|
+
depth: THREE.Texture | null;
|
|
53
|
+
/** null = the canvas, when this is the last pass in the chain. */
|
|
54
|
+
output: THREE.WebGLRenderTarget | null;
|
|
55
|
+
toScreen: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function createHostedPass(name: string, draw: (input: HostedInput, deltaTime: number) => void): HostedPass;
|
|
58
|
+
/** Offer the pass to whichever composer is (or later gets) mounted. Returns the release. */
|
|
59
|
+
export declare function publishHostedPass(gl: THREE.WebGLRenderer, pass: HostedPass): () => void;
|
|
60
|
+
/** The pass a composer on this renderer should host, or null. Re-renders when it changes. */
|
|
61
|
+
export declare function useHostedPass(gl: THREE.WebGLRenderer): HostedPass | null;
|
|
62
|
+
/** The part of postprocessing's EffectComposer this needs. */
|
|
63
|
+
export interface ComposerLike {
|
|
64
|
+
passes: unknown[];
|
|
65
|
+
addPass(pass: unknown, index?: number): void;
|
|
66
|
+
removePass(pass: unknown): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Put the pass right after the composer's RenderPass (always its first pass), ahead
|
|
70
|
+
* of every effect. Returns the detach. Effects the composer adds or rebuilds later
|
|
71
|
+
* are appended after it, so the position holds.
|
|
72
|
+
*/
|
|
73
|
+
export declare function attachHostedPass(composer: ComposerLike, pass: HostedPass): () => void;
|
|
74
|
+
//# sourceMappingURL=composerHostedPass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composerHostedPass.d.ts","sourceRoot":"","sources":["../../src/utils/composerHostedPass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;IACrC,sEAAsE;IACtE,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IAChC,gGAAgG;IAChG,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACzF,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1D,eAAe,IAAI,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;IACxC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,WAAW,EAAE,KAAK,CAAC,iBAAiB,EAAE,YAAY,EAAE,KAAK,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7I;oEACgE;IAChE,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,6FAA6F;AAC7F,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;IAC5B,kEAAkE;IAClE,MAAM,EAAE,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,UAAU,CA2BhH;AAUD,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,IAAI,CASvF;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,GAAG,UAAU,GAAG,IAAI,CAMxE;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,IAAI,CAOrF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
export function createHostedPass(name, draw) {
|
|
3
|
+
let depth = null;
|
|
4
|
+
return {
|
|
5
|
+
name,
|
|
6
|
+
enabled: true,
|
|
7
|
+
renderer: null,
|
|
8
|
+
needsSwap: true,
|
|
9
|
+
needsDepthBlit: false,
|
|
10
|
+
needsDepthTexture: true,
|
|
11
|
+
renderToScreen: false,
|
|
12
|
+
mainScene: null,
|
|
13
|
+
mainCamera: null,
|
|
14
|
+
hosted: false,
|
|
15
|
+
setSize() { },
|
|
16
|
+
initialize() { },
|
|
17
|
+
setDepthTexture(t) { depth = t; },
|
|
18
|
+
getDepthTexture() { return depth; },
|
|
19
|
+
render(_renderer, inputBuffer, outputBuffer, deltaTime = 0) {
|
|
20
|
+
draw({
|
|
21
|
+
scene: inputBuffer.texture,
|
|
22
|
+
depth,
|
|
23
|
+
output: this.renderToScreen ? null : outputBuffer,
|
|
24
|
+
toScreen: this.renderToScreen,
|
|
25
|
+
}, deltaTime);
|
|
26
|
+
},
|
|
27
|
+
dispose() { },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Registry: one hosted pass per renderer.
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
const registry = new WeakMap();
|
|
34
|
+
const listeners = new Set();
|
|
35
|
+
const notify = () => listeners.forEach((l) => l());
|
|
36
|
+
/** Offer the pass to whichever composer is (or later gets) mounted. Returns the release. */
|
|
37
|
+
export function publishHostedPass(gl, pass) {
|
|
38
|
+
registry.set(gl, pass);
|
|
39
|
+
notify();
|
|
40
|
+
return () => {
|
|
41
|
+
if (registry.get(gl) === pass) {
|
|
42
|
+
registry.delete(gl);
|
|
43
|
+
notify();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** The pass a composer on this renderer should host, or null. Re-renders when it changes. */
|
|
48
|
+
export function useHostedPass(gl) {
|
|
49
|
+
return useSyncExternalStore((l) => { listeners.add(l); return () => { listeners.delete(l); }; }, () => registry.get(gl) ?? null, () => null);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Put the pass right after the composer's RenderPass (always its first pass), ahead
|
|
53
|
+
* of every effect. Returns the detach. Effects the composer adds or rebuilds later
|
|
54
|
+
* are appended after it, so the position holds.
|
|
55
|
+
*/
|
|
56
|
+
export function attachHostedPass(composer, pass) {
|
|
57
|
+
composer.addPass(pass, 1);
|
|
58
|
+
pass.hosted = true;
|
|
59
|
+
return () => {
|
|
60
|
+
pass.hosted = false;
|
|
61
|
+
composer.removePass(pass);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BufferGeometry } from 'three';
|
|
2
|
+
import { type ScriptParams, type ScriptRunReport } from '@3driseai/3drise-core';
|
|
3
|
+
export declare class ScriptGeometryError extends Error {
|
|
4
|
+
line?: number;
|
|
5
|
+
constructor(message: string, line?: number);
|
|
6
|
+
}
|
|
7
|
+
export interface ScriptBuild {
|
|
8
|
+
geometry: BufferGeometry;
|
|
9
|
+
report: ScriptRunReport;
|
|
10
|
+
}
|
|
11
|
+
/** The cached build, when there is one (synchronous; the first render of a known script needs no suspense). */
|
|
12
|
+
export declare function cachedScriptGeometry(source: string, params: ScriptParams): ScriptBuild | undefined;
|
|
13
|
+
/** Builds (or reads from the cache). The returned geometry is shared: clone it before mutating. */
|
|
14
|
+
export declare function buildScriptGeometry(source: string, params: ScriptParams): Promise<ScriptBuild>;
|
|
15
|
+
/** Drops the cached builds (tests, memory pressure). */
|
|
16
|
+
export declare function clearScriptGeometryCache(): void;
|
|
17
|
+
//# sourceMappingURL=geometryScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryScript.d.ts","sourceRoot":"","sources":["../../src/utils/geometryScript.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAyE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEvJ,qBAAa,mBAAoB,SAAQ,KAAK;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAC7C;AAED,MAAM,WAAW,WAAW;IAAG,QAAQ,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE;AA4DlF,+GAA+G;AAC/G,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,WAAW,GAAG,SAAS,CAElG;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAa9F;AAED,wDAAwD;AACxD,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { buffersToGeometry, scriptKey, SCRIPT_TIMEOUT_MS } from '@3driseai/3drise-core';
|
|
2
|
+
export class ScriptGeometryError extends Error {
|
|
3
|
+
line;
|
|
4
|
+
constructor(message, line) { super(message); this.name = 'ScriptGeometryError'; this.line = line; }
|
|
5
|
+
}
|
|
6
|
+
const CACHE_MAX = 64;
|
|
7
|
+
const cache = new Map();
|
|
8
|
+
const pending = new Map();
|
|
9
|
+
const queue = [];
|
|
10
|
+
let running = null;
|
|
11
|
+
let worker = null;
|
|
12
|
+
let seq = 0;
|
|
13
|
+
function makeWorker() {
|
|
14
|
+
const w = new Worker(new URL('./geometryScript.worker.ts', import.meta.url), { type: 'module' });
|
|
15
|
+
w.onmessage = (ev) => {
|
|
16
|
+
const job = running;
|
|
17
|
+
if (!job || ev.data.id !== job.id)
|
|
18
|
+
return;
|
|
19
|
+
clearTimeout(job.timer);
|
|
20
|
+
running = null;
|
|
21
|
+
if (ev.data.ok && ev.data.buffers && ev.data.report)
|
|
22
|
+
job.resolve({ geometry: buffersToGeometry(ev.data.buffers), report: ev.data.report });
|
|
23
|
+
else
|
|
24
|
+
job.reject(new ScriptGeometryError(ev.data.error ?? 'The geometry script failed.', ev.data.line));
|
|
25
|
+
next();
|
|
26
|
+
};
|
|
27
|
+
w.onerror = (ev) => {
|
|
28
|
+
const job = running;
|
|
29
|
+
if (!job)
|
|
30
|
+
return;
|
|
31
|
+
clearTimeout(job.timer);
|
|
32
|
+
running = null;
|
|
33
|
+
job.reject(new ScriptGeometryError(ev.message || 'The geometry worker failed.'));
|
|
34
|
+
next();
|
|
35
|
+
};
|
|
36
|
+
return w;
|
|
37
|
+
}
|
|
38
|
+
function next() {
|
|
39
|
+
if (running || !queue.length)
|
|
40
|
+
return;
|
|
41
|
+
const job = queue.shift();
|
|
42
|
+
running = job;
|
|
43
|
+
if (!worker)
|
|
44
|
+
worker = makeWorker();
|
|
45
|
+
job.timer = setTimeout(() => {
|
|
46
|
+
if (running !== job)
|
|
47
|
+
return;
|
|
48
|
+
worker?.terminate();
|
|
49
|
+
worker = null;
|
|
50
|
+
running = null;
|
|
51
|
+
job.reject(new ScriptGeometryError(`The geometry script ran for more than ${SCRIPT_TIMEOUT_MS / 1000} s and was stopped — lower the segments or the number of CSG operations.`));
|
|
52
|
+
next();
|
|
53
|
+
}, SCRIPT_TIMEOUT_MS);
|
|
54
|
+
worker.postMessage({ id: job.id, source: job.source, params: job.params });
|
|
55
|
+
}
|
|
56
|
+
function remember(key, build) {
|
|
57
|
+
cache.set(key, build);
|
|
58
|
+
if (cache.size > CACHE_MAX) {
|
|
59
|
+
const oldest = cache.keys().next().value;
|
|
60
|
+
cache.get(oldest)?.geometry.dispose();
|
|
61
|
+
cache.delete(oldest);
|
|
62
|
+
}
|
|
63
|
+
return build;
|
|
64
|
+
}
|
|
65
|
+
/** The cached build, when there is one (synchronous; the first render of a known script needs no suspense). */
|
|
66
|
+
export function cachedScriptGeometry(source, params) {
|
|
67
|
+
return cache.get(scriptKey(source, params));
|
|
68
|
+
}
|
|
69
|
+
/** Builds (or reads from the cache). The returned geometry is shared: clone it before mutating. */
|
|
70
|
+
export function buildScriptGeometry(source, params) {
|
|
71
|
+
const key = scriptKey(source, params);
|
|
72
|
+
const hit = cache.get(key);
|
|
73
|
+
if (hit)
|
|
74
|
+
return Promise.resolve(hit);
|
|
75
|
+
const inflight = pending.get(key);
|
|
76
|
+
if (inflight)
|
|
77
|
+
return inflight;
|
|
78
|
+
if (typeof Worker === 'undefined')
|
|
79
|
+
return Promise.reject(new ScriptGeometryError('Geometry scripts need a browser with Web Workers.'));
|
|
80
|
+
const p = new Promise((resolve, reject) => {
|
|
81
|
+
queue.push({ id: ++seq, source, params, resolve: (r) => resolve(remember(key, r)), reject });
|
|
82
|
+
next();
|
|
83
|
+
}).finally(() => pending.delete(key));
|
|
84
|
+
pending.set(key, p);
|
|
85
|
+
return p;
|
|
86
|
+
}
|
|
87
|
+
/** Drops the cached builds (tests, memory pressure). */
|
|
88
|
+
export function clearScriptGeometryCache() {
|
|
89
|
+
for (const b of cache.values())
|
|
90
|
+
b.geometry.dispose();
|
|
91
|
+
cache.clear();
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryScript.worker.d.ts","sourceRoot":"","sources":["../../src/utils/geometryScript.worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Geometry script worker — runs `build(p, g)` away from the page
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// A saved script is untrusted code (a shared project, a market object), so it
|
|
6
|
+
// never runs on the page thread. This worker has no DOM, and every way out
|
|
7
|
+
// (fetch, sockets, importScripts, storage) is removed before the first script
|
|
8
|
+
// runs — the same hardening as the agent's scriptSandbox. In: { id, source,
|
|
9
|
+
// params }. Out: { id, ok, buffers, report } with the buffers transferred, or
|
|
10
|
+
// { id, ok: false, error, line }.
|
|
11
|
+
//
|
|
12
|
+
import { createGeometryKit, errorLine, geometryToBuffers, runGeometryScript } from '@3driseai/3drise-core';
|
|
13
|
+
const BLOCKED = ['fetch', 'XMLHttpRequest', 'WebSocket', 'WebSocketStream', 'EventSource', 'importScripts', 'indexedDB', 'caches',
|
|
14
|
+
'BroadcastChannel', 'Worker', 'SharedWorker', 'Request', 'Response', 'navigator', 'location', 'open', 'close'];
|
|
15
|
+
for (const name of BLOCKED) {
|
|
16
|
+
for (let o = self; o; o = Object.getPrototypeOf(o)) {
|
|
17
|
+
try {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(o, name))
|
|
19
|
+
delete o[name];
|
|
20
|
+
}
|
|
21
|
+
catch { /* sealed */ }
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
Object.defineProperty(self, name, { value: undefined, configurable: false, writable: false });
|
|
25
|
+
}
|
|
26
|
+
catch { /* sealed */ }
|
|
27
|
+
}
|
|
28
|
+
const kit = createGeometryKit();
|
|
29
|
+
const post = self.postMessage.bind(self);
|
|
30
|
+
self.onmessage = async (ev) => {
|
|
31
|
+
const { id, source, params } = ev.data;
|
|
32
|
+
try {
|
|
33
|
+
const { geometry, report } = await runGeometryScript(source, params, kit);
|
|
34
|
+
const buffers = geometryToBuffers(geometry);
|
|
35
|
+
geometry.dispose();
|
|
36
|
+
post({ id, ok: true, buffers, report }, [buffers.position.buffer, buffers.normal.buffer, buffers.uv.buffer]);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
const err = e;
|
|
40
|
+
post({ id, ok: false, error: err?.message ?? String(e), line: errorLine(e) });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TerrainConfig } from '@3driseai/3drise-core';
|
|
2
|
+
export type GroundProvider = (x: number, z: number) => number | null;
|
|
3
|
+
export declare function registerGround(id: string, provider: GroundProvider): () => void;
|
|
4
|
+
/** A provider's surface changed (same function, different answers). */
|
|
5
|
+
export declare function bumpGround(): void;
|
|
6
|
+
export declare const groundVersion: () => number;
|
|
7
|
+
export declare const hasGround: () => boolean;
|
|
8
|
+
/** Highest registered ground at world (x, z); null where nothing covers it. */
|
|
9
|
+
export declare function groundHeightAt(x: number, z: number): number | null;
|
|
10
|
+
export declare function heightSignature(cfg: TerrainConfig, extra?: string): string;
|
|
11
|
+
//# sourceMappingURL=groundRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groundRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/groundRegistry.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAKrE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI,CAM/E;AAED,uEAAuE;AACvE,wBAAgB,UAAU,IAAI,IAAI,CAAe;AAEjD,eAAO,MAAM,aAAa,QAAO,MAAiB,CAAC;AACnD,eAAO,MAAM,SAAS,QAAO,OAA6B,CAAC;AAE3D,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOlE;AASD,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,SAAK,GAAG,MAAM,CAItE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const providers = new Map();
|
|
2
|
+
let version = 0;
|
|
3
|
+
export function registerGround(id, provider) {
|
|
4
|
+
providers.set(id, provider);
|
|
5
|
+
version++;
|
|
6
|
+
return () => {
|
|
7
|
+
if (providers.get(id) === provider) {
|
|
8
|
+
providers.delete(id);
|
|
9
|
+
version++;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** A provider's surface changed (same function, different answers). */
|
|
14
|
+
export function bumpGround() { version++; }
|
|
15
|
+
export const groundVersion = () => version;
|
|
16
|
+
export const hasGround = () => providers.size > 0;
|
|
17
|
+
/** Highest registered ground at world (x, z); null where nothing covers it. */
|
|
18
|
+
export function groundHeightAt(x, z) {
|
|
19
|
+
let best = null;
|
|
20
|
+
for (const p of providers.values()) {
|
|
21
|
+
const h = p(x, z);
|
|
22
|
+
if (h !== null && Number.isFinite(h) && (best === null || h > best))
|
|
23
|
+
best = h;
|
|
24
|
+
}
|
|
25
|
+
return best;
|
|
26
|
+
}
|
|
27
|
+
/** The height-field knobs of a terrain config, as one string: providers compare it per frame
|
|
28
|
+
* and bump the version only when the ground itself moved (not on a colour or texture edit). */
|
|
29
|
+
const HEIGHT_KEYS = [
|
|
30
|
+
'terrainType', 'featureSize', 'octaves', 'lacunarity', 'gain', 'ridgeSharpness', 'warpStrength', 'warpSize',
|
|
31
|
+
'erosion', 'elevation', 'seaLevel', 'bearing', 'duneWavelength', 'duneAsymmetry', 'plateau', 'valleyDepth',
|
|
32
|
+
'valleyWidth', 'terraces', 'terraceSharpness',
|
|
33
|
+
];
|
|
34
|
+
export function heightSignature(cfg, extra = '') {
|
|
35
|
+
let s = extra;
|
|
36
|
+
for (const k of HEIGHT_KEYS)
|
|
37
|
+
s += '|' + cfg[k];
|
|
38
|
+
return s;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Material } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a material draws correctly on an InstancedMesh. three's built-in
|
|
4
|
+
* materials apply `instanceMatrix` in the `project_vertex` chunk; a custom
|
|
5
|
+
* ShaderMaterial does only if its vertex shader includes that chunk (or reads
|
|
6
|
+
* instanceMatrix itself). Without it every copy would draw on top of the master.
|
|
7
|
+
*/
|
|
8
|
+
export declare function instancingSupported(material: Material): boolean;
|
|
9
|
+
//# sourceMappingURL=instancingSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instancingSupport.d.ts","sourceRoot":"","sources":["../../src/utils/instancingSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAK/D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a material draws correctly on an InstancedMesh. three's built-in
|
|
3
|
+
* materials apply `instanceMatrix` in the `project_vertex` chunk; a custom
|
|
4
|
+
* ShaderMaterial does only if its vertex shader includes that chunk (or reads
|
|
5
|
+
* instanceMatrix itself). Without it every copy would draw on top of the master.
|
|
6
|
+
*/
|
|
7
|
+
export function instancingSupported(material) {
|
|
8
|
+
const m = material;
|
|
9
|
+
if (!m.isShaderMaterial && !m.isRawShaderMaterial)
|
|
10
|
+
return true;
|
|
11
|
+
const vs = m.vertexShader ?? '';
|
|
12
|
+
return vs.includes('instanceMatrix') || (!m.isRawShaderMaterial && vs.includes('#include <project_vertex>'));
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import type { LandObjectConfig, LandQuality, TerrainConfig, TerrainQualityConfig } from '@3driseai/3drise-core';
|
|
2
|
+
import type { LandObjectConfig, LandQuality, ShapeLayoutField, TerrainConfig, TerrainQualityConfig } from '@3driseai/3drise-core';
|
|
3
3
|
export declare const LAND_SEGMENTS: Record<LandQuality, number>;
|
|
4
4
|
/** The seed's offset into the field, in metres. Deterministic, far apart. */
|
|
5
5
|
export declare function landSeedOffset(seed: number, out?: THREE.Vector2): THREE.Vector2;
|
|
@@ -21,13 +21,34 @@ export declare function landFrame(object: THREE.Object3D, out?: LandFrame): Land
|
|
|
21
21
|
* the camera and sun brought into terrain space. Call after applyTerrainUniforms
|
|
22
22
|
* and applySunUniforms (both of which write world-space or unscaled values).
|
|
23
23
|
*/
|
|
24
|
-
export declare function applyLandPatchUniforms(material: THREE.ShaderMaterial, cfg: LandObjectConfig, frame: LandFrame, camera: THREE.Camera
|
|
24
|
+
export declare function applyLandPatchUniforms(material: THREE.ShaderMaterial, cfg: LandObjectConfig, frame: LandFrame, camera: THREE.Camera,
|
|
25
|
+
/** The grid is a layout's (landLayoutGeometry): its per-vertex band replaces the rectangle's. */
|
|
26
|
+
layoutActive?: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* A land that keeps to a layout, as geometry: the field (core shapeLayoutField) stretched over the
|
|
29
|
+
* patch's unit grid (-0.5…0.5 on x / z), so the object's scale stretches the island with the grid —
|
|
30
|
+
* live while dragging, no rebuild — while the terrain inside stays a window in metres. `edge`: the
|
|
31
|
+
* band at the layout's edge in unit-grid units (edgeFade, a fraction of the side).
|
|
32
|
+
*/
|
|
33
|
+
export interface LandLayout {
|
|
34
|
+
field: ShapeLayoutField;
|
|
35
|
+
edge: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The patch grid for a land on a layout — independent of the object's scale. The unit grid with the
|
|
39
|
+
* cells that touch the layout kept, and every kept point that lies off it moved onto the layout's
|
|
40
|
+
* edge (the outline follows the layout, not the cells). Per vertex, for TerrainMaterial's
|
|
41
|
+
* LAND_LAYOUT path: the mask with its slope (per unit) and the lift (metres) with its slope.
|
|
42
|
+
* null: nothing of the grid is on the layout.
|
|
43
|
+
*/
|
|
44
|
+
export declare function landLayoutGeometry(segments: number, layout: LandLayout): THREE.BufferGeometry | null;
|
|
25
45
|
/**
|
|
26
46
|
* Height of the land above the object's base, in terrain metres, at terrain-space
|
|
27
47
|
* (tx, tz) measured from the object's centre (before rotation). Multiply nothing:
|
|
28
|
-
* scale.y is already in (elevation x scale.y).
|
|
48
|
+
* scale.y is already in (elevation x scale.y). With a layout: the layout's mask in
|
|
49
|
+
* place of the rectangle's, plus its lift (x scale.y); 0 off the layout.
|
|
29
50
|
*/
|
|
30
|
-
export declare function landHeightAt(cfg: LandObjectConfig, scale: THREE.Vector3, tx: number, tz: number, lodCell?: number): number;
|
|
51
|
+
export declare function landHeightAt(cfg: LandObjectConfig, scale: THREE.Vector3, tx: number, tz: number, lodCell?: number, layout?: LandLayout | null): number;
|
|
31
52
|
/** World-space height of a land object's surface under world (x, z), or null off the patch. */
|
|
32
|
-
export declare function landWorldHeightAt(object: THREE.Object3D, cfg: LandObjectConfig, x: number, z: number): number | null;
|
|
53
|
+
export declare function landWorldHeightAt(object: THREE.Object3D, cfg: LandObjectConfig, x: number, z: number, layout?: LandLayout | null): number | null;
|
|
33
54
|
//# sourceMappingURL=landPatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landPatch.d.ts","sourceRoot":"","sources":["../../src/utils/landPatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"landPatch.d.ts","sourceRoot":"","sources":["../../src/utils/landPatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAgBlI,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAwC,CAAC;AAE/F,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAsB,GAAG,KAAK,CAAC,OAAO,CAKrF;AAED;qCACqC;AACrC,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAExE;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,oBAAoB,CAevE;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACtB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IACrB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC;CACvC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,CAM5E;AAKD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM;AACpB,iGAAiG;AACjG,YAAY,UAAQ,GACrB,IAAI,CAkBN;AAcD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAAG,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAwBrE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,KAAK,CAAC,cAAc,GAAG,IAAI,CAkDpG;AAGD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,SAAI,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,CAWjJ;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAYhJ"}
|