@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.
Files changed (408) 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/utils/composerHostedPass.d.ts +74 -0
  370. package/dist/utils/composerHostedPass.d.ts.map +1 -0
  371. package/dist/utils/composerHostedPass.js +63 -0
  372. package/dist/utils/geometryScript.d.ts +17 -0
  373. package/dist/utils/geometryScript.d.ts.map +1 -0
  374. package/dist/utils/geometryScript.js +92 -0
  375. package/dist/utils/geometryScript.worker.d.ts +2 -0
  376. package/dist/utils/geometryScript.worker.d.ts.map +1 -0
  377. package/dist/utils/geometryScript.worker.js +42 -0
  378. package/dist/utils/groundRegistry.d.ts +11 -0
  379. package/dist/utils/groundRegistry.d.ts.map +1 -0
  380. package/dist/utils/groundRegistry.js +39 -0
  381. package/dist/utils/instancingSupport.d.ts +9 -0
  382. package/dist/utils/instancingSupport.d.ts.map +1 -0
  383. package/dist/utils/instancingSupport.js +13 -0
  384. package/dist/utils/landPatch.d.ts +26 -5
  385. package/dist/utils/landPatch.d.ts.map +1 -1
  386. package/dist/utils/landPatch.js +124 -9
  387. package/dist/utils/layoutPlacement.d.ts +30 -0
  388. package/dist/utils/layoutPlacement.d.ts.map +1 -0
  389. package/dist/utils/layoutPlacement.js +113 -0
  390. package/dist/utils/linkRegistry.d.ts +15 -0
  391. package/dist/utils/linkRegistry.d.ts.map +1 -0
  392. package/dist/utils/linkRegistry.js +11 -0
  393. package/dist/utils/shapes.d.ts +28 -2
  394. package/dist/utils/shapes.d.ts.map +1 -1
  395. package/dist/utils/shapes.js +32 -3
  396. package/dist/utils/sharedParts.d.ts +61 -0
  397. package/dist/utils/sharedParts.d.ts.map +1 -0
  398. package/dist/utils/sharedParts.js +268 -0
  399. package/dist/utils/svgAsset.d.ts +6 -0
  400. package/dist/utils/svgAsset.d.ts.map +1 -0
  401. package/dist/utils/svgAsset.js +46 -0
  402. package/dist/utils/waterLight.d.ts +29 -0
  403. package/dist/utils/waterLight.d.ts.map +1 -0
  404. package/dist/utils/waterLight.js +67 -0
  405. package/dist/utils/waterReflection.d.ts +185 -0
  406. package/dist/utils/waterReflection.d.ts.map +1 -0
  407. package/dist/utils/waterReflection.js +616 -0
  408. package/package.json +4 -3
@@ -2,9 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { useObjectReady } from '../hooks/useObjectReady.js';
4
4
  import { EdgesGeometry, WireframeGeometry, Mesh, MeshBasicMaterial, Raycaster, Vector3, DoubleSide, } from 'three';
5
- import { buildSegmentQuadGeometry } from '@3driseai/3drise-core';
5
+ import { applyShapeLayout, applyShapeLayoutGrounds, buildSegmentQuadGeometry, shapeLayoutData } from '@3driseai/3drise-core';
6
+ import LayoutGrounds from './layout/LayoutGrounds.js';
7
+ import { useLayoutRefVersion } from '../hooks/useResolvedLayout.js';
6
8
  import { shapeGenerators } from '../utils/shapes.js';
7
9
  import { DEFAULT_TEXT_SHAPE_FONT, loadOutlineFont } from '../utils/textShape.js';
10
+ import { buildScriptGeometry, cachedScriptGeometry } from '../utils/geometryScript.js';
11
+ import { loadSvgAsset, svgAssetSync } from '../utils/svgAsset.js';
12
+ import { scriptKey } from '@3driseai/3drise-core';
8
13
  import PointCloud from './PointCloud.js';
9
14
  /**
10
15
  * World-space half-thickness of a line ribbon at `lineWidth: 1`. Line modes are
@@ -53,16 +58,72 @@ function useTextShapeFont(cfg) {
53
58
  }, [font]);
54
59
  return font === null ? 0 : tick;
55
60
  }
56
- export function useShapeGeometry(options) {
61
+ /**
62
+ * Shapes built elsewhere: a geometry script runs in the worker (utils/geometryScript.ts), an uploaded .svg is
63
+ * fetched (utils/svgAsset.ts). The generator reads their caches synchronously; this bumps once the build / fetch
64
+ * lands (or fails — the generator then yields an empty geometry and the controller shows the error).
65
+ */
66
+ function useAsyncShapeTick(cfg) {
67
+ const [tick, setTick] = useState(0);
68
+ const c = cfg;
69
+ const key = c.type === 'script' ? scriptKey(c.source ?? '', c.params ?? {}) : null;
70
+ const svgUrl = c.type === 'svg' && c.svgUrl ? c.svgUrl : null;
71
+ useEffect(() => {
72
+ if (!key || cachedScriptGeometry(c.source ?? '', c.params ?? {}))
73
+ return;
74
+ let dead = false;
75
+ const bump = () => { if (!dead)
76
+ setTick((t) => t + 1); };
77
+ buildScriptGeometry(c.source ?? '', c.params ?? {}).then(bump, bump);
78
+ return () => { dead = true; };
79
+ }, [key]); // eslint-disable-line react-hooks/exhaustive-deps
80
+ useEffect(() => {
81
+ if (!svgUrl || svgAssetSync(svgUrl) !== null)
82
+ return;
83
+ let dead = false;
84
+ const bump = () => { if (!dead)
85
+ setTick((t) => t + 1); };
86
+ loadSvgAsset(svgUrl).then(bump, bump);
87
+ return () => { dead = true; };
88
+ }, [svgUrl]);
89
+ return tick;
90
+ }
91
+ /** The shape's geometry and, with a layout applied (the object's layout.shape), its ground holes' geometries. */
92
+ function useShapeBuild(options, shapeLayout) {
57
93
  const safeOptions = useMemo(() => normalizeShapeConfig(options), [options]);
58
94
  const key = JSON.stringify(safeOptions);
59
95
  const fontTick = useTextShapeFont(safeOptions);
60
- const geometry = useMemo(() => {
96
+ const asyncTick = useAsyncShapeTick(safeOptions);
97
+ // a saved layout by ref rebuilds when it loads / is edited; the ground textures don't change the geometry
98
+ const layoutTick = useLayoutRefVersion(shapeLayout?.ref);
99
+ const layoutKey = shapeLayout ? JSON.stringify({ ...shapeLayout, groundTexture: undefined, groundTextures: undefined }) : '';
100
+ const built = useMemo(() => {
61
101
  const generator = shapeGenerators[safeOptions.type] ?? shapeGenerators.box;
62
- return generator(safeOptions);
63
- }, [safeOptions.type, key, fontTick]); // eslint-disable-line react-hooks/exhaustive-deps
64
- useEffect(() => () => geometry.dispose(), [geometry]);
65
- return geometry;
102
+ const base = generator(safeOptions);
103
+ if (!shapeLayout)
104
+ return { geometry: base, grounds: [] };
105
+ // until a saved layout has loaded (or when it gives nothing) the shape shows as it is
106
+ let shaped = null, grounds = [];
107
+ try {
108
+ const layout = shapeLayoutData(shapeLayout);
109
+ shaped = applyShapeLayout(base, safeOptions.type, shapeLayout, layout);
110
+ if (shaped)
111
+ grounds = applyShapeLayoutGrounds(base, safeOptions.type, shapeLayout, layout);
112
+ }
113
+ catch (e) {
114
+ console.warn('[shapeLayout] could not apply the layout:', e);
115
+ }
116
+ if (!shaped)
117
+ return { geometry: base, grounds: [] };
118
+ base.dispose();
119
+ return { geometry: shaped, grounds };
120
+ }, [safeOptions.type, key, fontTick, asyncTick, layoutTick, layoutKey]); // eslint-disable-line react-hooks/exhaustive-deps
121
+ useEffect(() => () => { built.geometry.dispose(); for (const g of built.grounds)
122
+ g.geometry.dispose(); }, [built]);
123
+ return built;
124
+ }
125
+ export function useShapeGeometry(options, shapeLayout) {
126
+ return useShapeBuild(options, shapeLayout).geometry;
66
127
  }
67
128
  function getTriangles(geo) {
68
129
  const pos = geo.attributes.position;
@@ -329,14 +390,14 @@ function useModeData(geometry, config) {
329
390
  const key = [safeConfig.mode, safeConfig.count, safeConfig.symmetry, safeConfig.spacing, safeConfig.slices, safeConfig.linkRadius, safeConfig.angle].join('|');
330
391
  return useMemo(() => computeMode(geometry, safeConfig), [geometry, key]); // eslint-disable-line react-hooks/exhaustive-deps
331
392
  }
332
- export function GeometryMesh({ config, materialSettings, animations, modeConfig = defaultModeConfig, color = '#ffffff', children, onObjectReady, onObjectDispose }) {
393
+ export function GeometryMesh({ config, shapeLayout, materialSettings, animations, modeConfig = defaultModeConfig, color = '#ffffff', children, onObjectReady, onObjectDispose }) {
333
394
  const rootRef = useRef(null);
334
395
  useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
335
396
  // The points branch delegates to PointCloud, which owns and reports its own
336
397
  // <points>; relabel so it still surfaces as this geometry's config.
337
398
  const reportReady = (_object, ref) => onObjectReady && onObjectReady(config, ref);
338
399
  const reportDispose = (_object, ref) => onObjectDispose && onObjectDispose(config, ref);
339
- const geometry = useShapeGeometry(config);
400
+ const { geometry, grounds } = useShapeBuild(config, shapeLayout);
340
401
  const safeModeConfig = normalizeModeConfig(modeConfig);
341
402
  const data = useModeData(geometry, safeModeConfig);
342
403
  // Line modes are ribbons of quads, not line primitives, so the material
@@ -355,7 +416,7 @@ export function GeometryMesh({ config, materialSettings, animations, modeConfig
355
416
  return lineGeometry ? (_jsx("mesh", { ref: rootRef, geometry: lineGeometry, children: children ?? _jsx("meshBasicMaterial", { color: color, side: DoubleSide }) })) : null;
356
417
  if (data.kind === 'plexus')
357
418
  return (_jsxs("group", { ref: rootRef, children: [_jsx(PointCloud, { positions: data.positions, animations: animations, materialSettings: materialSettings }), lineGeometry && (_jsx("mesh", { geometry: lineGeometry, children: children ?? _jsx("meshBasicMaterial", { color: color, side: DoubleSide, transparent: true, opacity: 0.45 }) }))] }));
358
- return (_jsx("mesh", { ref: rootRef, geometry: geometry, children: children ?? _jsx("meshPhongMaterial", { color: color, side: DoubleSide }) }));
419
+ return (_jsxs("mesh", { ref: rootRef, geometry: geometry, children: [children ?? _jsx("meshPhongMaterial", { color: color, side: DoubleSide }), shapeLayout && grounds.length > 0 && _jsx(LayoutGrounds, { grounds: grounds, shapeLayout: shapeLayout, uv: "metres", untextured: "object" })] }));
359
420
  }
360
421
  export function FitGroup({ geometry, radius = 1.7, children }) {
361
422
  const { scale, position } = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"LandObject.d.ts","sourceRoot":"","sources":["../../src/components/LandObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,uBAAuB,CAAC;AAC5G,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,aAAa,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAMF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAYzC,CAAC;AACF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"LandObject.d.ts","sourceRoot":"","sources":["../../src/components/LandObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,uBAAuB,CAAC;AAC5G,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,aAAa,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAMF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAazC,CAAC;AACF,eAAe,UAAU,CAAC"}
@@ -10,6 +10,6 @@ const LandObject = ({ createdObject, onObjectReady, onObjectDispose }) => {
10
10
  const Component = FAMILY[config.type];
11
11
  if (!Component)
12
12
  return null;
13
- return _jsx(Component, { config: config, id: createdObject.id, keyframes: createdObject.animations?.land?.animations, mouseMove: createdObject.mouseMove?.land, onObjectReady: (_source, ref) => onObjectReady?.(createdObject, ref), onObjectDispose: (_source, ref) => onObjectDispose?.(createdObject, ref) });
13
+ return _jsx(Component, { config: config, id: createdObject.id, shapeLayout: createdObject.layout?.shape, keyframes: createdObject.animations?.land?.animations, mouseMove: createdObject.mouseMove?.land, onObjectReady: (_source, ref) => onObjectReady?.(createdObject, ref), onObjectDispose: (_source, ref) => onObjectDispose?.(createdObject, ref) });
14
14
  };
15
15
  export default LandObject;
@@ -5,7 +5,8 @@ import type { CreatedObjectSettings, ObjectLayoutSettings } from '@3driseai/3dri
5
5
  export interface LayoutInstancesProps {
6
6
  createdObject: CreatedObjectSettings;
7
7
  layout: ObjectLayoutSettings;
8
- render: (slot: number) => ReactNode;
8
+ /** Renders one copy: its slot index and the object with the copy's variant applied. */
9
+ render: (slot: number, obj: CreatedObjectSettings) => ReactNode;
9
10
  handleObjectClick?: (createdObject: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
10
11
  }
11
12
  declare const LayoutInstances: import("react").MemoExoticComponent<({ createdObject, layout, render, handleObjectClick }: LayoutInstancesProps) => import("react").JSX.Element>;
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutInstances.d.ts","sourceRoot":"","sources":["../../src/components/LayoutInstances.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAc,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAErG,MAAM,WAAW,oBAAoB;IACjC,aAAa,EAAE,qBAAqB,CAAC;IACrC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC;IACpC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACpH;AAmCD,QAAA,MAAM,eAAe,6FAA+D,oBAAoB,iCAmBtG,CAAC;AAGH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"LayoutInstances.d.ts","sourceRoot":"","sources":["../../src/components/LayoutInstances.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAc,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGrG,MAAM,WAAW,oBAAoB;IACjC,aAAa,EAAE,qBAAqB,CAAC;IACrC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,uFAAuF;IACvF,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAChE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACpH;AAoCD,QAAA,MAAM,eAAe,6FAA+D,oBAAoB,iCAwCtG,CAAC;AAGH,eAAe,eAAe,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // =============================================================================
3
3
  // LayoutInstances — repeat one scene object across a gallery layout
4
4
  // =============================================================================
@@ -15,9 +15,16 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
15
15
  // - Clicks are per slot: zoom / glow / vanish target the copy that was clicked, the
16
16
  // same way gallery frames behave.
17
17
  // - Motion stays on the CreatedObject group, so the whole layout animates as one.
18
+ // - This is the full-copy path: effects, lights, and mesh / model layouts that
19
+ // cannot be instanced (InstancedLayout handles the rest). Copies get the same
20
+ // variation (size, turn, variant — core layoutCopies) and ground placement
21
+ // (onGround, utils/layoutPlacement); tint needs instance colours and is
22
+ // instanced-only.
18
23
  import { memo, useMemo, useRef } from 'react';
19
- import { generateLayoutSlots } from '@3driseai/3drise-core';
20
- const LayoutSlotGroup = ({ slot, index, createdObject, handleObjectClick, children }) => {
24
+ import { useFrame } from '@react-three/fiber';
25
+ import { layoutCopies, objectForVariant } from '@3driseai/3drise-core';
26
+ import { GroundTracker, isMetricLayout, placeCopies } from '../utils/layoutPlacement.js';
27
+ const LayoutSlotGroup = ({ copy, index, createdObject, handleObjectClick, groupRef, children }) => {
21
28
  const ref = useRef(null);
22
29
  const onClick = handleObjectClick
23
30
  ? (e) => {
@@ -27,13 +34,39 @@ const LayoutSlotGroup = ({ slot, index, createdObject, handleObjectClick, childr
27
34
  handleObjectClick(createdObject, ref.current, e);
28
35
  }
29
36
  : undefined;
30
- return (_jsx("group", { ref: ref, name: `layout-slot-${index}`, position: slot.position, rotation: slot.rotation ?? [0, 0, 0], scale: slot.scale ?? [1, 1, 1], userData: { layoutSlot: index }, onClick: onClick, children: children }));
37
+ return (_jsx("group", { ref: (g) => { ref.current = g; groupRef(index, g); }, name: `layout-slot-${index}`, position: copy.position, rotation: copy.rotation, scale: copy.scale, userData: { layoutSlot: index }, onClick: onClick, children: children }));
31
38
  };
32
39
  const LayoutInstances = memo(({ createdObject, layout, render, handleObjectClick }) => {
33
40
  // ObjectNode normalises the block on every render, so key on its contents.
34
41
  const layoutKey = JSON.stringify(layout);
35
- const slots = useMemo(() => generateLayoutSlots(layout.count, layout), [layoutKey]);
36
- return (_jsx(_Fragment, { children: slots.map((slot, index) => (_jsx(LayoutSlotGroup, { slot: slot, index: index, createdObject: createdObject, handleObjectClick: handleObjectClick, children: render(index) }, index))) }));
42
+ const copies = useMemo(() => layoutCopies(layout, layout.count), [layoutKey]); // eslint-disable-line react-hooks/exhaustive-deps
43
+ const mix = layout.variantMix && layout.variantMix.values?.length ? layout.variantMix : null;
44
+ // onGround / area / path: the slot groups are placed imperatively (their JSX transform is the raw slot):
45
+ // dropped onto the ground, and area / path positions kept in metres whatever the object's scale.
46
+ const rootRef = useRef(null);
47
+ const groups = useRef([]);
48
+ const groupRef = useRef((i, g) => { groups.current[i] = g; }).current;
49
+ const tracker = useMemo(() => new GroundTracker(), []);
50
+ const matrices = useRef([]);
51
+ const placedFor = useRef(null);
52
+ useFrame(() => {
53
+ const root = rootRef.current;
54
+ if (!root || !(layout.onGround || isMetricLayout(layout.layout))) {
55
+ placedFor.current = null;
56
+ return;
57
+ }
58
+ if (placedFor.current !== copies) {
59
+ placedFor.current = copies;
60
+ tracker.reset();
61
+ }
62
+ root.updateWorldMatrix(true, false);
63
+ if (!tracker.tick(root))
64
+ return;
65
+ placeCopies(copies, layout, root, matrices.current);
66
+ matrices.current.forEach((m, i) => { const g = groups.current[i]; if (g)
67
+ m.decompose(g.position, g.quaternion, g.scale); });
68
+ });
69
+ return (_jsx("group", { ref: rootRef, name: "layout-copies", children: copies.map((copy, index) => (_jsx(LayoutSlotGroup, { copy: copy, index: index, createdObject: createdObject, handleObjectClick: handleObjectClick, groupRef: groupRef, children: render(index, objectForVariant(createdObject, mix, copy.variant)) }, index))) }));
37
70
  });
38
71
  LayoutInstances.displayName = 'LayoutInstances';
39
72
  export default LayoutInstances;
@@ -1 +1 @@
1
- {"version":3,"file":"LightObject.d.ts","sourceRoot":"","sources":["../../src/components/LightObject.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAUnE,KAAK,gBAAgB,GAAG,gBAAgB,GAAG;IACvC,aAAa,EAAE,qBAAqB,CAAC;CACxC,CAAC;AA+CF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+B3C,CAAC;AACF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"LightObject.d.ts","sourceRoot":"","sources":["../../src/components/LightObject.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAWnE,KAAK,gBAAgB,GAAG,gBAAgB,GAAG;IACvC,aAAa,EAAE,qBAAqB,CAAC;CACxC,CAAC;AA+CF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiC3C,CAAC;AACF,eAAe,WAAW,CAAC"}
@@ -9,6 +9,7 @@ import SpotBeam from './spotBeam/SpotBeam.js';
9
9
  import LedArray from './ledArray/LedArray.js';
10
10
  import FluorescentTube from './fluorescentTube/FluorescentTube.js';
11
11
  import Candle from './candle/Candle.js';
12
+ import Projector from './projector/Projector.js';
12
13
  const DirectionalLightR3F = ({ config, animations, mouseMove, settings, onObjectReady, onObjectDispose }) => {
13
14
  const lightRef = useRef(null);
14
15
  useObjectReady(lightRef, settings, onObjectReady, onObjectDispose);
@@ -81,6 +82,8 @@ const LightObject = ({ createdObject, onObjectReady, onObjectDispose }) => {
81
82
  // A visible bulb: point light + glass/filament/base + self-drawn glow.
82
83
  case 'lightBulb':
83
84
  return _jsx(LightBulb, { id: createdObject.id, config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
85
+ case 'projector':
86
+ return _jsx(Projector, { id: createdObject.id, config: config, animations: animations, mouseMove: mouseMove, settings: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose });
84
87
  default:
85
88
  return null;
86
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAA2C,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiBrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA8BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmJzC,CAAC;AACF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAA2C,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiBrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA8BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgMzC,CAAC;AACF,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useContext, useMemo } from "react";
2
+ import { useCallback, useContext, useMemo, useState } from "react";
3
3
  import { GroupMaterialContext, groupMaterialFor } from "./GroupMaterialContext.js";
4
4
  import { EnabledContext } from "./EnabledContext.js";
5
5
  import CustomPrimitive from "./CustomPrimitive.js";
@@ -13,15 +13,22 @@ import LandObject from "./LandObject.js";
13
13
  import TextGenerator from "./TextGenerator.js";
14
14
  import ImageObject from "./ImageObject.js";
15
15
  import GalleryObject from "./GalleryObject.js";
16
+ import UrbanObject from "./UrbanObject.js";
17
+ import VegetationObject from "./VegetationObject.js";
18
+ import SportsObject from "./SportsObject.js";
19
+ import WaterObject from "./WaterObject.js";
16
20
  import Galaxy from "./Galaxy.js";
17
21
  import GridGenerator from "./GridsGenerator.js";
18
- import OceanBuilder from "./OceanBuilder.js";
19
22
  import LandscapeObject from "./LandscapeObject.js";
20
23
  import LayoutInstances from "./LayoutInstances.js";
24
+ import InstancedLayout from "./layout/InstancedLayout.js";
25
+ import LinkedSource from "./layout/LinkedSource.js";
26
+ import LinkProxies from "./layout/LinkProxies.js";
27
+ import { useLinkStatus } from "../hooks/useLinkStatus.js";
21
28
  import { useRuntimeSettings } from "../hooks/useRuntimeSettings.js";
22
29
  import { usePresentedVisibility } from "../operations/usePresentedVisibility.js";
23
30
  import { SELF_MANAGED_MATERIAL } from "../constants.js";
24
- import { LAYOUT_CAPABLE_TYPES, getObjectLayoutSupport, normalizeObjectLayout, isGenerativeParticlesConfig, isGalleryObjectConfig, galleryTakesMaterial } from "@3driseai/3drise-core";
31
+ import { LAYOUT_CAPABLE_TYPES, getObjectLayoutSupport, layoutCopiesLimit, normalizeObjectLayout, resolveLinkedLook, isGenerativeParticlesConfig, isGalleryObjectConfig, galleryTakesMaterial } from "@3driseai/3drise-core";
25
32
  // Slots after the first render with no ready callbacks: one object reports once.
26
33
  const NO_READY = {};
27
34
  // A point light's shadow is six extra renders; only slot 0 keeps it. Cached per settings
@@ -44,7 +51,7 @@ const withoutShadow = (obj) => {
44
51
  // ))}
45
52
  // </>
46
53
  // ) : null;
47
- const GroupWithChildren = ({ createdObject, children, onObjectReady, onObjectDispose, handleObjectClick, renderObject }) => {
54
+ const GroupWithChildren = ({ createdObject, children, onObjectReady, onObjectDispose, handleObjectClick, renderObject, noMaterial = false, structureKey = '' }) => {
48
55
  const isGroup = createdObject.type === 'group';
49
56
  // Generative particle objects own their shaders, like effects do.
50
57
  const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type)
@@ -57,7 +64,7 @@ const GroupWithChildren = ({ createdObject, children, onObjectReady, onObjectDis
57
64
  const handed = useMemo(() => groupMaterialFor(createdObject, parentMaterial),
58
65
  // eslint-disable-next-line react-hooks/exhaustive-deps
59
66
  [createdObject.id, createdObject.type, ms, parentMaterial]);
60
- const body = (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
67
+ const body = (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial && !noMaterial, structureKey: structureKey, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
61
68
  // Always the Provider (even when it hands the parent's value on): wrapping only when a material is
62
69
  // on would change the element type here and remount the whole subtree whenever Apply is toggled —
63
70
  // new Object3Ds for every child (the studio's live preview kept writing to the old ones).
@@ -69,7 +76,13 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
69
76
  // below sees the patched object, so an action can change anything an edit can.
70
77
  const runtimeObject = useRuntimeSettings(node.createdObject?.id, node.createdObject);
71
78
  // An object whose effects follow its visibility stays drawn until they have played out.
72
- const createdObject = usePresentedVisibility(runtimeObject);
79
+ const presented = usePresentedVisibility(runtimeObject);
80
+ // Linked instance (meshSettings.instanceOf — core linkedInstances.ts): drawn by its source
81
+ // (LinkedSource) and here only its transform, interactions and pick proxies; when the source
82
+ // cannot share its drawing, it renders the source's look on its own.
83
+ const linkStatus = useLinkStatus(node.linkSource ? node.linkSource.id : null);
84
+ const linkedShared = !!node.linkSource && !!node.linkShared && linkStatus !== 'fallback';
85
+ const createdObject = useMemo(() => (presented && node.linkSource && !linkedShared ? resolveLinkedLook(presented, node.linkSource) : presented), [presented, node.linkSource, linkedShared]);
73
86
  // Enabled = its own (presented) visibility and every ancestor's — see EnabledContext.
74
87
  const parentEnabled = useContext(EnabledContext);
75
88
  const enabled = parentEnabled && createdObject?.meshSettings?.visible !== false;
@@ -132,7 +145,8 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
132
145
  // A placed body of water — the object host. The world ocean is mounted by
133
146
  // the environment instead, so this branch only ever sees a pool, a pond or
134
147
  // a canal; OceanBuilder decides which from config.host either way.
135
- ocean: (obj, onObjectReady) => (_jsx(OceanBuilder, { settings: obj, ...relabel(obj) }, obj.id)),
148
+ // A moving-water variant (waterfall, fountain, stream) renders its own construction instead.
149
+ water: (obj) => (_jsx(WaterObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, obj.id)),
136
150
  // A placed landscape — the object host. The world ground is mounted by
137
151
  // LandscapeConnector instead; this one is a diorama, a floating island or
138
152
  // a game tile, and gets its transform from the CreatedObject wrapper.
@@ -148,6 +162,14 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
148
162
  land: (obj, onObjectReady) => (_jsx(LandObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
149
163
  // Image variants (config.type: shards, …): one picture at a time from config.imageUrls, every change animated.
150
164
  image: (obj, onObjectReady) => (_jsx(ImageObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
165
+ // Urban variants (config.type: building, block, road, streetFurniture): the context city kit.
166
+ // urban takes a layout slot too (lamps along a path, a row of signs); every copy registers its lamp.
167
+ urban: (obj, _onObjectReady, slot = 0) => (_jsx(UrbanObject, { createdObject: obj, ...(slot === 0 ? { onObjectReady, onObjectDispose } : NO_READY) })),
168
+ // Vegetation variants (config.type: tree, bush, grass, flowers, crops, ivy, hedge, fruit, vegetable): procedural plants.
169
+ // takes a layout slot (InstancedLayout mirrors): slot 0 is the object itself and reports ready
170
+ vegetation: (obj, _onObjectReady, slot = 0) => (_jsx(VegetationObject, { createdObject: obj, ...(slot === 0 ? { onObjectReady, onObjectDispose } : NO_READY) })),
171
+ // Sports variants (config.type: court, ball, equipment, goal): regulation-size sports props.
172
+ sports: (obj) => (_jsx(SportsObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
151
173
  // rain: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
152
174
  // <Rain
153
175
  // settings={obj}
@@ -169,28 +191,55 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
169
191
  // />
170
192
  // ),
171
193
  }), [handleObjectClick, onObjectReady, onObjectDispose, relabel]);
194
+ // A mesh / model layout whose parts turned out not to be instanceable (InstancedLayout says why)
195
+ // renders full copies instead, with the copies limit. Per object, for this mount.
196
+ const [instancingFallback, setInstancingFallback] = useState(null);
197
+ // A link source whose parts cannot be shared: it renders as itself, its instances on their own.
198
+ const [linkFallback, setLinkFallback] = useState(null);
199
+ const onLinkFallback = useCallback((reason) => {
200
+ console.warn(`[link] ${node.createdObject?.name ?? node.objectId}: cannot share ${reason} — its linked instances render on their own.`);
201
+ setLinkFallback(reason);
202
+ }, [node.createdObject?.name, node.objectId]);
203
+ const linkedIds = node.linkedIds;
204
+ // the renderer output remounts when it becomes / stops being a link source or falls back
205
+ const structureKey = `${linkedIds?.length ? 'source' : ''}|${linkFallback ? 'fallback' : ''}|${linkedShared ? 'linked' : ''}`;
206
+ const onInstancingFallback = useCallback((reason) => {
207
+ console.warn(`[layout] ${node.createdObject?.name ?? node.objectId}: cannot instance ${reason} — drawing full copies (max ${layoutCopiesLimit(node.createdObject?.type ?? 'mesh')}).`);
208
+ setInstancingFallback(reason);
209
+ }, [node.createdObject?.name, node.createdObject?.type, node.objectId]);
172
210
  const renderObject = useCallback((obj, _handleObjectClick) => {
173
211
  const renderer = renderers[obj.type];
174
212
  if (!renderer)
175
213
  return null;
176
- // meshSettings.layout: repeat the renderer output across a gallery layout.
214
+ // a linked instance drawn by its source: only the pick proxies here
215
+ if (linkedShared)
216
+ return _jsx(LinkProxies, { sourceId: node.linkSource.id });
217
+ // a link source: draws itself and its linked instances (one draw per part, or mirrors)
218
+ if (linkedIds?.length && !linkFallback && !obj.meshSettings?.layout?.enabled)
219
+ return (_jsx(LinkedSource, { sourceId: obj.id, memberIds: linkedIds, mirrors: obj.type === 'vegetation', onFallback: onLinkFallback, children: renderer(obj, onObjectReady) }));
220
+ // meshSettings.layout: repeat the renderer output across a layout.
177
221
  // Absent on every object saved before layouts existed, which renders as before.
178
222
  const layout = LAYOUT_CAPABLE_TYPES.has(obj.type) ? normalizeObjectLayout(obj.meshSettings?.layout) : null;
179
223
  const support = layout?.enabled ? getObjectLayoutSupport(obj) : null;
180
224
  if (layout && support?.allowed) {
181
- const capped = layout.count > support.maxCount ? { ...layout, count: support.maxCount } : layout;
182
- return (_jsx(LayoutInstances, { createdObject: obj, layout: capped, handleObjectClick: handleObjectClick, render: (slot) => renderer(obj, onObjectReady, slot) }));
225
+ const shared = support.mode !== 'copies'; // instanced or mirrors: one master, shared drawing
226
+ const instanced = shared && !instancingFallback;
227
+ const max = shared && !instanced ? layoutCopiesLimit(obj.type) : support.maxCount;
228
+ const capped = layout.count > max ? { ...layout, count: max } : layout;
229
+ if (instanced)
230
+ return (_jsx(InstancedLayout, { createdObject: obj, layout: capped, mirrors: support.mode === 'mirrors', handleObjectClick: handleObjectClick, onFallback: onInstancingFallback, render: (o, slot) => renderer(o, onObjectReady, slot) }));
231
+ return (_jsx(LayoutInstances, { createdObject: obj, layout: capped, handleObjectClick: handleObjectClick, render: (slot, o) => renderer(o, onObjectReady, slot) }));
183
232
  }
184
233
  return renderer(obj, onObjectReady) ?? null;
185
- }, [onObjectReady, renderers, handleObjectClick]);
234
+ }, [onObjectReady, renderers, handleObjectClick, instancingFallback, onInstancingFallback, linkedShared, linkedIds, linkFallback, onLinkFallback, node.linkSource]);
186
235
  if (!createdObject) {
187
236
  return null;
188
237
  }
189
238
  const hasChildren = children.length > 0;
190
239
  const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
191
240
  const renderedObject = shouldRenderAsGroup
192
- ? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
193
- : _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !(SELF_MANAGED_MATERIAL.has(createdObject.type) || (createdObject.type === 'gallery' && isGalleryObjectConfig(createdObject.config) && !galleryTakesMaterial(createdObject.config))), children: renderObject(createdObject) }, createdObject.id);
241
+ ? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject, noMaterial: linkedShared, structureKey: structureKey })
242
+ : _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, structureKey: structureKey, shouldApply3driseMaterial: !linkedShared && !(SELF_MANAGED_MATERIAL.has(createdObject.type) || (createdObject.type === 'gallery' && isGalleryObjectConfig(createdObject.config) && !galleryTakesMaterial(createdObject.config))), children: renderObject(createdObject) }, createdObject.id);
194
243
  // createdObject.effects
195
244
  // ? <>
196
245
  // {renderObject(createdObject)}
@@ -14,6 +14,8 @@ export interface OceanBuilderProps extends ObjectReadyProps {
14
14
  /** The environment terrain's config: the world ocean's shoreline and the
15
15
  * terrain's shadow on the water. Omit (or disabled) for open water. */
16
16
  terrain?: TerrainConfig | null;
17
+ /** A scene object: the CreatedObject wrapper applies the transform. */
18
+ transformOwned?: boolean;
17
19
  }
18
20
  /**
19
21
  * Picks the water body for the scene.
@@ -1 +1 @@
1
- {"version":3,"file":"OceanBuilder.d.ts","sourceRoot":"","sources":["../../src/components/OceanBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD;;uEAEmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;4EACwE;IACxE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuC7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"OceanBuilder.d.ts","sourceRoot":"","sources":["../../src/components/OceanBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD;;uEAEmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;4EACwE;IACxE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyC7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -23,7 +23,7 @@ import Shore from './water/Shore.js';
23
23
  * the nearest type, its plane size onto the host, its Y onto the sea level. See
24
24
  * `normalizeOcean`.
25
25
  */
26
- const OceanBuilder = ({ settings, skySettings, timeSettings, sunIntensity, terrain, onObjectReady, onObjectDispose, }) => {
26
+ const OceanBuilder = ({ settings, skySettings, timeSettings, sunIntensity, terrain, transformOwned, onObjectReady, onObjectDispose, }) => {
27
27
  // Each block against its own source. Merging them through one object would
28
28
  // hand the renderer a new config every time a quality slider moved, which
29
29
  // rebuilds every clipmap ring.
@@ -39,6 +39,7 @@ const OceanBuilder = ({ settings, skySettings, timeSettings, sunIntensity, terra
39
39
  sunIntensity,
40
40
  id: settings?.id,
41
41
  meshSettings: settings?.meshSettings,
42
+ transformOwned,
42
43
  animations: settings?.animations,
43
44
  mouseMove: settings?.mouseMove,
44
45
  terrain,
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { PostProcessingState } from '@3driseai/3drise-core';
3
+ export interface RenderEffectsProps {
4
+ settings: PostProcessingState | null | undefined;
5
+ }
6
+ declare const RenderEffects: React.FC<RenderEffectsProps>;
7
+ export default RenderEffects;
8
+ //# sourceMappingURL=RenderEffects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderEffects.d.ts","sourceRoot":"","sources":["../../src/components/RenderEffects.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAoB3D,OAAO,KAAK,EAAyB,mBAAmB,EAAoC,MAAM,uBAAuB,CAAC;AAuC1H,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;CACpD;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkG/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { useThree } from '@react-three/fiber';
4
+ import { EffectComposer, Bloom, DepthOfField, ChromaticAberration, Vignette, Noise, Glitch, Outline, Sepia, BrightnessContrast, HueSaturation, SSAO, GodRays, ToneMapping, SMAA, } from '@react-three/postprocessing';
5
+ import { Vector2, Mesh } from 'three';
6
+ import { registerRenderEffect, registerRenderTargets } from '../render/renderLive.js';
7
+ import { attachHostedPass, useHostedPass } from '../utils/composerHostedPass.js';
8
+ /**
9
+ * The post-processing chain, from the project's post-processing settings.
10
+ *
11
+ * Moved here from the studio (client PostProcessingEffects) so the editor and a
12
+ * published scene render the same chain from the same settings — the editor wraps
13
+ * it in a connector (RenderConnector), SceneBuilder passes project.postProcessingData.
14
+ *
15
+ * Pass the settings with any 'render' action patch already laid over them
16
+ * (patchPostProcessing). Effect instances are registered with renderLive, which
17
+ * is how clip tracks and data-set sliders drive bloom / exposure / grading… per
18
+ * frame without re-rendering this.
19
+ *
20
+ * Tone mapping is the last effect of the chain, and only exists while
21
+ * post-processing is on: the canvas renders with NoToneMapping, so a scene with
22
+ * post-processing off looks exactly as it did before tone mapping was wired.
23
+ *
24
+ * A full-screen pass that would otherwise draw the frame itself (the volumetric
25
+ * clouds) is hosted inside this chain, right after the scene render — see
26
+ * composerHostedPass. Without that both drew the whole scene every frame.
27
+ */
28
+ // postprocessing's BlendFunction / ToneMappingMode values. Not imported: the
29
+ // viewer resolves `postprocessing` only through @react-three/postprocessing.
30
+ const BLEND = { MULTIPLY: 21, NORMAL: 23, SCREEN: 28, COLOR_DODGE: 5 };
31
+ const TONE_MODE = { linear: 0, reinhard: 1, cineon: 5, 'aces-filmic': 6 };
32
+ /** The view key the live handle knows an effect by (only the effects the render view exposes). */
33
+ const SLOT = {
34
+ ssao: 'ssao', bloom: 'bloom', 'color-correction': 'grading', 'depth-of-field': 'dof', vignette: 'vignette',
35
+ };
36
+ const slotRef = (slot) => slot ? (instance) => registerRenderEffect(slot, instance ?? null) : undefined;
37
+ const n = (v, d) => (typeof v === 'number' && Number.isFinite(v) ? v : d);
38
+ const RenderEffects = ({ settings }) => {
39
+ const { gl, scene } = useThree();
40
+ const sunMeshRef = useRef(new Mesh());
41
+ useEffect(() => { registerRenderTargets(gl, scene); return () => registerRenderTargets(null, null); }, [gl, scene]);
42
+ // The composer instance (null while it is not mounted), and the pass to host in it.
43
+ const [composer, setComposer] = useState(null);
44
+ const hostedPass = useHostedPass(gl);
45
+ useEffect(() => {
46
+ if (!composer || !hostedPass)
47
+ return;
48
+ return attachHostedPass(composer, hostedPass);
49
+ }, [composer, hostedPass]);
50
+ const exposure = n(settings?.toneMapping?.exposure, 1);
51
+ useEffect(() => {
52
+ const was = gl.toneMappingExposure;
53
+ gl.toneMappingExposure = exposure;
54
+ return () => { gl.toneMappingExposure = was; };
55
+ }, [gl, exposure]);
56
+ if (!settings?.globalEnabled)
57
+ return null;
58
+ const enabledEffects = (settings.effects ?? [])
59
+ .filter(e => e.enabled)
60
+ .sort((a, b) => a.order - b.order);
61
+ const toneType = settings.toneMapping?.type ?? 'none';
62
+ const tone = toneType !== 'none' ? TONE_MODE[toneType] : undefined;
63
+ if (enabledEffects.length === 0 && tone === undefined)
64
+ return null;
65
+ const needsNormals = enabledEffects.some(e => e.type === 'ssao');
66
+ const renderEffect = (effect) => {
67
+ const key = `${effect.type}-${effect.id}`;
68
+ const s = effect.settings;
69
+ const ref = slotRef(SLOT[effect.type]);
70
+ switch (effect.type) {
71
+ case 'bloom':
72
+ return _jsx(Bloom, { ref: ref, intensity: n(s.intensity, 1), luminanceThreshold: n(s.threshold, 0.85), radius: n(s.radius, 0.4), blendFunction: BLEND.SCREEN }, key);
73
+ case 'depth-of-field':
74
+ return _jsx(DepthOfField, { ref: ref, focusDistance: n(s.focusDistance, 5), bokehScale: n(s.bokehScale, 2) }, key);
75
+ case 'chromatic-aberration': {
76
+ const o = n(s.offset, 0.002);
77
+ return _jsx(ChromaticAberration, { offset: [o, o], blendFunction: BLEND.NORMAL }, key);
78
+ }
79
+ case 'vignette':
80
+ return _jsx(Vignette, { ref: ref, offset: n(s.offset, 0.5), darkness: n(s.darkness, 0.5), blendFunction: BLEND.NORMAL }, key);
81
+ case 'noise':
82
+ return _jsx(Noise, { opacity: n(s.intensity, 0.5), blendFunction: BLEND.COLOR_DODGE }, key);
83
+ case 'glitch': {
84
+ const i = n(s.intensity, 0.1);
85
+ return _jsx(Glitch, { delay: new Vector2(1.5, 3.5), duration: new Vector2(0.6, 1.0), strength: new Vector2(i, i), columns: n(s.columns, 0.05), blendFunction: BLEND.NORMAL }, key);
86
+ }
87
+ case 'outline':
88
+ return _jsx(Outline, { selection: [], edgeStrength: n(s.thickness, 1), pulseSpeed: 0, visibleEdgeColor: 0x000000, hiddenEdgeColor: 0x000000, blur: false, xRay: true }, key);
89
+ case 'sepia':
90
+ return _jsx(Sepia, { intensity: n(s.intensity, 1), blendFunction: BLEND.NORMAL }, key);
91
+ case 'color-correction':
92
+ return (_jsxs(React.Fragment, { children: [_jsx(BrightnessContrast, { ref: slotRef('grading'), brightness: n(s.brightness, 0), contrast: n(s.contrast, 0), blendFunction: BLEND.NORMAL }), _jsx(HueSaturation, { ref: slotRef('gradingHue'), hue: n(s.hue, 0), saturation: n(s.saturation, 0), blendFunction: BLEND.NORMAL })] }, key));
93
+ case 'ssao':
94
+ return _jsx(SSAO, { ref: ref, radius: n(s.radius, 0.1), intensity: n(s.intensity, 1), bias: n(s.bias, 0.025), blendFunction: BLEND.MULTIPLY }, key);
95
+ case 'god-rays':
96
+ return (_jsx(GodRays, { sun: sunMeshRef.current, blendFunction: BLEND.SCREEN, samples: 60, density: n(s.density, 0.96), decay: n(s.decay, 0.9), weight: 0.4, exposure: n(s.intensity, 0.6), clampMax: 1, width: 480, height: 480, kernelSize: 0, blur: true }, key));
97
+ case 'ssr':
98
+ case 'motion-blur':
99
+ // Not available in @react-three/postprocessing v3.
100
+ return null;
101
+ default:
102
+ return null;
103
+ }
104
+ };
105
+ // Anti-aliasing is SMAA at the end of the chain, not MSAA on the composer's
106
+ // buffers. The composer's default (8x MSAA on full-resolution HDR targets) made
107
+ // the RenderPass draw the whole scene into an 8-sample float buffer: on a 1M
108
+ // triangle city it cost 60 -> 54 fps with tone mapping alone, and 60 -> 48 with
109
+ // clouds too. With multisampling 0 + SMAA both hold 60.
110
+ return (
111
+ // Keyed on needsNormals: v3 builds the composer in an effect, so flipping
112
+ // enableNormalPass on a mounted composer renders the children once with the
113
+ // old (normal-pass-less) context and SSAO errors. A remount builds it fresh.
114
+ _jsx(EffectComposer, { ref: setComposer, multisampling: 0, enableNormalPass: needsNormals, children: [
115
+ ...enabledEffects.map(renderEffect).filter((e) => e !== null),
116
+ ...(tone !== undefined ? [_jsx(ToneMapping, { mode: tone }, `tone-${toneType}`)] : []),
117
+ _jsx(SMAA, {}, "smaa"),
118
+ ] }, needsNormals ? 'normals' : 'plain'));
119
+ };
120
+ export default RenderEffects;
@@ -1 +1 @@
1
- {"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAqB,KAAK,WAAW,EAA0B,MAAM,oBAAoB,CAAC;AAGjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAWxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG;IACzE;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,mFAAmF;IACnF,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,oEAAoE;IACpE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,YAAY;IApBd;;;OAGG;mBACY,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAC3C,mFAAmF;uBAChE,KAAK,CAAC,SAAS;IAClC,oEAAoE;SAC/D,OAAO;IACZ,qFAAqF;eAC1E,OAAO,EAAE;IACpB,2EAA2E;eAChE,MAAM;IACjB;;;OAGG;eACQ,OAAO;qCA8LpB,CAAC;AAIH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAqB,KAAK,WAAW,EAA0B,MAAM,oBAAoB,CAAC;AAGjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAcxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG;IACzE;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,mFAAmF;IACnF,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,oEAAoE;IACpE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,YAAY;IApBd;;;OAGG;mBACY,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAC3C,mFAAmF;uBAChE,KAAK,CAAC,SAAS;IAClC,oEAAoE;SAC/D,OAAO;IACZ,qFAAqF;eAC1E,OAAO,EAAE;IACpB,2EAA2E;eAChE,MAAM;IACjB;;;OAGG;eACQ,OAAO;qCAqMpB,CAAC;AAIH,eAAe,YAAY,CAAC"}