@3driseai/3drise-viewer 0.1.41 → 0.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/dist/animationsV2/ClipsRuntime.d.ts +16 -1
  2. package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
  3. package/dist/animationsV2/ClipsRuntime.js +144 -25
  4. package/dist/animationsV2/appliers.d.ts +9 -0
  5. package/dist/animationsV2/appliers.d.ts.map +1 -1
  6. package/dist/animationsV2/appliers.js +62 -2
  7. package/dist/animationsV2/clipUtils.d.ts +30 -0
  8. package/dist/animationsV2/clipUtils.d.ts.map +1 -1
  9. package/dist/animationsV2/clipUtils.js +163 -17
  10. package/dist/animationsV2/elementSettings.d.ts +5 -0
  11. package/dist/animationsV2/elementSettings.d.ts.map +1 -1
  12. package/dist/animationsV2/elementSettings.js +6 -3
  13. package/dist/animationsV2/sequenceUtils.js +4 -4
  14. package/dist/animationsV2/types.d.ts +23 -0
  15. package/dist/animationsV2/types.d.ts.map +1 -1
  16. package/dist/api/sceneHandle.js +2 -2
  17. package/dist/components/CreatedObject.d.ts +3 -0
  18. package/dist/components/CreatedObject.d.ts.map +1 -1
  19. package/dist/components/CreatedObject.js +6 -2
  20. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  21. package/dist/components/CustomPrimitive.js +1 -10
  22. package/dist/components/EnvironmentManager.d.ts.map +1 -1
  23. package/dist/components/EnvironmentManager.js +11 -5
  24. package/dist/components/GeometryShape.d.ts +5 -2
  25. package/dist/components/GeometryShape.d.ts.map +1 -1
  26. package/dist/components/GeometryShape.js +71 -10
  27. package/dist/components/LandObject.d.ts.map +1 -1
  28. package/dist/components/LandObject.js +1 -1
  29. package/dist/components/LayoutInstances.d.ts +2 -1
  30. package/dist/components/LayoutInstances.d.ts.map +1 -1
  31. package/dist/components/LayoutInstances.js +39 -6
  32. package/dist/components/LightObject.d.ts.map +1 -1
  33. package/dist/components/LightObject.js +3 -0
  34. package/dist/components/ObjectNode.d.ts.map +1 -1
  35. package/dist/components/ObjectNode.js +62 -13
  36. package/dist/components/OceanBuilder.d.ts +2 -0
  37. package/dist/components/OceanBuilder.d.ts.map +1 -1
  38. package/dist/components/OceanBuilder.js +2 -1
  39. package/dist/components/RenderEffects.d.ts +8 -0
  40. package/dist/components/RenderEffects.d.ts.map +1 -0
  41. package/dist/components/RenderEffects.js +120 -0
  42. package/dist/components/SceneBuilder.d.ts.map +1 -1
  43. package/dist/components/SceneBuilder.js +18 -9
  44. package/dist/components/SportsObject.d.ts +9 -0
  45. package/dist/components/SportsObject.d.ts.map +1 -0
  46. package/dist/components/SportsObject.js +20 -0
  47. package/dist/components/UrbanObject.d.ts +9 -0
  48. package/dist/components/UrbanObject.d.ts.map +1 -0
  49. package/dist/components/UrbanObject.js +28 -0
  50. package/dist/components/VegetationObject.d.ts +9 -0
  51. package/dist/components/VegetationObject.d.ts.map +1 -0
  52. package/dist/components/VegetationObject.js +26 -0
  53. package/dist/components/WaterObject.d.ts +15 -0
  54. package/dist/components/WaterObject.d.ts.map +1 -0
  55. package/dist/components/WaterObject.js +29 -0
  56. package/dist/components/index.d.ts +7 -2
  57. package/dist/components/index.d.ts.map +1 -1
  58. package/dist/components/index.js +6 -1
  59. package/dist/components/land/LandPatch.d.ts +3 -1
  60. package/dist/components/land/LandPatch.d.ts.map +1 -1
  61. package/dist/components/land/LandPatch.js +80 -7
  62. package/dist/components/layout/InstancedLayout.d.ts +19 -0
  63. package/dist/components/layout/InstancedLayout.d.ts.map +1 -0
  64. package/dist/components/layout/InstancedLayout.js +154 -0
  65. package/dist/components/layout/LayoutGrounds.d.ts +19 -0
  66. package/dist/components/layout/LayoutGrounds.d.ts.map +1 -0
  67. package/dist/components/layout/LayoutGrounds.js +104 -0
  68. package/dist/components/layout/LinkProxies.d.ts +5 -0
  69. package/dist/components/layout/LinkProxies.d.ts.map +1 -0
  70. package/dist/components/layout/LinkProxies.js +51 -0
  71. package/dist/components/layout/LinkedSource.d.ts +14 -0
  72. package/dist/components/layout/LinkedSource.d.ts.map +1 -0
  73. package/dist/components/layout/LinkedSource.js +129 -0
  74. package/dist/components/projector/Projector.d.ts +14 -0
  75. package/dist/components/projector/Projector.d.ts.map +1 -0
  76. package/dist/components/projector/Projector.js +44 -0
  77. package/dist/components/projector/index.d.ts +4 -0
  78. package/dist/components/projector/index.d.ts.map +1 -0
  79. package/dist/components/projector/index.js +2 -0
  80. package/dist/components/projector/projectorCore.d.ts +19 -0
  81. package/dist/components/projector/projectorCore.d.ts.map +1 -0
  82. package/dist/components/projector/projectorCore.js +545 -0
  83. package/dist/components/sports/SportsBall.d.ts +9 -0
  84. package/dist/components/sports/SportsBall.d.ts.map +1 -0
  85. package/dist/components/sports/SportsBall.js +23 -0
  86. package/dist/components/sports/SportsCourt.d.ts +9 -0
  87. package/dist/components/sports/SportsCourt.d.ts.map +1 -0
  88. package/dist/components/sports/SportsCourt.js +23 -0
  89. package/dist/components/sports/SportsEquipment.d.ts +9 -0
  90. package/dist/components/sports/SportsEquipment.d.ts.map +1 -0
  91. package/dist/components/sports/SportsEquipment.js +23 -0
  92. package/dist/components/sports/SportsGoal.d.ts +9 -0
  93. package/dist/components/sports/SportsGoal.d.ts.map +1 -0
  94. package/dist/components/sports/SportsGoal.js +23 -0
  95. package/dist/components/sports/core/ball.d.ts +166 -0
  96. package/dist/components/sports/core/ball.d.ts.map +1 -0
  97. package/dist/components/sports/core/ball.js +402 -0
  98. package/dist/components/sports/core/court.d.ts +442 -0
  99. package/dist/components/sports/core/court.d.ts.map +1 -0
  100. package/dist/components/sports/core/court.js +658 -0
  101. package/dist/components/sports/core/equipment.d.ts +103 -0
  102. package/dist/components/sports/core/equipment.d.ts.map +1 -0
  103. package/dist/components/sports/core/equipment.js +403 -0
  104. package/dist/components/sports/core/goal.d.ts +98 -0
  105. package/dist/components/sports/core/goal.d.ts.map +1 -0
  106. package/dist/components/sports/core/goal.js +44 -0
  107. package/dist/components/sports/index.d.ts +11 -0
  108. package/dist/components/sports/index.d.ts.map +1 -0
  109. package/dist/components/sports/index.js +8 -0
  110. package/dist/components/sports/sportsCore.d.ts +195 -0
  111. package/dist/components/sports/sportsCore.d.ts.map +1 -0
  112. package/dist/components/sports/sportsCore.js +758 -0
  113. package/dist/components/sports/useSportsInstance.d.ts +35 -0
  114. package/dist/components/sports/useSportsInstance.d.ts.map +1 -0
  115. package/dist/components/sports/useSportsInstance.js +47 -0
  116. package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
  117. package/dist/components/terrain/TerrainSurface.js +14 -0
  118. package/dist/components/urban/UrbanBlock.d.ts +9 -0
  119. package/dist/components/urban/UrbanBlock.d.ts.map +1 -0
  120. package/dist/components/urban/UrbanBlock.js +23 -0
  121. package/dist/components/urban/UrbanBuilding.d.ts +9 -0
  122. package/dist/components/urban/UrbanBuilding.d.ts.map +1 -0
  123. package/dist/components/urban/UrbanBuilding.js +23 -0
  124. package/dist/components/urban/UrbanJunction.d.ts +9 -0
  125. package/dist/components/urban/UrbanJunction.d.ts.map +1 -0
  126. package/dist/components/urban/UrbanJunction.js +23 -0
  127. package/dist/components/urban/UrbanPark.d.ts +9 -0
  128. package/dist/components/urban/UrbanPark.d.ts.map +1 -0
  129. package/dist/components/urban/UrbanPark.js +23 -0
  130. package/dist/components/urban/UrbanParkingLot.d.ts +9 -0
  131. package/dist/components/urban/UrbanParkingLot.d.ts.map +1 -0
  132. package/dist/components/urban/UrbanParkingLot.js +23 -0
  133. package/dist/components/urban/UrbanPlaza.d.ts +9 -0
  134. package/dist/components/urban/UrbanPlaza.d.ts.map +1 -0
  135. package/dist/components/urban/UrbanPlaza.js +23 -0
  136. package/dist/components/urban/UrbanRoad.d.ts +9 -0
  137. package/dist/components/urban/UrbanRoad.d.ts.map +1 -0
  138. package/dist/components/urban/UrbanRoad.js +23 -0
  139. package/dist/components/urban/UrbanSignage.d.ts +9 -0
  140. package/dist/components/urban/UrbanSignage.d.ts.map +1 -0
  141. package/dist/components/urban/UrbanSignage.js +23 -0
  142. package/dist/components/urban/UrbanSkyline.d.ts +9 -0
  143. package/dist/components/urban/UrbanSkyline.d.ts.map +1 -0
  144. package/dist/components/urban/UrbanSkyline.js +23 -0
  145. package/dist/components/urban/UrbanStreetFurniture.d.ts +9 -0
  146. package/dist/components/urban/UrbanStreetFurniture.d.ts.map +1 -0
  147. package/dist/components/urban/UrbanStreetFurniture.js +23 -0
  148. package/dist/components/urban/UrbanStreetGrid.d.ts +9 -0
  149. package/dist/components/urban/UrbanStreetGrid.d.ts.map +1 -0
  150. package/dist/components/urban/UrbanStreetGrid.js +34 -0
  151. package/dist/components/urban/UrbanTraffic.d.ts +9 -0
  152. package/dist/components/urban/UrbanTraffic.d.ts.map +1 -0
  153. package/dist/components/urban/UrbanTraffic.js +23 -0
  154. package/dist/components/urban/core/block.d.ts +119 -0
  155. package/dist/components/urban/core/block.d.ts.map +1 -0
  156. package/dist/components/urban/core/block.js +266 -0
  157. package/dist/components/urban/core/building.d.ts +128 -0
  158. package/dist/components/urban/core/building.d.ts.map +1 -0
  159. package/dist/components/urban/core/building.js +741 -0
  160. package/dist/components/urban/core/junction.d.ts +152 -0
  161. package/dist/components/urban/core/junction.d.ts.map +1 -0
  162. package/dist/components/urban/core/junction.js +617 -0
  163. package/dist/components/urban/core/park.d.ts +67 -0
  164. package/dist/components/urban/core/park.d.ts.map +1 -0
  165. package/dist/components/urban/core/park.js +176 -0
  166. package/dist/components/urban/core/parkingLot.d.ts +82 -0
  167. package/dist/components/urban/core/parkingLot.d.ts.map +1 -0
  168. package/dist/components/urban/core/parkingLot.js +284 -0
  169. package/dist/components/urban/core/plaza.d.ts +24 -0
  170. package/dist/components/urban/core/plaza.d.ts.map +1 -0
  171. package/dist/components/urban/core/plaza.js +243 -0
  172. package/dist/components/urban/core/road.d.ts +113 -0
  173. package/dist/components/urban/core/road.d.ts.map +1 -0
  174. package/dist/components/urban/core/road.js +347 -0
  175. package/dist/components/urban/core/signage.d.ts +83 -0
  176. package/dist/components/urban/core/signage.d.ts.map +1 -0
  177. package/dist/components/urban/core/signage.js +209 -0
  178. package/dist/components/urban/core/skyline.d.ts +100 -0
  179. package/dist/components/urban/core/skyline.d.ts.map +1 -0
  180. package/dist/components/urban/core/skyline.js +89 -0
  181. package/dist/components/urban/core/streetFurniture.d.ts +75 -0
  182. package/dist/components/urban/core/streetFurniture.d.ts.map +1 -0
  183. package/dist/components/urban/core/streetFurniture.js +193 -0
  184. package/dist/components/urban/core/streetGrid.d.ts +134 -0
  185. package/dist/components/urban/core/streetGrid.d.ts.map +1 -0
  186. package/dist/components/urban/core/streetGrid.js +422 -0
  187. package/dist/components/urban/core/traffic.d.ts +125 -0
  188. package/dist/components/urban/core/traffic.d.ts.map +1 -0
  189. package/dist/components/urban/core/traffic.js +305 -0
  190. package/dist/components/urban/index.d.ts +29 -0
  191. package/dist/components/urban/index.d.ts.map +1 -0
  192. package/dist/components/urban/index.js +16 -0
  193. package/dist/components/urban/textureSetResolver.d.ts +8 -0
  194. package/dist/components/urban/textureSetResolver.d.ts.map +1 -0
  195. package/dist/components/urban/textureSetResolver.js +16 -0
  196. package/dist/components/urban/urbanCore.d.ts +262 -0
  197. package/dist/components/urban/urbanCore.d.ts.map +1 -0
  198. package/dist/components/urban/urbanCore.js +928 -0
  199. package/dist/components/urban/useUrbanInstance.d.ts +53 -0
  200. package/dist/components/urban/useUrbanInstance.d.ts.map +1 -0
  201. package/dist/components/urban/useUrbanInstance.js +100 -0
  202. package/dist/components/vegetation/VegetationBush.d.ts +9 -0
  203. package/dist/components/vegetation/VegetationBush.d.ts.map +1 -0
  204. package/dist/components/vegetation/VegetationBush.js +23 -0
  205. package/dist/components/vegetation/VegetationCrops.d.ts +9 -0
  206. package/dist/components/vegetation/VegetationCrops.d.ts.map +1 -0
  207. package/dist/components/vegetation/VegetationCrops.js +23 -0
  208. package/dist/components/vegetation/VegetationFlowers.d.ts +9 -0
  209. package/dist/components/vegetation/VegetationFlowers.d.ts.map +1 -0
  210. package/dist/components/vegetation/VegetationFlowers.js +23 -0
  211. package/dist/components/vegetation/VegetationForest.d.ts +9 -0
  212. package/dist/components/vegetation/VegetationForest.d.ts.map +1 -0
  213. package/dist/components/vegetation/VegetationForest.js +23 -0
  214. package/dist/components/vegetation/VegetationFruit.d.ts +9 -0
  215. package/dist/components/vegetation/VegetationFruit.d.ts.map +1 -0
  216. package/dist/components/vegetation/VegetationFruit.js +23 -0
  217. package/dist/components/vegetation/VegetationGrass.d.ts +9 -0
  218. package/dist/components/vegetation/VegetationGrass.d.ts.map +1 -0
  219. package/dist/components/vegetation/VegetationGrass.js +23 -0
  220. package/dist/components/vegetation/VegetationHedge.d.ts +9 -0
  221. package/dist/components/vegetation/VegetationHedge.d.ts.map +1 -0
  222. package/dist/components/vegetation/VegetationHedge.js +23 -0
  223. package/dist/components/vegetation/VegetationIvy.d.ts +9 -0
  224. package/dist/components/vegetation/VegetationIvy.d.ts.map +1 -0
  225. package/dist/components/vegetation/VegetationIvy.js +23 -0
  226. package/dist/components/vegetation/VegetationTree.d.ts +9 -0
  227. package/dist/components/vegetation/VegetationTree.d.ts.map +1 -0
  228. package/dist/components/vegetation/VegetationTree.js +23 -0
  229. package/dist/components/vegetation/VegetationVegetable.d.ts +9 -0
  230. package/dist/components/vegetation/VegetationVegetable.d.ts.map +1 -0
  231. package/dist/components/vegetation/VegetationVegetable.js +23 -0
  232. package/dist/components/vegetation/core/bush.d.ts +1256 -0
  233. package/dist/components/vegetation/core/bush.d.ts.map +1 -0
  234. package/dist/components/vegetation/core/bush.js +376 -0
  235. package/dist/components/vegetation/core/crops.d.ts +1033 -0
  236. package/dist/components/vegetation/core/crops.d.ts.map +1 -0
  237. package/dist/components/vegetation/core/crops.js +378 -0
  238. package/dist/components/vegetation/core/flowers.d.ts +648 -0
  239. package/dist/components/vegetation/core/flowers.d.ts.map +1 -0
  240. package/dist/components/vegetation/core/flowers.js +225 -0
  241. package/dist/components/vegetation/core/forest.d.ts +138 -0
  242. package/dist/components/vegetation/core/forest.d.ts.map +1 -0
  243. package/dist/components/vegetation/core/forest.js +310 -0
  244. package/dist/components/vegetation/core/fruit.d.ts +99 -0
  245. package/dist/components/vegetation/core/fruit.d.ts.map +1 -0
  246. package/dist/components/vegetation/core/fruit.js +77 -0
  247. package/dist/components/vegetation/core/grass.d.ts +103 -0
  248. package/dist/components/vegetation/core/grass.d.ts.map +1 -0
  249. package/dist/components/vegetation/core/grass.js +102 -0
  250. package/dist/components/vegetation/core/hedge.d.ts +193 -0
  251. package/dist/components/vegetation/core/hedge.d.ts.map +1 -0
  252. package/dist/components/vegetation/core/hedge.js +243 -0
  253. package/dist/components/vegetation/core/ivy.d.ts +213 -0
  254. package/dist/components/vegetation/core/ivy.d.ts.map +1 -0
  255. package/dist/components/vegetation/core/ivy.js +173 -0
  256. package/dist/components/vegetation/core/tree.d.ts +1117 -0
  257. package/dist/components/vegetation/core/tree.d.ts.map +1 -0
  258. package/dist/components/vegetation/core/tree.js +408 -0
  259. package/dist/components/vegetation/core/vegetable.d.ts +99 -0
  260. package/dist/components/vegetation/core/vegetable.d.ts.map +1 -0
  261. package/dist/components/vegetation/core/vegetable.js +76 -0
  262. package/dist/components/vegetation/index.d.ts +23 -0
  263. package/dist/components/vegetation/index.d.ts.map +1 -0
  264. package/dist/components/vegetation/index.js +14 -0
  265. package/dist/components/vegetation/produceCore.d.ts +929 -0
  266. package/dist/components/vegetation/produceCore.d.ts.map +1 -0
  267. package/dist/components/vegetation/produceCore.js +723 -0
  268. package/dist/components/vegetation/useVegetationInstance.d.ts +39 -0
  269. package/dist/components/vegetation/useVegetationInstance.d.ts.map +1 -0
  270. package/dist/components/vegetation/useVegetationInstance.js +45 -0
  271. package/dist/components/vegetation/vegetationCore.d.ts +412 -0
  272. package/dist/components/vegetation/vegetationCore.d.ts.map +1 -0
  273. package/dist/components/vegetation/vegetationCore.js +1728 -0
  274. package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +5 -0
  275. package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
  276. package/dist/components/volumetricClouds/VolumetricCloudsPass.js +39 -13
  277. package/dist/components/water/OceanSurface.d.ts.map +1 -1
  278. package/dist/components/water/OceanSurface.js +3 -2
  279. package/dist/components/water/WaterBody.d.ts.map +1 -1
  280. package/dist/components/water/WaterBody.js +31 -10
  281. package/dist/components/water/WaterFountain.d.ts +9 -0
  282. package/dist/components/water/WaterFountain.d.ts.map +1 -0
  283. package/dist/components/water/WaterFountain.js +24 -0
  284. package/dist/components/water/WaterStream.d.ts +9 -0
  285. package/dist/components/water/WaterStream.d.ts.map +1 -0
  286. package/dist/components/water/WaterStream.js +24 -0
  287. package/dist/components/water/WaterWaterfall.d.ts +9 -0
  288. package/dist/components/water/WaterWaterfall.d.ts.map +1 -0
  289. package/dist/components/water/WaterWaterfall.js +24 -0
  290. package/dist/components/water/core/fountain.d.ts +70 -0
  291. package/dist/components/water/core/fountain.d.ts.map +1 -0
  292. package/dist/components/water/core/fountain.js +619 -0
  293. package/dist/components/water/core/stream.d.ts +72 -0
  294. package/dist/components/water/core/stream.d.ts.map +1 -0
  295. package/dist/components/water/core/stream.js +167 -0
  296. package/dist/components/water/core/waterfall.d.ts +78 -0
  297. package/dist/components/water/core/waterfall.d.ts.map +1 -0
  298. package/dist/components/water/core/waterfall.js +325 -0
  299. package/dist/components/water/index.d.ts +8 -0
  300. package/dist/components/water/index.d.ts.map +1 -1
  301. package/dist/components/water/index.js +7 -0
  302. package/dist/components/water/types.d.ts +3 -0
  303. package/dist/components/water/types.d.ts.map +1 -1
  304. package/dist/components/water/useWaterInstance.d.ts +43 -0
  305. package/dist/components/water/useWaterInstance.d.ts.map +1 -0
  306. package/dist/components/water/useWaterInstance.js +89 -0
  307. package/dist/components/water/waterCore.d.ts +179 -0
  308. package/dist/components/water/waterCore.d.ts.map +1 -0
  309. package/dist/components/water/waterCore.js +516 -0
  310. package/dist/constants.d.ts.map +1 -1
  311. package/dist/constants.js +9 -1
  312. package/dist/hooks/index.d.ts +7 -2
  313. package/dist/hooks/index.d.ts.map +1 -1
  314. package/dist/hooks/index.js +5 -2
  315. package/dist/hooks/useActionPatch.d.ts +23 -0
  316. package/dist/hooks/useActionPatch.d.ts.map +1 -0
  317. package/dist/hooks/useActionPatch.js +38 -0
  318. package/dist/hooks/useCloudSun.d.ts.map +1 -1
  319. package/dist/hooks/useCloudSun.js +3 -2
  320. package/dist/hooks/useCommittedInstance.d.ts +6 -0
  321. package/dist/hooks/useCommittedInstance.d.ts.map +1 -0
  322. package/dist/hooks/useCommittedInstance.js +42 -0
  323. package/dist/hooks/useConfigLive.d.ts +1 -1
  324. package/dist/hooks/useConfigLive.d.ts.map +1 -1
  325. package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
  326. package/dist/hooks/useContinuousEffects.js +36 -20
  327. package/dist/hooks/useGridLayout.d.ts +7 -0
  328. package/dist/hooks/useGridLayout.d.ts.map +1 -0
  329. package/dist/hooks/useGridLayout.js +10 -0
  330. package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
  331. package/dist/hooks/useInteractionEffects.js +48 -9
  332. package/dist/hooks/useLightLive.d.ts.map +1 -1
  333. package/dist/hooks/useLightLive.js +2 -0
  334. package/dist/hooks/useLinkStatus.d.ts +7 -0
  335. package/dist/hooks/useLinkStatus.d.ts.map +1 -0
  336. package/dist/hooks/useLinkStatus.js +20 -0
  337. package/dist/hooks/useMaterialApplication.d.ts +6 -1
  338. package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
  339. package/dist/hooks/useMaterialApplication.js +7 -2
  340. package/dist/hooks/useOceanMaterial.d.ts +11 -1
  341. package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
  342. package/dist/hooks/useOceanMaterial.js +185 -27
  343. package/dist/hooks/usePathAnimation.d.ts +8 -0
  344. package/dist/hooks/usePathAnimation.d.ts.map +1 -1
  345. package/dist/hooks/usePathAnimation.js +140 -59
  346. package/dist/hooks/useResolvedLayout.d.ts +10 -0
  347. package/dist/hooks/useResolvedLayout.d.ts.map +1 -0
  348. package/dist/hooks/useResolvedLayout.js +17 -0
  349. package/dist/hooks/useTimeLighting.d.ts +36 -0
  350. package/dist/hooks/useTimeLighting.d.ts.map +1 -0
  351. package/dist/hooks/useTimeLighting.js +67 -0
  352. package/dist/index.d.ts +4 -0
  353. package/dist/index.d.ts.map +1 -1
  354. package/dist/index.js +4 -0
  355. package/dist/operations/catalogue/shaderLayers.d.ts.map +1 -1
  356. package/dist/operations/catalogue/shaderLayers.js +26 -3
  357. package/dist/render/renderLive.d.ts +11 -0
  358. package/dist/render/renderLive.d.ts.map +1 -0
  359. package/dist/render/renderLive.js +57 -0
  360. package/dist/shaders/glsl/oceanCore.glsl.d.ts +2 -2
  361. package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -1
  362. package/dist/shaders/glsl/oceanCore.glsl.js +35 -5
  363. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +12 -0
  364. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
  365. package/dist/shaders/ocean/OceanSurfaceMaterial.js +55 -7
  366. package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
  367. package/dist/shaders/terrain/TerrainMaterial.js +28 -0
  368. package/dist/triggers/kinds/change.js +1 -1
  369. package/dist/ui/UiLayers.d.ts +17 -1
  370. package/dist/ui/UiLayers.d.ts.map +1 -1
  371. package/dist/ui/UiLayers.js +76 -3
  372. package/dist/ui/index.d.ts +2 -2
  373. package/dist/ui/index.d.ts.map +1 -1
  374. package/dist/ui/index.js +1 -1
  375. package/dist/utils/composerHostedPass.d.ts +74 -0
  376. package/dist/utils/composerHostedPass.d.ts.map +1 -0
  377. package/dist/utils/composerHostedPass.js +63 -0
  378. package/dist/utils/geometryScript.d.ts +17 -0
  379. package/dist/utils/geometryScript.d.ts.map +1 -0
  380. package/dist/utils/geometryScript.js +92 -0
  381. package/dist/utils/geometryScript.worker.d.ts +2 -0
  382. package/dist/utils/geometryScript.worker.d.ts.map +1 -0
  383. package/dist/utils/geometryScript.worker.js +42 -0
  384. package/dist/utils/groundRegistry.d.ts +11 -0
  385. package/dist/utils/groundRegistry.d.ts.map +1 -0
  386. package/dist/utils/groundRegistry.js +39 -0
  387. package/dist/utils/instancingSupport.d.ts +9 -0
  388. package/dist/utils/instancingSupport.d.ts.map +1 -0
  389. package/dist/utils/instancingSupport.js +13 -0
  390. package/dist/utils/landPatch.d.ts +26 -5
  391. package/dist/utils/landPatch.d.ts.map +1 -1
  392. package/dist/utils/landPatch.js +124 -9
  393. package/dist/utils/layoutPlacement.d.ts +30 -0
  394. package/dist/utils/layoutPlacement.d.ts.map +1 -0
  395. package/dist/utils/layoutPlacement.js +113 -0
  396. package/dist/utils/linkRegistry.d.ts +15 -0
  397. package/dist/utils/linkRegistry.d.ts.map +1 -0
  398. package/dist/utils/linkRegistry.js +11 -0
  399. package/dist/utils/shapes.d.ts +28 -2
  400. package/dist/utils/shapes.d.ts.map +1 -1
  401. package/dist/utils/shapes.js +32 -3
  402. package/dist/utils/sharedParts.d.ts +61 -0
  403. package/dist/utils/sharedParts.d.ts.map +1 -0
  404. package/dist/utils/sharedParts.js +268 -0
  405. package/dist/utils/svgAsset.d.ts +6 -0
  406. package/dist/utils/svgAsset.d.ts.map +1 -0
  407. package/dist/utils/svgAsset.js +46 -0
  408. package/dist/utils/waterLight.d.ts +29 -0
  409. package/dist/utils/waterLight.d.ts.map +1 -0
  410. package/dist/utils/waterLight.js +67 -0
  411. package/dist/utils/waterReflection.d.ts +185 -0
  412. package/dist/utils/waterReflection.d.ts.map +1 -0
  413. package/dist/utils/waterReflection.js +616 -0
  414. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import type { LandObjectConfig, LandQuality, TerrainConfig, TerrainQualityConfig } from '@3driseai/3drise-core';
2
+ import type { LandObjectConfig, LandQuality, ShapeLayoutField, TerrainConfig, TerrainQualityConfig } from '@3driseai/3drise-core';
3
3
  export declare const LAND_SEGMENTS: Record<LandQuality, number>;
4
4
  /** The seed's offset into the field, in metres. Deterministic, far apart. */
5
5
  export declare function landSeedOffset(seed: number, out?: THREE.Vector2): THREE.Vector2;
@@ -21,13 +21,34 @@ export declare function landFrame(object: THREE.Object3D, out?: LandFrame): Land
21
21
  * the camera and sun brought into terrain space. Call after applyTerrainUniforms
22
22
  * and applySunUniforms (both of which write world-space or unscaled values).
23
23
  */
24
- export declare function applyLandPatchUniforms(material: THREE.ShaderMaterial, cfg: LandObjectConfig, frame: LandFrame, camera: THREE.Camera): void;
24
+ export declare function applyLandPatchUniforms(material: THREE.ShaderMaterial, cfg: LandObjectConfig, frame: LandFrame, camera: THREE.Camera,
25
+ /** The grid is a layout's (landLayoutGeometry): its per-vertex band replaces the rectangle's. */
26
+ layoutActive?: boolean): void;
27
+ /**
28
+ * A land that keeps to a layout, as geometry: the field (core shapeLayoutField) stretched over the
29
+ * patch's unit grid (-0.5…0.5 on x / z), so the object's scale stretches the island with the grid —
30
+ * live while dragging, no rebuild — while the terrain inside stays a window in metres. `edge`: the
31
+ * band at the layout's edge in unit-grid units (edgeFade, a fraction of the side).
32
+ */
33
+ export interface LandLayout {
34
+ field: ShapeLayoutField;
35
+ edge: number;
36
+ }
37
+ /**
38
+ * The patch grid for a land on a layout — independent of the object's scale. The unit grid with the
39
+ * cells that touch the layout kept, and every kept point that lies off it moved onto the layout's
40
+ * edge (the outline follows the layout, not the cells). Per vertex, for TerrainMaterial's
41
+ * LAND_LAYOUT path: the mask with its slope (per unit) and the lift (metres) with its slope.
42
+ * null: nothing of the grid is on the layout.
43
+ */
44
+ export declare function landLayoutGeometry(segments: number, layout: LandLayout): THREE.BufferGeometry | null;
25
45
  /**
26
46
  * Height of the land above the object's base, in terrain metres, at terrain-space
27
47
  * (tx, tz) measured from the object's centre (before rotation). Multiply nothing:
28
- * scale.y is already in (elevation x scale.y).
48
+ * scale.y is already in (elevation x scale.y). With a layout: the layout's mask in
49
+ * place of the rectangle's, plus its lift (x scale.y); 0 off the layout.
29
50
  */
30
- export declare function landHeightAt(cfg: LandObjectConfig, scale: THREE.Vector3, tx: number, tz: number, lodCell?: number): number;
51
+ export declare function landHeightAt(cfg: LandObjectConfig, scale: THREE.Vector3, tx: number, tz: number, lodCell?: number, layout?: LandLayout | null): number;
31
52
  /** World-space height of a land object's surface under world (x, z), or null off the patch. */
32
- export declare function landWorldHeightAt(object: THREE.Object3D, cfg: LandObjectConfig, x: number, z: number): number | null;
53
+ export declare function landWorldHeightAt(object: THREE.Object3D, cfg: LandObjectConfig, x: number, z: number, layout?: LandLayout | null): number | null;
33
54
  //# sourceMappingURL=landPatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"landPatch.d.ts","sourceRoot":"","sources":["../../src/utils/landPatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAgBhH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAwC,CAAC;AAE/F,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAsB,GAAG,KAAK,CAAC,OAAO,CAKrF;AAED;qCACqC;AACrC,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAExE;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,oBAAoB,CAevE;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACtB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IACrB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC;CACvC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,KA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ector2();
56
56
  * the camera and sun brought into terrain space. Call after applyTerrainUniforms
57
57
  * and applySunUniforms (both of which write world-space or unscaled values).
58
58
  */
59
- export function applyLandPatchUniforms(material, cfg, frame, camera) {
59
+ export function applyLandPatchUniforms(material, cfg, frame, camera,
60
+ /** The grid is a layout's (landLayoutGeometry): its per-vertex band replaces the rectangle's. */
61
+ layoutActive = false) {
60
62
  const u = material.uniforms;
61
63
  const { scale } = frame;
62
64
  landSeedOffset(cfg.seed, _off);
63
65
  u.u_patchSize.value.set(scale.x, scale.z);
64
66
  u.u_patchOffset.value.copy(_off);
65
- u.u_edgeWidth.value = Math.max(0, cfg.edgeFade ?? 0) * Math.min(scale.x, scale.z);
67
+ // with a layout its own edge band takes over (per vertex): the rectangle only bounds it
68
+ u.u_edgeWidth.value = layoutActive ? 0 : Math.max(0, cfg.edgeFade ?? 0) * Math.min(scale.x, scale.z);
66
69
  u.u_scaleY.value = scale.y;
67
70
  u.u_elevation.value = Math.max(cfg.elevation, 0.01) * scale.y;
68
71
  u.u_seaLevel.value = 0;
@@ -84,22 +87,132 @@ function patchMask(tx, tz, sizeX, sizeZ, edge) {
84
87
  const x = Math.min(Math.max(d / edge, 0), 1);
85
88
  return x * x * (3 - 2 * x);
86
89
  }
90
+ const _ed = { d: 0, gx: 0, gz: 0 };
91
+ /**
92
+ * The layout at unit-grid (u, v): its mask (0 at the edge … 1 past the band) and the mask's slope
93
+ * per unit, and its lift — the layout's height in its own metres (times scale.y where drawn). false off it.
94
+ */
95
+ function layoutAt(l, u, v, out) {
96
+ if (!l.field.contains(u, v))
97
+ return false;
98
+ let m = 1, dmx = 0, dmz = 0;
99
+ if (l.edge > 1e-4) {
100
+ const e = l.field.edgeDistance(u, v, l.edge, _ed);
101
+ const x = Math.min(Math.max(e.d / l.edge, 0), 1);
102
+ m = x * x * (3 - 2 * x);
103
+ const dm = x < 1 ? (6 * x * (1 - x)) / l.edge : 0;
104
+ dmx = dm * e.gx;
105
+ dmz = dm * e.gz;
106
+ }
107
+ const h = l.field.heightAt(u, v);
108
+ out[0] = m;
109
+ out[1] = dmx;
110
+ out[2] = dmz;
111
+ out[3] = Number.isFinite(h) ? h / l.field.heightScale : 0;
112
+ return true;
113
+ }
114
+ /** The layout's height (its metres) at (u, v), NaN off it. */
115
+ const liftAt = (l, u, v) => l.field.heightAt(u, v) / l.field.heightScale;
116
+ /**
117
+ * The patch grid for a land on a layout — independent of the object's scale. The unit grid with the
118
+ * cells that touch the layout kept, and every kept point that lies off it moved onto the layout's
119
+ * edge (the outline follows the layout, not the cells). Per vertex, for TerrainMaterial's
120
+ * LAND_LAYOUT path: the mask with its slope (per unit) and the lift (metres) with its slope.
121
+ * null: nothing of the grid is on the layout.
122
+ */
123
+ export function landLayoutGeometry(segments, layout) {
124
+ const g = new THREE.PlaneGeometry(1, 1, segments, segments);
125
+ g.rotateX(-Math.PI / 2);
126
+ const p = g.getAttribute('position');
127
+ const n = p.count, mask = new Float32Array(n * 3), lift = new Float32Array(n * 3);
128
+ const inside = new Uint8Array(n);
129
+ const v = [0, 0, 0, 0], cell = 1 / segments, eps = cell / 2;
130
+ for (let i = 0; i < n; i++) {
131
+ const u = p.getX(i), w = p.getZ(i);
132
+ if (!layoutAt(layout, u, w, v))
133
+ continue;
134
+ inside[i] = 1;
135
+ mask[i * 3] = v[0];
136
+ mask[i * 3 + 1] = v[1];
137
+ mask[i * 3 + 2] = v[2];
138
+ // the lift's slope by central differences (a side off the layout: the one-sided one)
139
+ const h = v[3], hx1 = liftAt(layout, u + eps, w), hx0 = liftAt(layout, u - eps, w);
140
+ const hz1 = liftAt(layout, u, w + eps), hz0 = liftAt(layout, u, w - eps);
141
+ const gx = Number.isFinite(hx1) && Number.isFinite(hx0) ? (hx1 - hx0) / (2 * eps) : Number.isFinite(hx1) ? (hx1 - h) / eps : Number.isFinite(hx0) ? (h - hx0) / eps : 0;
142
+ const gz = Number.isFinite(hz1) && Number.isFinite(hz0) ? (hz1 - hz0) / (2 * eps) : Number.isFinite(hz1) ? (hz1 - h) / eps : Number.isFinite(hz0) ? (h - hz0) / eps : 0;
143
+ lift[i * 3] = h;
144
+ lift[i * 3 + 1] = gx;
145
+ lift[i * 3 + 2] = gz;
146
+ }
147
+ // keep the triangles with a point on the layout; their points off it go onto the edge
148
+ const idx = g.getIndex().array, keep = [];
149
+ const snap = new Uint8Array(n);
150
+ for (let t = 0; t < idx.length; t += 3) {
151
+ const a = idx[t], b = idx[t + 1], c = idx[t + 2];
152
+ if (!inside[a] && !inside[b] && !inside[c])
153
+ continue;
154
+ keep.push(a, b, c);
155
+ if (!inside[a])
156
+ snap[a] = 1;
157
+ if (!inside[b])
158
+ snap[b] = 1;
159
+ if (!inside[c])
160
+ snap[c] = 1;
161
+ }
162
+ if (!keep.length) {
163
+ g.dispose();
164
+ return null;
165
+ }
166
+ for (let i = 0; i < n; i++) {
167
+ if (!snap[i])
168
+ continue;
169
+ const u = p.getX(i), w = p.getZ(i);
170
+ const e = layout.field.edgeDistance(u, w, cell * 2, _ed);
171
+ if (e.d >= cell * 2)
172
+ continue; // no edge near: leave it (mask 0)
173
+ // the nearest edge point, at the edge's own height there (a surface lookup right on the edge
174
+ // can miss the triangles and fall back to 0 — a lone vertex dropped or raised: a spike)
175
+ const ex = u - e.gx * e.d, ez = w - e.gz * e.d;
176
+ p.setX(i, ex);
177
+ p.setZ(i, ez);
178
+ lift[i * 3] = (e.y ?? 0) / layout.field.heightScale;
179
+ // no slope of its own on the edge (the shading takes it from the points inside)
180
+ lift[i * 3 + 1] = 0;
181
+ lift[i * 3 + 2] = 0;
182
+ }
183
+ p.needsUpdate = true;
184
+ g.setIndex(keep);
185
+ g.setAttribute('aLayoutMask', new THREE.BufferAttribute(mask, 3));
186
+ g.setAttribute('aLayoutLift', new THREE.BufferAttribute(lift, 3));
187
+ g.computeBoundingBox();
188
+ return g;
189
+ }
190
+ const _lv = [0, 0, 0, 0];
87
191
  /**
88
192
  * Height of the land above the object's base, in terrain metres, at terrain-space
89
193
  * (tx, tz) measured from the object's centre (before rotation). Multiply nothing:
90
- * scale.y is already in (elevation x scale.y).
194
+ * scale.y is already in (elevation x scale.y). With a layout: the layout's mask in
195
+ * place of the rectangle's, plus its lift (x scale.y); 0 off the layout.
91
196
  */
92
- export function landHeightAt(cfg, scale, tx, tz, lodCell = 2) {
93
- const m = patchMask(tx, tz, scale.x, scale.z, Math.max(0, cfg.edgeFade ?? 0) * Math.min(scale.x, scale.z));
197
+ export function landHeightAt(cfg, scale, tx, tz, lodCell = 2, layout) {
198
+ let m, lift = 0;
199
+ if (layout) {
200
+ if (!layoutAt(layout, tx / scale.x, tz / scale.z, _lv))
201
+ return 0;
202
+ m = _lv[0];
203
+ lift = _lv[3] * scale.y;
204
+ }
205
+ else
206
+ m = patchMask(tx, tz, scale.x, scale.z, Math.max(0, cfg.edgeFade ?? 0) * Math.min(scale.x, scale.z));
94
207
  if (m <= 0)
95
- return 0;
208
+ return lift;
96
209
  const off = landSeedOffset(cfg.seed, _off);
97
210
  const t = landToTerrainConfig(cfg);
98
211
  t.elevation = Math.max(cfg.elevation, 0.01) * scale.y;
99
- return terrainHeightAt(t, tx + off.x, tz + off.y, lodCell) * m;
212
+ return terrainHeightAt(t, tx + off.x, tz + off.y, lodCell) * m + lift;
100
213
  }
101
214
  /** World-space height of a land object's surface under world (x, z), or null off the patch. */
102
- export function landWorldHeightAt(object, cfg, x, z) {
215
+ export function landWorldHeightAt(object, cfg, x, z, layout) {
103
216
  object.updateWorldMatrix(true, false);
104
217
  const f = landFrame(object);
105
218
  // A vertical line through (x, z) in terrain space: assume the patch is not
@@ -107,7 +220,9 @@ export function landWorldHeightAt(object, cfg, x, z) {
107
220
  _v.set(x, f.position.y, z).sub(f.position).applyQuaternion(f.inverseQuaternion);
108
221
  if (Math.abs(_v.x) > f.scale.x / 2 || Math.abs(_v.z) > f.scale.z / 2)
109
222
  return null;
110
- const h = landHeightAt(cfg, f.scale, _v.x, _v.z);
223
+ if (layout && !layout.field.contains(_v.x / f.scale.x, _v.z / f.scale.z))
224
+ return null; // off the layout: no ground here
225
+ const h = landHeightAt(cfg, f.scale, _v.x, _v.z, 2, layout);
111
226
  _v.y = h;
112
227
  _v.applyQuaternion(f.quaternion).add(f.position);
113
228
  return _v.y;
@@ -0,0 +1,30 @@
1
+ import { Matrix4 } from 'three';
2
+ import type { Object3D } from 'three';
3
+ import type { LayoutCopy } from '@3driseai/3drise-core';
4
+ export interface PlacementOptions {
5
+ onGround?: boolean;
6
+ alignToSlope?: boolean;
7
+ /** Area / path layouts: in world metres (the object's scale sizes each copy, not the layout). */
8
+ layout?: string;
9
+ }
10
+ /** Layouts measured in world metres: the object's scale must not stretch where copies go. */
11
+ export declare const isMetricLayout: (layout: string | undefined) => boolean;
12
+ /**
13
+ * Writes one local matrix per copy into `out` (grown as needed). `root` is the layout
14
+ * root (its matrixWorld must be current). Without ground (or root) copies keep their
15
+ * slot height. Area / path positions are metres: divided by the root's world scale,
16
+ * so the object's scale sizes the copies and not the layout.
17
+ */
18
+ export declare function placeCopies(copies: LayoutCopy[], opts: PlacementOptions, root: Object3D | null, out: Matrix4[]): Matrix4[];
19
+ /** When a layout with onGround has to re-drop its copies. One per layout. */
20
+ export declare class GroundTracker {
21
+ private version;
22
+ private last;
23
+ private placedOnce;
24
+ private pending;
25
+ private frame;
26
+ /** Call once per frame with the layout root (matrixWorld current). True = re-place now. */
27
+ tick(root: Object3D): boolean;
28
+ reset(): void;
29
+ }
30
+ //# sourceMappingURL=layoutPlacement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layoutPlacement.d.ts","sourceRoot":"","sources":["../../src/utils/layoutPlacement.ts"],"names":[],"mappings":"AAcA,OAAO,EAAS,OAAO,EAAuB,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAexD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,6FAA6F;AAC7F,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,OAAiD,CAAC;AAM9G;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAgC1H;AAKD,6EAA6E;AAC7E,qBAAa,aAAa;IACtB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,IAAI,CAAiB;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAK;IAElB,2FAA2F;IAC3F,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAa7B,KAAK,IAAI,IAAI;CAChB"}
@@ -0,0 +1,113 @@
1
+ // =============================================================================
2
+ // layoutPlacement — layout copies to local matrices, dropped onto the ground
3
+ // =============================================================================
4
+ //
5
+ // core's layoutCopies gives each copy its slot transform with the variation
6
+ // applied. This turns them into matrices in the layout root's space and, with
7
+ // `onGround`, moves each copy vertically onto the highest ground under it
8
+ // (groundRegistry) — optionally tilted to the slope. Shared by InstancedLayout
9
+ // (instance matrices) and LayoutInstances (slot group transforms).
10
+ //
11
+ // `GroundTracker` decides when to re-drop: when the ground changed (groundVersion)
12
+ // or the layout root moved by more than a centimetre / a hundredth of a radian —
13
+ // not on every frame of a small physical wobble — and at most every few frames
14
+ // while it keeps moving.
15
+ import { Euler, Matrix4, Quaternion, Vector3 } from 'three';
16
+ import { groundHeightAt, groundVersion } from './groundRegistry.js';
17
+ const _pos = new Vector3();
18
+ const _w = new Vector3();
19
+ const _n = new Vector3();
20
+ const _q = new Quaternion();
21
+ const _tilt = new Quaternion();
22
+ const _e = new Euler();
23
+ const _s = new Vector3();
24
+ const _inv = new Matrix4();
25
+ const UP = new Vector3(0, 1, 0);
26
+ /** Finite-difference step for the slope normal, in world metres. */
27
+ const SLOPE_STEP = 0.75;
28
+ /** Layouts measured in world metres: the object's scale must not stretch where copies go. */
29
+ export const isMetricLayout = (layout) => layout === 'area' || layout === 'path';
30
+ const _rootScale = new Vector3();
31
+ const _rq = new Quaternion();
32
+ const _rp = new Vector3();
33
+ /**
34
+ * Writes one local matrix per copy into `out` (grown as needed). `root` is the layout
35
+ * root (its matrixWorld must be current). Without ground (or root) copies keep their
36
+ * slot height. Area / path positions are metres: divided by the root's world scale,
37
+ * so the object's scale sizes the copies and not the layout.
38
+ */
39
+ export function placeCopies(copies, opts, root, out) {
40
+ while (out.length < copies.length)
41
+ out.push(new Matrix4());
42
+ out.length = copies.length;
43
+ const ground = !!opts.onGround && !!root;
44
+ if (ground)
45
+ _inv.copy(root.matrixWorld).invert();
46
+ const metric = isMetricLayout(opts.layout) && !!root;
47
+ if (metric)
48
+ root.matrixWorld.decompose(_rp, _rq, _rootScale);
49
+ for (let i = 0; i < copies.length; i++) {
50
+ const c = copies[i];
51
+ _pos.set(c.position[0], c.position[1], c.position[2]);
52
+ if (metric)
53
+ _pos.set(_pos.x / (_rootScale.x || 1), _pos.y / (_rootScale.y || 1), _pos.z / (_rootScale.z || 1));
54
+ _q.setFromEuler(_e.set(c.rotation[0], c.rotation[1], c.rotation[2]));
55
+ _s.set(c.scale[0], c.scale[1], c.scale[2]);
56
+ if (ground) {
57
+ _w.copy(_pos).applyMatrix4(root.matrixWorld);
58
+ const h = groundHeightAt(_w.x, _w.z);
59
+ if (h !== null) {
60
+ _w.y = h;
61
+ _pos.copy(_w).applyMatrix4(_inv);
62
+ if (opts.alignToSlope) {
63
+ const hx = groundHeightAt(_w.x + SLOPE_STEP, _w.z) ?? h;
64
+ const hz = groundHeightAt(_w.x, _w.z + SLOPE_STEP) ?? h;
65
+ // world normal of the plane through the three samples, into root space
66
+ _n.set(h - hx, SLOPE_STEP, h - hz).normalize().transformDirection(_inv);
67
+ _tilt.setFromUnitVectors(UP, _n);
68
+ _q.premultiply(_tilt);
69
+ }
70
+ }
71
+ }
72
+ out[i].compose(_pos, _q, _s);
73
+ }
74
+ return out;
75
+ }
76
+ const EPS_MOVE = 0.01;
77
+ const REDROP_EVERY = 6;
78
+ /** When a layout with onGround has to re-drop its copies. One per layout. */
79
+ export class GroundTracker {
80
+ version = -1;
81
+ last = new Matrix4();
82
+ placedOnce = false;
83
+ pending = false;
84
+ frame = 0;
85
+ /** Call once per frame with the layout root (matrixWorld current). True = re-place now. */
86
+ tick(root) {
87
+ this.frame++;
88
+ const v = groundVersion();
89
+ if (v !== this.version || !this.placedOnce || moved(this.last, root.matrixWorld))
90
+ this.pending = true;
91
+ if (!this.pending)
92
+ return false;
93
+ if (this.placedOnce && this.frame % REDROP_EVERY)
94
+ return false;
95
+ this.version = v;
96
+ this.last.copy(root.matrixWorld);
97
+ this.placedOnce = true;
98
+ this.pending = false;
99
+ return true;
100
+ }
101
+ reset() { this.placedOnce = false; }
102
+ }
103
+ function moved(a, b) {
104
+ const x = a.elements, y = b.elements;
105
+ // translation by more than EPS_MOVE metres; rotation / scale columns by more than EPS_MOVE
106
+ for (let i = 0; i < 16; i++) {
107
+ if (i === 3 || i === 7 || i === 11 || i === 15)
108
+ continue;
109
+ if (Math.abs(x[i] - y[i]) > EPS_MOVE)
110
+ return true;
111
+ }
112
+ return false;
113
+ }
@@ -0,0 +1,15 @@
1
+ import type { BufferGeometry, Matrix4 } from 'three';
2
+ export interface LinkPartInfo {
3
+ geometry: BufferGeometry;
4
+ /** the part's matrix relative to the source's master */
5
+ rel: Matrix4;
6
+ }
7
+ export interface LinkState {
8
+ status: 'shared' | 'fallback';
9
+ parts: LinkPartInfo[];
10
+ version: number;
11
+ }
12
+ export declare function publishLink(sourceId: string, status: LinkState['status'], parts: LinkPartInfo[]): void;
13
+ export declare function clearLink(sourceId: string): void;
14
+ export declare const linkState: (sourceId: string) => LinkState | undefined;
15
+ //# sourceMappingURL=linkRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/linkRegistry.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,wDAAwD;IACxD,GAAG,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB;AAID,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAGtG;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGhD;AAED,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,KAAG,SAAS,GAAG,SAAiC,CAAC"}
@@ -0,0 +1,11 @@
1
+ const states = new Map();
2
+ export function publishLink(sourceId, status, parts) {
3
+ const prev = states.get(sourceId);
4
+ states.set(sourceId, { status, parts, version: (prev?.version ?? 0) + 1 });
5
+ }
6
+ export function clearLink(sourceId) {
7
+ const prev = states.get(sourceId);
8
+ if (prev)
9
+ states.set(sourceId, { status: 'fallback', parts: [], version: prev.version + 1 });
10
+ }
11
+ export const linkState = (sourceId) => states.get(sourceId);
@@ -1,5 +1,6 @@
1
1
  import { BufferGeometry } from 'three';
2
- export type ShapeName = 'heart' | 'box' | 'star' | 'polygon' | 'gear' | 'flower' | 'spade' | 'club' | 'diamond' | 'droplet' | 'lightning' | 'sparkle' | 'shield' | 'pawPrint' | 'superformula' | 'sphere' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'ring' | 'arcPlane' | 'bentPlane' | 'bentPlaneInverse' | 'capsule' | 'icosahedron' | 'octahedron' | 'tetrahedron' | 'dodecahedron' | 'text' | 'point' | 'custom' | 'infinity';
2
+ import { type ScriptParams } from '@3driseai/3drise-core';
3
+ export type ShapeName = 'heart' | 'box' | 'star' | 'polygon' | 'gear' | 'flower' | 'spade' | 'club' | 'diamond' | 'droplet' | 'lightning' | 'sparkle' | 'shield' | 'pawPrint' | 'superformula' | 'sphere' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'ring' | 'arcPlane' | 'bentPlane' | 'bentPlaneInverse' | 'capsule' | 'icosahedron' | 'octahedron' | 'tetrahedron' | 'dodecahedron' | 'text' | 'point' | 'custom' | 'infinity' | 'outline' | 'extrude' | 'lathe' | 'sweep' | 'svg' | 'superellipsoid' | 'torusKnot' | 'script';
3
4
  export interface ShapeOptions {
4
5
  type: ShapeName;
5
6
  curveSegments?: number;
@@ -7,7 +8,8 @@ export interface ShapeOptions {
7
8
  segments?: number;
8
9
  rings?: number;
9
10
  /** counts */
10
- points?: number;
11
+ /** star / sparkle: the point count; outline / extrude: the plan outline as [x, z] metres */
12
+ points?: number | number[][];
11
13
  sides?: number;
12
14
  petals?: number;
13
15
  teeth?: number;
@@ -68,6 +70,30 @@ export interface ShapeOptions {
68
70
  /** infinity */
69
71
  waist?: number;
70
72
  thickness?: number;
73
+ /** parametric recipes (core ParametricShapeConfig) */
74
+ holes?: number[][][];
75
+ profile?: number[][];
76
+ path?: number[][];
77
+ curve?: number;
78
+ depth?: number;
79
+ twist?: number;
80
+ angle?: number;
81
+ cap?: boolean;
82
+ scaleEnd?: number;
83
+ closed?: boolean;
84
+ svg?: string;
85
+ svgUrl?: string;
86
+ orientation?: 'flat' | 'upright';
87
+ e1?: number;
88
+ e2?: number;
89
+ crease?: number;
90
+ /** torusKnot */
91
+ p?: number;
92
+ q?: number;
93
+ /** script */
94
+ source?: string;
95
+ params?: ScriptParams;
96
+ schema?: Record<string, unknown>;
71
97
  }
72
98
  export type ShapeGenerator = (opts: ShapeOptions) => BufferGeometry;
73
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../../src/utils/shapes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAyQ,MAAM,OAAO,CAAC;AAG3T,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,kBAAkB,GAAG,SAAS,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEpa,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aA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,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,aAAa;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAKD,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,cAAc,CAAC;AAgBpE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,cAAc,CA+b7D,CAAC"}
@@ -1,6 +1,11 @@
1
- import { BoxGeometry, BufferGeometry, CapsuleGeometry, ConeGeometry, CylinderGeometry, DodecahedronGeometry, ExtrudeGeometry, Float32BufferAttribute, IcosahedronGeometry, OctahedronGeometry, Path, PlaneGeometry, RingGeometry, Shape, ShapeGeometry, SphereGeometry, TetrahedronGeometry, TorusGeometry, } from 'three';
1
+ import { BoxGeometry, BufferGeometry, CapsuleGeometry, ConeGeometry, CylinderGeometry, DodecahedronGeometry, ExtrudeGeometry, Float32BufferAttribute, IcosahedronGeometry, OctahedronGeometry, Path, PlaneGeometry, RingGeometry, Shape, ShapeGeometry, SphereGeometry, TetrahedronGeometry, TorusGeometry, TorusKnotGeometry, } from 'three';
2
2
  import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
3
+ import { buildParametricGeometry } from '@3driseai/3drise-core';
3
4
  import { buildTextGeometry, outlineFontSync } from './textShape.js';
5
+ import { cachedScriptGeometry } from './geometryScript.js';
6
+ import { svgAssetSync } from './svgAsset.js';
7
+ /** A recipe generator: the config is the recipe (core buildParametricGeometry). */
8
+ const parametric = (o) => buildParametricGeometry(o);
4
9
  const safeNumber = (value, fallback, min) => {
5
10
  const num = typeof value === 'number' && !Number.isNaN(value) ? value : fallback;
6
11
  return min !== undefined ? Math.max(num, min) : num;
@@ -222,7 +227,8 @@ export const shapeGenerators = {
222
227
  }
223
228
  return geometry;
224
229
  },
225
- star: ({ points = 5, outer = 0.5, inner = 0.2, curveSegments, bevelThickness, bevelSize, bevelSegments }) => {
230
+ star: ({ points: count = 5, outer = 0.5, inner = 0.2, curveSegments, bevelThickness, bevelSize, bevelSegments }) => {
231
+ const points = typeof count === 'number' ? count : 5;
226
232
  const s = new Shape();
227
233
  for (let i = 0; i < points * 2; i++) {
228
234
  const r = i % 2 === 0 ? outer : inner;
@@ -361,7 +367,8 @@ export const shapeGenerators = {
361
367
  s.closePath();
362
368
  return extrude(s, curveSegments, bevelThickness, bevelSize, bevelSegments);
363
369
  },
364
- sparkle: ({ points = 4, outer = 0.5, inner = 0.14, curveSegments, bevelThickness = 0.015, bevelSize = 0.015, bevelSegments = 1 }) => {
370
+ sparkle: ({ points: count = 4, outer = 0.5, inner = 0.14, curveSegments, bevelThickness = 0.015, bevelSize = 0.015, bevelSegments = 1 }) => {
371
+ const points = typeof count === 'number' ? count : 4;
365
372
  const step = (Math.PI * 2) / points;
366
373
  const tip = (k) => {
367
374
  const a = k * step + Math.PI / 2;
@@ -419,6 +426,28 @@ export const shapeGenerators = {
419
426
  blob(0.26, 0.10, 0.11, 0.14),
420
427
  ], false);
421
428
  },
429
+ /* ---------------- parametric recipes: the config is the recipe (core geometry/parametricGeometry.ts) ---------------- */
430
+ outline: parametric,
431
+ extrude: parametric,
432
+ lathe: parametric,
433
+ sweep: parametric,
434
+ superellipsoid: parametric,
435
+ svg: (o) => {
436
+ // an uploaded .svg is fetched once (svgAsset); until it lands the shape is empty and GeometryShape re-renders when it does
437
+ if (o.svgUrl) {
438
+ const text = svgAssetSync(o.svgUrl);
439
+ if (text === null)
440
+ return new BufferGeometry();
441
+ return buildParametricGeometry(o, text);
442
+ }
443
+ return parametric(o);
444
+ },
445
+ torusKnot: ({ radius = 1, tube = 0.3, p = 2, q = 3, radialSegments = 12, tubularSegments = 128 }) => new TorusKnotGeometry(safeNumber(radius, 1, 0.0001), safeNumber(tube, 0.3, 0.0001), safeNumber(tubularSegments, 128, 16), safeNumber(radialSegments, 12, 3), safeNumber(p, 2, 1), safeNumber(q, 3, 1)),
446
+ /* ---------------- scripted: built in the geometry worker (utils/geometryScript.ts); read from its cache here ---------------- */
447
+ script: ({ source = '', params = {} }) => {
448
+ const hit = cachedScriptGeometry(source, params);
449
+ return hit ? hit.geometry.clone() : new BufferGeometry();
450
+ },
422
451
  /* ---------------- parametric ---------------- */
423
452
  superformula: ({ symmetry = 6, // was m — rotational symmetry (lobe / corner count)
424
453
  roundness = 0.3, // was n1 — overall inflation: lower = puffier, higher = pinched/spikier
@@ -0,0 +1,61 @@
1
+ import { InstancedMesh, Matrix4, Mesh } from 'three';
2
+ import type { Object3D } from 'three';
3
+ /** One drawn part: the master mesh and what draws it at every slot. */
4
+ export interface SharedPart {
5
+ source: Mesh;
6
+ /** instanced mode: one InstancedMesh for all slots */
7
+ inst: InstancedMesh | null;
8
+ /** mirrors mode: one Mesh per slot */
9
+ mirrors: Mesh[] | null;
10
+ /** the part's matrix relative to its master */
11
+ rel: Matrix4;
12
+ relValid: boolean;
13
+ tintFor: string;
14
+ tintKey: unknown;
15
+ }
16
+ export interface SharedSyncInput {
17
+ /** Number of slots. */
18
+ count: number;
19
+ /** Slot k's matrix in the draw root's space (the master's frame there), or null = hidden. */
20
+ slot: (k: number) => Matrix4 | null;
21
+ /** Slots moved / changed since the last sync. */
22
+ slotsDirty: boolean;
23
+ /** Re-scan the master's meshes (a model landed, a geometry was rebuilt). Cheap enough every few frames. */
24
+ checkParts: boolean;
25
+ /** Per-slot tint shift [hue turns, lightness] (instanced parts only), and what it was computed from. */
26
+ tint?: {
27
+ amount: number;
28
+ of: (k: number) => [number, number];
29
+ key: unknown;
30
+ };
31
+ }
32
+ export declare const sameMatrix: (a: Matrix4, b: Matrix4) => boolean;
33
+ /** The meshes of a master, whether they must be mirrored, and why they cannot be shared (if they cannot). */
34
+ export declare function collectParts(master: Object3D, forceMirrors: boolean): {
35
+ meshes: Mesh[];
36
+ mirrors: boolean;
37
+ reason?: string;
38
+ };
39
+ /** Draws one master at `count` slots under `drawRoot`. One per master (a layout's variant, a link source). */
40
+ export declare class SharedParts {
41
+ private readonly drawRoot;
42
+ /** tagged on every drawn mesh as userData.layoutVariant (picking maps a hit back to its slot) */
43
+ private readonly tag;
44
+ private readonly forceMirrors;
45
+ parts: SharedPart[];
46
+ /** Bumps when the part set changes (pick proxies rebuild on it). */
47
+ version: number;
48
+ private signature;
49
+ private count;
50
+ constructor(drawRoot: Object3D,
51
+ /** tagged on every drawn mesh as userData.layoutVariant (picking maps a hit back to its slot) */
52
+ tag: number, forceMirrors?: boolean);
53
+ /** Draws the master at every slot. Returns why it cannot be shared (the caller falls back), or null. */
54
+ sync(master: Object3D, input: SharedSyncInput): string | null;
55
+ private rebuild;
56
+ private writeTint;
57
+ private disposeParts;
58
+ /** Takes the drawing down and puts the master's meshes back on the render layers. */
59
+ dispose(): void;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