@3driseai/3drise-viewer 0.1.2 → 0.1.4

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 (331) hide show
  1. package/dist/components/AnimatedObject.d.ts +2 -1
  2. package/dist/components/AnimatedObject.d.ts.map +1 -1
  3. package/dist/components/AnimatedObject.js +11 -3
  4. package/dist/components/Bubbles.d.ts +2 -1
  5. package/dist/components/Bubbles.d.ts.map +1 -1
  6. package/dist/components/Bubbles.js +5 -2
  7. package/dist/components/CameraController.d.ts +9 -1
  8. package/dist/components/CameraController.d.ts.map +1 -1
  9. package/dist/components/CameraController.js +12 -1
  10. package/dist/components/Clouds.d.ts +2 -1
  11. package/dist/components/Clouds.d.ts.map +1 -1
  12. package/dist/components/Clouds.js +3 -4
  13. package/dist/components/CreatedObject.d.ts +2 -2
  14. package/dist/components/CreatedObject.d.ts.map +1 -1
  15. package/dist/components/CreatedObject.js +5 -10
  16. package/dist/components/CustomPrimitive.d.ts +2 -2
  17. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  18. package/dist/components/CustomPrimitive.js +6 -2
  19. package/dist/components/Earth.d.ts +2 -4
  20. package/dist/components/Earth.d.ts.map +1 -1
  21. package/dist/components/Earth.js +6 -4
  22. package/dist/components/EffectsGenerator.d.ts +2 -1
  23. package/dist/components/EffectsGenerator.d.ts.map +1 -1
  24. package/dist/components/EffectsGenerator.js +26 -25
  25. package/dist/components/EffectsGroup.d.ts +2 -1
  26. package/dist/components/EffectsGroup.d.ts.map +1 -1
  27. package/dist/components/EffectsGroup.js +7 -2
  28. package/dist/components/EnvironmentManager.js +2 -2
  29. package/dist/components/EnvironmentObject.d.ts +2 -1
  30. package/dist/components/EnvironmentObject.d.ts.map +1 -1
  31. package/dist/components/EnvironmentObject.js +2 -2
  32. package/dist/components/Frame.d.ts +3 -2
  33. package/dist/components/Frame.d.ts.map +1 -1
  34. package/dist/components/Frame.js +3 -1
  35. package/dist/components/Galaxy.d.ts +2 -3
  36. package/dist/components/Galaxy.d.ts.map +1 -1
  37. package/dist/components/Galaxy.js +10 -10
  38. package/dist/components/GalleryLayout.d.ts +2 -1
  39. package/dist/components/GalleryLayout.d.ts.map +1 -1
  40. package/dist/components/GalleryLayout.js +3 -1
  41. package/dist/components/GeometryShape.d.ts +3 -2
  42. package/dist/components/GeometryShape.d.ts.map +1 -1
  43. package/dist/components/GeometryShape.js +17 -6
  44. package/dist/components/Glyphs.d.ts +2 -1
  45. package/dist/components/Glyphs.d.ts.map +1 -1
  46. package/dist/components/Glyphs.js +6 -2
  47. package/dist/components/GridHelper.d.ts +2 -1
  48. package/dist/components/GridHelper.d.ts.map +1 -1
  49. package/dist/components/GridHelper.js +3 -1
  50. package/dist/components/GridsGenerator.d.ts +2 -1
  51. package/dist/components/GridsGenerator.d.ts.map +1 -1
  52. package/dist/components/GridsGenerator.js +12 -4
  53. package/dist/components/HdrPlaylistRenderer.d.ts +2 -1
  54. package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
  55. package/dist/components/HdrPlaylistRenderer.js +3 -1
  56. package/dist/components/Lensflare.d.ts +2 -1
  57. package/dist/components/Lensflare.d.ts.map +1 -1
  58. package/dist/components/Lensflare.js +3 -1
  59. package/dist/components/Letter.d.ts +3 -2
  60. package/dist/components/Letter.d.ts.map +1 -1
  61. package/dist/components/Letter.js +3 -1
  62. package/dist/components/Letters.d.ts +3 -2
  63. package/dist/components/Letters.d.ts.map +1 -1
  64. package/dist/components/Letters.js +3 -1
  65. package/dist/components/LightObject.d.ts +2 -1
  66. package/dist/components/LightObject.d.ts.map +1 -1
  67. package/dist/components/LightObject.js +11 -7
  68. package/dist/components/LightsManager.d.ts +2 -1
  69. package/dist/components/LightsManager.d.ts.map +1 -1
  70. package/dist/components/LightsManager.js +6 -3
  71. package/dist/components/Lines.d.ts +2 -1
  72. package/dist/components/Lines.d.ts.map +1 -1
  73. package/dist/components/Lines.js +2 -2
  74. package/dist/components/Moon.d.ts +2 -3
  75. package/dist/components/Moon.d.ts.map +1 -1
  76. package/dist/components/Moon.js +6 -4
  77. package/dist/components/MyGrid.d.ts +3 -2
  78. package/dist/components/MyGrid.d.ts.map +1 -1
  79. package/dist/components/MyGrid.js +5 -2
  80. package/dist/components/ObjectNode.d.ts +2 -2
  81. package/dist/components/ObjectNode.d.ts.map +1 -1
  82. package/dist/components/ObjectNode.js +30 -30
  83. package/dist/components/ObjectNodeApi.d.ts +2 -2
  84. package/dist/components/ObjectNodeApi.d.ts.map +1 -1
  85. package/dist/components/ObjectNodeApi.js +2 -2
  86. package/dist/components/ObjectsRenderer.d.ts +2 -1
  87. package/dist/components/ObjectsRenderer.d.ts.map +1 -1
  88. package/dist/components/ObjectsRenderer.js +15 -4
  89. package/dist/components/ObjectsRendererApi.d.ts +2 -1
  90. package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
  91. package/dist/components/ObjectsRendererApi.js +2 -2
  92. package/dist/components/Ocean.d.ts +2 -1
  93. package/dist/components/Ocean.d.ts.map +1 -1
  94. package/dist/components/Ocean.js +3 -1
  95. package/dist/components/Outline.d.ts +3 -2
  96. package/dist/components/Outline.d.ts.map +1 -1
  97. package/dist/components/Outline.js +6 -2
  98. package/dist/components/ParticlesR3f.d.ts +2 -1
  99. package/dist/components/ParticlesR3f.d.ts.map +1 -1
  100. package/dist/components/ParticlesR3f.js +3 -1
  101. package/dist/components/Path.d.ts +2 -1
  102. package/dist/components/Path.d.ts.map +1 -1
  103. package/dist/components/Path.js +14 -3
  104. package/dist/components/PathGeometry.d.ts +2 -1
  105. package/dist/components/PathGeometry.d.ts.map +1 -1
  106. package/dist/components/PathGeometry.js +6 -2
  107. package/dist/components/PathRenderer.d.ts +2 -1
  108. package/dist/components/PathRenderer.d.ts.map +1 -1
  109. package/dist/components/PathRenderer.js +6 -2
  110. package/dist/components/Planet.d.ts +2 -3
  111. package/dist/components/Planet.d.ts.map +1 -1
  112. package/dist/components/Planet.js +6 -4
  113. package/dist/components/PointCloud.d.ts +2 -1
  114. package/dist/components/PointCloud.d.ts.map +1 -1
  115. package/dist/components/PointCloud.js +3 -1
  116. package/dist/components/ProjectLoader.d.ts +2 -1
  117. package/dist/components/ProjectLoader.d.ts.map +1 -1
  118. package/dist/components/ProjectLoader.js +6 -3
  119. package/dist/components/Rain.d.ts +2 -1
  120. package/dist/components/Rain.d.ts.map +1 -1
  121. package/dist/components/Rain.js +7 -1
  122. package/dist/components/SceneBuilder.d.ts +2 -1
  123. package/dist/components/SceneBuilder.d.ts.map +1 -1
  124. package/dist/components/SceneBuilder.js +2 -2
  125. package/dist/components/ShootingStar.d.ts +2 -1
  126. package/dist/components/ShootingStar.d.ts.map +1 -1
  127. package/dist/components/ShootingStar.js +5 -2
  128. package/dist/components/ShootingStars.d.ts +2 -1
  129. package/dist/components/ShootingStars.d.ts.map +1 -1
  130. package/dist/components/ShootingStars.js +2 -2
  131. package/dist/components/SkyController.d.ts +3 -2
  132. package/dist/components/SkyController.d.ts.map +1 -1
  133. package/dist/components/SkyController.js +9 -6
  134. package/dist/components/SkyMesh.d.ts +2 -3
  135. package/dist/components/SkyMesh.d.ts.map +1 -1
  136. package/dist/components/SkyMesh.js +3 -5
  137. package/dist/components/SkySystem.d.ts +2 -1
  138. package/dist/components/SkySystem.d.ts.map +1 -1
  139. package/dist/components/SkySystem.js +6 -2
  140. package/dist/components/Skybox.d.ts +2 -1
  141. package/dist/components/Skybox.d.ts.map +1 -1
  142. package/dist/components/Skybox.js +5 -2
  143. package/dist/components/SolarSystem.d.ts +2 -4
  144. package/dist/components/SolarSystem.d.ts.map +1 -1
  145. package/dist/components/SolarSystem.js +3 -1
  146. package/dist/components/SparklesBurst.d.ts +2 -1
  147. package/dist/components/SparklesBurst.d.ts.map +1 -1
  148. package/dist/components/SparklesBurst.js +5 -2
  149. package/dist/components/Stars.d.ts +2 -3
  150. package/dist/components/Stars.d.ts.map +1 -1
  151. package/dist/components/Stars.js +3 -2
  152. package/dist/components/Sun.d.ts +3 -2
  153. package/dist/components/Sun.d.ts.map +1 -1
  154. package/dist/components/Sun.js +7 -3
  155. package/dist/components/SunCore.d.ts +3 -2
  156. package/dist/components/SunCore.d.ts.map +1 -1
  157. package/dist/components/SunCore.js +3 -1
  158. package/dist/components/SunLight.d.ts +2 -1
  159. package/dist/components/SunLight.d.ts.map +1 -1
  160. package/dist/components/SunLight.js +3 -1
  161. package/dist/components/Text2D.d.ts +2 -1
  162. package/dist/components/Text2D.d.ts.map +1 -1
  163. package/dist/components/Text2D.js +3 -1
  164. package/dist/components/Text3D.d.ts +2 -1
  165. package/dist/components/Text3D.d.ts.map +1 -1
  166. package/dist/components/Text3D.js +2 -2
  167. package/dist/components/VolumePoints.d.ts +3 -2
  168. package/dist/components/VolumePoints.d.ts.map +1 -1
  169. package/dist/components/VolumePoints.js +6 -2
  170. package/dist/components/cursor/AuraCursor.d.ts.map +1 -1
  171. package/dist/components/cursor/AuraCursor.js +3 -1
  172. package/dist/components/cursor/AuroraCursor.d.ts.map +1 -1
  173. package/dist/components/cursor/AuroraCursor.js +5 -2
  174. package/dist/components/cursor/BubblesCursor.d.ts.map +1 -1
  175. package/dist/components/cursor/BubblesCursor.js +5 -2
  176. package/dist/components/cursor/CometCursor.d.ts.map +1 -1
  177. package/dist/components/cursor/CometCursor.js +6 -3
  178. package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -1
  179. package/dist/components/cursor/CrosshairCursor.js +6 -3
  180. package/dist/components/cursor/CursorActions.d.ts +2 -1
  181. package/dist/components/cursor/CursorActions.d.ts.map +1 -1
  182. package/dist/components/cursor/CursorActions.js +12 -10
  183. package/dist/components/cursor/CursorController.d.ts +4 -1
  184. package/dist/components/cursor/CursorController.d.ts.map +1 -1
  185. package/dist/components/cursor/CursorController.js +1 -1
  186. package/dist/components/cursor/CursorEffects.d.ts +4 -2
  187. package/dist/components/cursor/CursorEffects.d.ts.map +1 -1
  188. package/dist/components/cursor/CursorEffects.js +6 -2
  189. package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -1
  190. package/dist/components/cursor/FerrofluidCursor.js +3 -1
  191. package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -1
  192. package/dist/components/cursor/GlyphRingCursor.js +3 -1
  193. package/dist/components/cursor/LightningCursor.d.ts.map +1 -1
  194. package/dist/components/cursor/LightningCursor.js +3 -1
  195. package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -1
  196. package/dist/components/cursor/LiquidMetalCursor.js +3 -1
  197. package/dist/components/cursor/OrbCursor.d.ts.map +1 -1
  198. package/dist/components/cursor/OrbCursor.js +3 -1
  199. package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -1
  200. package/dist/components/cursor/PlasmaWhipCursor.js +3 -1
  201. package/dist/components/cursor/SparklesCursor.d.ts.map +1 -1
  202. package/dist/components/cursor/SparklesCursor.js +5 -2
  203. package/dist/components/cursor/TeslaCursor.d.ts.map +1 -1
  204. package/dist/components/cursor/TeslaCursor.js +6 -9
  205. package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +2 -1
  206. package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -1
  207. package/dist/components/cursor/clickActions/BoltFlashAction.js +5 -2
  208. package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +2 -1
  209. package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -1
  210. package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +3 -1
  211. package/dist/components/cursor/clickActions/ImplosionAction.d.ts +2 -1
  212. package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -1
  213. package/dist/components/cursor/clickActions/ImplosionAction.js +3 -1
  214. package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +2 -1
  215. package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -1
  216. package/dist/components/cursor/clickActions/PhaseShiftAction.js +5 -2
  217. package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +2 -1
  218. package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -1
  219. package/dist/components/cursor/clickActions/PlasmaBombAction.js +5 -2
  220. package/dist/components/cursor/clickActions/RealityTearAction.d.ts +2 -1
  221. package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -1
  222. package/dist/components/cursor/clickActions/RealityTearAction.js +3 -1
  223. package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +2 -1
  224. package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -1
  225. package/dist/components/cursor/clickActions/ShockwaveAction.js +5 -2
  226. package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +2 -1
  227. package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -1
  228. package/dist/components/cursor/clickActions/SparklesBurstAction.js +3 -1
  229. package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +2 -1
  230. package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -1
  231. package/dist/components/cursor/clickActions/VoronoiFractureAction.js +3 -1
  232. package/dist/components/cursor/clickActions/index.d.ts +11 -0
  233. package/dist/components/cursor/clickActions/index.d.ts.map +1 -0
  234. package/dist/components/cursor/clickActions/index.js +10 -0
  235. package/dist/components/cursor/index.d.ts +21 -0
  236. package/dist/components/cursor/index.d.ts.map +1 -0
  237. package/dist/components/cursor/index.js +19 -0
  238. package/dist/components/effects/AuraEffect.d.ts +2 -1
  239. package/dist/components/effects/AuraEffect.d.ts.map +1 -1
  240. package/dist/components/effects/AuraEffect.js +5 -2
  241. package/dist/components/effects/AuroraEffect.d.ts +2 -1
  242. package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
  243. package/dist/components/effects/AuroraEffect.js +3 -1
  244. package/dist/components/effects/BlackHoleEffect.d.ts +2 -1
  245. package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
  246. package/dist/components/effects/BlackHoleEffect.js +3 -1
  247. package/dist/components/effects/ConstellationEffect.d.ts +2 -1
  248. package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
  249. package/dist/components/effects/ConstellationEffect.js +3 -1
  250. package/dist/components/effects/Corona.d.ts +19 -0
  251. package/dist/components/effects/Corona.d.ts.map +1 -0
  252. package/dist/components/effects/Corona.js +15 -0
  253. package/dist/components/effects/DataStreamEffect.d.ts +2 -1
  254. package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
  255. package/dist/components/effects/DataStreamEffect.js +5 -2
  256. package/dist/components/effects/DnaHelixEffect.d.ts +2 -1
  257. package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
  258. package/dist/components/effects/DnaHelixEffect.js +3 -1
  259. package/dist/components/effects/Fire.d.ts +3 -2
  260. package/dist/components/effects/Fire.d.ts.map +1 -1
  261. package/dist/components/effects/Fire.js +3 -1
  262. package/dist/components/effects/FireEffect.d.ts +2 -1
  263. package/dist/components/effects/FireEffect.d.ts.map +1 -1
  264. package/dist/components/effects/FireEffect.js +5 -2
  265. package/dist/components/effects/Flares.d.ts +25 -0
  266. package/dist/components/effects/Flares.d.ts.map +1 -0
  267. package/dist/components/effects/Flares.js +136 -0
  268. package/dist/components/effects/ForcefieldEffect.d.ts +2 -1
  269. package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
  270. package/dist/components/effects/ForcefieldEffect.js +3 -1
  271. package/dist/components/effects/HologramEffect.d.ts +2 -1
  272. package/dist/components/effects/HologramEffect.d.ts.map +1 -1
  273. package/dist/components/effects/HologramEffect.js +5 -2
  274. package/dist/components/effects/IceCrystalsEffect.d.ts +2 -1
  275. package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
  276. package/dist/components/effects/IceCrystalsEffect.js +3 -1
  277. package/dist/components/effects/LightningEffect.d.ts +2 -1
  278. package/dist/components/effects/LightningEffect.d.ts.map +1 -1
  279. package/dist/components/effects/LightningEffect.js +5 -2
  280. package/dist/components/effects/MoleculesEffect.d.ts +2 -1
  281. package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
  282. package/dist/components/effects/MoleculesEffect.js +5 -2
  283. package/dist/components/effects/NeuralNetworkEffect.d.ts +2 -1
  284. package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
  285. package/dist/components/effects/NeuralNetworkEffect.js +3 -1
  286. package/dist/components/effects/OrbEffect.d.ts +2 -1
  287. package/dist/components/effects/OrbEffect.d.ts.map +1 -1
  288. package/dist/components/effects/OrbEffect.js +5 -2
  289. package/dist/components/effects/PortalEffect.d.ts +2 -1
  290. package/dist/components/effects/PortalEffect.d.ts.map +1 -1
  291. package/dist/components/effects/PortalEffect.js +5 -2
  292. package/dist/components/effects/ShockwaveEffect.d.ts +2 -1
  293. package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
  294. package/dist/components/effects/ShockwaveEffect.js +5 -2
  295. package/dist/components/effects/SmokePlumeEffect.d.ts +2 -1
  296. package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
  297. package/dist/components/effects/SmokePlumeEffect.js +5 -2
  298. package/dist/components/effects/SmokeRibbon.d.ts +3 -2
  299. package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
  300. package/dist/components/effects/SmokeRibbon.js +5 -2
  301. package/dist/components/effects/SmokeRingEffect.d.ts +2 -1
  302. package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
  303. package/dist/components/effects/SmokeRingEffect.js +5 -2
  304. package/dist/components/effects/VolumetricFogEffect.d.ts +2 -1
  305. package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
  306. package/dist/components/effects/VolumetricFogEffect.js +5 -2
  307. package/dist/components/effects/index.d.ts +28 -0
  308. package/dist/components/effects/index.d.ts.map +1 -0
  309. package/dist/components/effects/index.js +24 -0
  310. package/dist/components/index.d.ts +112 -0
  311. package/dist/components/index.d.ts.map +1 -0
  312. package/dist/components/index.js +77 -0
  313. package/dist/constants.d.ts +1 -1
  314. package/dist/constants.d.ts.map +1 -1
  315. package/dist/constants.js +1 -1
  316. package/dist/hooks/index.d.ts +55 -0
  317. package/dist/hooks/index.d.ts.map +1 -1
  318. package/dist/hooks/index.js +46 -1
  319. package/dist/hooks/useObjectReady.d.ts +29 -0
  320. package/dist/hooks/useObjectReady.d.ts.map +1 -0
  321. package/dist/hooks/useObjectReady.js +59 -0
  322. package/dist/index.d.ts +4 -135
  323. package/dist/index.d.ts.map +1 -1
  324. package/dist/index.js +6 -108
  325. package/dist/types/index.d.ts +2 -0
  326. package/dist/types/index.d.ts.map +1 -0
  327. package/dist/types/index.js +1 -0
  328. package/dist/types/objectReady.d.ts +24 -0
  329. package/dist/types/objectReady.d.ts.map +1 -0
  330. package/dist/types/objectReady.js +1 -0
  331. package/package.json +3 -3
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { PositionsCreator } from '@3driseai/3drise-core';
4
4
  import Path from './Path.js';
5
- const Lines = ({ createdObject, transitionSettings }) => {
5
+ const Lines = ({ createdObject, transitionSettings, onObjectReady, onObjectDispose }) => {
6
6
  if (!createdObject)
7
7
  return null;
8
8
  const { config } = createdObject;
@@ -14,6 +14,6 @@ const Lines = ({ createdObject, transitionSettings }) => {
14
14
  : config.shapeType;
15
15
  const curves = useMemo(() => PositionsCreator.generatePaths(config.shapeType), [config.shapeType]);
16
16
  const targetCurves = useMemo(() => PositionsCreator.generatePaths(targetShape), [targetShape]);
17
- return (_jsx(_Fragment, { children: curves.map((currentCurve, index) => (_jsx(Path, { curve: currentCurve, targetCurve: targetCurves[index % targetCurves.length], duration: 1, color: color }, `path-${index}`))) }));
17
+ return (_jsx(_Fragment, { children: curves.map((currentCurve, index) => (_jsx(Path, { curve: currentCurve, targetCurve: targetCurves[index % targetCurves.length], duration: 1, color: color, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, `path-${index}`))) }));
18
18
  };
19
19
  export default Lines;
@@ -1,10 +1,9 @@
1
- import type { Mesh } from 'three';
1
+ import type { ObjectReadyProps } from '../types/objectReady';
2
2
  import React from "react";
3
3
  import type { MoonSettings } from "@3driseai/3drise-core";
4
- export interface MoonProps {
4
+ export interface MoonProps extends ObjectReadyProps {
5
5
  settings?: MoonSettings;
6
6
  sunPosition?: [number, number, number];
7
- onMeshReady?: (mesh: Mesh) => void;
8
7
  }
9
8
  export type { MoonSettings };
10
9
  export { defaultMoonSettings } from '@3driseai/3drise-core';
@@ -1 +1 @@
1
- {"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACtC;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAyD7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Moon.d.ts","sourceRoot":"","sources":["../../src/components/Moon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA0D7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useObjectReady } from '../hooks/useObjectReady.js';
2
3
  import { useRef, useEffect, useState, useCallback } from 'react';
3
4
  import { TextureLoader, Vector3 } from 'three';
4
5
  import { useFrame } from '@react-three/fiber';
5
6
  export { defaultMoonSettings } from '@3driseai/3drise-core';
6
7
  const MOON_TEXTURE_URL = "https://3d-rise.sfo3.cdn.digitaloceanspaces.com/app/images/moon_1024.jpg";
7
- const Moon = ({ settings, sunPosition, onMeshReady }) => {
8
+ const Moon = ({ settings, sunPosition, onObjectReady, onObjectDispose }) => {
8
9
  const meshRef = useRef(null);
10
+ const rootRef = useRef(null);
11
+ useObjectReady(rootRef, settings, onObjectReady, onObjectDispose);
9
12
  const lightRef = useRef(null);
10
13
  const targetRef = useRef(null);
11
14
  const [texture, setTexture] = useState(null);
@@ -37,9 +40,8 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
37
40
  const handleMeshRef = useCallback((mesh) => {
38
41
  if (mesh) {
39
42
  meshRef.current = mesh;
40
- onMeshReady?.(mesh);
41
43
  }
42
- }, [onMeshReady]);
44
+ }, []);
43
45
  useFrame((state) => {
44
46
  const moonPos = sunPosition ?? s.position;
45
47
  if (meshRef.current && s.enableOrbit) {
@@ -60,7 +62,7 @@ const Moon = ({ settings, sunPosition, onMeshReady }) => {
60
62
  }
61
63
  });
62
64
  const moonPos = sunPosition ?? s.position;
63
- return (_jsxs("group", { userData: { id: '3drise-moon' }, children: [_jsx("object3D", { ref: targetRef, position: moonPos }), _jsx("directionalLight", { ref: lightRef, intensity: 2, color: 0xffffff, target: targetRef.current ?? undefined }), _jsxs("mesh", { ref: handleMeshRef, position: moonPos, rotation: s.rotation, scale: s.scale, visible: s.visible, children: [_jsx("sphereGeometry", { args: [1, 32, 32] }), _jsx("meshPhongMaterial", { color: 0xb2b2b2, normalMap: texture, shininess: 0 })] })] }));
65
+ return (_jsxs("group", { ref: rootRef, userData: { id: '3drise-moon' }, children: [_jsx("object3D", { ref: targetRef, position: moonPos }), _jsx("directionalLight", { ref: lightRef, intensity: 2, color: 0xffffff, target: targetRef.current ?? undefined }), _jsxs("mesh", { ref: handleMeshRef, position: moonPos, rotation: s.rotation, scale: s.scale, visible: s.visible, children: [_jsx("sphereGeometry", { args: [1, 32, 32] }), _jsx("meshPhongMaterial", { color: 0xb2b2b2, normalMap: texture, shininess: 0 })] })] }));
64
66
  };
65
67
  Moon.displayName = 'Moon';
66
68
  export default Moon;
@@ -1,6 +1,7 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import type { ThreeElements } from '@react-three/fiber';
2
3
  import type { MyGridConfig } from '@3driseai/3drise-core';
3
- export interface MyGridProps {
4
+ export interface MyGridProps extends ObjectReadyProps {
4
5
  config?: MyGridConfig;
5
6
  groupProps?: ThreeElements['group'];
6
7
  }
@@ -10,6 +11,6 @@ export interface MyGridProps {
10
11
  * and any preset/serialization layer.
11
12
  */
12
13
  export declare const defaultMyGridConfig: MyGridConfig;
13
- export declare function MyGrid({ config, groupProps }: MyGridProps): import("react").JSX.Element;
14
+ export declare function MyGrid({ config, groupProps, onObjectReady, onObjectDispose }: MyGridProps): import("react").JSX.Element;
14
15
  export default MyGrid;
15
16
  //# sourceMappingURL=MyGrid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MyGrid.d.ts","sourceRoot":"","sources":["../../src/components/MyGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAID;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAuBjC,CAAC;AACF,wBAAgB,MAAM,CAAC,EAAE,MAA4B,EAAE,UAAU,EAAE,EAAE,WAAW,+BAkC/E;AACD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"MyGrid.d.ts","sourceRoot":"","sources":["../../src/components/MyGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AAID;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAuBjC,CAAC;AACF,wBAAgB,MAAM,CAAC,EAAE,MAA4B,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,WAAW,+BAoC/G;AACD,eAAe,MAAM,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useObjectReady } from '../hooks/useObjectReady.js';
2
3
  import { useMemo, useRef } from 'react';
3
4
  import * as THREE from 'three';
4
5
  import { useFrame } from '@react-three/fiber';
@@ -34,8 +35,10 @@ export const defaultMyGridConfig = {
34
35
  bgOpacity: 0,
35
36
  followMouse: false,
36
37
  };
37
- export function MyGrid({ config = defaultMyGridConfig, groupProps }) {
38
+ export function MyGrid({ config = defaultMyGridConfig, groupProps, onObjectReady, onObjectDispose }) {
38
39
  const matRef = useRef(null);
40
+ const rootRef = useRef(null);
41
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
39
42
  const meshRef = useRef(null);
40
43
  const { cellSize, size, segments, flat, lineMode, cellMode, lineWidth, sectionSize, sectionWidth, animSpeed, animScale, animIntensity, fadeDistance, fadeStrength, displace, lineColor, sectionColor, cellColor, glowColor, bgColor, bgOpacity, followMouse, } = config;
41
44
  const segs = segments ?? (displace > 0 ? Math.max(64, Math.ceil(size / cellSize) * 2) : 1);
@@ -67,6 +70,6 @@ export function MyGrid({ config = defaultMyGridConfig, groupProps }) {
67
70
  }
68
71
  }
69
72
  });
70
- return (_jsx("group", { ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("myGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, MyGridMaterial.key)] }) }));
73
+ return (_jsx("group", { ref: rootRef, ...groupProps, children: _jsxs("mesh", { ref: meshRef, rotation: flat ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: [_jsx("planeGeometry", { args: [size, size, segs, segs] }), _jsx("myGridMaterial", { ref: matRef, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, u_cellSize: cellSize, u_lineWidth: lineWidth, u_sectionSize: sectionSize, u_sectionWidth: sectionWidth, u_lineMode: lineMode, u_cellMode: cellMode, u_animSpeed: animSpeed, u_animScale: animScale, u_animIntensity: animIntensity, u_fadeDistance: fade, u_fadeStrength: fadeStrength, u_displace: displace, u_lineColor: colors.line, u_sectionColor: colors.section, u_cellColor: colors.cell, u_glowColor: colors.glow, u_bgColor: colors.bg, u_bgOpacity: bgOpacity }, MyGridMaterial.key)] }) }));
71
74
  }
72
75
  export default MyGrid;
@@ -1,11 +1,11 @@
1
+ import type { ObjectReadyProps } from "../types/objectReady";
1
2
  import React from "react";
2
3
  import { Object3D } from "three";
3
4
  import type { CameraState, CreatedObjectSettings, ObjectTreeNode } from "@3driseai/3drise-core";
4
5
  import { type ThreeEvent } from "@react-three/fiber";
5
- type ObjectNodeProps = {
6
+ type ObjectNodeProps = ObjectReadyProps & {
6
7
  node: ObjectTreeNode;
7
8
  cameraSettings: CameraState;
8
- onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
9
9
  handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
10
10
  };
11
11
  declare const ObjectNode: React.FC<ObjectNodeProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,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,CA+FzC,CAAC;AACF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAcA,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,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AA0BF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4GzC,CAAC;AACF,eAAe,UAAU,CAAC"}
@@ -13,16 +13,11 @@ import LightObject from "./LightObject.js";
13
13
  import EnvironmentObject from "./EnvironmentObject.js";
14
14
  import Galaxy from "./Galaxy.js";
15
15
  import GridGenerator from "./GridsGenerator.js";
16
- // Types whose React component instantiates and drives its own ShaderMaterial.
17
- // useMaterialApplication would otherwise traverse the mesh tree and replace
18
- // that material with a registry-default instance, breaking config-driven
19
- // uniform updates (e.g. only ringRadius worked on glyphs because that drives
20
- // geometry, not the material).
21
16
  const SELF_MANAGED_MATERIAL = new Set([
22
17
  'effect',
23
18
  // 'gallery',
24
19
  'earth',
25
- 'solarSystem',
20
+ 'space',
26
21
  'shootingStars',
27
22
  'grid',
28
23
  // 'moon'
@@ -35,18 +30,24 @@ const SELF_MANAGED_MATERIAL = new Set([
35
30
  // ))}
36
31
  // </>
37
32
  // ) : null;
38
- const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, handleObjectClick, renderObject }) => {
33
+ const GroupWithChildren = ({ createdObject, children, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick, renderObject }) => {
39
34
  const isGroup = createdObject.type === 'group';
40
35
  const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type);
41
- return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, cameraSettings: cameraSettings, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady }, childNode.objectId)))] }, createdObject.id));
36
+ return (_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, cameraSettings: cameraSettings, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
42
37
  };
43
- const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick }) => {
38
+ const ObjectNode = ({ node, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick }) => {
44
39
  const { children, createdObject } = node;
45
40
  // console.log(createdObject.meshSettings.name, createdObject.actions, createdObject.mouseMove)
41
+ // Children describe themselves with their own settings; the scene above
42
+ // knows them by the node's createdObject, so relabel on the way up.
43
+ const relabel = useCallback((obj) => ({
44
+ onObjectReady: (_object, ref) => onObjectReady && onObjectReady(obj, ref),
45
+ onObjectDispose: (_object, ref) => onObjectDispose && onObjectDispose(obj, ref),
46
+ }), [onObjectReady, onObjectDispose]);
46
47
  // Specialized renderers for each object type
47
48
  const renderers = useMemo(() => ({
48
49
  group: () => null,
49
- mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
50
+ mesh: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
50
51
  // water: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
51
52
  // <Ocean
52
53
  // settings={obj}
@@ -62,7 +63,7 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
62
63
  // settings={obj}
63
64
  // />
64
65
  // ),
65
- model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }, obj.id)),
66
+ model: (obj, cameraSettings, onObjectReady) => (_jsx(CustomPrimitive, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }, obj.id)),
66
67
  // custom_primitive: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
67
68
  // <CustomPrimitive
68
69
  // key={obj.id}
@@ -74,24 +75,24 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
74
75
  text: (obj, cameraSettings, onObjectReady) => {
75
76
  const renderMode = obj.config?.renderMode ?? 'bitmap';
76
77
  return (_jsx(_Fragment, { children: renderMode === 'text3d'
77
- ? _jsx(Text3D, { textSettings: obj })
78
- : _jsx(Text2D, { textSettings: obj }) }));
78
+ ? _jsx(Text3D, { textSettings: obj, ...relabel(obj) })
79
+ : _jsx(Text2D, { textSettings: obj, ...relabel(obj) }) }));
79
80
  },
80
81
  particles: (obj, cameraSettings, onObjectReady) => {
81
82
  const particlesSettings = obj;
82
- return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings, cameraFov: cameraSettings.fov, duration: 1, transitionSettings: particlesSettings.meshSettings })), particlesSettings.config?.paths && (_jsx(Lines, { createdObject: particlesSettings }))] }));
83
+ return (_jsxs(_Fragment, { children: [particlesSettings.config?.particles && (_jsx(ParticlesR3f, { particlesSettings: particlesSettings, cameraFov: cameraSettings.fov, duration: 1, transitionSettings: particlesSettings.meshSettings, ...relabel(obj) })), particlesSettings.config?.paths && (_jsx(Lines, { createdObject: particlesSettings, ...relabel(obj) }))] }));
83
84
  },
84
- path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config }, obj.id)),
85
+ path: (obj, cameraSettings, onObjectReady) => (_jsx(PathRenderer, { pathSettings: obj.config, ...relabel(obj) }, obj.id)),
85
86
  grid: (obj, cameraSettings, onObjectReady) => (
86
87
  // <GridHelper {...(obj.config as GridConfig)} side={2} />
87
- _jsx(GridGenerator, { config: obj.config })),
88
+ _jsx(GridGenerator, { config: obj.config, ...relabel(obj) })),
88
89
  effect: (obj) => (_jsx(EffectsGenerator, { settings: {
89
90
  config: obj.config,
90
- } }, obj.id)),
91
- gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick })),
92
- light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj })),
93
- environment: (obj, cameraSettings, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj })),
94
- space: (obj, cameraSettings, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady })),
91
+ }, ...relabel(obj) }, obj.id)),
92
+ gallery: (obj, cameraSettings, onObjectReady) => (_jsx(GalleryLayout, { createdObject: obj, handleObjectClick: handleObjectClick, ...relabel(obj) })),
93
+ light: (obj, cameraSettings, onObjectReady) => (_jsx(LightObject, { createdObject: obj, ...relabel(obj) })),
94
+ environment: (obj, cameraSettings, onObjectReady) => (_jsx(EnvironmentObject, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
95
+ space: (obj, cameraSettings, onObjectReady) => (_jsx(Galaxy, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
95
96
  // rain: (obj: CreatedObjectSettings, cameraSettings: CameraState, onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void) => (
96
97
  // <Rain
97
98
  // settings={obj}
@@ -112,22 +113,21 @@ const ObjectNode = ({ node, cameraSettings, onObjectReady, handleObjectClick })
112
113
  // settings={obj.config as ShootingStarsSettings}
113
114
  // />
114
115
  // ),
115
- }), [handleObjectClick]);
116
+ }), [handleObjectClick, onObjectReady, onObjectDispose, relabel]);
117
+ const renderObject = useCallback((obj, handleObjectClick) => {
118
+ // console.log('Rendering object:', obj);
119
+ const renderer = renderers[obj.type];
120
+ return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
121
+ }, [cameraSettings, onObjectReady, renderers]);
116
122
  if (!createdObject) {
117
123
  console.warn(`createdObject not found.`);
118
124
  return null;
119
125
  }
120
- const meshSettings = createdObject.meshSettings;
121
126
  const hasChildren = children.length > 0;
122
127
  const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
123
- const renderObject = useCallback((obj, handleObjectClick) => {
124
- // console.log('Rendering object:', obj);
125
- const renderer = renderers[obj.type];
126
- return renderer?.(obj, cameraSettings, onObjectReady) ?? null;
127
- }, [cameraSettings, onObjectReady, renderers]);
128
128
  const renderedObject = shouldRenderAsGroup
129
- ? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, renderObject: renderObject })
130
- : _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
129
+ ? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, cameraSettings: cameraSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
130
+ : _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
131
131
  // createdObject.effects
132
132
  // ? <>
133
133
  // {renderObject(createdObject)}
@@ -1,11 +1,11 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import React from "react";
2
3
  import { Object3D } from "three";
3
4
  import type { CameraState, CreatedObjectSettings } from "@3driseai/3drise-core";
4
5
  import { type ThreeEvent } from "@react-three/fiber";
5
- type ObjectNodeApiProps = {
6
+ type ObjectNodeApiProps = ObjectReadyProps & {
6
7
  objectId: string;
7
8
  cameraSettings: CameraState;
8
- onObjectReady?: (object: CreatedObjectSettings, ref: Object3D) => void;
9
9
  handleObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
10
10
  };
11
11
  declare const ObjectNodeApi: React.FC<ObjectNodeApiProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,kBAAkB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,WAAW,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAW/C,CAAC;AACF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ObjectNodeApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNodeApi.tsx"],"names":[],"mappings":"AAIA,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,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,KAAK,kBAAkB,GAAG,gBAAgB,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAGF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAW/C,CAAC;AACF,eAAe,aAAa,CAAC"}
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
3
3
  // import { apiFetch } from '../utils/apiFetch';
4
4
  import ObjectNode from './ObjectNode.js';
5
5
  import { dataCenterServer } from '../constants.js';
6
- const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, handleObjectClick }) => {
6
+ const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, onObjectDispose, handleObjectClick }) => {
7
7
  const [node, setNode] = useState(null);
8
8
  useEffect(() => {
9
9
  fetch(`${dataCenterServer}scene-objects/${objectId}/tree`)
@@ -13,6 +13,6 @@ const ObjectNodeApi = ({ objectId, cameraSettings, onObjectReady, handleObjectCl
13
13
  }, [objectId]);
14
14
  if (!node)
15
15
  return null;
16
- return (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClick }));
16
+ return (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick }));
17
17
  };
18
18
  export default ObjectNodeApi;
@@ -1,8 +1,9 @@
1
1
  import type { AnimationSequence, GeneralObjectSettings, CameraState, CreatedObjectSettings } from '@3driseai/3drise-core';
2
+ import type { ObjectReadyProps } from '../types/objectReady';
2
3
  import React from "react";
3
4
  import { Object3D } from "three";
4
5
  import { type ThreeEvent } from "@react-three/fiber";
5
- interface ObjectsRendererProps {
6
+ interface ObjectsRendererProps extends ObjectReadyProps {
6
7
  cameraSettings: CameraState;
7
8
  generalObjectSettings: GeneralObjectSettings;
8
9
  createdObjects: CreatedObjectSettings[];
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG1H,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAoB;IAC1B,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgClD,CAAC;AAEH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ObjectsRenderer.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI1H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,UAAU,oBAAqB,SAAQ,gBAAgB;IACnD,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAGD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6ClD,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -3,17 +3,28 @@ import { memo, useRef, useCallback, useMemo } from 'react';
3
3
  import { buildObjectTree } from '@3driseai/3drise-core';
4
4
  import ObjectNode from './ObjectNode.js';
5
5
  import useInteraction from '../hooks/useInteraction.js';
6
- const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSettings, onObjectsReady, handleObjectClick, sequences = [], }) => {
6
+ import { useObjectReady } from '../hooks/useObjectReady.js';
7
+ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSettings, onObjectsReady, onObjectReady, onObjectDispose, handleObjectClick, sequences = [], }) => {
7
8
  const groupRef = useRef(null);
8
9
  const objectsTree = useMemo(() => buildObjectTree(createdObjects), [createdObjects]);
9
10
  const readyObjectsCount = useRef(0);
10
- const onObjectReady = useCallback((object, ref) => {
11
+ // Count for the aggregate onObjectsReady signal, then forward the event up.
12
+ // Previously this callback counted and dropped the (object, ref) pair, which
13
+ // is why nothing above ObjectsRenderer ever received an object ref.
14
+ const handleObjectReady = useCallback((object, ref) => {
11
15
  readyObjectsCount.current += 1;
12
16
  if (readyObjectsCount.current === objectsTree.length) {
13
17
  console.log("All objects are ready!");
14
18
  onObjectsReady && onObjectsReady();
15
19
  }
16
- }, [objectsTree.length, onObjectsReady]);
20
+ onObjectReady && onObjectReady(object, ref);
21
+ }, [objectsTree.length, onObjectsReady, onObjectReady]);
22
+ const handleObjectDispose = useCallback((object, ref) => {
23
+ readyObjectsCount.current = Math.max(0, readyObjectsCount.current - 1);
24
+ onObjectDispose && onObjectDispose(object, ref);
25
+ }, [onObjectDispose]);
26
+ // The wrapper group itself is an Object3D the parent may want to transform.
27
+ useObjectReady(groupRef, generalObjectSettings, onObjectReady, onObjectDispose);
17
28
  function filterInteractionsByEvent(interactions, mouseEvent) {
18
29
  if (!interactions)
19
30
  return [];
@@ -34,7 +45,7 @@ const ObjectsRenderer = memo(({ cameraSettings, createdObjects, generalObjectSet
34
45
  handleObjectClick(createdObject, ref, event);
35
46
  }
36
47
  };
37
- return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: onObjectReady, handleObjectClick: handleObjectClickHandler }, node.objectId))) }));
48
+ return (_jsx("group", { ref: groupRef, name: "main-objects", position: generalObjectSettings.meshSettings.position, rotation: generalObjectSettings.meshSettings.rotation, scale: generalObjectSettings.meshSettings.scale, children: objectsTree.map(node => (_jsx(ObjectNode, { node: node, cameraSettings: cameraSettings, onObjectReady: handleObjectReady, onObjectDispose: handleObjectDispose, handleObjectClick: handleObjectClickHandler }, node.objectId))) }));
38
49
  });
39
50
  ObjectsRenderer.displayName = 'ObjectsRenderer';
40
51
  export default ObjectsRenderer;
@@ -1,8 +1,9 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import React from "react";
2
3
  import { CreatedObjectSettings, CameraState, GeneralObjectSettings } from "@3driseai/3drise-core";
3
4
  import { type ThreeEvent } from "@react-three/fiber";
4
5
  import { Object3D } from "three";
5
- export interface ObjectsRendererApiProps {
6
+ export interface ObjectsRendererApiProps extends ObjectReadyProps {
6
7
  objectIds: string[];
7
8
  cameraSettings: CameraState;
8
9
  generalObjectSettings: GeneralObjectSettings;
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,WAAW,uBAAuB;IACpC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyDzD,CAAC;AACF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"ObjectsRendererApi.d.ts","sourceRoot":"","sources":["../../src/components/ObjectsRendererApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,WAAW,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAGD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyDzD,CAAC;AACF,eAAe,kBAAkB,CAAC"}
@@ -15,7 +15,7 @@ import ObjectsRenderer from './ObjectsRenderer.js';
15
15
  * apiBaseUrl="http://localhost:3001"
16
16
  * />
17
17
  */
18
- const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings, apiBaseUrl = 'http://localhost:3001', onObjectsReady, handleObjectClick, onError, onLoading, }) => {
18
+ const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings, apiBaseUrl = 'http://localhost:3001', onObjectsReady, handleObjectClick, onError, onLoading, onObjectReady, onObjectDispose, }) => {
19
19
  const [createdObjects, setCreatedObjects] = useState([]);
20
20
  const [isLoading, setIsLoading] = useState(true);
21
21
  const [error, setError] = useState(null);
@@ -71,6 +71,6 @@ const ObjectsRendererApi = ({ objectIds, cameraSettings, generalObjectSettings,
71
71
  console.error('ObjectsRendererApi Error:', error);
72
72
  return (_jsx("group", { children: _jsxs("mesh", { position: [0, 0, 0], children: [_jsx("sphereGeometry", { args: [0.5, 32, 32] }), _jsx("meshStandardMaterial", { color: 0xff0000, wireframe: true })] }) }));
73
73
  }
74
- return (_jsx(ObjectsRenderer, { cameraSettings: cameraSettings, createdObjects: createdObjects, generalObjectSettings: generalObjectSettings, onObjectsReady: onObjectsReady, handleObjectClick: handleObjectClick }));
74
+ return (_jsx(ObjectsRenderer, { cameraSettings: cameraSettings, createdObjects: createdObjects, generalObjectSettings: generalObjectSettings, onObjectsReady: onObjectsReady, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
75
75
  };
76
76
  export default ObjectsRendererApi;
@@ -1,6 +1,7 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import type { CreatedObjectSettings } from '@3driseai/3drise-core';
2
3
  import React from "react";
3
- export interface OceanProps {
4
+ export interface OceanProps extends ObjectReadyProps {
4
5
  settings: CreatedObjectSettings;
5
6
  }
6
7
  declare const Ocean: React.FC<OceanProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA6J/B,CAAC;AACF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAU7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,qBAAqB,CAAC;CACnC;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8J/B,CAAC;AACF,eAAe,KAAK,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useObjectReady } from '../hooks/useObjectReady.js';
2
3
  import { useRef, useState } from 'react';
3
4
  import * as THREE from 'three';
4
5
  import { useFrame } from '@react-three/fiber';
@@ -8,8 +9,9 @@ import { useWaterReflections } from '../hooks/useWaterReflections.js';
8
9
  import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
9
10
  import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
10
11
  import { handleTransformAnimations, handleMaterialAnimations, handleTransformMouseMove, handleMaterialMouseMove, } from '@3driseai/3drise-core';
11
- const Ocean = ({ settings }) => {
12
+ const Ocean = ({ settings, onObjectReady, onObjectDispose }) => {
12
13
  const meshRef = useRef(null);
14
+ useObjectReady(meshRef, settings, onObjectReady, onObjectDispose);
13
15
  const uniformOverrideRef = useRef(null);
14
16
  const matAnimCacheRef = useRef({});
15
17
  const [meshVisible, setMeshVisible] = useState(null);
@@ -1,9 +1,10 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import { Line } from '@react-three/drei';
2
3
  import type { ComponentProps } from "react";
3
4
  import type { BufferGeometry } from "three";
4
5
  import { OutlineMode } from "./extractOutline";
5
6
  type DreiLineProps = ComponentProps<typeof Line>;
6
- export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments' | 'ref' | 'geometry'> {
7
+ export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments' | 'ref' | 'geometry'>, ObjectReadyProps {
7
8
  /** Any host geometry to outline. */
8
9
  geometry: BufferGeometry;
9
10
  /** '3d' = feature edges (uses `angle`), '2d' = flat front-plane profile. */
@@ -16,6 +17,6 @@ export interface OutlineProps extends Omit<DreiLineProps, 'points' | 'segments'
16
17
  * handled by drei's <Line>. Color / lineWidth / dashed are forwarded straight
17
18
  * through, so the parent owns all appearance.
18
19
  */
19
- export declare function Outline({ geometry, mode, angle, ...lineProps }: OutlineProps): import("react").JSX.Element;
20
+ export declare function Outline({ geometry, mode, angle, onObjectReady, onObjectDispose, ...lineProps }: OutlineProps): import("react").JSX.Element;
20
21
  export {};
21
22
  //# sourceMappingURL=Outline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/components/Outline.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,CAAC;IACjG,oCAAoC;IACpC,QAAQ,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAW,EAAE,KAAU,EAAE,GAAG,SAAS,EAAE,EAAE,YAAY,+BAKxF"}
1
+ {"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/components/Outline.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,CAAC,EAAE,gBAAgB;IACnH,oCAAoC;IACpC,QAAQ,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAW,EAAE,KAAU,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,EAAE,YAAY,+BAOxH"}
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { useObjectReady } from '../hooks/useObjectReady.js';
2
4
  import { Line } from '@react-three/drei';
3
5
  import { useOutline } from '../hooks/useOutline.js';
4
6
  /**
@@ -6,9 +8,11 @@ import { useOutline } from '../hooks/useOutline.js';
6
8
  * handled by drei's <Line>. Color / lineWidth / dashed are forwarded straight
7
9
  * through, so the parent owns all appearance.
8
10
  */
9
- export function Outline({ geometry, mode = '3d', angle = 18, ...lineProps }) {
11
+ export function Outline({ geometry, mode = '3d', angle = 18, onObjectReady, onObjectDispose, ...lineProps }) {
10
12
  const points = useOutline(geometry, mode, angle);
13
+ const rootRef = useRef(null);
14
+ useObjectReady(rootRef, { mode, angle }, onObjectReady, onObjectDispose);
11
15
  if (points.length === 0)
12
16
  return null;
13
- return _jsx(Line, { points: points, segments: true, ...lineProps });
17
+ return _jsx(Line, { ref: rootRef, points: points, segments: true, ...lineProps });
14
18
  }
@@ -1,6 +1,7 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import type { ParticlesSettings } from '@3driseai/3drise-core';
2
3
  import React from "react";
3
- interface ParticlesR3fProps {
4
+ interface ParticlesR3fProps extends ObjectReadyProps {
4
5
  particlesSettings: ParticlesSettings;
5
6
  cameraFov?: number;
6
7
  duration?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAiB;IACvB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiG7C,CAAC;AACF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"ParticlesR3f.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesR3f.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkG7C,CAAC;AACF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useObjectReady } from '../hooks/useObjectReady.js';
2
3
  import { useEffect, useMemo, useRef } from 'react';
3
4
  import { useFrame } from '@react-three/fiber';
4
5
  import { useParticlePositions } from '../hooks/useParticlePositions.js';
@@ -9,9 +10,10 @@ import { update3driseShaderUniforms } from '../hooks/use3driseShader.js';
9
10
  function normalizeEffects(raw) {
10
11
  return Array.isArray(raw) ? raw : [];
11
12
  }
12
- const ParticlesR3f = ({ particlesSettings, duration = 1, transitionSettings, }) => {
13
+ const ParticlesR3f = ({ particlesSettings, duration = 1, transitionSettings, onObjectReady, onObjectDispose, }) => {
13
14
  const materialRef = useRef(null);
14
15
  const pointsRef = useRef(null);
16
+ useObjectReady(pointsRef, particlesSettings, onObjectReady, onObjectDispose);
15
17
  const { name, config, meshSettings } = particlesSettings;
16
18
  const { count, shapeType, outlines, texture } = config;
17
19
  const color = particlesSettings.materialSettings && 'color' in particlesSettings.materialSettings
@@ -1,6 +1,7 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import React from "react";
2
3
  import type { CatmullRomCurve3 } from "three";
3
- interface PathProps {
4
+ interface PathProps extends ObjectReadyProps {
4
5
  curve: CatmullRomCurve3;
5
6
  targetCurve: CatmullRomCurve3;
6
7
  duration?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/components/Path.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,UAAU,SAAS;IACf,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAoC7B,CAAC;AACF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/components/Path.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,UAAU,SAAU,SAAQ,gBAAgB;IACxC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAqD7B,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -1,13 +1,24 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useEffect } from 'react';
3
3
  import { useFrame } from '@react-three/fiber';
4
- const Path = ({ curve, targetCurve, duration = 1, color = '#4c00ff', opacity = 1, tubeRadius = 0.001, }) => {
4
+ import { useObjectReady } from '../hooks/useObjectReady.js';
5
+ const Path = ({ curve, targetCurve, duration = 1, color = '#4c00ff', opacity = 1, tubeRadius = 0.001, onObjectReady, onObjectDispose, }) => {
5
6
  const tubeRef = useRef(null);
6
7
  const targetTubeRef = useRef(null);
7
8
  const meshRef = useRef(null);
9
+ const rootRef = useRef(null);
10
+ useObjectReady(rootRef, { curve, targetCurve, duration, color, opacity, tubeRadius }, onObjectReady, onObjectDispose);
8
11
  const animationProgress = useRef(0);
9
12
  const basePositions = useRef(null);
10
13
  const speed = 1 / duration;
14
+ useObjectReady(meshRef, {
15
+ curve,
16
+ targetCurve,
17
+ duration,
18
+ color,
19
+ opacity,
20
+ tubeRadius,
21
+ }, onObjectReady, onObjectDispose);
11
22
  useEffect(() => {
12
23
  if (tubeRef.current) {
13
24
  basePositions.current = new Float32Array(tubeRef.current.attributes.position.array);
@@ -36,6 +47,6 @@ const Path = ({ curve, targetCurve, duration = 1, color = '#4c00ff', opacity = 1
36
47
  animationProgress.current = progress;
37
48
  currentPosAttr.needsUpdate = true;
38
49
  });
39
- return (_jsxs(_Fragment, { children: [_jsxs("mesh", { ref: meshRef, children: [_jsx("tubeGeometry", { ref: tubeRef, args: [curve, 64, tubeRadius, 8, false] }), _jsx("meshBasicMaterial", { color: color, transparent: opacity < 1, opacity: opacity })] }), _jsx("mesh", { position: [0, -1000, 0], children: _jsx("tubeGeometry", { ref: targetTubeRef, args: [targetCurve, 64, tubeRadius, 8, false] }) })] }));
50
+ return (_jsxs("group", { ref: rootRef, children: [_jsxs("mesh", { ref: meshRef, children: [_jsx("tubeGeometry", { ref: tubeRef, args: [curve, 64, tubeRadius, 8, false] }), _jsx("meshBasicMaterial", { color: color, transparent: opacity < 1, opacity: opacity })] }), _jsx("mesh", { position: [0, -1000, 0], children: _jsx("tubeGeometry", { ref: targetTubeRef, args: [targetCurve, 64, tubeRadius, 8, false] }) })] }));
40
51
  };
41
52
  export default Path;
@@ -1,6 +1,7 @@
1
+ import type { ObjectReadyProps } from '../types/objectReady';
1
2
  import type { PathGeometrySettings, Vector3Array } from '@3driseai/3drise-core';
2
3
  import React from "react";
3
- interface PathGeometryProps {
4
+ interface PathGeometryProps extends ObjectReadyProps {
4
5
  points: Vector3Array[];
5
6
  curve: number;
6
7
  smoothCorners?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"PathGeometry.d.ts","sourceRoot":"","sources":["../../src/components/PathGeometry.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAiB;IACvB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,oBAAoB,CAAC;CAClC;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsG7C,CAAC;AACF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"PathGeometry.d.ts","sourceRoot":"","sources":["../../src/components/PathGeometry.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,iBAAkB,SAAQ,gBAAgB;IAChD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,oBAAoB,CAAC;CAClC;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AACF,eAAe,YAAY,CAAC"}