@3driseai/3drise-viewer 0.1.41 → 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/ui/UiLayers.d.ts +17 -1
- package/dist/ui/UiLayers.d.ts.map +1 -1
- package/dist/ui/UiLayers.js +76 -3
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.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
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// InstancedLayout — a mesh / model layout drawn as one InstancedMesh per part
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// The part machinery (instanced / mirrors, sync, tint) lives in utils/sharedParts.ts and
|
|
7
|
+
// is shared with linked instances (LinkedSource). This file adds the layout: copies,
|
|
8
|
+
// variants, ground placement, clicks.
|
|
9
|
+
//
|
|
10
|
+
// Master + mirrors. The object renders ONCE, as itself (the master: the real
|
|
11
|
+
// CustomPrimitive / ModelPrimitive inside its CreatedObject), so everything that
|
|
12
|
+
// already works on an object keeps working on the layout untouched: material
|
|
13
|
+
// application and material clips, model-part tracks, object effects, findById,
|
|
14
|
+
// readiness. Its meshes stay in the scene graph but are taken off the render
|
|
15
|
+
// layers (layers.mask = 0): they are not drawn and not picked.
|
|
16
|
+
//
|
|
17
|
+
// Beside it, one InstancedMesh per master mesh SHARES the master's geometry and
|
|
18
|
+
// material by reference. Each frame a cheap sync copies over whatever the master
|
|
19
|
+
// swapped (material, geometry, visibility, shadow flags); instance matrices are
|
|
20
|
+
// rewritten only when an input changed: the copies (layout / variation), the
|
|
21
|
+
// ground (onGround), or a part's own matrix (a clip moving a model part).
|
|
22
|
+
//
|
|
23
|
+
// - instance matrix = copy (slot × variation, on the ground) × partRel, where
|
|
24
|
+
// partRel is the part's matrix relative to its master.
|
|
25
|
+
// - The instanced group carries SELF_OWNED_MATERIAL_KEY (useMaterialApplication
|
|
26
|
+
// skips it: no material clones per copy) and every instanced mesh carries
|
|
27
|
+
// __opFxHelper (object effects work on the master only; the copies show the
|
|
28
|
+
// result through the shared material).
|
|
29
|
+
// - variantMix: one master per variant used, each with its own instanced set.
|
|
30
|
+
// - tintJitter: instanceColor = the per-copy shifted colour / the material colour.
|
|
31
|
+
// - Mirrors: an object that instances its own insides (vegetation: leaves, blades
|
|
32
|
+
// and fruit are InstancedBufferGeometry with per-leaf attributes) cannot be
|
|
33
|
+
// instanced again. Each part then gets one plain Mesh per copy (a mirror) that
|
|
34
|
+
// shares the master's geometry, material and depth material — no rebuild, no
|
|
35
|
+
// extra memory, one draw per part per copy, culled per copy. Chosen by `mirrors`
|
|
36
|
+
// (getObjectLayoutSupport mode) or automatically when a master part has
|
|
37
|
+
// InstancedBufferGeometry. Every part of that master is mirrored, so the parts of
|
|
38
|
+
// one copy stay together (their shaders read modelMatrix, e.g. the plant wind).
|
|
39
|
+
// - Falls back (onFallback) when a part cannot be instanced: a skinned mesh, a
|
|
40
|
+
// line / points object, or a shader material with no instancing in its vertex
|
|
41
|
+
// shader. ObjectNode then renders full copies with the copies limit.
|
|
42
|
+
//
|
|
43
|
+
// The 18 Oct rule holds: one master per variant, so every animation, effect or
|
|
44
|
+
// config change on the object reaches every copy.
|
|
45
|
+
import { memo, useEffect, useMemo, useRef } from 'react';
|
|
46
|
+
import { useFrame } from '@react-three/fiber';
|
|
47
|
+
import { layoutCopies, objectForVariant } from '@3driseai/3drise-core';
|
|
48
|
+
import { GroundTracker, isMetricLayout, placeCopies } from '../../utils/layoutPlacement.js';
|
|
49
|
+
import { SharedParts } from '../../utils/sharedParts.js';
|
|
50
|
+
const PART_CHECK_EVERY = 10;
|
|
51
|
+
const InstancedLayout = memo(({ createdObject, layout, render, handleObjectClick, onFallback, mirrors: forceMirrors = false }) => {
|
|
52
|
+
const rootRef = useRef(null);
|
|
53
|
+
const instRootRef = useRef(null);
|
|
54
|
+
const proxyRef = useRef(null);
|
|
55
|
+
// ObjectNode normalises the block on every render, so key on its contents.
|
|
56
|
+
const layoutKey = JSON.stringify(layout);
|
|
57
|
+
const copies = useMemo(() => layoutCopies(layout, layout.count), [layoutKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
58
|
+
const mix = layout.variantMix && layout.variantMix.values?.length ? layout.variantMix : null;
|
|
59
|
+
// copies grouped by variant (-1 = the object as it is)
|
|
60
|
+
const variants = useMemo(() => {
|
|
61
|
+
const by = new Map();
|
|
62
|
+
copies.forEach((c, i) => { const v = mix ? c.variant : -1; (by.get(v) ?? by.set(v, []).get(v)).push(i); });
|
|
63
|
+
return [...by.entries()].sort((a, b) => a[0] - b[0]);
|
|
64
|
+
}, [copies, mix]);
|
|
65
|
+
const sets = useRef([]);
|
|
66
|
+
const dropped = useRef([]);
|
|
67
|
+
// one VariantSet per variant, kept across renders (the master group refs are filled by React)
|
|
68
|
+
const prevSets = sets.current;
|
|
69
|
+
sets.current = variants.map(([variant, list]) => {
|
|
70
|
+
const prev = prevSets.find(s => s.variant === variant);
|
|
71
|
+
if (prev) {
|
|
72
|
+
if (prev.copies.join() !== list.join()) {
|
|
73
|
+
prev.copies = list;
|
|
74
|
+
prev.dirty = true;
|
|
75
|
+
}
|
|
76
|
+
return prev;
|
|
77
|
+
}
|
|
78
|
+
return { variant, master: null, copies: list, shared: null, dirty: true };
|
|
79
|
+
});
|
|
80
|
+
for (const s of prevSets)
|
|
81
|
+
if (!sets.current.includes(s))
|
|
82
|
+
dropped.current.push(s); // disposed next frame
|
|
83
|
+
const matrices = useRef([]);
|
|
84
|
+
const tracker = useMemo(() => new GroundTracker(), []);
|
|
85
|
+
const placedFor = useRef(null);
|
|
86
|
+
const fellBack = useRef(false);
|
|
87
|
+
const frame = useRef(0);
|
|
88
|
+
useEffect(() => () => { sets.current.forEach(s => s.shared?.dispose()); dropped.current.forEach(s => s.shared?.dispose()); }, []);
|
|
89
|
+
useFrame(() => {
|
|
90
|
+
const root = rootRef.current, g = instRootRef.current;
|
|
91
|
+
if (!root || !g || fellBack.current)
|
|
92
|
+
return;
|
|
93
|
+
const checkParts = !(frame.current++ % PART_CHECK_EVERY);
|
|
94
|
+
if (dropped.current.length) {
|
|
95
|
+
dropped.current.forEach(s => s.shared?.dispose());
|
|
96
|
+
dropped.current = [];
|
|
97
|
+
}
|
|
98
|
+
root.updateWorldMatrix(true, false);
|
|
99
|
+
// copies -> local matrices (re-dropped onto the ground only when it or the root moved)
|
|
100
|
+
let copiesDirty = false;
|
|
101
|
+
if (placedFor.current !== copies) {
|
|
102
|
+
placedFor.current = copies;
|
|
103
|
+
tracker.reset();
|
|
104
|
+
copiesDirty = true;
|
|
105
|
+
}
|
|
106
|
+
// ground and metre layouts depend on where the root is: re-placed when it moves
|
|
107
|
+
const tracksRoot = !!layout.onGround || isMetricLayout(layout.layout);
|
|
108
|
+
if (tracksRoot ? tracker.tick(root) : copiesDirty) {
|
|
109
|
+
placeCopies(copies, layout, root, matrices.current);
|
|
110
|
+
copiesDirty = true;
|
|
111
|
+
}
|
|
112
|
+
for (const s of sets.current) {
|
|
113
|
+
if (!s.master)
|
|
114
|
+
continue;
|
|
115
|
+
s.shared ??= new SharedParts(g, s.variant, forceMirrors);
|
|
116
|
+
const list = s.copies;
|
|
117
|
+
const reason = s.shared.sync(s.master, {
|
|
118
|
+
count: list.length,
|
|
119
|
+
slot: (k) => matrices.current[list[k]] ?? null,
|
|
120
|
+
slotsDirty: copiesDirty || s.dirty,
|
|
121
|
+
checkParts,
|
|
122
|
+
tint: { amount: layout.tintJitter ?? 0, of: (k) => copies[list[k]].tint, key: copies },
|
|
123
|
+
});
|
|
124
|
+
s.dirty = false;
|
|
125
|
+
if (reason) {
|
|
126
|
+
fellBack.current = true;
|
|
127
|
+
sets.current.forEach(x => x.shared?.dispose());
|
|
128
|
+
onFallback(reason);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// Clicks: the copy that was hit, as a stand-in object at its transform (zoom / focus target it).
|
|
134
|
+
const onClick = handleObjectClick
|
|
135
|
+
? (e) => {
|
|
136
|
+
const hit = e.object;
|
|
137
|
+
const set = sets.current.find(s => s.variant === hit.userData?.layoutVariant);
|
|
138
|
+
// an instanced part reports the instance; a mirror carries its copy
|
|
139
|
+
const k = hit.isInstancedMesh ? e.instanceId : hit.userData?.layoutCopy;
|
|
140
|
+
const ci = set && k !== undefined ? set.copies[k] : undefined;
|
|
141
|
+
const proxy = proxyRef.current;
|
|
142
|
+
if (ci === undefined || !proxy || !matrices.current[ci])
|
|
143
|
+
return;
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
matrices.current[ci].decompose(proxy.position, proxy.quaternion, proxy.scale);
|
|
146
|
+
proxy.updateMatrixWorld(true);
|
|
147
|
+
handleObjectClick(createdObject, proxy, e);
|
|
148
|
+
}
|
|
149
|
+
: undefined;
|
|
150
|
+
return (_jsxs("group", { ref: rootRef, name: "layout-instanced", children: [variants.map(([variant], i) => (_jsx("group", { name: `layout-master-${variant}`, ref: (m) => { const s = sets.current.find(x => x.variant === variant); if (s)
|
|
151
|
+
s.master = m; }, children: render(objectForVariant(createdObject, mix, variant), i) }, variant))), _jsx("group", { ref: instRootRef, name: "layout-instances", onClick: onClick }), _jsx("group", { ref: proxyRef, name: "layout-picked-copy" })] }));
|
|
152
|
+
});
|
|
153
|
+
InstancedLayout.displayName = 'InstancedLayout';
|
|
154
|
+
export default InstancedLayout;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { type ShapeLayout } from '@3driseai/3drise-core';
|
|
4
|
+
/** How the geometry's UVs are measured: 'metres' (u = x m — a mesh) or 'unit' (0…1 across the object — a land, tiled by its world scale each frame). */
|
|
5
|
+
export type GroundUvMode = 'metres' | 'unit';
|
|
6
|
+
export interface LayoutGroundsProps {
|
|
7
|
+
grounds: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
geometry: THREE.BufferGeometry;
|
|
10
|
+
}>;
|
|
11
|
+
shapeLayout: ShapeLayout;
|
|
12
|
+
uv: GroundUvMode;
|
|
13
|
+
/** An untextured ground: 'object' (left to the object's material), or this material. */
|
|
14
|
+
untextured: 'object' | THREE.Material;
|
|
15
|
+
receiveShadow?: boolean;
|
|
16
|
+
castShadow?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export default function LayoutGrounds({ grounds, shapeLayout, uv, untextured, receiveShadow, castShadow }: LayoutGroundsProps): React.JSX.Element;
|
|
19
|
+
//# sourceMappingURL=LayoutGrounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutGrounds.d.ts","sourceRoot":"","sources":["../../../src/components/layout/LayoutGrounds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA4D,KAAK,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAkBzI,wJAAwJ;AACxJ,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAC;AAgC7C,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAA;KAAE,CAAC,CAAC;IAC/D,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,wFAAwF;IACxF,UAAU,EAAE,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAYD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,aAAoB,EAAE,UAAkB,EAAE,EAAE,kBAAkB,qBAmD3I"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { SELF_OWNED_MATERIAL_KEY, shapeLayoutGroundTexture, toCdn } from '@3driseai/3drise-core';
|
|
6
|
+
import { resolveTextureMaps, textureResolverVersion } from '../urban/textureSetResolver.js';
|
|
7
|
+
const loader = new THREE.TextureLoader();
|
|
8
|
+
const cache = new Map();
|
|
9
|
+
/** A map, loaded once per url (each material clones it to tile on its own). */
|
|
10
|
+
function mapTexture(url, color) {
|
|
11
|
+
const key = `${color ? 'c' : 'd'}|${url}`;
|
|
12
|
+
let t = cache.get(key);
|
|
13
|
+
if (!t) {
|
|
14
|
+
t = loader.load(toCdn(url));
|
|
15
|
+
t.wrapS = t.wrapT = THREE.RepeatWrapping;
|
|
16
|
+
t.anisotropy = 4;
|
|
17
|
+
if (color)
|
|
18
|
+
t.colorSpace = THREE.SRGBColorSpace;
|
|
19
|
+
cache.set(key, t);
|
|
20
|
+
}
|
|
21
|
+
const c = t.clone();
|
|
22
|
+
c.wrapS = c.wrapT = THREE.RepeatWrapping;
|
|
23
|
+
return c;
|
|
24
|
+
}
|
|
25
|
+
/** A ground's standard material from its texture ref (its maps from the library when the ref names only the set). */
|
|
26
|
+
function groundMaterial(ref) {
|
|
27
|
+
const m = new THREE.MeshStandardMaterial({ color: '#ffffff', roughness: 0.9, metalness: 0 });
|
|
28
|
+
const maps = (Object.values(ref.maps ?? {}).some(Boolean) ? ref.maps : resolveTextureMaps(ref)) ?? {};
|
|
29
|
+
if (maps.color)
|
|
30
|
+
m.map = mapTexture(maps.color, true);
|
|
31
|
+
if (maps.normal)
|
|
32
|
+
m.normalMap = mapTexture(maps.normal, false);
|
|
33
|
+
if (maps.roughness)
|
|
34
|
+
m.roughnessMap = mapTexture(maps.roughness, false);
|
|
35
|
+
if (maps.ao)
|
|
36
|
+
m.aoMap = mapTexture(maps.ao, false);
|
|
37
|
+
return m;
|
|
38
|
+
}
|
|
39
|
+
const mapsOf = (m) => [m.map, m.normalMap, m.roughnessMap, m.aoMap].filter((t) => !!t);
|
|
40
|
+
/** The texture library's version — a set named before the library loaded resolves once it has. */
|
|
41
|
+
function useResolverVersion() {
|
|
42
|
+
const [v, setV] = useState(textureResolverVersion());
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const t = setInterval(() => { const n = textureResolverVersion(); if (n !== v)
|
|
45
|
+
setV(n); }, 1000);
|
|
46
|
+
return () => clearInterval(t);
|
|
47
|
+
}, [v]);
|
|
48
|
+
return v;
|
|
49
|
+
}
|
|
50
|
+
export default function LayoutGrounds({ grounds, shapeLayout, uv, untextured, receiveShadow = true, castShadow = false }) {
|
|
51
|
+
// one material per textured ground (rebuilt when its texture changes, or the library arrives)
|
|
52
|
+
const resolverVersion = useResolverVersion();
|
|
53
|
+
const texKey = JSON.stringify(grounds.map((g) => shapeLayoutGroundTexture(shapeLayout, g.id))) + '|' + resolverVersion;
|
|
54
|
+
const materials = useMemo(() => grounds.map((g) => {
|
|
55
|
+
const ref = shapeLayoutGroundTexture(shapeLayout, g.id);
|
|
56
|
+
if (!ref)
|
|
57
|
+
return null;
|
|
58
|
+
const m = groundMaterial(ref);
|
|
59
|
+
if (uv === 'metres')
|
|
60
|
+
for (const t of mapsOf(m))
|
|
61
|
+
t.repeat.set(1 / Math.max(0.05, ref.tileSize || 4), 1 / Math.max(0.05, ref.tileSize || 4));
|
|
62
|
+
return { m, tile: Math.max(0.05, ref.tileSize || 4) };
|
|
63
|
+
}), [grounds, texKey, uv]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
64
|
+
useEffect(() => () => { for (const x of materials) {
|
|
65
|
+
if (!x)
|
|
66
|
+
continue;
|
|
67
|
+
for (const t of mapsOf(x.m))
|
|
68
|
+
t.dispose();
|
|
69
|
+
x.m.dispose();
|
|
70
|
+
} }, [materials]);
|
|
71
|
+
// 'unit' UVs: the land's footprint changes with its scale — the tiling follows it every frame
|
|
72
|
+
const own = useRef(null);
|
|
73
|
+
const s = useMemo(() => new THREE.Vector3(), []);
|
|
74
|
+
useFrame(() => {
|
|
75
|
+
if (uv !== 'unit' || !own.current)
|
|
76
|
+
return;
|
|
77
|
+
own.current.updateWorldMatrix(true, false);
|
|
78
|
+
s.setFromMatrixScale(own.current.matrixWorld);
|
|
79
|
+
for (const x of materials)
|
|
80
|
+
if (x)
|
|
81
|
+
for (const t of mapsOf(x.m))
|
|
82
|
+
t.repeat.set(Math.abs(s.x) / x.tile, Math.abs(s.z) / x.tile);
|
|
83
|
+
});
|
|
84
|
+
useEffect(() => { if (own.current)
|
|
85
|
+
own.current.userData[SELF_OWNED_MATERIAL_KEY] = true; }, []);
|
|
86
|
+
// 'object': the untextured grounds draw with the parent mesh's material (whatever the material system gave it, followed every frame)
|
|
87
|
+
const plain = useRef(null);
|
|
88
|
+
useFrame(() => {
|
|
89
|
+
if (untextured !== 'object' || !plain.current)
|
|
90
|
+
return;
|
|
91
|
+
const parent = plain.current.parent;
|
|
92
|
+
const material = parent && parent.isMesh ? parent.material : null;
|
|
93
|
+
if (!material)
|
|
94
|
+
return;
|
|
95
|
+
for (const child of plain.current.children) {
|
|
96
|
+
const m = child;
|
|
97
|
+
if (m.isMesh && m.material !== material)
|
|
98
|
+
m.material = material;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return (_jsxs(_Fragment, { children: [_jsx("group", { ref: own, children: grounds.map((g, k) => materials[k] && (_jsx("mesh", { name: `ground ${g.id}`, geometry: g.geometry, material: materials[k].m, receiveShadow: receiveShadow, castShadow: castShadow }, g.id))) }), _jsx("group", { ref: plain, children: grounds.map((g, k) => !materials[k] && (untextured === 'object'
|
|
102
|
+
? _jsx("mesh", { name: `ground ${g.id}`, geometry: g.geometry, receiveShadow: receiveShadow, castShadow: castShadow }, g.id)
|
|
103
|
+
: _jsx("mesh", { name: `ground ${g.id}`, geometry: g.geometry, material: untextured, receiveShadow: receiveShadow, castShadow: castShadow }, g.id))) })] }));
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkProxies.d.ts","sourceRoot":"","sources":["../../../src/components/layout/LinkProxies.tsx"],"names":[],"mappings":"AAoBA,QAAA,MAAM,WAAW,GAAI,cAAc;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,gCA0BtD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// LinkProxies — invisible hit shapes of a link source's parts (pick proxies)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// A member of a linked group (the source itself, or a linked instance) is drawn by the
|
|
7
|
+
// source's shared drawing, outside its own subtree. So that hover, click, selection and
|
|
8
|
+
// the gizmo still treat it as its own object, it carries one invisible mesh per source
|
|
9
|
+
// part: the same geometry at the part's place, a pick material with material.visible
|
|
10
|
+
// off (hit by the pointer and counted in bounds, never drawn — no draw call).
|
|
11
|
+
// Rebuilt when the source publishes a new part set (linkRegistry version).
|
|
12
|
+
import { useEffect, useRef } from 'react';
|
|
13
|
+
import { useFrame } from '@react-three/fiber';
|
|
14
|
+
import { Mesh } from 'three';
|
|
15
|
+
import { SELF_OWNED_MATERIAL_KEY } from '@3driseai/3drise-core';
|
|
16
|
+
import { linkState } from '../../utils/linkRegistry.js';
|
|
17
|
+
import { pickMaterial, PICK_PROXY_NAME } from '../../utils/pickProxy.js';
|
|
18
|
+
const material = (() => { const m = pickMaterial(); m.visible = false; return m; })();
|
|
19
|
+
const LinkProxies = ({ sourceId }) => {
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const version = useRef(-1);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const g = ref.current;
|
|
24
|
+
// material application and object effects leave the proxies alone
|
|
25
|
+
if (g) {
|
|
26
|
+
g.userData[SELF_OWNED_MATERIAL_KEY] = true;
|
|
27
|
+
g.userData.__opFxHelper = true;
|
|
28
|
+
}
|
|
29
|
+
return () => { g?.clear(); };
|
|
30
|
+
}, []);
|
|
31
|
+
useFrame(() => {
|
|
32
|
+
const g = ref.current, st = linkState(sourceId);
|
|
33
|
+
if (!g || !st || st.version === version.current)
|
|
34
|
+
return;
|
|
35
|
+
version.current = st.version;
|
|
36
|
+
g.clear();
|
|
37
|
+
if (st.status !== 'shared')
|
|
38
|
+
return;
|
|
39
|
+
for (const p of st.parts) {
|
|
40
|
+
const m = new Mesh(p.geometry, material);
|
|
41
|
+
m.name = PICK_PROXY_NAME;
|
|
42
|
+
m.userData.__opFxHelper = true;
|
|
43
|
+
m.matrixAutoUpdate = false;
|
|
44
|
+
m.matrix.copy(p.rel);
|
|
45
|
+
m.castShadow = m.receiveShadow = false;
|
|
46
|
+
g.add(m);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return _jsx("group", { ref: ref, name: "link-proxies" });
|
|
50
|
+
};
|
|
51
|
+
export default LinkProxies;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface LinkedSourceProps {
|
|
3
|
+
sourceId: string;
|
|
4
|
+
/** The linked instances' ids (ObjectTreeNode.linkedIds). */
|
|
5
|
+
memberIds: string[];
|
|
6
|
+
/** The source's own renderer output (the master). */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Draw as mirrors (vegetation) — see utils/sharedParts. */
|
|
9
|
+
mirrors?: boolean;
|
|
10
|
+
onFallback: (reason: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const LinkedSource: ({ sourceId, memberIds, children, mirrors, onFallback }: LinkedSourceProps) => import("react").JSX.Element;
|
|
13
|
+
export default LinkedSource;
|
|
14
|
+
//# sourceMappingURL=LinkedSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkedSource.d.ts","sourceRoot":"","sources":["../../../src/components/layout/LinkedSource.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qDAAqD;IACrD,QAAQ,EAAE,SAAS,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAaD,QAAA,MAAM,YAAY,GAAI,wDAAgE,iBAAiB,gCAqFtG,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// LinkedSource — a link source draws itself and every linked instance in one go
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// Rendered by ObjectNode in place of the source's own renderer output when other
|
|
7
|
+
// objects are linked to it (meshSettings.instanceOf — core linkedInstances.ts).
|
|
8
|
+
//
|
|
9
|
+
// - The master is the source's renderer output, as itself, inside its CreatedObject:
|
|
10
|
+
// material application, material clips, model-part tracks and object effects work
|
|
11
|
+
// on it unchanged and reach every member through the shared material.
|
|
12
|
+
// - The drawing (utils/sharedParts: one InstancedMesh per part, or mirrors for
|
|
13
|
+
// vegetation) lives at the scene root, one slot per member: the source first, then
|
|
14
|
+
// each linked instance at its own CreatedObject's world matrix. Hiding the source
|
|
15
|
+
// hides its slot only; a hidden member (or one under a hidden group) is skipped.
|
|
16
|
+
// - Every member, the source included, carries LinkProxies so hover, click,
|
|
17
|
+
// selection and the gizmo work on it as its own object.
|
|
18
|
+
// - A part that cannot be shared (skinned, points / lines, a shader without
|
|
19
|
+
// instancing) → onFallback: the source renders normally and every linked instance
|
|
20
|
+
// renders the source's look on its own (linkRegistry status 'fallback').
|
|
21
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
22
|
+
import { useFrame, useThree } from '@react-three/fiber';
|
|
23
|
+
import { Group, Matrix4 } from 'three';
|
|
24
|
+
import { findById } from '../../utils/sceneQuery.js';
|
|
25
|
+
import { shownInScene } from '../../utils/shownInScene.js';
|
|
26
|
+
import { SharedParts, sameMatrix } from '../../utils/sharedParts.js';
|
|
27
|
+
import { clearLink, publishLink } from '../../utils/linkRegistry.js';
|
|
28
|
+
import LinkProxies from './LinkProxies.js';
|
|
29
|
+
const PART_CHECK_EVERY = 10;
|
|
30
|
+
/** Whether `o` still hangs under `scene` (a remounted object leaves a detached old root behind). */
|
|
31
|
+
function attachedTo(o, scene) {
|
|
32
|
+
for (let p = o; p; p = p.parent)
|
|
33
|
+
if (p === scene)
|
|
34
|
+
return true;
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const _rootInv = new Matrix4();
|
|
38
|
+
const _masterInRoot = new Matrix4();
|
|
39
|
+
const _next = new Matrix4();
|
|
40
|
+
const LinkedSource = ({ sourceId, memberIds, children, mirrors = false, onFallback }) => {
|
|
41
|
+
const scene = useThree(s => s.scene);
|
|
42
|
+
const masterRef = useRef(null);
|
|
43
|
+
const drawRoot = useMemo(() => { const g = new Group(); g.name = `linked-drawing:${sourceId}`; return g; }, [sourceId]);
|
|
44
|
+
const shared = useMemo(() => new SharedParts(drawRoot, 0, mirrors), [drawRoot, mirrors]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
scene.add(drawRoot);
|
|
47
|
+
return () => { shared.dispose(); drawRoot.removeFromParent(); clearLink(sourceId); };
|
|
48
|
+
}, [scene, drawRoot, shared, sourceId]);
|
|
49
|
+
const ids = useMemo(() => [sourceId, ...memberIds], [sourceId, memberIds.join()]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
50
|
+
// last frame's member matrices (world × master-in-root) and whether each was shown
|
|
51
|
+
const slots = useRef([]);
|
|
52
|
+
const shown = useRef([]);
|
|
53
|
+
const published = useRef({ version: -1, masterInRoot: new Matrix4() });
|
|
54
|
+
const frame = useRef(0);
|
|
55
|
+
const fellBack = useRef(false);
|
|
56
|
+
// member roots, cached: findById walks the scene, so it runs only for a root that is missing
|
|
57
|
+
// or no longer attached (remounted) — and for a missing one at most every few frames
|
|
58
|
+
const roots = useRef(new Map());
|
|
59
|
+
const rootOf = (id) => {
|
|
60
|
+
const cached = roots.current.get(id);
|
|
61
|
+
if (cached && attachedTo(cached, scene))
|
|
62
|
+
return cached;
|
|
63
|
+
if (cached === undefined || frame.current % PART_CHECK_EVERY === 0) {
|
|
64
|
+
const found = findById(id);
|
|
65
|
+
if (found)
|
|
66
|
+
roots.current.set(id, found);
|
|
67
|
+
else
|
|
68
|
+
roots.current.delete(id);
|
|
69
|
+
return found;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
73
|
+
useEffect(() => { fellBack.current = false; }, [ids]);
|
|
74
|
+
useFrame(() => {
|
|
75
|
+
const master = masterRef.current;
|
|
76
|
+
if (!master || fellBack.current)
|
|
77
|
+
return;
|
|
78
|
+
const sourceRoot = rootOf(sourceId);
|
|
79
|
+
if (!sourceRoot)
|
|
80
|
+
return;
|
|
81
|
+
sourceRoot.updateWorldMatrix(true, false);
|
|
82
|
+
master.updateWorldMatrix(true, false);
|
|
83
|
+
_rootInv.copy(sourceRoot.matrixWorld).invert();
|
|
84
|
+
_masterInRoot.multiplyMatrices(_rootInv, master.matrixWorld);
|
|
85
|
+
// one slot per member, at its own CreatedObject's place (the master's frame inside it)
|
|
86
|
+
let dirty = slots.current.length !== ids.length;
|
|
87
|
+
slots.current.length = ids.length;
|
|
88
|
+
shown.current.length = ids.length;
|
|
89
|
+
for (let k = 0; k < ids.length; k++) {
|
|
90
|
+
const root = k === 0 ? sourceRoot : rootOf(ids[k]);
|
|
91
|
+
const vis = !!root && shownInScene(root);
|
|
92
|
+
if (root)
|
|
93
|
+
root.updateWorldMatrix(true, false);
|
|
94
|
+
const m = slots.current[k] ?? (slots.current[k] = new Matrix4());
|
|
95
|
+
if (root) {
|
|
96
|
+
_next.multiplyMatrices(root.matrixWorld, _masterInRoot);
|
|
97
|
+
if (!sameMatrix(_next, m)) {
|
|
98
|
+
m.copy(_next);
|
|
99
|
+
dirty = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (shown.current[k] !== vis) {
|
|
103
|
+
shown.current[k] = vis;
|
|
104
|
+
dirty = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const reason = shared.sync(master, {
|
|
108
|
+
count: ids.length,
|
|
109
|
+
slot: (k) => (shown.current[k] ? slots.current[k] : null),
|
|
110
|
+
slotsDirty: dirty,
|
|
111
|
+
checkParts: !(frame.current++ % PART_CHECK_EVERY),
|
|
112
|
+
});
|
|
113
|
+
if (reason) {
|
|
114
|
+
fellBack.current = true;
|
|
115
|
+
publishLink(sourceId, 'fallback', []);
|
|
116
|
+
onFallback(reason);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// tell the members (their pick proxies) which parts there are and where
|
|
120
|
+
const pub = published.current;
|
|
121
|
+
if (pub.version !== shared.version || !sameMatrix(pub.masterInRoot, _masterInRoot)) {
|
|
122
|
+
pub.version = shared.version;
|
|
123
|
+
pub.masterInRoot.copy(_masterInRoot);
|
|
124
|
+
publishLink(sourceId, 'shared', shared.parts.map(p => ({ geometry: p.source.geometry, rel: new Matrix4().multiplyMatrices(_masterInRoot, p.rel) })));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return (_jsxs(_Fragment, { children: [_jsx("group", { ref: masterRef, name: "link-master", children: children }), _jsx(LinkProxies, { sourceId: sourceId })] }));
|
|
128
|
+
};
|
|
129
|
+
export default LinkedSource;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AnimationOptions, CreatedObjectSettings, MouseMoveDomain } from '@3driseai/3drise-core';
|
|
3
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
+
export type ProjectorProps = ObjectReadyProps & {
|
|
5
|
+
/** Scene object id: the light controller finds the live-edit handle by it. */
|
|
6
|
+
id?: string;
|
|
7
|
+
config: Record<string, any>;
|
|
8
|
+
animations?: AnimationOptions[];
|
|
9
|
+
mouseMove?: MouseMoveDomain;
|
|
10
|
+
settings: CreatedObjectSettings | Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
declare const Projector: React.FC<ProjectorProps>;
|
|
13
|
+
export default Projector;
|
|
14
|
+
//# sourceMappingURL=Projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Projector.d.ts","sourceRoot":"","sources":["../../../src/components/projector/Projector.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAItG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAC5C,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzD,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA4BvC,CAAC;AACF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Projector — a stadium floodlight bank (light family)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// Rendered by LightObject for `config.type === 'projector'`. The construction is
|
|
7
|
+
// projectorCore.ts (generated from the approved lab module); this file is the light
|
|
8
|
+
// contract around it: useLightConfig merges committed config + live drags +
|
|
9
|
+
// keyframes + pointer bindings into `merged`, which the core reads every frame.
|
|
10
|
+
//
|
|
11
|
+
// Generated by Claude outputs/lights-lab/emit_object.mjs — edit the lab and regenerate.
|
|
12
|
+
//
|
|
13
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
14
|
+
import { useFrame } from '@react-three/fiber';
|
|
15
|
+
import { DEFAULT_LIGHTS, SELF_OWNED_MATERIAL_KEY } from '@3driseai/3drise-core';
|
|
16
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
17
|
+
import { useLightShadow } from '../../hooks/useLightShadow.js';
|
|
18
|
+
import { useLightConfig } from '../../hooks/useLightConfig.js';
|
|
19
|
+
import { createProjector } from './projectorCore.js';
|
|
20
|
+
const Projector = ({ id, config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
|
|
21
|
+
const groupRef = useRef(null);
|
|
22
|
+
// One instance for the object's life: structural knobs (lamp, columns, rows,
|
|
23
|
+
// aspect, edge softness) rebuild the fixture inside the core, keyed on the
|
|
24
|
+
// merged config, so the light, its shadow map and its target stay put.
|
|
25
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
+
const instance = useMemo(() => createProjector({ ...DEFAULT_LIGHTS.projector, ...config }), []);
|
|
27
|
+
const lightRef = useRef(instance.light);
|
|
28
|
+
useObjectReady(groupRef, settings, onObjectReady, onObjectDispose);
|
|
29
|
+
useLightShadow(lightRef, config.shadow, config.type);
|
|
30
|
+
// Before the frame callback below: R3F runs them in subscription order.
|
|
31
|
+
const { merged } = useLightConfig(groupRef, lightRef, id, config, animations, mouseMove);
|
|
32
|
+
// The light owns its materials and its shadow flags.
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const group = groupRef.current;
|
|
35
|
+
if (!group)
|
|
36
|
+
return;
|
|
37
|
+
group.userData[SELF_OWNED_MATERIAL_KEY] = true;
|
|
38
|
+
return () => { delete group.userData[SELF_OWNED_MATERIAL_KEY]; };
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(() => () => instance.dispose(), [instance]);
|
|
41
|
+
useFrame(({ camera }, delta) => instance.update(delta, camera, merged.current));
|
|
42
|
+
return (_jsx("group", { ref: groupRef, children: _jsx("primitive", { object: instance.root }) }));
|
|
43
|
+
};
|
|
44
|
+
export default Projector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/projector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/** The defaults live in core (DEFAULT_LIGHTS.projector); this is that table. */
|
|
3
|
+
export declare const DEFAULTS: Record<string, any>;
|
|
4
|
+
export declare const STRUCTURAL: string[];
|
|
5
|
+
/**
|
|
6
|
+
* The spot's projection square spans ±tan(angle); the optic's rectangle spans
|
|
7
|
+
* ±tx, ±ty inside it. angle is set from the rectangle's corner (×1.04), so the
|
|
8
|
+
* rectangle's share of the square depends only on aspect — `spread` can then be
|
|
9
|
+
* animated without redrawing the mask.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CORNER = 1.04;
|
|
12
|
+
export declare function createProjector(cfg0: any): {
|
|
13
|
+
root: THREE.Group<THREE.Object3DEventMap>;
|
|
14
|
+
light: THREE.SpotLight;
|
|
15
|
+
update: (dt: any, camera: any, cfg: any) => void;
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
heads: any[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=projectorCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectorCore.d.ts","sourceRoot":"","sources":["../../../src/components/projector/projectorCore.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,gFAAgF;AAChF,eAAO,MAAM,QAAQ,EAA+B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,UAAwD,CAAC;AAyEhF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,OAAO,CAAC;AAuI3B,wBAAgB,eAAe,CAAC,IAAI,KAAA;;;;;;EA8QnC"}
|