@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 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../src/components/vegetation/core/tree.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmNnB,CAAC;AAIF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqC;AAEnE,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,EAAE,IAAI,KAAA,QAcrC;AAgBD,sGAAsG;AACtG,wBAAgB,aAAa,CAAC,CAAC,KAAA,OAQ9B;AAED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EzB;AAED,8GAA8G;AAC9G,eAAO,MAAM,UAAU,UAA2F,CAAC"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
// Emitted from Claude outputs/vegetation-lab/tree.mjs by gen_family.mjs — edit the lab module and re-emit.
|
|
2
|
+
// vegetation/core/tree — Tree (type 'vegetation', config.type 'tree'). Shared core: ../vegetationCore.
|
|
3
|
+
// Construction:
|
|
4
|
+
// skeleton a parametric branching model (Weber–Penn): trunk → 1–3 levels of branches, each
|
|
5
|
+
// level with a child count, length/radius ratios, down angle, phyllotactic rotation,
|
|
6
|
+
// curvature, gravity (droop) and phototropism; the crown silhouette is a shape function
|
|
7
|
+
// of the attachment height. A species is one parameter set; the knobs scale it.
|
|
8
|
+
// bark one merged generalized-cylinder mesh (fewer sides on thinner branches), procedural
|
|
9
|
+
// ridged bark as a bump, moss low on the trunk.
|
|
10
|
+
// leaves instanced cards along the last levels, shaped per leaf type (SDF), coloured by the
|
|
11
|
+
// per-leaf hash, canopy depth and season, translucent against the sun.
|
|
12
|
+
// wind hierarchical: the trunk leans with travelling gusts (∝ height²), branches sway at their
|
|
13
|
+
// own phase and flexibility, leaves flutter; one field shared by bark, leaves and fruit.
|
|
14
|
+
// fruit instanced spheroids shaped and skinned per kind, hanging from the outer leaves,
|
|
15
|
+
// ripening (two colours) across the crown.
|
|
16
|
+
// fall analytic falling leaves, released by the season, a knob, or the cursor's rustle.
|
|
17
|
+
// Size: the unit box — the transform scale is the tree's width and height.
|
|
18
|
+
import * as THREE from 'three';
|
|
19
|
+
import { mulberry32, setColor, createCommonUniforms, applyCommonConfig, updateCommon, LEAF_TYPES, QUALITY_V, generatePlant, branchGeometry, leafGeometry, fillLeaves, unitBounds, barkMaterial, leafMaterial, fruitMaterial, applyFruitConfig, fruitGeometry, fillFruit, fallingMaterial, plantMesh, flowerHeads, plantLod, lodOrder, } from '../vegetationCore.js';
|
|
20
|
+
// ----------------------------------------------------------------------------- species
|
|
21
|
+
// Lengths relative to the trunk length; the whole plant is fitted to the unit box afterwards.
|
|
22
|
+
export const SPECIES = {
|
|
23
|
+
oak: {
|
|
24
|
+
leaf: 'lobed', bark: '#5a4632', autumn: ['#d99a1e', '#9c3a16'],
|
|
25
|
+
levels: 3, droop: 0.05, twist: 0.7, photo: 0.35, branchiness: 1,
|
|
26
|
+
// a short trunk forking into three or four heavy limbs, each with two more levels of branching
|
|
27
|
+
trunk: { length: 0.34, radius: 0.055, taper: 0.3, curve: 6, segments: 6, flex: 0.05, splits: 3, splitAngle: 32, splitLength: 1.1, splitRadius: 0.72 },
|
|
28
|
+
level: [
|
|
29
|
+
{ count: 4, length: 0.9, radius: 0.6, downAngle: 55, downVar: 30, curve: 30, curveVar: 1.2, segments: 5, start: 0.55, splits: 2, splitAngle: 30, splitLength: 0.8, splitRadius: 0.75 },
|
|
30
|
+
{ count: 8, length: 0.6, radius: 0.6, downAngle: 50, downVar: 40, curve: 25, segments: 4, start: 0.2 },
|
|
31
|
+
{ count: 9, length: 0.5, radius: 0.5, downAngle: 45, downVar: 50, curve: 20, segments: 3, start: 0.1 },
|
|
32
|
+
],
|
|
33
|
+
shape: (t) => 0.55 + 0.6 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
34
|
+
leaves: { perLength: 150, size: 0.024, sizeVar: 0.5, spread: 0.8, lift: 0.3, fromLevel: 1, tuft: 2, start: 0.15 },
|
|
35
|
+
},
|
|
36
|
+
maple: {
|
|
37
|
+
leaf: 'maple', bark: '#6b5a4a', autumn: ['#e8821c', '#c0281c'],
|
|
38
|
+
levels: 3, droop: 0.05, twist: 0.4, photo: 0.4, branchiness: 1,
|
|
39
|
+
trunk: { length: 0.3, radius: 0.045, taper: 0.3, curve: 3, segments: 5, flex: 0.05, splits: 3, splitAngle: 26, splitLength: 1.2, splitRadius: 0.7 },
|
|
40
|
+
level: [
|
|
41
|
+
{ count: 3, length: 0.8, radius: 0.6, downAngle: 40, downVar: 25, curve: 20, curveVar: 1, segments: 5, start: 0.5, splits: 2, splitAngle: 28, splitLength: 0.8, splitRadius: 0.75 },
|
|
42
|
+
{ count: 5, length: 0.6, radius: 0.6, downAngle: 40, downVar: 35, curve: 15, segments: 4, start: 0.2 },
|
|
43
|
+
{ count: 5, length: 0.5, radius: 0.5, downAngle: 40, downVar: 40, curve: 15, segments: 3, start: 0.1 },
|
|
44
|
+
],
|
|
45
|
+
shape: (t) => 0.5 + 0.7 * Math.sin(Math.PI * (0.05 + 0.9 * t)),
|
|
46
|
+
leaves: { perLength: 80, size: 0.022, sizeVar: 0.4, spread: 0.8, lift: 0.3, fromLevel: 1, tuft: 2, start: 0.15 },
|
|
47
|
+
},
|
|
48
|
+
pine: {
|
|
49
|
+
leaf: 'needles', bark: '#4e3a2c', autumn: ['#7a6a2a', '#5a4a1a'],
|
|
50
|
+
levels: 2, droop: 0.35, twist: 0.15, photo: 0.1, branchiness: 1, whorls: 5,
|
|
51
|
+
trunk: { length: 1, radius: 0.04, taper: 0.9, curve: 1, segments: 12, flex: 0.03 },
|
|
52
|
+
level: [
|
|
53
|
+
{ count: 40, length: 0.42, radius: 0.35, downAngle: 82, downVar: 10, curve: -12, curveVar: 0.5, segments: 4, start: 0.3 },
|
|
54
|
+
{ count: 6, length: 0.45, radius: 0.5, downAngle: 50, downVar: 30, curve: 5, segments: 3, start: 0.25 },
|
|
55
|
+
],
|
|
56
|
+
shape: (t) => Math.max(0.08, 1.05 - 0.95 * t),
|
|
57
|
+
leaves: { perLength: 90, size: 0.03, sizeVar: 0.3, spread: 1.1, lift: 0.1, fromLevel: 0, tuft: 2, start: 0.1, faceUp: 0.4 },
|
|
58
|
+
},
|
|
59
|
+
birch: {
|
|
60
|
+
leaf: 'broadleaf', bark: '#d8d4c8', autumn: ['#f0c21a', '#d99a1e'],
|
|
61
|
+
levels: 3, droop: 0.5, twist: 0.3, photo: 0.3, branchiness: 1,
|
|
62
|
+
trunk: { length: 0.5, radius: 0.028, taper: 0.7, curve: 4, segments: 8, flex: 0.08, lean: 0.1 },
|
|
63
|
+
level: [
|
|
64
|
+
{ count: 9, length: 0.9, radius: 0.5, downAngle: 38, downVar: 20, curve: 15, curveVar: 1, segments: 4, start: 0.35 },
|
|
65
|
+
{ count: 5, length: 0.6, radius: 0.55, downAngle: 45, downVar: 30, curve: 25, segments: 4, start: 0.2 },
|
|
66
|
+
{ count: 5, length: 0.55, radius: 0.5, downAngle: 60, downVar: 40, curve: 30, segments: 3, start: 0.1 },
|
|
67
|
+
],
|
|
68
|
+
shape: (t) => 0.5 + 0.5 * Math.sin(Math.PI * (0.2 + 0.7 * t)),
|
|
69
|
+
leaves: { perLength: 60, size: 0.022, sizeVar: 0.4, spread: 0.9, lift: 0.1, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
70
|
+
},
|
|
71
|
+
willow: {
|
|
72
|
+
leaf: 'lanceolate', bark: '#6a5a44', autumn: ['#d9c21e', '#b89a1e'],
|
|
73
|
+
levels: 3, droop: 1.3, twist: 0.3, photo: 0.6, branchiness: 1,
|
|
74
|
+
trunk: { length: 0.3, radius: 0.05, taper: 0.4, curve: 8, segments: 5, flex: 0.05 },
|
|
75
|
+
level: [
|
|
76
|
+
{ count: 7, length: 1.3, radius: 0.6, downAngle: 35, downVar: 25, curve: 10, curveVar: 1, segments: 5, start: 0.5 },
|
|
77
|
+
{ count: 6, length: 0.9, radius: 0.45, downAngle: 40, downVar: 30, curve: 10, segments: 6, start: 0.3 },
|
|
78
|
+
{ count: 4, length: 0.8, radius: 0.4, downAngle: 30, downVar: 30, curve: 5, segments: 6, start: 0.2 },
|
|
79
|
+
],
|
|
80
|
+
shape: (t) => 0.6 + 0.5 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
81
|
+
leaves: { perLength: 110, size: 0.03, sizeVar: 0.4, spread: 0.9, lift: -0.4, fromLevel: 2, tuft: 2, start: 0.05 },
|
|
82
|
+
},
|
|
83
|
+
palm: {
|
|
84
|
+
leaf: 'lanceolate', bark: '#8a7a5a', autumn: ['#b8a040', '#8a6a2a'],
|
|
85
|
+
levels: 1, droop: 1.6, twist: 0.05, photo: 0, branchiness: 1,
|
|
86
|
+
trunk: { length: 1, radius: 0.035, taper: 0.3, curve: 14, segments: 10, flex: 0.1, lean: 0.25 },
|
|
87
|
+
level: [
|
|
88
|
+
// the fronds: arching rachises from the crown, leaflets in two ranks along them
|
|
89
|
+
{ count: 18, length: 0.55, radius: 0.3, downAngle: 25, downVar: 50, curve: 30, curveVar: 0.4, segments: 8, start: 0.97, azVar: 1.5 },
|
|
90
|
+
],
|
|
91
|
+
shape: () => 1,
|
|
92
|
+
leaves: { perLength: 150, size: 0.055, sizeVar: 0.2, spread: 1.6, lift: -0.15, fromLevel: 0, tuft: 2, start: 0.12, faceUp: 0.6 },
|
|
93
|
+
},
|
|
94
|
+
cypress: {
|
|
95
|
+
leaf: 'needles', bark: '#5a4a3a', autumn: ['#7a6a2a', '#5a4a1a'],
|
|
96
|
+
levels: 2, droop: -0.2, twist: 0.2, photo: 0.5, branchiness: 1,
|
|
97
|
+
trunk: { length: 1, radius: 0.03, taper: 0.9, curve: 1, segments: 12, flex: 0.04 },
|
|
98
|
+
level: [
|
|
99
|
+
{ count: 50, length: 0.18, radius: 0.4, downAngle: 30, downVar: 15, curve: -10, segments: 3, start: 0.05 },
|
|
100
|
+
{ count: 5, length: 0.5, radius: 0.5, downAngle: 35, downVar: 30, curve: 5, segments: 3, start: 0.2 },
|
|
101
|
+
],
|
|
102
|
+
shape: (t) => 0.4 + 0.6 * Math.sin(Math.PI * (0.05 + 0.9 * t)),
|
|
103
|
+
leaves: { perLength: 110, size: 0.024, sizeVar: 0.3, spread: 1, lift: 0.4, fromLevel: 0, tuft: 2, start: 0.1, faceUp: 0.6 },
|
|
104
|
+
},
|
|
105
|
+
olive: {
|
|
106
|
+
leaf: 'lanceolate', bark: '#8a8070', autumn: ['#9a9a6a', '#7a7a5a'],
|
|
107
|
+
levels: 3, droop: 0.25, twist: 1.2, photo: 0.2, branchiness: 1,
|
|
108
|
+
trunk: { length: 0.3, radius: 0.07, taper: 0.35, curve: 18, segments: 7, flex: 0.03, splits: 3, splitAngle: 38, splitLength: 0.9, splitRadius: 0.7 },
|
|
109
|
+
level: [
|
|
110
|
+
{ count: 4, length: 0.8, radius: 0.6, downAngle: 50, downVar: 40, curve: 35, curveVar: 1.5, segments: 5, start: 0.5, splits: 2, splitAngle: 35, splitLength: 0.75, splitRadius: 0.75 },
|
|
111
|
+
{ count: 7, length: 0.6, radius: 0.6, downAngle: 55, downVar: 40, curve: 30, segments: 4, start: 0.2 },
|
|
112
|
+
{ count: 8, length: 0.5, radius: 0.5, downAngle: 50, downVar: 50, curve: 25, segments: 3, start: 0.1 },
|
|
113
|
+
],
|
|
114
|
+
shape: (t) => 0.6 + 0.5 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
115
|
+
leaves: { perLength: 140, size: 0.02, sizeVar: 0.4, spread: 0.9, lift: 0.1, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
116
|
+
leafColor: '#7f8f5a', shade: '#3a4a2a',
|
|
117
|
+
},
|
|
118
|
+
cherryBlossom: {
|
|
119
|
+
leaf: 'broadleaf', bark: '#4a3a34', autumn: ['#e8a03a', '#c0502a'],
|
|
120
|
+
levels: 3, droop: 0.1, twist: 0.5, photo: 0.3, branchiness: 1,
|
|
121
|
+
trunk: { length: 0.3, radius: 0.045, taper: 0.3, curve: 8, segments: 6, flex: 0.05, splits: 3, splitAngle: 35, splitLength: 1.0, splitRadius: 0.7 },
|
|
122
|
+
level: [
|
|
123
|
+
{ count: 4, length: 0.85, radius: 0.6, downAngle: 50, downVar: 30, curve: 25, curveVar: 1, segments: 5, start: 0.5, splits: 2, splitAngle: 32, splitLength: 0.8, splitRadius: 0.75 },
|
|
124
|
+
{ count: 7, length: 0.6, radius: 0.6, downAngle: 50, downVar: 40, curve: 20, segments: 4, start: 0.2 },
|
|
125
|
+
{ count: 8, length: 0.5, radius: 0.5, downAngle: 45, downVar: 50, curve: 20, segments: 3, start: 0.1 },
|
|
126
|
+
],
|
|
127
|
+
shape: (t) => 0.6 + 0.6 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
128
|
+
leaves: { perLength: 60, size: 0.02, sizeVar: 0.4, spread: 0.8, lift: 0.2, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
129
|
+
blossom: { petals: 5, size: 0.012, color: '#f6c6d6', head: 3, cup: 0.35 }, flowersAlways: 0.9, leafColor: '#6a9a3a',
|
|
130
|
+
},
|
|
131
|
+
magnolia: {
|
|
132
|
+
leaf: 'broadleaf', bark: '#7a7a72', autumn: ['#b89a3a', '#8a6a2a'],
|
|
133
|
+
levels: 3, droop: 0.1, twist: 0.5, photo: 0.4, branchiness: 1,
|
|
134
|
+
trunk: { length: 0.25, radius: 0.045, taper: 0.3, curve: 6, segments: 5, flex: 0.05, splits: 4, splitAngle: 40, splitLength: 1.1, splitRadius: 0.7 },
|
|
135
|
+
level: [
|
|
136
|
+
{ count: 3, length: 0.8, radius: 0.6, downAngle: 50, downVar: 30, curve: 20, curveVar: 1, segments: 5, start: 0.4, splits: 2, splitAngle: 35, splitLength: 0.8, splitRadius: 0.75 },
|
|
137
|
+
{ count: 6, length: 0.6, radius: 0.6, downAngle: 50, downVar: 40, curve: 20, segments: 4, start: 0.2 },
|
|
138
|
+
{ count: 6, length: 0.5, radius: 0.5, downAngle: 45, downVar: 50, curve: 20, segments: 3, start: 0.1 },
|
|
139
|
+
],
|
|
140
|
+
shape: (t) => 0.7 + 0.5 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
141
|
+
leaves: { perLength: 40, size: 0.028, sizeVar: 0.4, spread: 0.8, lift: 0.2, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
142
|
+
blossom: { petals: 9, size: 0.03, color: '#f2d6e6', head: 1, cup: 0.6 }, flowersAlways: 0.7, leafColor: '#4f7a3a',
|
|
143
|
+
},
|
|
144
|
+
jacaranda: {
|
|
145
|
+
leaf: 'frond', bark: '#6a6056', autumn: ['#c8a84a', '#9a7a3a'],
|
|
146
|
+
levels: 3, droop: 0.2, twist: 0.4, photo: 0.4, branchiness: 1,
|
|
147
|
+
trunk: { length: 0.35, radius: 0.045, taper: 0.3, curve: 6, segments: 6, flex: 0.05, splits: 3, splitAngle: 35, splitLength: 1.0, splitRadius: 0.7 },
|
|
148
|
+
level: [
|
|
149
|
+
{ count: 4, length: 0.9, radius: 0.6, downAngle: 50, downVar: 30, curve: 20, curveVar: 1, segments: 5, start: 0.5, splits: 2, splitAngle: 32, splitLength: 0.8, splitRadius: 0.75 },
|
|
150
|
+
{ count: 7, length: 0.6, radius: 0.6, downAngle: 50, downVar: 40, curve: 20, segments: 4, start: 0.2 },
|
|
151
|
+
{ count: 8, length: 0.5, radius: 0.5, downAngle: 45, downVar: 50, curve: 20, segments: 3, start: 0.1 },
|
|
152
|
+
],
|
|
153
|
+
shape: (t) => 0.7 + 0.6 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
154
|
+
leaves: { perLength: 50, size: 0.035, sizeVar: 0.3, spread: 0.9, lift: 0.0, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
155
|
+
blossom: { petals: 5, size: 0.01, color: '#8a74d8', head: 6, cup: 0.6 }, flowersAlways: 0.9, leafColor: '#5f9a3a',
|
|
156
|
+
},
|
|
157
|
+
acacia: {
|
|
158
|
+
leaf: 'frond', bark: '#5a4a3a', autumn: ['#b8a84a', '#8a7a3a'],
|
|
159
|
+
levels: 3, droop: -0.1, twist: 0.6, photo: 0.9, branchiness: 1,
|
|
160
|
+
trunk: { length: 0.45, radius: 0.04, taper: 0.3, curve: 10, segments: 6, flex: 0.05, splits: 3, splitAngle: 55, splitLength: 0.9, splitRadius: 0.7 },
|
|
161
|
+
level: [
|
|
162
|
+
{ count: 3, length: 0.8, radius: 0.6, downAngle: 70, downVar: 20, curve: -25, curveVar: 0.6, segments: 5, start: 0.5, splits: 2, splitAngle: 45, splitLength: 0.7, splitRadius: 0.75 },
|
|
163
|
+
{ count: 7, length: 0.5, radius: 0.6, downAngle: 70, downVar: 30, curve: -15, segments: 4, start: 0.3 },
|
|
164
|
+
{ count: 8, length: 0.45, radius: 0.5, downAngle: 60, downVar: 40, curve: -10, segments: 3, start: 0.1 },
|
|
165
|
+
],
|
|
166
|
+
shape: (t) => 0.4 + 0.9 * t,
|
|
167
|
+
leaves: { perLength: 70, size: 0.028, sizeVar: 0.3, spread: 1.0, lift: 0.5, fromLevel: 1, tuft: 2, start: 0.2, faceUp: 1 },
|
|
168
|
+
blossom: { petals: 10, size: 0.007, color: '#f2d040', head: 5, cup: 0.2, type: 'round' }, leafColor: '#6f9a3a',
|
|
169
|
+
},
|
|
170
|
+
baobab: {
|
|
171
|
+
leaf: 'broadleaf', bark: '#9a8a78', autumn: ['#b8a84a', '#8a7a3a'],
|
|
172
|
+
levels: 2, droop: -0.1, twist: 0.5, photo: 0.6, branchiness: 1,
|
|
173
|
+
trunk: { length: 0.7, radius: 0.16, taper: 0.25, curve: 3, segments: 6, flex: 0.01, splits: 5, splitAngle: 50, splitLength: 0.45, splitRadius: 0.45 },
|
|
174
|
+
level: [
|
|
175
|
+
{ count: 3, length: 0.5, radius: 0.55, downAngle: 55, downVar: 30, curve: 10, curveVar: 1, segments: 4, start: 0.5, splits: 2, splitAngle: 45, splitLength: 0.7, splitRadius: 0.7 },
|
|
176
|
+
{ count: 5, length: 0.5, radius: 0.5, downAngle: 50, downVar: 40, curve: 10, segments: 3, start: 0.2 },
|
|
177
|
+
],
|
|
178
|
+
shape: () => 1,
|
|
179
|
+
leaves: { perLength: 40, size: 0.02, sizeVar: 0.4, spread: 0.9, lift: 0.2, fromLevel: 1, tuft: 2, start: 0.2 },
|
|
180
|
+
leafColor: '#6a9a3a',
|
|
181
|
+
},
|
|
182
|
+
spruce: {
|
|
183
|
+
leaf: 'needles', bark: '#5a4535', autumn: ['#7a6a2a', '#5a4a1a'],
|
|
184
|
+
levels: 2, droop: 0.55, twist: 0.1, photo: 0.05, branchiness: 1, whorls: 6,
|
|
185
|
+
trunk: { length: 1, radius: 0.04, taper: 0.92, curve: 1, segments: 14, flex: 0.03 },
|
|
186
|
+
level: [
|
|
187
|
+
{ count: 66, length: 0.38, radius: 0.35, downAngle: 88, downVar: 8, curve: -8, curveVar: 0.4, segments: 4, start: 0.12 },
|
|
188
|
+
{ count: 8, length: 0.4, radius: 0.5, downAngle: 60, downVar: 25, curve: 5, segments: 3, start: 0.2 },
|
|
189
|
+
],
|
|
190
|
+
shape: (t) => Math.max(0.05, 1.0 - 0.95 * t),
|
|
191
|
+
leaves: { perLength: 120, size: 0.022, sizeVar: 0.3, spread: 1.1, lift: -0.1, fromLevel: 0, tuft: 2, start: 0.05, faceUp: 0.3 },
|
|
192
|
+
leafColor: '#2a5a30', shade: '#102414',
|
|
193
|
+
},
|
|
194
|
+
poplar: {
|
|
195
|
+
leaf: 'broadleaf', bark: '#7a7a6a', autumn: ['#f0c21a', '#d99a1e'],
|
|
196
|
+
levels: 3, droop: -0.4, twist: 0.2, photo: 1.0, branchiness: 1,
|
|
197
|
+
trunk: { length: 1, radius: 0.035, taper: 0.8, curve: 1, segments: 10, flex: 0.06 },
|
|
198
|
+
level: [
|
|
199
|
+
{ count: 40, length: 0.25, radius: 0.4, downAngle: 25, downVar: 15, curve: -10, segments: 4, start: 0.1 },
|
|
200
|
+
{ count: 4, length: 0.6, radius: 0.5, downAngle: 30, downVar: 30, curve: -10, segments: 3, start: 0.2 },
|
|
201
|
+
{ count: 4, length: 0.5, radius: 0.5, downAngle: 30, downVar: 40, curve: 0, segments: 3, start: 0.1 },
|
|
202
|
+
],
|
|
203
|
+
shape: (t) => 0.5 + 0.6 * Math.sin(Math.PI * (0.05 + 0.9 * t)),
|
|
204
|
+
leaves: { perLength: 90, size: 0.02, sizeVar: 0.4, spread: 0.9, lift: 0.1, fromLevel: 1, tuft: 2, start: 0.1 },
|
|
205
|
+
leafColor: '#5f9a3a',
|
|
206
|
+
},
|
|
207
|
+
eucalyptus: {
|
|
208
|
+
leaf: 'lanceolate', bark: '#c8b8a8', autumn: ['#a8a86a', '#7a7a5a'],
|
|
209
|
+
levels: 3, droop: 0.6, twist: 0.6, photo: 0.5, branchiness: 1,
|
|
210
|
+
trunk: { length: 0.55, radius: 0.04, taper: 0.5, curve: 8, segments: 8, flex: 0.06, splits: 2, splitAngle: 25, splitLength: 0.9, splitRadius: 0.7 },
|
|
211
|
+
level: [
|
|
212
|
+
{ count: 4, length: 0.7, radius: 0.55, downAngle: 45, downVar: 30, curve: 20, curveVar: 1, segments: 5, start: 0.6, splits: 2, splitAngle: 30, splitLength: 0.8, splitRadius: 0.75 },
|
|
213
|
+
{ count: 6, length: 0.6, radius: 0.55, downAngle: 50, downVar: 40, curve: 20, segments: 4, start: 0.2 },
|
|
214
|
+
{ count: 6, length: 0.55, radius: 0.5, downAngle: 55, downVar: 50, curve: 20, segments: 4, start: 0.1 },
|
|
215
|
+
],
|
|
216
|
+
shape: (t) => 0.5 + 0.5 * Math.sin(Math.PI * (0.15 + 0.75 * t)),
|
|
217
|
+
leaves: { perLength: 90, size: 0.03, sizeVar: 0.4, spread: 0.6, lift: -0.5, fromLevel: 2, tuft: 2, start: 0.05 },
|
|
218
|
+
leafColor: '#7a9a7a', shade: '#2f4a3a',
|
|
219
|
+
},
|
|
220
|
+
bare: {
|
|
221
|
+
leaf: 'broadleaf', bark: '#5a4a3a', autumn: ['#8a6a2a', '#5a3a1a'],
|
|
222
|
+
levels: 3, droop: 0.1, twist: 1.0, photo: 0.3, branchiness: 1.2,
|
|
223
|
+
trunk: { length: 0.3, radius: 0.05, taper: 0.3, curve: 10, segments: 6, flex: 0.03, splits: 3, splitAngle: 35, splitLength: 1.0, splitRadius: 0.7 },
|
|
224
|
+
level: [
|
|
225
|
+
{ count: 4, length: 0.9, radius: 0.6, downAngle: 55, downVar: 35, curve: 35, curveVar: 1.5, segments: 5, start: 0.5, splits: 2, splitAngle: 35, splitLength: 0.8, splitRadius: 0.75 },
|
|
226
|
+
{ count: 8, length: 0.6, radius: 0.6, downAngle: 50, downVar: 45, curve: 30, segments: 4, start: 0.2 },
|
|
227
|
+
{ count: 9, length: 0.5, radius: 0.5, downAngle: 45, downVar: 55, curve: 25, segments: 3, start: 0.1 },
|
|
228
|
+
],
|
|
229
|
+
shape: (t) => 0.6 + 0.6 * Math.sin(Math.PI * (0.1 + 0.8 * t)),
|
|
230
|
+
leaves: { perLength: 2, size: 0.02, sizeVar: 0.4, spread: 0.8, lift: 0.2, fromLevel: 2, tuft: 1, start: 0.5 },
|
|
231
|
+
foliageAlways: 0,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const LEAF_BASE = 34000, FALL_BASE = 400, FRUIT_BASE = 320;
|
|
235
|
+
export function createUniforms() { return createCommonUniforms(); }
|
|
236
|
+
export function applyConfig(u, c, mats) {
|
|
237
|
+
if (c.species !== undefined)
|
|
238
|
+
c = Object.assign({}, c, speciesColors(c));
|
|
239
|
+
applyCommonConfig(u, c);
|
|
240
|
+
if (c.leafType !== undefined || c.species !== undefined) {
|
|
241
|
+
const sp = SPECIES[c.species] || SPECIES.oak;
|
|
242
|
+
const lt = !c.leafType || c.leafType === 'auto' ? sp.leaf : c.leafType;
|
|
243
|
+
u.uLeafType.value = Math.max(0, LEAF_TYPES.indexOf(lt));
|
|
244
|
+
}
|
|
245
|
+
if (!mats)
|
|
246
|
+
return;
|
|
247
|
+
if (c.barkColor !== undefined)
|
|
248
|
+
setColor(mats.bark.userData.uniforms.uBarkColor, c.barkColor);
|
|
249
|
+
if (c.leafFall !== undefined)
|
|
250
|
+
mats.fall.userData.uniforms.uLeafFall.value = c.leafFall;
|
|
251
|
+
if (c.flowers !== undefined && mats.flowerU)
|
|
252
|
+
mats.flowerU.uFoliage.value = c.flowers;
|
|
253
|
+
if (c.flowerColor !== undefined && c.flowerColor !== '#ffffff' && mats.flowerU)
|
|
254
|
+
setColor(mats.flowerU.uColor, c.flowerColor);
|
|
255
|
+
applyFruitConfig(mats.fruit, c);
|
|
256
|
+
}
|
|
257
|
+
/** Fits the generated plant to the unit box: width 1 (x/z), height 1 (y). */
|
|
258
|
+
function fitUnit(plant) {
|
|
259
|
+
let maxY = 1e-6, maxR = 1e-6;
|
|
260
|
+
for (const b of plant.branches)
|
|
261
|
+
for (const p of b.pts) {
|
|
262
|
+
if (p.y > maxY)
|
|
263
|
+
maxY = p.y;
|
|
264
|
+
const r = Math.hypot(p.x, p.z);
|
|
265
|
+
if (r > maxR)
|
|
266
|
+
maxR = r;
|
|
267
|
+
}
|
|
268
|
+
for (const l of plant.leaves) {
|
|
269
|
+
if (l.pos.y + l.size > maxY)
|
|
270
|
+
maxY = l.pos.y + l.size;
|
|
271
|
+
const r = Math.hypot(l.pos.x, l.pos.z) + l.size * 0.7;
|
|
272
|
+
if (r > maxR)
|
|
273
|
+
maxR = r;
|
|
274
|
+
}
|
|
275
|
+
const sy = 1 / maxY, sxz = 0.5 / maxR, sr = Math.sqrt(sy * sxz);
|
|
276
|
+
const S = new THREE.Vector3(sxz, sy, sxz);
|
|
277
|
+
for (const b of plant.branches) {
|
|
278
|
+
for (const p of b.pts) {
|
|
279
|
+
p.multiply(S);
|
|
280
|
+
if (p.y < 0.01)
|
|
281
|
+
p.y = 0.01;
|
|
282
|
+
}
|
|
283
|
+
for (let i = 0; i < b.radii.length; i++)
|
|
284
|
+
b.radii[i] *= sr;
|
|
285
|
+
}
|
|
286
|
+
for (const l of plant.leaves) {
|
|
287
|
+
l.pos.multiply(S);
|
|
288
|
+
l.along.multiply(S).normalize();
|
|
289
|
+
l.normal.multiply(S).normalize();
|
|
290
|
+
l.size *= sr;
|
|
291
|
+
l.hf = Math.min(1, Math.max(0, l.pos.y));
|
|
292
|
+
}
|
|
293
|
+
for (const b of plant.branches)
|
|
294
|
+
b.hf0 = Math.min(1, Math.max(0, b.pts[0].y));
|
|
295
|
+
return plant;
|
|
296
|
+
}
|
|
297
|
+
const SPECIES_LEAF = new Set(Object.values(SPECIES).map((s) => (s['leafColor'] || '#4f8a3a').toLowerCase()).concat(['#4f8a3a']));
|
|
298
|
+
/** Leaf / bark colours the user has not customised (a species default) follow the current species. */
|
|
299
|
+
export function speciesColors(c) {
|
|
300
|
+
const sp = SPECIES[c.species] || SPECIES.oak;
|
|
301
|
+
const barks = new Set(Object.values(SPECIES).map((s) => s.bark.toLowerCase()).concat(['#6e5844']));
|
|
302
|
+
const out = Object.create(null); // only the keys set below override the config
|
|
303
|
+
if (!c.color || SPECIES_LEAF.has(c.color.toLowerCase()))
|
|
304
|
+
out.color = sp.leafColor || '#4f8a3a';
|
|
305
|
+
if (!c.shadeColor || c.shadeColor.toLowerCase() === '#1f3d1a' || Object.values(SPECIES).some((s) => s['shade'] && s['shade'].toLowerCase() === c.shadeColor.toLowerCase()))
|
|
306
|
+
out.shadeColor = sp.shade || '#1f3d1a';
|
|
307
|
+
if (!c.barkColor || barks.has(c.barkColor.toLowerCase()))
|
|
308
|
+
out.barkColor = sp.bark;
|
|
309
|
+
return out;
|
|
310
|
+
}
|
|
311
|
+
export function build(u, c) {
|
|
312
|
+
const q = QUALITY_V[c.quality] || 1;
|
|
313
|
+
const sp = SPECIES[c.species] || SPECIES.oak;
|
|
314
|
+
c = Object.assign({}, c, speciesColors(c));
|
|
315
|
+
const rnd = mulberry32((c.seed ?? 7) * 2654435761 + 17);
|
|
316
|
+
// the knobs scale the species: trunk share, branch counts, gravity, wander
|
|
317
|
+
const P = Object.assign({}, sp, {
|
|
318
|
+
trunk: Object.assign({}, sp.trunk, { length: sp.trunk.length * (c.trunkRatio ?? 1) }),
|
|
319
|
+
branchiness: (sp.branchiness || 1) * (c.branchiness ?? 1),
|
|
320
|
+
droop: (sp.droop || 0) + (c.droop ?? 0),
|
|
321
|
+
twist: (sp.twist || 0) + (c.twist ?? 0.5) - 0.5,
|
|
322
|
+
leaves: Object.assign({}, sp.leaves, { density: 1 }),
|
|
323
|
+
});
|
|
324
|
+
const plant = fitUnit(generatePlant(P, rnd));
|
|
325
|
+
// leaf budget: density × quality; keep coverage by growing the cards when thinning
|
|
326
|
+
let leaves = plant.leaves;
|
|
327
|
+
const target = Math.round(LEAF_BASE * (c.density ?? 1) * q);
|
|
328
|
+
if (leaves.length > target) {
|
|
329
|
+
const grow = Math.min(1.8, Math.sqrt(leaves.length / Math.max(target, 1)));
|
|
330
|
+
const picked = [];
|
|
331
|
+
for (let i = 0; i < target; i++)
|
|
332
|
+
picked.push(leaves[Math.floor(rnd() * leaves.length)]);
|
|
333
|
+
picked.forEach((l) => { l.size *= grow; });
|
|
334
|
+
leaves = picked;
|
|
335
|
+
}
|
|
336
|
+
leaves = lodOrder(leaves, c.seed ?? 7); // drawing the first K at distance is an even thinning
|
|
337
|
+
const mats = { bark: null, leaf: null, fruit: null, fall: null, flowerU: null };
|
|
338
|
+
const barkPair = barkMaterial(u, { barkColor: c.barkColor || sp.bark, lod: true });
|
|
339
|
+
const leafPair = leafMaterial(u, { autumnA: sp.autumn[0], autumnB: sp.autumn[1], translucency: sp.leaf === 'needles' ? 0.25 : 0.55, lod: true });
|
|
340
|
+
const fruitPair = fruitMaterial(u);
|
|
341
|
+
const fallPair = fallingMaterial(u);
|
|
342
|
+
fallPair.material.userData.uniforms.uAutumnA.value.set(sp.autumn[0]);
|
|
343
|
+
fallPair.material.userData.uniforms.uAutumnB.value.set(sp.autumn[1]);
|
|
344
|
+
mats.bark = barkPair.material;
|
|
345
|
+
mats.leaf = leafPair.material;
|
|
346
|
+
mats.fruit = fruitPair.material;
|
|
347
|
+
mats.fall = fallPair.material;
|
|
348
|
+
// root flare and buttresses at the foot of the trunk
|
|
349
|
+
const flare = (br, i, a) => { if (br.level !== -1)
|
|
350
|
+
return 1; const y = br.pts[i].y; const e = Math.exp(-y / 0.035); return 1 + 0.9 * e + 0.5 * e * Math.pow(Math.max(0, Math.cos(a * 3 + 0.7)), 2) + 0.15 * Math.exp(-y / 0.12); };
|
|
351
|
+
const barkGeo = branchGeometry(plant.branches, { sides: [16, 9, 6, 4], flare });
|
|
352
|
+
const leafGeo = leafGeometry(Math.max(1, leaves.length));
|
|
353
|
+
fillLeaves(leafGeo, leaves);
|
|
354
|
+
unitBounds(leafGeo);
|
|
355
|
+
const fallGeo = leafGeometry(Math.round(FALL_BASE * q));
|
|
356
|
+
fillLeaves(fallGeo, leaves.length ? Array.from({ length: fallGeo.instanceCount }, () => leaves[Math.floor(rnd() * leaves.length)]).map((l, i) => Object.assign({}, l, { order: (i + 0.5) / fallGeo.instanceCount })) : []);
|
|
357
|
+
unitBounds(fallGeo);
|
|
358
|
+
const fruitGeo = fruitGeometry(Math.round(FRUIT_BASE * q), 12);
|
|
359
|
+
if (leaves.length)
|
|
360
|
+
fillFruit(fruitGeo, leaves, rnd, 0.014);
|
|
361
|
+
unitBounds(fruitGeo);
|
|
362
|
+
// blossom: fans of petals at the twig tips, for the flowering species (or any, with a flowers knob > 0)
|
|
363
|
+
const tips = plant.branches.filter((b) => b.level >= P.levels - 1);
|
|
364
|
+
const bl = sp.blossom || { petals: 5, size: 0.012, color: '#f6e6f0', head: 2, cup: 0.35 };
|
|
365
|
+
const heads = flowerHeads(u, tips, rnd, Object.assign({}, bl, { color: c.flowerColor && c.flowerColor !== '#ffffff' ? c.flowerColor : bl.color }), Math.round(1600 * q / Math.max(1, bl.head)), { lod: true });
|
|
366
|
+
mats.flowerU = heads.U;
|
|
367
|
+
const blossom = plantMesh(heads.geo, heads.pair, 'blossom');
|
|
368
|
+
const bark = plantMesh(barkGeo, barkPair, 'bark');
|
|
369
|
+
const foliage = plantMesh(leafGeo, leafPair, 'leaves');
|
|
370
|
+
const falling = plantMesh(fallGeo, fallPair, 'falling');
|
|
371
|
+
const fruit = plantMesh(fruitGeo, fruitPair, 'fruit');
|
|
372
|
+
const object = new THREE.Group();
|
|
373
|
+
object.name = 'tree';
|
|
374
|
+
object.add(bark, foliage, blossom, fruit, falling);
|
|
375
|
+
const lod = plantLod(u, object, {
|
|
376
|
+
leaves: [foliage, blossom], bark: [bark], other: [fruit, falling], bake: [bark, foliage, blossom, fruit],
|
|
377
|
+
visible: [[blossom, () => heads.U.uFoliage.value > 0.001], [falling, () => mats.fall.userData.uniforms.uLeafFall.value + 0.6 * Math.max(0, Math.min(1, (u.uSeason.value - 0.5) * 2)) > 0.001]],
|
|
378
|
+
});
|
|
379
|
+
const cfg = Object.assign({}, c);
|
|
380
|
+
if (sp.flowersAlways !== undefined && (c.flowers ?? 0) === 0)
|
|
381
|
+
cfg.flowers = sp.flowersAlways;
|
|
382
|
+
if (sp.foliageAlways !== undefined)
|
|
383
|
+
cfg.foliage = sp.foliageAlways;
|
|
384
|
+
applyConfig(u, cfg, mats);
|
|
385
|
+
lod.applied(cfg);
|
|
386
|
+
return {
|
|
387
|
+
object,
|
|
388
|
+
materials: [barkPair.material, leafPair.material, heads.pair.material, fruitPair.material, fallPair.material, lod.impostor.material],
|
|
389
|
+
apply: function (cfg) { applyConfig(u, cfg, mats); lod.applied(cfg); },
|
|
390
|
+
update: function (dt, camera, sunWorld, renderer) { updateCommon(u, object, camera, dt, sunWorld); lod.update(dt, renderer); },
|
|
391
|
+
lod,
|
|
392
|
+
stats: { branches: plant.branches.length, leaves: leaves.length, barkVerts: barkGeo.attributes.position.count },
|
|
393
|
+
dispose: function () {
|
|
394
|
+
barkGeo.dispose();
|
|
395
|
+
leafGeo.dispose();
|
|
396
|
+
fallGeo.dispose();
|
|
397
|
+
fruitGeo.dispose();
|
|
398
|
+
heads.geo.dispose();
|
|
399
|
+
lod.dispose();
|
|
400
|
+
for (const p of [barkPair, leafPair, heads.pair, fruitPair, fallPair]) {
|
|
401
|
+
p.material.dispose();
|
|
402
|
+
p.depth.dispose();
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
408
|
+
export const STRUCTURAL = ['species', 'trunkRatio', 'branchiness', 'droop', 'twist', 'density', 'quality', 'seed'];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare function createUniforms(): {
|
|
3
|
+
uTime: {
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
uWindPhase: {
|
|
7
|
+
value: number;
|
|
8
|
+
};
|
|
9
|
+
uWindDir: {
|
|
10
|
+
value: THREE.Vector2;
|
|
11
|
+
};
|
|
12
|
+
uWindStrength: {
|
|
13
|
+
value: number;
|
|
14
|
+
};
|
|
15
|
+
uTurb: {
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
uSpeed: {
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
uSway: {
|
|
22
|
+
value: number;
|
|
23
|
+
};
|
|
24
|
+
uFlutter: {
|
|
25
|
+
value: number;
|
|
26
|
+
};
|
|
27
|
+
uScale: {
|
|
28
|
+
value: THREE.Vector3;
|
|
29
|
+
};
|
|
30
|
+
uMean: {
|
|
31
|
+
value: number;
|
|
32
|
+
};
|
|
33
|
+
uOpacity: {
|
|
34
|
+
value: number;
|
|
35
|
+
};
|
|
36
|
+
uColor: {
|
|
37
|
+
value: THREE.Color;
|
|
38
|
+
};
|
|
39
|
+
uShadeColor: {
|
|
40
|
+
value: THREE.Color;
|
|
41
|
+
};
|
|
42
|
+
uSeason: {
|
|
43
|
+
value: number;
|
|
44
|
+
};
|
|
45
|
+
uFoliage: {
|
|
46
|
+
value: number;
|
|
47
|
+
};
|
|
48
|
+
uLeafType: {
|
|
49
|
+
value: number;
|
|
50
|
+
};
|
|
51
|
+
uLeafSize: {
|
|
52
|
+
value: number;
|
|
53
|
+
};
|
|
54
|
+
uGrowth: {
|
|
55
|
+
value: number;
|
|
56
|
+
};
|
|
57
|
+
uSunDirView: {
|
|
58
|
+
value: THREE.Vector3;
|
|
59
|
+
};
|
|
60
|
+
uViewPos: {
|
|
61
|
+
value: THREE.Vector3;
|
|
62
|
+
};
|
|
63
|
+
uLodK: {
|
|
64
|
+
value: number;
|
|
65
|
+
};
|
|
66
|
+
uLodOrtho: {
|
|
67
|
+
value: number;
|
|
68
|
+
};
|
|
69
|
+
uLodBias: {
|
|
70
|
+
value: number;
|
|
71
|
+
};
|
|
72
|
+
uImpReady: {
|
|
73
|
+
value: number;
|
|
74
|
+
};
|
|
75
|
+
uBake: {
|
|
76
|
+
value: number;
|
|
77
|
+
};
|
|
78
|
+
uBakeView: {
|
|
79
|
+
value: THREE.Matrix3;
|
|
80
|
+
};
|
|
81
|
+
uBakeDepth: {
|
|
82
|
+
value: THREE.Vector2;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export declare function applyConfig(u: any, c: any, mats: any): void;
|
|
86
|
+
export declare function build(u: any, c: any): {
|
|
87
|
+
object: THREE.Group<THREE.Object3DEventMap>;
|
|
88
|
+
materials: THREE.MeshPhysicalMaterial[];
|
|
89
|
+
apply: (cfg: any) => void;
|
|
90
|
+
update: (dt: any, camera: any, sunWorld: any) => void;
|
|
91
|
+
stats: {
|
|
92
|
+
pieces: number;
|
|
93
|
+
verts: number;
|
|
94
|
+
};
|
|
95
|
+
dispose: () => void;
|
|
96
|
+
};
|
|
97
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
98
|
+
export declare const STRUCTURAL: string[];
|
|
99
|
+
//# sourceMappingURL=vegetable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vegetable.d.ts","sourceRoot":"","sources":["../../../../src/components/vegetation/core/vegetable.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqC;AAEnE,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,EAAE,IAAI,KAAA,QAarC;AAED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;;;;;;;;;;EAyCzB;AAED,8GAA8G;AAC9G,eAAO,MAAM,UAAU,UAAuC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Emitted from Claude outputs/vegetation-lab/vegetable.mjs by gen_family.mjs — edit the lab module and re-emit.
|
|
2
|
+
// Vegetable — vegetation object (lab module). Engine: ./produce.mjs (shared with fruit).
|
|
3
|
+
// Construction: one kind of vegetable, as a single piece or a pile resting on the ground: lathe
|
|
4
|
+
// profiles with lobes, ribs, kernels, warts and eyes (tomato, pepper, pumpkin, carrot, corn,
|
|
5
|
+
// cucumber, eggplant, broccoli, potato, onion), stems, calyxes, tops and husks as leaf cards, and a
|
|
6
|
+
// skin that ripens between two colours with the kind's pattern and gloss. Size: the unit box.
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { mulberry32, setColor, createCommonUniforms, applyCommonConfig, updateCommon, QUALITY_V, unitBounds, plantMesh } from '../vegetationCore.js';
|
|
9
|
+
import { PRODUCE, buildPiece, produceMaterial, instancePieces, pilePlacement, applyKind } from '../produceCore.js';
|
|
10
|
+
export function createUniforms() { return createCommonUniforms(); }
|
|
11
|
+
export function applyConfig(u, c, mats) {
|
|
12
|
+
// the family's `color` is the skin tint here and `shadeColor` the greens (leaves, calyx, crown)
|
|
13
|
+
applyCommonConfig(u, Object.assign({}, c, { color: c.shadeColor, shadeColor: undefined }));
|
|
14
|
+
if (!mats)
|
|
15
|
+
return;
|
|
16
|
+
const o = mats.skin.userData.uniforms;
|
|
17
|
+
const P = PRODUCE[c.kind] || PRODUCE.tomato;
|
|
18
|
+
if (c.kind !== undefined)
|
|
19
|
+
applyKind(mats.skin, P);
|
|
20
|
+
if (c.ripeness !== undefined)
|
|
21
|
+
o.uRipeness.value = c.ripeness;
|
|
22
|
+
if (c.sizeVar !== undefined)
|
|
23
|
+
o.uSizeVar.value = c.sizeVar;
|
|
24
|
+
if (c.blemish !== undefined)
|
|
25
|
+
o.uBlemish.value = c.blemish;
|
|
26
|
+
if (c.gloss !== undefined)
|
|
27
|
+
o.uGloss.value = P.gloss * c.gloss;
|
|
28
|
+
if (c.color !== undefined)
|
|
29
|
+
setColor(o.uTint, c.color);
|
|
30
|
+
if (c.count !== undefined)
|
|
31
|
+
o.uCount.value = c.count;
|
|
32
|
+
}
|
|
33
|
+
export function build(u, c) {
|
|
34
|
+
const q = QUALITY_V[c.quality] || 1;
|
|
35
|
+
const kind = PRODUCE[c.kind] ? c.kind : 'tomato';
|
|
36
|
+
const P = PRODUCE[kind];
|
|
37
|
+
const rnd = mulberry32((c.seed ?? 5) * 2654435761 + 5);
|
|
38
|
+
const count = Math.max(1, Math.round(c.count ?? 1));
|
|
39
|
+
let pair_setPieceH = 1;
|
|
40
|
+
const piece = buildPiece(kind, c.seed ?? 5, Math.min(1.6, 0.8 + 0.5 * q));
|
|
41
|
+
// fit: a single piece fills the box; a pile's footprint does
|
|
42
|
+
const ext = Math.max(piece.height, piece.width);
|
|
43
|
+
const foot = count <= 1 ? 1 : Math.min(0.5, 0.82 / Math.sqrt(count)) * (P.small ? 1.15 : 1);
|
|
44
|
+
const s = foot / ext;
|
|
45
|
+
piece.geo.scale(s, s, s);
|
|
46
|
+
const geo = instancePieces(piece.geo, count);
|
|
47
|
+
// lying kinds (carrot, banana, corn, cucumber) take their length as footprint and rest on their side
|
|
48
|
+
const foot2 = P.lie ? piece.height * s : piece.width * s;
|
|
49
|
+
const places = pilePlacement(count, foot2, rnd, count <= 1 || !!P.invert || !!P.crown || !!P.tops || !!P.mushroom || !!P.wrap, !!P.lie, piece.width * s * 0.5);
|
|
50
|
+
pair_setPieceH = piece.height * s;
|
|
51
|
+
for (let i = 0; i < count; i++) {
|
|
52
|
+
const p = places[i] || places[0];
|
|
53
|
+
geo.attributes.aXf.setXYZW(i, p.x, p.y, p.z, p.yaw);
|
|
54
|
+
geo.attributes.aTilt.setXYZW(i, p.tiltX, p.tiltZ, p.tilt, 1);
|
|
55
|
+
geo.attributes.aPiece.setXYZW(i, rnd(), i / count, rnd(), 0);
|
|
56
|
+
}
|
|
57
|
+
unitBounds(geo);
|
|
58
|
+
const pair = produceMaterial(u);
|
|
59
|
+
pair.material.userData.uniforms.uPieceH.value = pair_setPieceH;
|
|
60
|
+
const mesh = plantMesh(geo, pair, 'vegetable');
|
|
61
|
+
const object = new THREE.Group();
|
|
62
|
+
object.name = 'vegetable';
|
|
63
|
+
object.add(mesh);
|
|
64
|
+
const mats = { skin: pair.material };
|
|
65
|
+
applyConfig(u, c, mats);
|
|
66
|
+
return {
|
|
67
|
+
object,
|
|
68
|
+
materials: [pair.material],
|
|
69
|
+
apply: function (cfg) { applyConfig(u, cfg, mats); },
|
|
70
|
+
update: function (dt, camera, sunWorld) { updateCommon(u, object, camera, dt, sunWorld); },
|
|
71
|
+
stats: { pieces: count, verts: piece.geo.attributes.position.count },
|
|
72
|
+
dispose: function () { geo.dispose(); piece.geo.dispose(); pair.material.dispose(); pair.depth.dispose(); },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Knobs whose change rebuilds the plant (dispose + build); every other knob is a live push through apply. */
|
|
76
|
+
export const STRUCTURAL = ['kind', 'count', 'quality', 'seed'];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { useVegetationInstance } from './useVegetationInstance';
|
|
2
|
+
export type { VegetationInstance, VegetationVariantProps, VegetationCore } from './useVegetationInstance';
|
|
3
|
+
export type { VegetationTreeProps } from './VegetationTree';
|
|
4
|
+
export { default as VegetationTree } from './VegetationTree';
|
|
5
|
+
export type { VegetationBushProps } from './VegetationBush';
|
|
6
|
+
export { default as VegetationBush } from './VegetationBush';
|
|
7
|
+
export type { VegetationGrassProps } from './VegetationGrass';
|
|
8
|
+
export { default as VegetationGrass } from './VegetationGrass';
|
|
9
|
+
export type { VegetationFlowersProps } from './VegetationFlowers';
|
|
10
|
+
export { default as VegetationFlowers } from './VegetationFlowers';
|
|
11
|
+
export type { VegetationCropsProps } from './VegetationCrops';
|
|
12
|
+
export { default as VegetationCrops } from './VegetationCrops';
|
|
13
|
+
export type { VegetationIvyProps } from './VegetationIvy';
|
|
14
|
+
export { default as VegetationIvy } from './VegetationIvy';
|
|
15
|
+
export type { VegetationHedgeProps } from './VegetationHedge';
|
|
16
|
+
export { default as VegetationHedge } from './VegetationHedge';
|
|
17
|
+
export type { VegetationFruitProps } from './VegetationFruit';
|
|
18
|
+
export { default as VegetationFruit } from './VegetationFruit';
|
|
19
|
+
export type { VegetationVegetableProps } from './VegetationVegetable';
|
|
20
|
+
export { default as VegetationVegetable } from './VegetationVegetable';
|
|
21
|
+
export type { VegetationForestProps } from './VegetationForest';
|
|
22
|
+
export { default as VegetationForest } from './VegetationForest';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/vegetation/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1G,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Vegetation variants (type 'vegetation', config.type set). One line per variant, written by the integrator.
|
|
2
|
+
// vegetationCore / produceCore are the family's own (imported by core/<key>.ts), not re-exported: their helper names
|
|
3
|
+
// (mulberry32, …) would collide with other families' cores in the components barrel.
|
|
4
|
+
export { useVegetationInstance } from './useVegetationInstance.js';
|
|
5
|
+
export { default as VegetationTree } from './VegetationTree.js';
|
|
6
|
+
export { default as VegetationBush } from './VegetationBush.js';
|
|
7
|
+
export { default as VegetationGrass } from './VegetationGrass.js';
|
|
8
|
+
export { default as VegetationFlowers } from './VegetationFlowers.js';
|
|
9
|
+
export { default as VegetationCrops } from './VegetationCrops.js';
|
|
10
|
+
export { default as VegetationIvy } from './VegetationIvy.js';
|
|
11
|
+
export { default as VegetationHedge } from './VegetationHedge.js';
|
|
12
|
+
export { default as VegetationFruit } from './VegetationFruit.js';
|
|
13
|
+
export { default as VegetationVegetable } from './VegetationVegetable.js';
|
|
14
|
+
export { default as VegetationForest } from './VegetationForest.js';
|