@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
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Emitted from Claude outputs/vegetation-lab/grass.mjs by gen_family.mjs — edit the lab module and re-emit.
|
|
2
|
+
// Grass — vegetation object (lab module). Shared core: ./common.mjs (blades).
|
|
3
|
+
// Construction: tens of thousands of bent blades over the footprint, seeded with a clump field
|
|
4
|
+
// (tufts and bare patches), each with its own height, width, lean and curve. Wind: the shared gust
|
|
5
|
+
// field bends every blade ∝ t² with a ripple travelling downwind, so waves run through the field;
|
|
6
|
+
// the cursor parts it, puffs it or stirs it. Blades shade from a dark base to a lit tip, dry from the
|
|
7
|
+
// tips with the season, and glow against the sun. Flowers (daisies / buttercups) and seed heads are
|
|
8
|
+
// optional scattered layers. Size: the footprint is the transform's x/z, the box height the tallest blade.
|
|
9
|
+
import * as THREE from 'three';
|
|
10
|
+
import { mulberry32, setColor, createCommonUniforms, applyCommonConfig, updateCommon, QUALITY_V, LEAF_TYPES, bladeGeometry, setBlade, bladeMaterial, clumpedPositions, leafGeometry, setLeaf, unitBounds, leafMaterial, plantMesh, } from '../vegetationCore.js';
|
|
11
|
+
const BLADE_BASE = 36000, FLOWER_BASE = 260;
|
|
12
|
+
export function createUniforms() { return Object.assign(createCommonUniforms(), { uLeafType: { value: LEAF_TYPES.indexOf('blade') } }); }
|
|
13
|
+
export function applyConfig(u, c, mats) {
|
|
14
|
+
applyCommonConfig(u, Object.assign({}, c, { leafType: undefined }));
|
|
15
|
+
if (c.bladeWidth !== undefined)
|
|
16
|
+
u.uLeafSize.value = c.bladeWidth;
|
|
17
|
+
if (!mats)
|
|
18
|
+
return;
|
|
19
|
+
if (c.flowerColor !== undefined)
|
|
20
|
+
setColor(mats.flowerU.uColor, c.flowerColor);
|
|
21
|
+
}
|
|
22
|
+
export function build(u, c) {
|
|
23
|
+
const q = QUALITY_V[c.quality] || 1;
|
|
24
|
+
const rnd = mulberry32((c.seed ?? 11) * 2654435761 + 23);
|
|
25
|
+
const n = Math.round(BLADE_BASE * (c.density ?? 1) * q);
|
|
26
|
+
const geo = bladeGeometry(n);
|
|
27
|
+
const pts = clumpedPositions(n, rnd, c.clumping ?? 0.5, 0.005);
|
|
28
|
+
// the clump field also sets height: tufts stand taller
|
|
29
|
+
for (let i = 0; i < n; i++) {
|
|
30
|
+
const p = pts[i];
|
|
31
|
+
const tuft = 0.5 + 0.5 * Math.sin(p.x * 17 + 2) * Math.cos(p.z * 13 - 1);
|
|
32
|
+
const h = (0.6 + 0.4 * rnd()) * (0.7 + 0.6 * tuft);
|
|
33
|
+
setBlade(geo, i, p, h, 0.011 * (0.7 + 0.6 * rnd()), rnd() * Math.PI * 2, rnd(), (c.lean ?? 0.7) * (0.15 + 1.2 * Math.pow(rnd(), 1.5)), rnd(), (i + 0.5) / n, 0);
|
|
34
|
+
}
|
|
35
|
+
for (const k of ['aPos', 'aInfoA', 'aInfoB'])
|
|
36
|
+
geo.attributes[k].needsUpdate = true;
|
|
37
|
+
// the height knob and growth both scale the blades: one uniform the blade shader reads as growth
|
|
38
|
+
const uG = Object.assign({}, u, { uGrowth: { value: (c.bladeHeight ?? 1) * (c.growth ?? 1) } });
|
|
39
|
+
const bladePair = bladeMaterial(uG, { translucency: 0.55 });
|
|
40
|
+
// meadow flowers: a stalk (blade), a petal fan and a centre disc, on a seeded subset of the positions
|
|
41
|
+
const nF = Math.round(FLOWER_BASE * (c.flowers ?? 0) * q * 2);
|
|
42
|
+
const flowerU = Object.assign({}, u, { uLeafType: { value: LEAF_TYPES.indexOf('petal') }, uColor: { value: new THREE.Color(c.flowerColor || '#f6f2e0') }, uShadeColor: { value: new THREE.Color('#b8ad8a') }, uGrowth: uG.uGrowth, uFoliage: { value: 1 }, uSeason: { value: 0 } });
|
|
43
|
+
const centreU = Object.assign({}, flowerU, { uLeafType: { value: LEAF_TYPES.indexOf('round') }, uColor: { value: new THREE.Color('#f2c230') }, uShadeColor: { value: new THREE.Color('#b88a10') } });
|
|
44
|
+
const petals = 7;
|
|
45
|
+
const fGeo = leafGeometry(Math.max(1, nF * petals)), cGeo = leafGeometry(Math.max(1, nF));
|
|
46
|
+
const stalks = bladeGeometry(Math.max(1, nF));
|
|
47
|
+
const along = new THREE.Vector3(), up = new THREE.Vector3(0, 1, 0), pos = new THREE.Vector3();
|
|
48
|
+
let fi = 0;
|
|
49
|
+
for (let i = 0; i < nF; i++) {
|
|
50
|
+
const p = pts[Math.floor(rnd() * pts.length)];
|
|
51
|
+
const h = 0.8 + 0.4 * rnd();
|
|
52
|
+
setBlade(stalks, i, p, h, 0.004, rnd() * Math.PI * 2, rnd(), 0.15 * rnd(), rnd(), 0, 0);
|
|
53
|
+
pos.set(p.x, h * 0.98, p.z);
|
|
54
|
+
const tilt = new THREE.Vector3(rnd() - 0.5, 1.5, rnd() - 0.5).normalize();
|
|
55
|
+
for (let k = 0; k < petals; k++) {
|
|
56
|
+
const a = k / petals * Math.PI * 2 + rnd() * 0.2;
|
|
57
|
+
along.set(Math.cos(a), 0.25, Math.sin(a)).normalize();
|
|
58
|
+
setLeaf(fGeo, fi++, pos, along, tilt, 0.0065, rnd(), h, 1, rnd(), 0.3, 0, 0);
|
|
59
|
+
}
|
|
60
|
+
setLeaf(cGeo, i, pos.clone().addScaledVector(tilt, 0.004), up.clone().addScaledVector(tilt, -up.dot(tilt)).normalize(), tilt, 0.0035, rnd(), h, 1, rnd(), 0.3, 0, 0);
|
|
61
|
+
}
|
|
62
|
+
fGeo.instanceCount = fi;
|
|
63
|
+
cGeo.instanceCount = nF;
|
|
64
|
+
for (const g of [fGeo, cGeo, stalks]) {
|
|
65
|
+
for (const k of ['aPos', 'aInfoA', 'aInfoB'])
|
|
66
|
+
g.attributes[k].needsUpdate = true;
|
|
67
|
+
if (g.attributes.aQuat)
|
|
68
|
+
g.attributes.aQuat.needsUpdate = true;
|
|
69
|
+
unitBounds(g);
|
|
70
|
+
}
|
|
71
|
+
const petalPair = leafMaterial(flowerU, { translucency: 0.7, veins: 0.0, roughness: 0.9, underside: 0.08 });
|
|
72
|
+
const centrePair = leafMaterial(centreU, { translucency: 0.2, veins: 0, roughness: 0.9, underside: 0 });
|
|
73
|
+
const stalkPair = bladeMaterial(uG, { translucency: 0.4 });
|
|
74
|
+
const object = new THREE.Group();
|
|
75
|
+
object.name = 'grass';
|
|
76
|
+
object.add(plantMesh(geo, bladePair, 'blades'), plantMesh(stalks, stalkPair, 'stalks'), plantMesh(fGeo, petalPair, 'petals'), plantMesh(cGeo, centrePair, 'centres'));
|
|
77
|
+
const state = { height: c.bladeHeight ?? 1, growth: c.growth ?? 1 };
|
|
78
|
+
const mats = { flowerU };
|
|
79
|
+
const applyAll = (cfg) => {
|
|
80
|
+
applyConfig(u, cfg, mats);
|
|
81
|
+
if (cfg.bladeHeight !== undefined)
|
|
82
|
+
state.height = cfg.bladeHeight;
|
|
83
|
+
if (cfg.growth !== undefined)
|
|
84
|
+
state.growth = cfg.growth;
|
|
85
|
+
uG.uGrowth.value = state.height * state.growth;
|
|
86
|
+
};
|
|
87
|
+
applyAll(c);
|
|
88
|
+
return {
|
|
89
|
+
object,
|
|
90
|
+
materials: [bladePair.material, stalkPair.material, petalPair.material, centrePair.material],
|
|
91
|
+
apply: applyAll,
|
|
92
|
+
update: function (dt, camera, sunWorld) { updateCommon(u, object, camera, dt, sunWorld); },
|
|
93
|
+
stats: { blades: n, flowers: nF },
|
|
94
|
+
dispose: function () { for (const g of [geo, stalks, fGeo, cGeo])
|
|
95
|
+
g.dispose(); for (const p of [bladePair, stalkPair, petalPair, centrePair]) {
|
|
96
|
+
p.material.dispose();
|
|
97
|
+
p.depth.dispose();
|
|
98
|
+
} },
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
102
|
+
export const STRUCTURAL = ['clumping', 'density', 'quality', 'seed', 'flowers', 'lean'];
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const SPECIES: {
|
|
3
|
+
boxwood: {
|
|
4
|
+
leaf: string;
|
|
5
|
+
size: number;
|
|
6
|
+
color: string;
|
|
7
|
+
shade: string;
|
|
8
|
+
autumn: string[];
|
|
9
|
+
};
|
|
10
|
+
privet: {
|
|
11
|
+
leaf: string;
|
|
12
|
+
size: number;
|
|
13
|
+
color: string;
|
|
14
|
+
shade: string;
|
|
15
|
+
autumn: string[];
|
|
16
|
+
};
|
|
17
|
+
yew: {
|
|
18
|
+
leaf: string;
|
|
19
|
+
size: number;
|
|
20
|
+
color: string;
|
|
21
|
+
shade: string;
|
|
22
|
+
autumn: string[];
|
|
23
|
+
};
|
|
24
|
+
laurel: {
|
|
25
|
+
leaf: string;
|
|
26
|
+
size: number;
|
|
27
|
+
color: string;
|
|
28
|
+
shade: string;
|
|
29
|
+
autumn: string[];
|
|
30
|
+
};
|
|
31
|
+
beech: {
|
|
32
|
+
leaf: string;
|
|
33
|
+
size: number;
|
|
34
|
+
color: string;
|
|
35
|
+
shade: string;
|
|
36
|
+
autumn: string[];
|
|
37
|
+
};
|
|
38
|
+
holly: {
|
|
39
|
+
leaf: string;
|
|
40
|
+
size: number;
|
|
41
|
+
color: string;
|
|
42
|
+
shade: string;
|
|
43
|
+
autumn: string[];
|
|
44
|
+
};
|
|
45
|
+
photinia: {
|
|
46
|
+
leaf: string;
|
|
47
|
+
size: number;
|
|
48
|
+
color: string;
|
|
49
|
+
shade: string;
|
|
50
|
+
autumn: string[];
|
|
51
|
+
redTips: number;
|
|
52
|
+
};
|
|
53
|
+
cypress: {
|
|
54
|
+
leaf: string;
|
|
55
|
+
size: number;
|
|
56
|
+
color: string;
|
|
57
|
+
shade: string;
|
|
58
|
+
autumn: string[];
|
|
59
|
+
};
|
|
60
|
+
hornbeam: {
|
|
61
|
+
leaf: string;
|
|
62
|
+
size: number;
|
|
63
|
+
color: string;
|
|
64
|
+
shade: string;
|
|
65
|
+
autumn: string[];
|
|
66
|
+
};
|
|
67
|
+
pittosporum: {
|
|
68
|
+
leaf: string;
|
|
69
|
+
size: number;
|
|
70
|
+
color: string;
|
|
71
|
+
shade: string;
|
|
72
|
+
autumn: string[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export declare function createUniforms(): {
|
|
76
|
+
uTime: {
|
|
77
|
+
value: number;
|
|
78
|
+
};
|
|
79
|
+
uWindPhase: {
|
|
80
|
+
value: number;
|
|
81
|
+
};
|
|
82
|
+
uWindDir: {
|
|
83
|
+
value: THREE.Vector2;
|
|
84
|
+
};
|
|
85
|
+
uWindStrength: {
|
|
86
|
+
value: number;
|
|
87
|
+
};
|
|
88
|
+
uTurb: {
|
|
89
|
+
value: number;
|
|
90
|
+
};
|
|
91
|
+
uSpeed: {
|
|
92
|
+
value: number;
|
|
93
|
+
};
|
|
94
|
+
uSway: {
|
|
95
|
+
value: number;
|
|
96
|
+
};
|
|
97
|
+
uFlutter: {
|
|
98
|
+
value: number;
|
|
99
|
+
};
|
|
100
|
+
uScale: {
|
|
101
|
+
value: THREE.Vector3;
|
|
102
|
+
};
|
|
103
|
+
uMean: {
|
|
104
|
+
value: number;
|
|
105
|
+
};
|
|
106
|
+
uOpacity: {
|
|
107
|
+
value: number;
|
|
108
|
+
};
|
|
109
|
+
uColor: {
|
|
110
|
+
value: THREE.Color;
|
|
111
|
+
};
|
|
112
|
+
uShadeColor: {
|
|
113
|
+
value: THREE.Color;
|
|
114
|
+
};
|
|
115
|
+
uSeason: {
|
|
116
|
+
value: number;
|
|
117
|
+
};
|
|
118
|
+
uFoliage: {
|
|
119
|
+
value: number;
|
|
120
|
+
};
|
|
121
|
+
uLeafType: {
|
|
122
|
+
value: number;
|
|
123
|
+
};
|
|
124
|
+
uLeafSize: {
|
|
125
|
+
value: number;
|
|
126
|
+
};
|
|
127
|
+
uGrowth: {
|
|
128
|
+
value: number;
|
|
129
|
+
};
|
|
130
|
+
uSunDirView: {
|
|
131
|
+
value: THREE.Vector3;
|
|
132
|
+
};
|
|
133
|
+
uViewPos: {
|
|
134
|
+
value: THREE.Vector3;
|
|
135
|
+
};
|
|
136
|
+
uLodK: {
|
|
137
|
+
value: number;
|
|
138
|
+
};
|
|
139
|
+
uLodOrtho: {
|
|
140
|
+
value: number;
|
|
141
|
+
};
|
|
142
|
+
uLodBias: {
|
|
143
|
+
value: number;
|
|
144
|
+
};
|
|
145
|
+
uImpReady: {
|
|
146
|
+
value: number;
|
|
147
|
+
};
|
|
148
|
+
uBake: {
|
|
149
|
+
value: number;
|
|
150
|
+
};
|
|
151
|
+
uBakeView: {
|
|
152
|
+
value: THREE.Matrix3;
|
|
153
|
+
};
|
|
154
|
+
uBakeDepth: {
|
|
155
|
+
value: THREE.Vector2;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export declare function applyConfig(u: any, c: any, mats: any): void;
|
|
159
|
+
export declare function speciesColors(c: any): any;
|
|
160
|
+
export declare function build(u: any, c: any): {
|
|
161
|
+
object: THREE.Group<THREE.Object3DEventMap>;
|
|
162
|
+
materials: any[];
|
|
163
|
+
apply: (cfg: any) => void;
|
|
164
|
+
update: (dt: any, camera: any, sunWorld: any, renderer: any) => void;
|
|
165
|
+
lod: {
|
|
166
|
+
impostor: THREE.Mesh<any, any, THREE.Object3DEventMap>;
|
|
167
|
+
state: {
|
|
168
|
+
u: any;
|
|
169
|
+
ready: boolean;
|
|
170
|
+
wanted: boolean;
|
|
171
|
+
dirty: boolean;
|
|
172
|
+
changedAt: number;
|
|
173
|
+
lastBake: number;
|
|
174
|
+
t: number;
|
|
175
|
+
frame: number;
|
|
176
|
+
key: string;
|
|
177
|
+
bakeScale: THREE.Vector3;
|
|
178
|
+
rtC: any;
|
|
179
|
+
rtN: any;
|
|
180
|
+
};
|
|
181
|
+
update(dt: any, renderer: any): void;
|
|
182
|
+
applied(cfg: any): void;
|
|
183
|
+
dispose(): void;
|
|
184
|
+
};
|
|
185
|
+
stats: {
|
|
186
|
+
leaves: number;
|
|
187
|
+
twigs: number;
|
|
188
|
+
};
|
|
189
|
+
dispose: () => void;
|
|
190
|
+
};
|
|
191
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
192
|
+
export declare const STRUCTURAL: string[];
|
|
193
|
+
//# sourceMappingURL=hedge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hedge.d.ts","sourceRoot":"","sources":["../../../../src/components/vegetation/core/hedge.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWnB,CAAC;AAuCF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqC;AAEnE,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,EAAE,IAAI,KAAA,QAOrC;AAED,wBAAgB,aAAa,CAAC,CAAC,KAAA,OAO9B;AAED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8EzB;AAED,8GAA8G;AAC9G,eAAO,MAAM,UAAU,UAAqD,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Emitted from Claude outputs/vegetation-lab/hedge.mjs by gen_family.mjs — edit the lab module and re-emit.
|
|
2
|
+
// vegetation/core/hedge — Hedge (type 'vegetation', config.type 'hedge'). Shared core: ../vegetationCore.
|
|
3
|
+
// Construction: a clipped shape (box, dome, ball, cylinder, cone, spiral topiary) filled with
|
|
4
|
+
// foliage: leaf cards sampled on the shape's surface with normals facing out (the clipped skin, dense,
|
|
5
|
+
// small leaves), a sparser fill inside (so gaps show depth, not emptiness), and a lattice of twigs
|
|
6
|
+
// (short stubs) under the skin. `trim` is how recently it was clipped: 0 = razor flat, 1 = shaggy
|
|
7
|
+
// (the skin's cards scatter outward and tilt). Lit by depth: skin bright, inside shaded. Wind: a
|
|
8
|
+
// soft shimmer only. Size: the box is the clipped shape's bounding box.
|
|
9
|
+
import * as THREE from 'three';
|
|
10
|
+
import { mulberry32, setColor, createCommonUniforms, applyCommonConfig, updateCommon, QUALITY_V, LEAF_TYPES, branchGeometry, leafGeometry, setLeaf, unitBounds, barkMaterial, leafMaterial, plantMesh, plantLod, } from '../vegetationCore.js';
|
|
11
|
+
export const SPECIES = {
|
|
12
|
+
boxwood: { leaf: 'round', size: 0.022, color: '#3f7f2e', shade: '#15301a', autumn: ['#7a8a2a', '#5a6a1a'] },
|
|
13
|
+
privet: { leaf: 'broadleaf', size: 0.024, color: '#4f8f36', shade: '#1e3a1a', autumn: ['#b89a2a', '#7a5a1a'] },
|
|
14
|
+
yew: { leaf: 'needles', size: 0.022, color: '#2f5a2a', shade: '#102414', autumn: ['#4a5a2a', '#3a4a1a'] },
|
|
15
|
+
laurel: { leaf: 'broadleaf', size: 0.04, color: '#3a7a30', shade: '#14301a', autumn: ['#8a8a2a', '#5a5a1a'] },
|
|
16
|
+
beech: { leaf: 'broadleaf', size: 0.028, color: '#6a9a3a', shade: '#2a4a1a', autumn: ['#c88a2a', '#8a4a1a'] },
|
|
17
|
+
holly: { leaf: 'lobed', size: 0.026, color: '#2a5a2a', shade: '#0f2414', autumn: ['#3a5a2a', '#2a4a1a'] },
|
|
18
|
+
photinia: { leaf: 'broadleaf', size: 0.03, color: '#4a7a3a', shade: '#1e3a1a', autumn: ['#c8302a', '#8a1a1a'], redTips: 0.35 },
|
|
19
|
+
cypress: { leaf: 'needles', size: 0.02, color: '#3a6a3a', shade: '#14301a', autumn: ['#4a5a2a', '#3a4a1a'] },
|
|
20
|
+
hornbeam: { leaf: 'broadleaf', size: 0.022, color: '#5f9a3a', shade: '#2a4a1a', autumn: ['#d8a83a', '#8a5a2a'] },
|
|
21
|
+
pittosporum: { leaf: 'round', size: 0.022, color: '#8fb86a', shade: '#3a5a2a', autumn: ['#9a9a4a', '#6a6a3a'] },
|
|
22
|
+
};
|
|
23
|
+
const SKIN_BASE = 30000, FILL_BASE = 5000, TWIG_BASE = 700;
|
|
24
|
+
/** Signed distance and normal of the clipped shape in the unit box (x/z ±0.5, y 0..1). */
|
|
25
|
+
function shapeSdf(shape, p, out) {
|
|
26
|
+
const x = p.x, y = p.y - 0.5, z = p.z;
|
|
27
|
+
let d, n = out;
|
|
28
|
+
if (shape === 'ball') {
|
|
29
|
+
const r = Math.hypot(x, y, z);
|
|
30
|
+
d = r - 0.5;
|
|
31
|
+
n.set(x, y, z).divideScalar(Math.max(r, 1e-6));
|
|
32
|
+
}
|
|
33
|
+
else if (shape === 'dome') {
|
|
34
|
+
const r = Math.hypot(x, p.y, z);
|
|
35
|
+
d = Math.max(r - 0.5 * Math.SQRT2 * 0.72, -p.y);
|
|
36
|
+
n.set(x, p.y, z).normalize();
|
|
37
|
+
if (-p.y > r - 0.5)
|
|
38
|
+
n.set(0, -1, 0);
|
|
39
|
+
}
|
|
40
|
+
else if (shape === 'cylinder') {
|
|
41
|
+
const r = Math.hypot(x, z);
|
|
42
|
+
const dr = r - 0.5, dy = Math.abs(y) - 0.5;
|
|
43
|
+
d = Math.max(dr, dy);
|
|
44
|
+
if (dr > dy)
|
|
45
|
+
n.set(x, 0, z).normalize();
|
|
46
|
+
else
|
|
47
|
+
n.set(0, Math.sign(y) || 1, 0);
|
|
48
|
+
}
|
|
49
|
+
else if (shape === 'cone') {
|
|
50
|
+
const r = Math.hypot(x, z);
|
|
51
|
+
const rr = 0.5 * (1 - p.y);
|
|
52
|
+
const dr = (r - rr) * 0.894;
|
|
53
|
+
const dy = Math.max(-p.y, p.y - 1);
|
|
54
|
+
d = Math.max(dr, dy);
|
|
55
|
+
if (dr > dy)
|
|
56
|
+
n.set(x, r * 0.5, z).normalize();
|
|
57
|
+
else
|
|
58
|
+
n.set(0, p.y > 0.5 ? 1 : -1, 0);
|
|
59
|
+
}
|
|
60
|
+
else if (shape === 'spiral') {
|
|
61
|
+
// a cone wound with a spiral groove: the classic topiary
|
|
62
|
+
const r = Math.hypot(x, z);
|
|
63
|
+
const a = Math.atan2(z, x);
|
|
64
|
+
const rr = 0.5 * (1 - p.y * 0.85);
|
|
65
|
+
const groove = 0.5 + 0.5 * Math.cos(a - p.y * 14);
|
|
66
|
+
const dr = (r - rr * (0.55 + 0.45 * groove)) * 0.85;
|
|
67
|
+
const dy = Math.max(-p.y, p.y - 1);
|
|
68
|
+
d = Math.max(dr, dy);
|
|
69
|
+
if (dr > dy)
|
|
70
|
+
n.set(x, r * 0.4, z).normalize();
|
|
71
|
+
else
|
|
72
|
+
n.set(0, p.y > 0.5 ? 1 : -1, 0);
|
|
73
|
+
}
|
|
74
|
+
else if (shape === 'pyramid') {
|
|
75
|
+
const r = Math.max(Math.abs(x), Math.abs(z));
|
|
76
|
+
const rr = 0.5 * (1 - p.y);
|
|
77
|
+
d = Math.max((r - rr) * 0.9, Math.max(-p.y, p.y - 1));
|
|
78
|
+
n.set(Math.abs(x) > Math.abs(z) ? Math.sign(x) : 0, 0.45, Math.abs(z) >= Math.abs(x) ? Math.sign(z) : 0).normalize();
|
|
79
|
+
if (p.y > 0.98)
|
|
80
|
+
n.set(0, 1, 0);
|
|
81
|
+
}
|
|
82
|
+
else if (shape === 'obelisk') {
|
|
83
|
+
const r = Math.max(Math.abs(x), Math.abs(z));
|
|
84
|
+
const rr = 0.5 * (1 - 0.55 * p.y) * (p.y > 0.9 ? (1 - p.y) * 10 : 1);
|
|
85
|
+
d = Math.max(r - rr, Math.max(-p.y, p.y - 1));
|
|
86
|
+
n.set(Math.abs(x) > Math.abs(z) ? Math.sign(x) : 0, 0.25, Math.abs(z) >= Math.abs(x) ? Math.sign(z) : 0).normalize();
|
|
87
|
+
}
|
|
88
|
+
else if (shape === 'arch') { // a box with a tunnel through it (along z)
|
|
89
|
+
const q = new THREE.Vector3(Math.abs(x) - 0.46, Math.abs(y) - 0.46, Math.abs(z) - 0.46);
|
|
90
|
+
const o = new THREE.Vector3(Math.max(q.x, 0), Math.max(q.y, 0), Math.max(q.z, 0));
|
|
91
|
+
const box = o.length() + Math.min(Math.max(q.x, q.y, q.z), 0) - 0.04;
|
|
92
|
+
const tun = -(Math.hypot(x * 1.6, Math.max(0, p.y - 0.3) * 1.3) - 0.42); // round-topped opening
|
|
93
|
+
d = Math.max(box, tun);
|
|
94
|
+
if (tun > box)
|
|
95
|
+
n.set(-x * 1.6, -Math.max(0, p.y - 0.3) * 1.3, 0).normalize();
|
|
96
|
+
else if (o.lengthSq() > 1e-8)
|
|
97
|
+
n.set(o.x * Math.sign(x), o.y * Math.sign(y), o.z * Math.sign(z)).normalize();
|
|
98
|
+
else {
|
|
99
|
+
if (q.x > q.y && q.x > q.z)
|
|
100
|
+
n.set(Math.sign(x), 0, 0);
|
|
101
|
+
else if (q.y > q.z)
|
|
102
|
+
n.set(0, Math.sign(y), 0);
|
|
103
|
+
else
|
|
104
|
+
n.set(0, 0, Math.sign(z));
|
|
105
|
+
}
|
|
106
|
+
if (p.y < 0.02) {
|
|
107
|
+
n.set(0, -1, 0);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else { // box with rounded edges
|
|
111
|
+
const q = new THREE.Vector3(Math.abs(x) - 0.46, Math.abs(y) - 0.46, Math.abs(z) - 0.46);
|
|
112
|
+
const o = new THREE.Vector3(Math.max(q.x, 0), Math.max(q.y, 0), Math.max(q.z, 0));
|
|
113
|
+
d = o.length() + Math.min(Math.max(q.x, q.y, q.z), 0) - 0.04;
|
|
114
|
+
if (o.lengthSq() > 1e-8)
|
|
115
|
+
n.set(o.x * Math.sign(x), o.y * Math.sign(y), o.z * Math.sign(z)).normalize();
|
|
116
|
+
else {
|
|
117
|
+
if (q.x > q.y && q.x > q.z)
|
|
118
|
+
n.set(Math.sign(x), 0, 0);
|
|
119
|
+
else if (q.y > q.z)
|
|
120
|
+
n.set(0, Math.sign(y), 0);
|
|
121
|
+
else
|
|
122
|
+
n.set(0, 0, Math.sign(z));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return d;
|
|
126
|
+
}
|
|
127
|
+
export function createUniforms() { return createCommonUniforms(); }
|
|
128
|
+
export function applyConfig(u, c, mats) {
|
|
129
|
+
if (c.species !== undefined)
|
|
130
|
+
c = Object.assign({}, c, speciesColors(c));
|
|
131
|
+
applyCommonConfig(u, Object.assign({}, c, { leafType: undefined }));
|
|
132
|
+
if (c.species !== undefined)
|
|
133
|
+
u.uLeafType.value = Math.max(0, LEAF_TYPES.indexOf((SPECIES[c.species] || SPECIES.boxwood).leaf));
|
|
134
|
+
if (!mats)
|
|
135
|
+
return;
|
|
136
|
+
if (c.barkColor !== undefined)
|
|
137
|
+
setColor(mats.bark.userData.uniforms.uBarkColor, c.barkColor);
|
|
138
|
+
if (c.trim !== undefined)
|
|
139
|
+
mats.trim.value = c.trim;
|
|
140
|
+
}
|
|
141
|
+
export function speciesColors(c) {
|
|
142
|
+
const sp = SPECIES[c.species] || SPECIES.boxwood;
|
|
143
|
+
const all = Object.values(SPECIES);
|
|
144
|
+
const out = Object.create(null); // only the keys set below override the config
|
|
145
|
+
if (!c.color || c.color.toLowerCase() === '#3f7f2e' || all.some((s) => s.color.toLowerCase() === c.color.toLowerCase()))
|
|
146
|
+
out.color = sp.color;
|
|
147
|
+
if (!c.shadeColor || c.shadeColor.toLowerCase() === '#15301a' || all.some((s) => s.shade.toLowerCase() === c.shadeColor.toLowerCase()))
|
|
148
|
+
out.shadeColor = sp.shade;
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
export function build(u, c) {
|
|
152
|
+
const q = QUALITY_V[c.quality] || 1;
|
|
153
|
+
const sp = SPECIES[c.species] || SPECIES.boxwood;
|
|
154
|
+
c = Object.assign({}, c, speciesColors(c));
|
|
155
|
+
const rnd = mulberry32((c.seed ?? 17) * 2654435761 + 171);
|
|
156
|
+
const shape = c.shape || 'box';
|
|
157
|
+
const nSkin = Math.round(SKIN_BASE * (c.density ?? 1) * q), nFill = Math.round(FILL_BASE * (c.density ?? 1) * q);
|
|
158
|
+
const geo = leafGeometry(nSkin + nFill);
|
|
159
|
+
const p = new THREE.Vector3(), n = new THREE.Vector3(), along = new THREE.Vector3(), nrm = new THREE.Vector3(), tmp = new THREE.Vector3();
|
|
160
|
+
let i = 0, tries = 0;
|
|
161
|
+
// skin: rejection-sample points near the surface (|sdf| small), project onto it, face outward
|
|
162
|
+
while (i < nSkin && tries++ < nSkin * 40) {
|
|
163
|
+
p.set(rnd() - 0.5, rnd(), rnd() - 0.5);
|
|
164
|
+
const d = shapeSdf(shape, p, n);
|
|
165
|
+
if (Math.abs(d) > 0.06)
|
|
166
|
+
continue;
|
|
167
|
+
p.addScaledVector(n, -d);
|
|
168
|
+
if (p.y < 0.01)
|
|
169
|
+
continue;
|
|
170
|
+
nrm.copy(n).add(tmp.set(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5).multiplyScalar(0.7)).normalize();
|
|
171
|
+
along.crossVectors(nrm, tmp.set(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5)).normalize().addScaledVector(nrm, 0.35).normalize();
|
|
172
|
+
// the trim: aInfoB.w (the grow slot is free here) carries how far this card may stand proud of the skin
|
|
173
|
+
setLeaf(geo, i, p, along, nrm, sp.size * (0.8 + 0.4 * rnd()), rnd(), p.y, 0.85 + 0.15 * rnd(), rnd(), 0.15, rnd() * 0.5, 0);
|
|
174
|
+
geo.attributes.aInfoB.setW(i, 0);
|
|
175
|
+
// shaggy growth: a seeded outward offset the shader scales by uTrim (stored in aRoot as a direction × amount)
|
|
176
|
+
geo.attributes.aRoot.setXYZ(i, n.x * rnd() * 0.06, n.y * rnd() * 0.06, n.z * rnd() * 0.06);
|
|
177
|
+
i++;
|
|
178
|
+
}
|
|
179
|
+
// fill: inside, facing anywhere, shaded by depth
|
|
180
|
+
tries = 0;
|
|
181
|
+
while (i < nSkin + nFill && tries++ < nFill * 40) {
|
|
182
|
+
p.set(rnd() - 0.5, rnd(), rnd() - 0.5);
|
|
183
|
+
const d = shapeSdf(shape, p, n);
|
|
184
|
+
if (d > -0.03 || p.y < 0.01)
|
|
185
|
+
continue;
|
|
186
|
+
nrm.set(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5).normalize();
|
|
187
|
+
along.crossVectors(nrm, tmp.set(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5)).normalize();
|
|
188
|
+
setLeaf(geo, i, p, along, nrm, sp.size * (0.8 + 0.4 * rnd()), rnd(), p.y, Math.max(0, 0.6 + d * 4), rnd(), 0.1, 0.5 + rnd() * 0.5, 0);
|
|
189
|
+
geo.attributes.aRoot.setXYZ(i, 0, 0, 0);
|
|
190
|
+
i++;
|
|
191
|
+
}
|
|
192
|
+
geo.instanceCount = i;
|
|
193
|
+
for (const k of ['aPos', 'aRoot', 'aQuat', 'aInfoA', 'aInfoB'])
|
|
194
|
+
geo.attributes[k].needsUpdate = true;
|
|
195
|
+
unitBounds(geo);
|
|
196
|
+
// twigs: short stubs just under the skin, pointing out
|
|
197
|
+
const twigs = [];
|
|
198
|
+
tries = 0;
|
|
199
|
+
const nT = Math.round(TWIG_BASE * q);
|
|
200
|
+
while (twigs.length < nT && tries++ < nT * 40) {
|
|
201
|
+
p.set(rnd() - 0.5, rnd(), rnd() - 0.5);
|
|
202
|
+
const d = shapeSdf(shape, p, n);
|
|
203
|
+
if (d > -0.02 || d < -0.12 || p.y < 0.02)
|
|
204
|
+
continue;
|
|
205
|
+
const a = p.clone().addScaledVector(n, -0.08 - rnd() * 0.1), b = p.clone().addScaledVector(n, 0.015 + rnd() * 0.02);
|
|
206
|
+
const m = a.clone().lerp(b, 0.5).add(tmp.set(rnd() - 0.5, rnd() - 0.5, rnd() - 0.5).multiplyScalar(0.03));
|
|
207
|
+
twigs.push({ level: 1, pts: [a, m, b], radii: [0.004, 0.003, 0.0015], hf0: a.y, phase: rnd(), flex: 0.05 });
|
|
208
|
+
}
|
|
209
|
+
const barkPair = barkMaterial(u, { barkColor: c.barkColor || '#5a4a38', ridges: 0.3, lod: true });
|
|
210
|
+
const leafPair = leafMaterial(u, { translucency: 0.35, veins: 0.3, autumnA: sp.autumn[0], autumnB: sp.autumn[1], lod: true });
|
|
211
|
+
// the trim knob: the leaf shader's root slot is (ab)used as an outward growth vector scaled by uTrim
|
|
212
|
+
const trimU = { value: c.trim ?? 0.25 };
|
|
213
|
+
const wrap = (mat) => { const orig = mat.onBeforeCompile; mat.onBeforeCompile = (shader) => { orig(shader); shader.uniforms.uTrim = trimU; shader.vertexShader = shader.vertexShader.replace('attribute vec3 aRoot;', 'attribute vec3 aRoot; uniform float uTrim;').replace('vec3 ap = aRoot + (aPos - aRoot) * uGrowth;', 'vec3 ap = aPos + aRoot * uTrim * 1.5;'); }; };
|
|
214
|
+
wrap(leafPair.material);
|
|
215
|
+
wrap(leafPair.depth);
|
|
216
|
+
leafPair.material.customProgramCacheKey = () => 'veg-leaf-hedge-lod';
|
|
217
|
+
leafPair.depth.customProgramCacheKey = () => 'veg-leaf-hedge-lod-depth';
|
|
218
|
+
const twigGeo = branchGeometry(twigs, { sides: [4, 4, 3] });
|
|
219
|
+
unitBounds(twigGeo);
|
|
220
|
+
const object = new THREE.Group();
|
|
221
|
+
object.name = 'hedge';
|
|
222
|
+
const twigsM = plantMesh(twigGeo, barkPair, 'twigs'), leavesM = plantMesh(geo, leafPair, 'leaves');
|
|
223
|
+
object.add(twigsM, leavesM);
|
|
224
|
+
// the skin cards come first, the inner fill after: thinning at distance drops the hidden fill first
|
|
225
|
+
const lod = plantLod(u, object, { leaves: [leavesM], bark: [twigsM], bake: [twigsM, leavesM] });
|
|
226
|
+
const mats = { bark: barkPair.material, trim: trimU };
|
|
227
|
+
applyConfig(u, c, mats);
|
|
228
|
+
lod.applied(c);
|
|
229
|
+
return {
|
|
230
|
+
object,
|
|
231
|
+
materials: [barkPair.material, leafPair.material, lod.impostor.material],
|
|
232
|
+
apply: function (cfg) { applyConfig(u, cfg, mats); lod.applied(cfg); },
|
|
233
|
+
update: function (dt, camera, sunWorld, renderer) { updateCommon(u, object, camera, dt, sunWorld); lod.update(dt, renderer); },
|
|
234
|
+
lod,
|
|
235
|
+
stats: { leaves: i, twigs: twigs.length },
|
|
236
|
+
dispose: function () { geo.dispose(); twigGeo.dispose(); lod.dispose(); for (const pr of [barkPair, leafPair]) {
|
|
237
|
+
pr.material.dispose();
|
|
238
|
+
pr.depth.dispose();
|
|
239
|
+
} },
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
243
|
+
export const STRUCTURAL = ['shape', 'species', 'density', 'quality', 'seed'];
|