@needle-tools/engine 4.11.4 → 4.11.5-next.4201116

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 (476) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/components.needle.json +1 -1
  3. package/dist/generateMeshBVH.worker-mO20N_b8.js +21 -0
  4. package/dist/{gltf-progressive-GwdQV1Qx.umd.cjs → gltf-progressive-DWcmTMCh.umd.cjs} +1 -1
  5. package/dist/{gltf-progressive-CftVUJy3.min.js → gltf-progressive-DZrY8VT6.min.js} +2 -2
  6. package/dist/{gltf-progressive-BvlZQAkt.js → gltf-progressive-DgYz5BYa.js} +19 -19
  7. package/dist/loader.worker-Dip-PthR.js +23 -0
  8. package/dist/{needle-engine.bundle-BxK1-fWD.umd.cjs → needle-engine.bundle-Cb9DQNr9.umd.cjs} +155 -160
  9. package/dist/{needle-engine.bundle-DmMrUPFQ.js → needle-engine.bundle-D2l0lwCn.js} +6509 -6332
  10. package/dist/{needle-engine.bundle-CQdk7IvU.min.js → needle-engine.bundle-DaoW7sFK.min.js} +162 -167
  11. package/dist/needle-engine.d.ts +18189 -1
  12. package/dist/needle-engine.js +336 -335
  13. package/dist/needle-engine.min.js +1 -1
  14. package/dist/needle-engine.umd.cjs +1 -1
  15. package/dist/{postprocessing-CJC0Npcd.js → postprocessing-BTW9pD_s.js} +1822 -1723
  16. package/dist/{postprocessing-DrM4PWU3.umd.cjs → postprocessing-CMgoN5t5.umd.cjs} +229 -158
  17. package/dist/{postprocessing-l7zsdO_Q.min.js → postprocessing-DYDtB188.min.js} +227 -156
  18. package/dist/rapier-B3oL1ap-.js +5217 -0
  19. package/dist/rapier-DJ-luMxr.min.js +1 -0
  20. package/dist/rapier-DQltNJbN.umd.cjs +1 -0
  21. package/dist/{three-BDW9I486.min.js → three-B7CT31Bt.min.js} +1 -5
  22. package/dist/{three-MHVqtJYj.js → three-DfMvBzXi.js} +0 -5
  23. package/dist/{three-examples-CgwGHSgz.umd.cjs → three-examples-CsW4_6LI.umd.cjs} +2 -7
  24. package/dist/{three-examples-fvEPSC8L.min.js → three-examples-D1P7eEhn.min.js} +2 -7
  25. package/dist/{three-examples-C5Ht-QFN.js → three-examples-D1SK93ek.js} +1 -7
  26. package/dist/{three-mesh-ui-BjWTTk1R.js → three-mesh-ui-C_uSB5dD.js} +1 -1
  27. package/dist/{three-mesh-ui-Bm32sS2a.umd.cjs → three-mesh-ui-DpATDXwU.umd.cjs} +1 -1
  28. package/dist/{three-mesh-ui-CLdkp21K.min.js → three-mesh-ui-LQ44s0AL.min.js} +1 -1
  29. package/dist/{three-iFaDq9U3.umd.cjs → three-qj71I7J3.umd.cjs} +2 -6
  30. package/dist/{vendor-CsyK1CFs.min.js → vendor-BKGa4GE0.min.js} +34 -39
  31. package/dist/{vendor-petGQl0N.js → vendor-D0zoswDa.js} +1626 -1605
  32. package/dist/{vendor-6kAXU6fm.umd.cjs → vendor-UCpFAwt1.umd.cjs} +30 -35
  33. package/lib/engine/api.d.ts +1 -1
  34. package/lib/engine/api.js +1 -1
  35. package/lib/engine/api.js.map +1 -1
  36. package/lib/engine/debug/debug_spector.d.ts +16 -0
  37. package/lib/engine/debug/debug_spector.js +28 -0
  38. package/lib/engine/debug/debug_spector.js.map +1 -0
  39. package/lib/engine/engine_addressables.d.ts +74 -11
  40. package/lib/engine/engine_addressables.js +74 -11
  41. package/lib/engine/engine_addressables.js.map +1 -1
  42. package/lib/engine/engine_application.d.ts +7 -0
  43. package/lib/engine/engine_application.js +8 -1
  44. package/lib/engine/engine_application.js.map +1 -1
  45. package/lib/engine/engine_camera.fit.d.ts +48 -3
  46. package/lib/engine/engine_camera.fit.js +29 -0
  47. package/lib/engine/engine_camera.fit.js.map +1 -1
  48. package/lib/engine/engine_context.d.ts +33 -8
  49. package/lib/engine/engine_context.js +47 -8
  50. package/lib/engine/engine_context.js.map +1 -1
  51. package/lib/engine/engine_loaders.d.ts +0 -6
  52. package/lib/engine/engine_loaders.js +5 -5
  53. package/lib/engine/engine_loaders.js.map +1 -1
  54. package/lib/engine/engine_physics.js +6 -2
  55. package/lib/engine/engine_physics.js.map +1 -1
  56. package/lib/engine/engine_physics_rapier.d.ts +11 -2
  57. package/lib/engine/engine_physics_rapier.js +9 -0
  58. package/lib/engine/engine_physics_rapier.js.map +1 -1
  59. package/lib/engine/engine_scenelighting.d.ts +12 -1
  60. package/lib/engine/engine_scenelighting.js +21 -1
  61. package/lib/engine/engine_scenelighting.js.map +1 -1
  62. package/lib/engine/engine_texture.d.ts +1 -1
  63. package/lib/engine/engine_tonemapping.d.ts +1 -1
  64. package/lib/engine/engine_types.d.ts +16 -0
  65. package/lib/engine/engine_typestore.d.ts +1 -0
  66. package/lib/engine/engine_typestore.js +5 -6
  67. package/lib/engine/engine_typestore.js.map +1 -1
  68. package/lib/engine/engine_utils_qrcode.js +1 -1
  69. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  70. package/lib/engine/extensions/NEEDLE_components.d.ts +4 -4
  71. package/lib/engine/extensions/NEEDLE_components.js +36 -17
  72. package/lib/engine/extensions/NEEDLE_components.js.map +1 -1
  73. package/lib/engine/extensions/NEEDLE_lightmaps.js +2 -2
  74. package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
  75. package/lib/engine/extensions/extensions.d.ts +2 -2
  76. package/lib/engine/extensions/extensions.js +11 -5
  77. package/lib/engine/extensions/extensions.js.map +1 -1
  78. package/lib/engine/webcomponents/buttons.d.ts +3 -1
  79. package/lib/engine/webcomponents/buttons.js +3 -1
  80. package/lib/engine/webcomponents/buttons.js.map +1 -1
  81. package/lib/engine/webcomponents/logo-element.d.ts +11 -0
  82. package/lib/engine/webcomponents/logo-element.js +6 -0
  83. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  84. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +63 -5
  85. package/lib/engine/webcomponents/needle menu/needle-menu.js +57 -5
  86. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  87. package/lib/engine/webcomponents/needle-button.d.ts +5 -0
  88. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  89. package/lib/engine/webcomponents/needle-engine.attributes.d.ts +11 -2
  90. package/lib/engine/webcomponents/needle-engine.d.ts +162 -8
  91. package/lib/engine/webcomponents/needle-engine.js +33 -7
  92. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  93. package/lib/engine/xr/NeedleXRSession.js +2 -1
  94. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  95. package/lib/engine-components/AlignmentConstraint.d.ts +9 -0
  96. package/lib/engine-components/AlignmentConstraint.js +9 -0
  97. package/lib/engine-components/AlignmentConstraint.js.map +1 -1
  98. package/lib/engine-components/Animator.d.ts +1 -0
  99. package/lib/engine-components/Animator.js.map +1 -1
  100. package/lib/engine-components/AudioListener.d.ts +2 -0
  101. package/lib/engine-components/AudioListener.js +2 -0
  102. package/lib/engine-components/AudioListener.js.map +1 -1
  103. package/lib/engine-components/AudioSource.d.ts +1 -0
  104. package/lib/engine-components/AudioSource.js +1 -0
  105. package/lib/engine-components/AudioSource.js.map +1 -1
  106. package/lib/engine-components/AxesHelper.d.ts +2 -0
  107. package/lib/engine-components/AxesHelper.js +2 -0
  108. package/lib/engine-components/AxesHelper.js.map +1 -1
  109. package/lib/engine-components/Camera.d.ts +1 -0
  110. package/lib/engine-components/Camera.js +1 -0
  111. package/lib/engine-components/Camera.js.map +1 -1
  112. package/lib/engine-components/CharacterController.d.ts +4 -1
  113. package/lib/engine-components/CharacterController.js +4 -1
  114. package/lib/engine-components/CharacterController.js.map +1 -1
  115. package/lib/engine-components/Component.d.ts +5 -0
  116. package/lib/engine-components/Component.js +7 -0
  117. package/lib/engine-components/Component.js.map +1 -1
  118. package/lib/engine-components/DeleteBox.d.ts +2 -0
  119. package/lib/engine-components/DeleteBox.js +2 -0
  120. package/lib/engine-components/DeleteBox.js.map +1 -1
  121. package/lib/engine-components/DeviceFlag.d.ts +4 -0
  122. package/lib/engine-components/DeviceFlag.js +4 -0
  123. package/lib/engine-components/DeviceFlag.js.map +1 -1
  124. package/lib/engine-components/DragControls.d.ts +1 -0
  125. package/lib/engine-components/DragControls.js +1 -0
  126. package/lib/engine-components/DragControls.js.map +1 -1
  127. package/lib/engine-components/DropListener.d.ts +1 -0
  128. package/lib/engine-components/DropListener.js +1 -0
  129. package/lib/engine-components/DropListener.js.map +1 -1
  130. package/lib/engine-components/Duplicatable.d.ts +1 -0
  131. package/lib/engine-components/Duplicatable.js +1 -0
  132. package/lib/engine-components/Duplicatable.js.map +1 -1
  133. package/lib/engine-components/EventTrigger.d.ts +2 -0
  134. package/lib/engine-components/EventTrigger.js +2 -0
  135. package/lib/engine-components/EventTrigger.js.map +1 -1
  136. package/lib/engine-components/GridHelper.d.ts +2 -0
  137. package/lib/engine-components/GridHelper.js +2 -0
  138. package/lib/engine-components/GridHelper.js.map +1 -1
  139. package/lib/engine-components/GroundProjection.d.ts +1 -0
  140. package/lib/engine-components/GroundProjection.js +1 -0
  141. package/lib/engine-components/GroundProjection.js.map +1 -1
  142. package/lib/engine-components/LODGroup.d.ts +2 -0
  143. package/lib/engine-components/LODGroup.js +2 -0
  144. package/lib/engine-components/LODGroup.js.map +1 -1
  145. package/lib/engine-components/Light.d.ts +1 -0
  146. package/lib/engine-components/Light.js +1 -0
  147. package/lib/engine-components/Light.js.map +1 -1
  148. package/lib/engine-components/LookAtConstraint.d.ts +1 -0
  149. package/lib/engine-components/LookAtConstraint.js +1 -0
  150. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  151. package/lib/engine-components/NeedleMenu.d.ts +1 -0
  152. package/lib/engine-components/NeedleMenu.js +1 -0
  153. package/lib/engine-components/NeedleMenu.js.map +1 -1
  154. package/lib/engine-components/NestedGltf.d.ts +1 -0
  155. package/lib/engine-components/NestedGltf.js +1 -0
  156. package/lib/engine-components/NestedGltf.js.map +1 -1
  157. package/lib/engine-components/Networking.d.ts +1 -0
  158. package/lib/engine-components/Networking.js +1 -0
  159. package/lib/engine-components/Networking.js.map +1 -1
  160. package/lib/engine-components/OffsetConstraint.d.ts +7 -0
  161. package/lib/engine-components/OffsetConstraint.js +7 -0
  162. package/lib/engine-components/OffsetConstraint.js.map +1 -1
  163. package/lib/engine-components/OrbitControls.d.ts +1 -0
  164. package/lib/engine-components/OrbitControls.js +1 -0
  165. package/lib/engine-components/OrbitControls.js.map +1 -1
  166. package/lib/engine-components/PlayerColor.d.ts +2 -0
  167. package/lib/engine-components/PlayerColor.js +2 -0
  168. package/lib/engine-components/PlayerColor.js.map +1 -1
  169. package/lib/engine-components/ReflectionProbe.d.ts +1 -0
  170. package/lib/engine-components/ReflectionProbe.js +17 -10
  171. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  172. package/lib/engine-components/Renderer.js +16 -42
  173. package/lib/engine-components/Renderer.js.map +1 -1
  174. package/lib/engine-components/RendererInstancing.d.ts +5 -3
  175. package/lib/engine-components/RendererInstancing.js +64 -31
  176. package/lib/engine-components/RendererInstancing.js.map +1 -1
  177. package/lib/engine-components/RendererLightmap.d.ts +1 -0
  178. package/lib/engine-components/RendererLightmap.js +24 -18
  179. package/lib/engine-components/RendererLightmap.js.map +1 -1
  180. package/lib/engine-components/RigidBody.d.ts +1 -0
  181. package/lib/engine-components/RigidBody.js +1 -0
  182. package/lib/engine-components/RigidBody.js.map +1 -1
  183. package/lib/engine-components/SceneSwitcher.d.ts +1 -0
  184. package/lib/engine-components/SceneSwitcher.js +1 -0
  185. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  186. package/lib/engine-components/ScreenCapture.d.ts +1 -0
  187. package/lib/engine-components/ScreenCapture.js +1 -0
  188. package/lib/engine-components/ScreenCapture.js.map +1 -1
  189. package/lib/engine-components/SeeThrough.d.ts +1 -0
  190. package/lib/engine-components/SeeThrough.js +1 -0
  191. package/lib/engine-components/SeeThrough.js.map +1 -1
  192. package/lib/engine-components/ShadowCatcher.d.ts +2 -0
  193. package/lib/engine-components/ShadowCatcher.js +2 -0
  194. package/lib/engine-components/ShadowCatcher.js.map +1 -1
  195. package/lib/engine-components/Skybox.d.ts +16 -5
  196. package/lib/engine-components/Skybox.js +38 -25
  197. package/lib/engine-components/Skybox.js.map +1 -1
  198. package/lib/engine-components/SmoothFollow.d.ts +1 -0
  199. package/lib/engine-components/SmoothFollow.js +1 -0
  200. package/lib/engine-components/SmoothFollow.js.map +1 -1
  201. package/lib/engine-components/SpatialTrigger.d.ts +1 -0
  202. package/lib/engine-components/SpatialTrigger.js +1 -0
  203. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  204. package/lib/engine-components/SpectatorCamera.d.ts +1 -0
  205. package/lib/engine-components/SpectatorCamera.js +1 -0
  206. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  207. package/lib/engine-components/SpriteRenderer.d.ts +1 -0
  208. package/lib/engine-components/SpriteRenderer.js +1 -0
  209. package/lib/engine-components/SpriteRenderer.js.map +1 -1
  210. package/lib/engine-components/SyncedCamera.d.ts +2 -0
  211. package/lib/engine-components/SyncedCamera.js +2 -0
  212. package/lib/engine-components/SyncedCamera.js.map +1 -1
  213. package/lib/engine-components/SyncedRoom.d.ts +1 -0
  214. package/lib/engine-components/SyncedRoom.js +1 -0
  215. package/lib/engine-components/SyncedRoom.js.map +1 -1
  216. package/lib/engine-components/SyncedTransform.d.ts +2 -0
  217. package/lib/engine-components/SyncedTransform.js +2 -0
  218. package/lib/engine-components/SyncedTransform.js.map +1 -1
  219. package/lib/engine-components/TransformGizmo.d.ts +2 -0
  220. package/lib/engine-components/TransformGizmo.js +2 -0
  221. package/lib/engine-components/TransformGizmo.js.map +1 -1
  222. package/lib/engine-components/VideoPlayer.d.ts +1 -0
  223. package/lib/engine-components/VideoPlayer.js +1 -0
  224. package/lib/engine-components/VideoPlayer.js.map +1 -1
  225. package/lib/engine-components/Voip.d.ts +1 -0
  226. package/lib/engine-components/Voip.js +1 -0
  227. package/lib/engine-components/Voip.js.map +1 -1
  228. package/lib/engine-components/export/usdz/USDZExporter.d.ts +24 -3
  229. package/lib/engine-components/export/usdz/USDZExporter.js +36 -2
  230. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  231. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +18 -0
  232. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +18 -0
  233. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  234. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +1 -0
  235. package/lib/engine-components/particlesystem/ParticleSystem.js +1 -0
  236. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  237. package/lib/engine-components/physics/Attractor.d.ts +3 -0
  238. package/lib/engine-components/physics/Attractor.js +3 -0
  239. package/lib/engine-components/physics/Attractor.js.map +1 -1
  240. package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -0
  241. package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -0
  242. package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
  243. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +4 -0
  244. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +4 -0
  245. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
  246. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +3 -0
  247. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +3 -0
  248. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
  249. package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +4 -0
  250. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +4 -0
  251. package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
  252. package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
  253. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
  254. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
  255. package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +3 -0
  256. package/lib/engine-components/postprocessing/Effects/Pixelation.js +3 -0
  257. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  258. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +4 -0
  259. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +4 -0
  260. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
  261. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +4 -0
  262. package/lib/engine-components/postprocessing/Effects/Sharpening.js +4 -0
  263. package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
  264. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +4 -0
  265. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +4 -0
  266. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
  267. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +4 -0
  268. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +4 -0
  269. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  270. package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +4 -0
  271. package/lib/engine-components/postprocessing/Effects/Vignette.js +4 -0
  272. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
  273. package/lib/engine-components/postprocessing/Volume.d.ts +1 -0
  274. package/lib/engine-components/postprocessing/Volume.js +1 -0
  275. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  276. package/lib/engine-components/splines/Spline.d.ts +1 -0
  277. package/lib/engine-components/splines/Spline.js +1 -0
  278. package/lib/engine-components/splines/Spline.js.map +1 -1
  279. package/lib/engine-components/splines/SplineWalker.d.ts +1 -0
  280. package/lib/engine-components/splines/SplineWalker.js +1 -0
  281. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  282. package/lib/engine-components/timeline/PlayableDirector.d.ts +3 -1
  283. package/lib/engine-components/timeline/PlayableDirector.js +17 -9
  284. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  285. package/lib/engine-components/timeline/SignalAsset.d.ts +1 -0
  286. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  287. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  288. package/lib/engine-components/ui/Button.d.ts +4 -0
  289. package/lib/engine-components/ui/Button.js +4 -0
  290. package/lib/engine-components/ui/Button.js.map +1 -1
  291. package/lib/engine-components/ui/Canvas.d.ts +5 -0
  292. package/lib/engine-components/ui/Canvas.js +5 -0
  293. package/lib/engine-components/ui/Canvas.js.map +1 -1
  294. package/lib/engine-components/ui/CanvasGroup.d.ts +4 -0
  295. package/lib/engine-components/ui/CanvasGroup.js +4 -0
  296. package/lib/engine-components/ui/CanvasGroup.js.map +1 -1
  297. package/lib/engine-components/ui/EventSystem.d.ts +2 -0
  298. package/lib/engine-components/ui/EventSystem.js +2 -0
  299. package/lib/engine-components/ui/EventSystem.js.map +1 -1
  300. package/lib/engine-components/ui/Image.d.ts +4 -0
  301. package/lib/engine-components/ui/Image.js +4 -0
  302. package/lib/engine-components/ui/Image.js.map +1 -1
  303. package/lib/engine-components/ui/InputField.d.ts +4 -0
  304. package/lib/engine-components/ui/InputField.js +4 -0
  305. package/lib/engine-components/ui/InputField.js.map +1 -1
  306. package/lib/engine-components/ui/Outline.d.ts +7 -0
  307. package/lib/engine-components/ui/Outline.js +7 -0
  308. package/lib/engine-components/ui/Outline.js.map +1 -1
  309. package/lib/engine-components/ui/Text.d.ts +1 -0
  310. package/lib/engine-components/ui/Text.js +1 -0
  311. package/lib/engine-components/ui/Text.js.map +1 -1
  312. package/lib/engine-components/utils/LookAt.d.ts +1 -0
  313. package/lib/engine-components/utils/LookAt.js +1 -0
  314. package/lib/engine-components/utils/LookAt.js.map +1 -1
  315. package/lib/engine-components/web/Clickthrough.d.ts +1 -1
  316. package/lib/engine-components/web/Clickthrough.js +1 -1
  317. package/lib/engine-components/web/CursorFollow.d.ts +2 -0
  318. package/lib/engine-components/web/CursorFollow.js +3 -0
  319. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  320. package/lib/engine-components/web/HoverAnimation.d.ts +1 -0
  321. package/lib/engine-components/web/HoverAnimation.js +1 -0
  322. package/lib/engine-components/web/HoverAnimation.js.map +1 -1
  323. package/lib/engine-components/web/ScrollFollow.d.ts +2 -0
  324. package/lib/engine-components/web/ScrollFollow.js +2 -0
  325. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  326. package/lib/engine-components/web/ViewBox.d.ts +1 -0
  327. package/lib/engine-components/web/ViewBox.js +1 -0
  328. package/lib/engine-components/web/ViewBox.js.map +1 -1
  329. package/lib/engine-components/webxr/Avatar.d.ts +5 -0
  330. package/lib/engine-components/webxr/Avatar.js +5 -0
  331. package/lib/engine-components/webxr/Avatar.js.map +1 -1
  332. package/lib/engine-components/webxr/WebARCameraBackground.d.ts +1 -0
  333. package/lib/engine-components/webxr/WebARCameraBackground.js +1 -0
  334. package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
  335. package/lib/engine-components/webxr/WebARSessionRoot.d.ts +1 -0
  336. package/lib/engine-components/webxr/WebARSessionRoot.js +1 -0
  337. package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
  338. package/lib/engine-components/webxr/WebXR.d.ts +1 -1
  339. package/lib/engine-components/webxr/WebXR.js +5 -1
  340. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  341. package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +1 -0
  342. package/lib/engine-components/webxr/controllers/XRControllerFollow.js +1 -0
  343. package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
  344. package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +4 -0
  345. package/lib/engine-components/webxr/controllers/XRControllerModel.js +5 -1
  346. package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
  347. package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +1 -0
  348. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +1 -0
  349. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  350. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +2 -0
  351. package/lib/engine-components-experimental/networking/PlayerSync.js +2 -0
  352. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  353. package/lib/needle-engine.js +2 -1
  354. package/lib/needle-engine.js.map +1 -1
  355. package/package.json +18 -12
  356. package/plugins/types/needleConfig.d.ts +1 -1
  357. package/plugins/types/next.d.ts +1 -1
  358. package/plugins/types/userconfig.d.ts +1 -1
  359. package/src/engine/api.ts +1 -1
  360. package/src/engine/debug/debug_spector.ts +43 -0
  361. package/src/engine/engine_addressables.ts +75 -11
  362. package/src/engine/engine_application.ts +16 -1
  363. package/src/engine/engine_camera.fit.ts +49 -4
  364. package/src/engine/engine_context.ts +59 -10
  365. package/src/engine/engine_loaders.ts +6 -6
  366. package/src/engine/engine_physics.ts +6 -2
  367. package/src/engine/engine_physics_rapier.ts +11 -2
  368. package/src/engine/engine_scenelighting.ts +30 -8
  369. package/src/engine/engine_texture.ts +1 -1
  370. package/src/engine/engine_tonemapping.ts +1 -1
  371. package/src/engine/engine_types.ts +17 -0
  372. package/src/engine/engine_typestore.ts +5 -6
  373. package/src/engine/engine_utils_qrcode.ts +1 -1
  374. package/src/engine/extensions/NEEDLE_components.ts +47 -26
  375. package/src/engine/extensions/NEEDLE_lightmaps.ts +2 -2
  376. package/src/engine/extensions/extensions.ts +11 -5
  377. package/src/engine/webcomponents/buttons.ts +3 -1
  378. package/src/engine/webcomponents/logo-element.ts +12 -0
  379. package/src/engine/webcomponents/needle menu/needle-menu.ts +64 -6
  380. package/src/engine/webcomponents/needle-button.ts +6 -0
  381. package/src/engine/webcomponents/needle-engine.attributes.ts +12 -3
  382. package/src/engine/webcomponents/needle-engine.ts +165 -13
  383. package/src/engine/xr/NeedleXRSession.ts +3 -1
  384. package/src/engine-components/AlignmentConstraint.ts +9 -0
  385. package/src/engine-components/Animator.ts +1 -0
  386. package/src/engine-components/AudioListener.ts +2 -0
  387. package/src/engine-components/AudioSource.ts +1 -0
  388. package/src/engine-components/AxesHelper.ts +2 -0
  389. package/src/engine-components/Camera.ts +1 -0
  390. package/src/engine-components/CharacterController.ts +4 -1
  391. package/src/engine-components/Component.ts +9 -1
  392. package/src/engine-components/DeleteBox.ts +2 -0
  393. package/src/engine-components/DeviceFlag.ts +4 -0
  394. package/src/engine-components/DragControls.ts +1 -0
  395. package/src/engine-components/DropListener.ts +1 -0
  396. package/src/engine-components/Duplicatable.ts +1 -0
  397. package/src/engine-components/EventTrigger.ts +2 -0
  398. package/src/engine-components/GridHelper.ts +2 -0
  399. package/src/engine-components/GroundProjection.ts +1 -0
  400. package/src/engine-components/LODGroup.ts +2 -0
  401. package/src/engine-components/Light.ts +1 -0
  402. package/src/engine-components/LookAtConstraint.ts +1 -0
  403. package/src/engine-components/NeedleMenu.ts +1 -0
  404. package/src/engine-components/NestedGltf.ts +1 -0
  405. package/src/engine-components/Networking.ts +1 -0
  406. package/src/engine-components/OffsetConstraint.ts +7 -0
  407. package/src/engine-components/OrbitControls.ts +1 -0
  408. package/src/engine-components/PlayerColor.ts +2 -0
  409. package/src/engine-components/ReflectionProbe.ts +19 -10
  410. package/src/engine-components/Renderer.ts +16 -44
  411. package/src/engine-components/RendererInstancing.ts +69 -33
  412. package/src/engine-components/RendererLightmap.ts +27 -17
  413. package/src/engine-components/RigidBody.ts +1 -0
  414. package/src/engine-components/SceneSwitcher.ts +1 -0
  415. package/src/engine-components/ScreenCapture.ts +1 -0
  416. package/src/engine-components/SeeThrough.ts +1 -0
  417. package/src/engine-components/ShadowCatcher.ts +2 -0
  418. package/src/engine-components/Skybox.ts +48 -36
  419. package/src/engine-components/SmoothFollow.ts +1 -0
  420. package/src/engine-components/SpatialTrigger.ts +1 -0
  421. package/src/engine-components/SpectatorCamera.ts +1 -0
  422. package/src/engine-components/SpriteRenderer.ts +1 -0
  423. package/src/engine-components/SyncedCamera.ts +2 -0
  424. package/src/engine-components/SyncedRoom.ts +1 -0
  425. package/src/engine-components/SyncedTransform.ts +2 -0
  426. package/src/engine-components/TransformGizmo.ts +2 -0
  427. package/src/engine-components/VideoPlayer.ts +1 -0
  428. package/src/engine-components/Voip.ts +1 -0
  429. package/src/engine-components/export/usdz/USDZExporter.ts +52 -5
  430. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +18 -0
  431. package/src/engine-components/particlesystem/ParticleSystem.ts +1 -0
  432. package/src/engine-components/physics/Attractor.ts +3 -0
  433. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -0
  434. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +4 -0
  435. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +3 -0
  436. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +4 -0
  437. package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
  438. package/src/engine-components/postprocessing/Effects/Pixelation.ts +3 -0
  439. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +4 -0
  440. package/src/engine-components/postprocessing/Effects/Sharpening.ts +4 -0
  441. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +4 -0
  442. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +4 -0
  443. package/src/engine-components/postprocessing/Effects/Vignette.ts +4 -0
  444. package/src/engine-components/postprocessing/Volume.ts +1 -0
  445. package/src/engine-components/splines/Spline.ts +1 -0
  446. package/src/engine-components/splines/SplineWalker.ts +1 -0
  447. package/src/engine-components/timeline/PlayableDirector.ts +17 -10
  448. package/src/engine-components/timeline/SignalAsset.ts +1 -0
  449. package/src/engine-components/ui/Button.ts +4 -0
  450. package/src/engine-components/ui/Canvas.ts +5 -0
  451. package/src/engine-components/ui/CanvasGroup.ts +4 -0
  452. package/src/engine-components/ui/EventSystem.ts +2 -0
  453. package/src/engine-components/ui/Image.ts +4 -0
  454. package/src/engine-components/ui/InputField.ts +4 -0
  455. package/src/engine-components/ui/Outline.ts +7 -0
  456. package/src/engine-components/ui/Text.ts +1 -0
  457. package/src/engine-components/utils/LookAt.ts +1 -0
  458. package/src/engine-components/web/Clickthrough.ts +1 -1
  459. package/src/engine-components/web/CursorFollow.ts +4 -0
  460. package/src/engine-components/web/HoverAnimation.ts +1 -0
  461. package/src/engine-components/web/ScrollFollow.ts +2 -0
  462. package/src/engine-components/web/ViewBox.ts +1 -0
  463. package/src/engine-components/webxr/Avatar.ts +5 -0
  464. package/src/engine-components/webxr/WebARCameraBackground.ts +1 -0
  465. package/src/engine-components/webxr/WebARSessionRoot.ts +1 -0
  466. package/src/engine-components/webxr/WebXR.ts +5 -1
  467. package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -0
  468. package/src/engine-components/webxr/controllers/XRControllerModel.ts +5 -1
  469. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +1 -0
  470. package/src/engine-components-experimental/networking/PlayerSync.ts +2 -0
  471. package/src/needle-engine.ts +4 -2
  472. package/dist/generateMeshBVH.worker-B9bjdr6J.js +0 -25
  473. package/dist/loader.worker-CiTwpNPW.js +0 -27
  474. package/dist/rapier-BqdcSmKY.umd.cjs +0 -1
  475. package/dist/rapier-Cg3w3nFI.min.js +0 -1
  476. package/dist/rapier-sU12SWAs.js +0 -5217
@@ -67,7 +67,7 @@ export class RapierPhysics implements IPhysicsEngine {
67
67
  debugRenderRaycasts: boolean = false;
68
68
 
69
69
  removeBody(obj: IComponent) {
70
- if(debugPhysics) console.log("REMOVE BODY", obj?.name, obj[$bodyKey]);
70
+ if (debugPhysics) console.log("REMOVE BODY", obj?.name, obj[$bodyKey]);
71
71
  if (!obj) return;
72
72
  this.validate();
73
73
  const body = obj[$bodyKey];
@@ -817,7 +817,16 @@ export class RapierPhysics implements IPhysicsEngine {
817
817
  return component;
818
818
  }
819
819
 
820
- private createCollider(collider: ICollider, desc: ColliderDesc) {
820
+ /**
821
+ * Creates a collider in the physics world.
822
+ *
823
+ * @param collider - The collider component.
824
+ * @param desc - The collider description.
825
+ * @returns The created collider.
826
+ *
827
+ * @throws Will throw an error if the physics world is not initialized. Make sure to call `initialize()` before creating colliders.
828
+ */
829
+ createCollider(collider: ICollider, desc: ColliderDesc) {
821
830
  if (!this.world) throw new Error("Physics world not initialized");
822
831
  const matrix = this._tempMatrix;
823
832
  let rigidBody: RigidBody | undefined = undefined;
@@ -1,4 +1,4 @@
1
- import { EquirectangularReflectionMapping, LightProbe, SphericalHarmonics3, SRGBColorSpace,Texture, Vector4, WebGLCubeRenderTarget } from "three";
1
+ import { EquirectangularReflectionMapping, LightProbe, Source, SphericalHarmonics3, SRGBColorSpace, Texture, Vector4, WebGLCubeRenderTarget } from "three";
2
2
 
3
3
  import { AssetReference } from "./engine_addressables.js";
4
4
  import { Context } from "./engine_setup.js";
@@ -44,9 +44,16 @@ export class RendererData {
44
44
  this.context.pre_update_callbacks.push(this.preUpdate.bind(this))
45
45
  }
46
46
 
47
+ /**
48
+ * The id of the currently active scene light settings (source identifier).
49
+ */
47
50
  private _currentLightSettingsId?: SourceIdentifier;
48
51
  private _sceneLightSettings?: Map<SourceIdentifier, SceneLightSettings>;
49
52
 
53
+ get currentLightSettingsId(): SourceIdentifier | undefined {
54
+ return this._currentLightSettingsId;
55
+ }
56
+
50
57
  private preUpdate() {
51
58
  const time = this.context.time;
52
59
  this._timevec4.x = time.time;
@@ -82,11 +89,11 @@ export class RendererData {
82
89
 
83
90
  /** set the scene lighting from a specific scene. Will disable any previously enabled lighting settings */
84
91
  enable(sourceId: SourceIdentifier | AssetReference) {
85
- if(sourceId instanceof AssetReference)
92
+ if (sourceId instanceof AssetReference)
86
93
  sourceId = sourceId.url;
87
94
  const settings = this._sceneLightSettings?.get(sourceId);
88
95
  if (!settings) {
89
- if(debug) console.warn("No light settings found for", sourceId);
96
+ if (debug) console.warn("No light settings found for", sourceId);
90
97
  return false;
91
98
  }
92
99
  if (debug) console.log("Enable scene light settings", sourceId, settings);
@@ -100,7 +107,7 @@ export class RendererData {
100
107
 
101
108
  /** disable the lighting of a specific scene, will only have any effect if it is currently active */
102
109
  disable(sourceId: SourceIdentifier | AssetReference) {
103
- if(sourceId instanceof AssetReference)
110
+ if (sourceId instanceof AssetReference)
104
111
  sourceId = sourceId.url;
105
112
  if (sourceId === null || sourceId === undefined) return false;
106
113
  const settings = this._sceneLightSettings?.get(sourceId);
@@ -112,8 +119,22 @@ export class RendererData {
112
119
  return true;
113
120
  }
114
121
 
115
- /** Disables the currently active scene lighting (if any), returns the id of the previously active lighting */
116
- disableCurrent() : SourceIdentifier | null {
122
+ /**
123
+ * Enables the currently active scene lighting (if any), returns the id of the enabled lighting.
124
+ * @returns The id of the enabled lighting, or null if no lighting is currently active.
125
+ */
126
+ enableCurrent(): SourceIdentifier | null {
127
+ if (this._currentLightSettingsId) {
128
+ this.enable(this._currentLightSettingsId);
129
+ return this._currentLightSettingsId ?? null;
130
+ }
131
+ return null;
132
+ }
133
+
134
+ /** Disables the currently active scene lighting (if any), returns the id of the previously active lighting
135
+ * @returns The id of the previously active lighting, or null if no lighting was active.
136
+ */
137
+ disableCurrent(): SourceIdentifier | null {
117
138
  if (this._currentLightSettingsId) {
118
139
  const prev = this._currentLightSettingsId;
119
140
  this.disable(this._currentLightSettingsId);
@@ -162,7 +183,7 @@ export class RendererData {
162
183
  private __currentReflectionId: SourceIdentifier | null = null;
163
184
 
164
185
  /** @internal */
165
- internalEnableReflection(sourceId: SourceIdentifier) : Texture | null {
186
+ internalEnableReflection(sourceId: SourceIdentifier): Texture | null {
166
187
  this.__currentReflectionId = sourceId;
167
188
  const settings = this._sceneLightSettings?.get(sourceId);
168
189
 
@@ -181,6 +202,7 @@ export class RendererData {
181
202
  const tex = existing.Source;
182
203
  tex.mapping = EquirectangularReflectionMapping;
183
204
  scene.environment = tex;
205
+ scene.environmentIntensity = this.environmentIntensity || 1;
184
206
  return tex;
185
207
  }
186
208
  else if (debug) console.warn("Could not find reflection for source", sourceId);
@@ -216,7 +238,7 @@ export class RendererData {
216
238
  /** @internal */
217
239
  internalDisableReflection(sourceId?: SourceIdentifier) {
218
240
  if (sourceId && sourceId !== this.__currentReflectionId) {
219
- if(debug) console.log("Not disabling reflection for", sourceId, "because it is not the current light settings id", this.__currentReflectionId)
241
+ if (debug) console.log("Not disabling reflection for", sourceId, "because it is not the current light settings id", this.__currentReflectionId)
220
242
  return;
221
243
  }
222
244
  if (debug) console.log("Disable reflection", sourceId)
@@ -1,6 +1,6 @@
1
1
  import type { EffectComposer } from "postprocessing";
2
2
  import { Camera, Mesh, Object3D, Texture, WebGLRenderer, WebGLRenderTarget } from "three";
3
- import type { EffectComposer as ThreeEffectComposer } from "three/examples/jsm/postprocessing/EffectComposer";
3
+ import type { EffectComposer as ThreeEffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js";
4
4
 
5
5
  import { findResourceUsers } from "./engine_assetdatabase.js";
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, NoToneMapping, ShaderChunk, ToneMapping } from "three";
2
2
 
3
3
  import { isDevEnvironment } from "./debug/index.js";
4
- import type { Context } from "./engine_setup";
4
+ import type { Context } from "./engine_setup.js";
5
5
 
6
6
  let patchedTonemapping = false;
7
7
  export function patchTonemapping(_ctx?: Context) {
@@ -566,6 +566,23 @@ export interface IPhysicsEngine {
566
566
  */
567
567
  boxOverlap(point: Vector3, size: Vector3, rotation: Vector4Like | null): Array<ShapeOverlapResult>;
568
568
 
569
+ /**
570
+ * Creates a collider in the physics world.
571
+ *
572
+ * @param collider - The collider component.
573
+ * @param desc - The collider description.
574
+ * @returns The created collider.
575
+ *
576
+ * @throws Will throw an error if the physics world is not initialized. Make sure to call `initialize()` before creating colliders.
577
+ *
578
+ * @example
579
+ * ```typescript
580
+ * const boxColliderDesc = NEEDLE_ENGINE_MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.cuboid(1, 1, 1);
581
+ * const collider = physicsEngine.createCollider(myBoxColliderComponent, boxColliderDesc);
582
+ * ```
583
+ */
584
+ createCollider(collider: ICollider, desc: any): any;
585
+
569
586
  // Collider methods
570
587
  /**
571
588
  * Adds a sphere collider to the physics world
@@ -7,6 +7,7 @@ declare type Type = new (...args: any[]) => any;
7
7
  class _TypeStore {
8
8
 
9
9
  private _types: Map<string, Type> = new Map();
10
+ private _reverseTypes: Map<Type, string> = new Map();
10
11
 
11
12
  constructor() {
12
13
  if (debug) console.warn("TypeStore: Created", this);
@@ -18,8 +19,10 @@ class _TypeStore {
18
19
  public add(key: string, type: Type) {
19
20
  if (debug) console.warn("ADD TYPE", key);
20
21
  const existing = this._types.get(key);
21
- if (!existing)
22
+ if (!existing) {
22
23
  this._types.set(key, type);
24
+ this._reverseTypes.set(type, key);
25
+ }
23
26
  else {
24
27
  if (debug) {
25
28
  if (existing !== type) {
@@ -40,11 +43,7 @@ class _TypeStore {
40
43
  * @returns the key/name for the given type if registered
41
44
  */
42
45
  public getKey(type: Type): string | null {
43
- for (const [key, value] of this._types) {
44
- if (value === type)
45
- return key;
46
- }
47
- return null;
46
+ return this._reverseTypes.get(type) || null;
48
47
  }
49
48
  }
50
49
 
@@ -166,7 +166,7 @@ async function internalRenderQRCodeOverlays(canvas: HTMLCanvasElement, args: { s
166
166
  haveLogo = await new Promise((resolve, _reject) => {
167
167
  image.onload = () => resolve(true);
168
168
  image.onerror = (err) => {
169
- let errorUrl = logoSrc !== needleLogoOnlySVG ? "'" + logoSrc + "'" : null;
169
+ const errorUrl = logoSrc !== needleLogoOnlySVG ? "'" + logoSrc + "'" : null;
170
170
  console.error("[QR Code] Error loading logo image for QR code", errorUrl, isDevEnvironment() ? err : "");
171
171
  resolve(false);
172
172
  };
@@ -2,12 +2,13 @@ import { Object3D } from "three";
2
2
  import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
3
3
  import { type GLTF, type GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
4
4
 
5
+ import { isDevEnvironment } from "../debug/debug.js";
5
6
  import { builtinComponentKeyName } from "../engine_constants.js";
6
7
  import { debugExtension } from "../engine_default_parameters.js";
7
8
  import { getLoader } from "../engine_gltf.js";
8
9
  import { type NodeToObjectMap, type ObjectToNodeMap, SerializationContext } from "../engine_serialization_core.js";
9
10
  import { apply } from "../js-extensions/index.js";
10
- import { maskGltfAssociation,resolveReferences } from "./extension_utils.js";
11
+ import { maskGltfAssociation, resolveReferences } from "./extension_utils.js";
11
12
 
12
13
  export const debug = debugExtension
13
14
  const componentsArrayExportKey = "$___Export_Components";
@@ -15,7 +16,7 @@ const componentsArrayExportKey = "$___Export_Components";
15
16
  export const EXTENSION_NAME = "NEEDLE_components";
16
17
 
17
18
  class ExtensionData {
18
- [builtinComponentKeyName]?: Array<object | null>
19
+ [builtinComponentKeyName]?: Array<Record<string, any> | null>
19
20
  }
20
21
 
21
22
  class ExportData {
@@ -35,14 +36,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
35
36
  get name(): string {
36
37
  return EXTENSION_NAME;
37
38
  }
38
-
39
- // import
40
- parser?: GLTFParser;
41
- nodeToObjectMap: NodeToObjectMap = {};
42
- /** The loaded gltf */
43
- gltf: GLTF | null = null;
44
-
45
- // export
39
+ // #region export
46
40
  exportContext!: { [nodeIndex: number]: ExportData };
47
41
  objectToNodeMap: ObjectToNodeMap = {};
48
42
  context!: SerializationContext;
@@ -112,7 +106,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
112
106
 
113
107
  writeNode(node: Object3D, nodeDef) {
114
108
  const nodeIndex = this.writer.json.nodes.length;
115
- if (debug)
109
+ if (debug)
116
110
  console.log(node.name, nodeIndex, node.uuid);
117
111
  const context = new ExportData(node, nodeIndex, nodeDef);
118
112
  this.exportContext[nodeIndex] = context;
@@ -158,8 +152,13 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
158
152
 
159
153
 
160
154
  // -------------------------------------
161
- // LOADING
162
- // called by GLTFLoader
155
+ // #region import
156
+ parser?: GLTFParser;
157
+ nodeToObjectMap: NodeToObjectMap = {};
158
+ /** The loaded gltf */
159
+ gltf: GLTF | null = null;
160
+
161
+
163
162
  beforeRoot() {
164
163
  if (debug)
165
164
  console.log("BEGIN LOAD");
@@ -167,7 +166,6 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
167
166
  return null;
168
167
  }
169
168
 
170
- // called by GLTFLoader
171
169
  async afterRoot(result: GLTF): Promise<void> {
172
170
  this.gltf = result;
173
171
 
@@ -175,8 +173,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
175
173
  const ext = parser?.extensions;
176
174
  if (!ext) return;
177
175
  const hasExtension = ext[this.name];
178
- if (debug)
179
- console.log("After root", result, this.parser, ext);
176
+ if (debug) console.log("After root", result, this.parser, ext);
180
177
 
181
178
  const loadComponents: Array<Promise<void>> = [];
182
179
  if (hasExtension === true) {
@@ -204,7 +201,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
204
201
 
205
202
  apply(obj);
206
203
 
207
- loadComponents.push(this.createComponents(obj, data));
204
+ loadComponents.push(this.createComponents(result, node, obj, data));
208
205
  }
209
206
  }
210
207
  }
@@ -220,7 +217,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
220
217
  }
221
218
  }
222
219
 
223
- private async createComponents(obj: Object3D, data: ExtensionData) {
220
+ private async createComponents(result: GLTF, node: Node, obj: Object3D, data: ExtensionData) {
224
221
  if (!data) return;
225
222
  const componentData = data[builtinComponentKeyName];
226
223
  if (componentData) {
@@ -228,20 +225,42 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
228
225
  if (debug)
229
226
  console.log(obj.name, componentData);
230
227
  for (const i in componentData) {
231
- const serializedData = componentData[i];
232
- if (debug)
233
- console.log("Serialized data", JSON.parse(JSON.stringify(serializedData)));
228
+ const data = componentData[i];
229
+
230
+ if (debug) console.log("Serialized data", JSON.parse(JSON.stringify(data)));
231
+
232
+ // Fix for https://linear.app/needle/issue/NE-6779/blender-export-has-missing-sharedmaterials
233
+ if (data?.name === "MeshRenderer" || data?.name === "SkinnedMeshRenderer") {
234
+ if (!data.sharedMaterials) {
235
+ let success = false;
236
+ if ("mesh" in node) {
237
+ const meshIndex = node.mesh;
238
+ if (typeof meshIndex === "number" && result.parser) {
239
+ const meshDef = result.parser.json.meshes?.[meshIndex];
240
+ if (meshDef?.primitives) {
241
+ data.sharedMaterials = meshDef.primitives.map(prim => {
242
+ return "/materials/" + (prim.material ?? 0);
243
+ });
244
+ success = true;
245
+ }
246
+ }
247
+ }
248
+ if(!success && (debug || isDevEnvironment())) {
249
+ console.warn(`[NEEDLE_components] Component '${data.name}' on object '${obj.name}' is not added to a mesh or failed to retrieve materials from glTF.`);
250
+ }
251
+ }
252
+ }
234
253
 
235
- if (serializedData && this.parser) {
254
+ if (data && this.parser) {
236
255
  tasks.push(
237
- resolveReferences(this.parser, serializedData)
238
- .catch(e => console.error(`Error while resolving references (see console for details)\n`, e, obj, serializedData))
256
+ resolveReferences(this.parser, data)
257
+ .catch(e => console.error(`Error while resolving references (see console for details)\n`, e, obj, data))
239
258
  );
240
259
  }
241
260
 
242
261
  obj.userData = obj.userData || {};
243
262
  obj.userData[builtinComponentKeyName] = obj.userData[builtinComponentKeyName] || [];
244
- obj.userData[builtinComponentKeyName].push(serializedData);
263
+ obj.userData[builtinComponentKeyName].push(data);
245
264
  }
246
265
  await Promise.all(tasks).catch((e) => {
247
266
  console.error("Error while loading components", e);
@@ -266,4 +285,6 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
266
285
  // // console.log(components);
267
286
  // return null;
268
287
  // }
269
- }
288
+ }
289
+
290
+
@@ -95,8 +95,8 @@ export class NEEDLE_lightmaps implements GLTFLoaderPlugin {
95
95
  }
96
96
  const results = await PromiseAllWithErrors(dependencies);
97
97
  if (results?.anyFailed) {
98
- if (isDevEnvironment())
99
- console.error("Failed to load lightmap extension", results);
98
+ if (isDevEnvironment() || debug)
99
+ console.error("[NEEDLE_lightmaps]Error during extension loading:", results);
100
100
  }
101
101
  resolve();
102
102
  });
@@ -92,18 +92,24 @@ class PointerResolver {
92
92
  }
93
93
  }
94
94
 
95
- export async function registerExtensions(loader: GLTFLoader, context: Context, url: string) {
95
+ export async function registerExtensions(loader: GLTFLoader, context: Context, url: string, sourceId: SourceIdentifier) {
96
96
 
97
97
  // Make sure to remove any url parameters from the sourceId (because the source id in the renderer does not have a ?v=xxx so it will not be able to register the resolved lightmap otherwise)
98
98
  const idEnd = url.indexOf("?");
99
99
  if (idEnd >= 0) url = url.substring(0, idEnd);
100
+ if (!sourceId) {
101
+ sourceId = url;
102
+ }
103
+ if (sourceId.startsWith("blob:") || sourceId.startsWith("data:")) {
104
+ console.debug("[GLTFLoader] Suspicious sourceId detected");
105
+ }
100
106
 
101
107
  loader.register(p => new NEEDLE_gameobject_data(p));
102
108
  loader.register(p => new NEEDLE_persistent_assets(p));
103
- loader.register(p => new NEEDLE_lightmaps(p, context.lightmaps, url));
104
- loader.register(p => new NEEDLE_lighting_settings(p, url, context));
105
- loader.register(p => new NEEDLE_techniques_webgl(p, url));
106
- loader.register(p => new NEEDLE_render_objects(p, url));
109
+ loader.register(p => new NEEDLE_lightmaps(p, context.lightmaps, sourceId));
110
+ loader.register(p => new NEEDLE_lighting_settings(p, sourceId, context));
111
+ loader.register(p => new NEEDLE_techniques_webgl(p, sourceId));
112
+ loader.register(p => new NEEDLE_render_objects(p, sourceId));
107
113
  loader.register(p => new NEEDLE_progressive(p));
108
114
  loader.register(p => new EXT_texture_exr(p));
109
115
  if (isResourceTrackingEnabled()) loader.register(p => new InternalUsageTrackerPlugin(p))
@@ -8,7 +8,9 @@ import { getIconElement } from "./icons.js";
8
8
  * Use the ButtonsFactory to create buttons with icons and functionality
9
9
  * Get access to the default buttons by using `ButtonsFactory.instance`
10
10
  * The factory will create the buttons if they don't exist yet, and return the existing ones if they do (this allows you to reparent or modify created buttons)
11
- */
11
+ *
12
+ * @category HTML
13
+ */
12
14
  export class ButtonsFactory {
13
15
 
14
16
  private static _instance?: ButtonsFactory;
@@ -2,6 +2,16 @@ import { madeWithNeedleSVG, needleLogoOnlySVG, needleLogoSVG } from "../assets/i
2
2
 
3
3
  const elementName = "needle-logo-element";
4
4
 
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ "needle-logo-element": NeedleLogoElement;
8
+ }
9
+ }
10
+
11
+ /**
12
+ * Needle logo web component used in the hosting UI (small, compact logo or full)
13
+ * @element needle-logo-element
14
+ */
5
15
  export class NeedleLogoElement extends HTMLElement {
6
16
 
7
17
  static get elementName() { return elementName; }
@@ -83,10 +93,12 @@ export class NeedleLogoElement extends HTMLElement {
83
93
  private readonly wrapper: HTMLDivElement;
84
94
  private readonly logoElement: HTMLImageElement;
85
95
 
96
+ /** Show or hide the logo element (used by the menu) */
86
97
  setLogoVisible(val: boolean) {
87
98
  this.logoElement.style.display = val ? "block" : "none";
88
99
  }
89
100
 
101
+ /** Switch the logo between full and compact versions */
90
102
  setType(type: "full" | "compact") {
91
103
  if (type === "full") {
92
104
  this.logoElement.src = needleLogoSVG;
@@ -9,6 +9,12 @@ import { getIconElement } from "../icons.js";
9
9
  import { NeedleLogoElement } from "../logo-element.js";
10
10
  import { NeedleSpatialMenu } from "./needle-menu-spatial.js";
11
11
 
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "needle-logo-element": NeedleLogoElement;
15
+ }
16
+ }
17
+
12
18
  const elementName = "needle-menu";
13
19
  const debug = getParam("debugmenu");
14
20
  const debugNonCommercial = getParam("debugnoncommercial");
@@ -48,11 +54,13 @@ export declare type ButtonInfo = {
48
54
  }
49
55
 
50
56
  /**
51
- * The NeedleMenu is a menu that can be displayed in the needle engine webcomponent or in VR/AR sessions.
57
+ * The NeedleMenu is a menu that can be displayed in the needle engine webcomponent or in VR/AR sessions.
58
+ *
52
59
  * The menu can be used to add buttons to the needle engine that can be used to interact with the application.
53
- * The menu can be positioned at the top or the bottom of the needle engine webcomponent
54
60
  *
55
- * @example Create a button using the NeedleMenu
61
+ * The menu can be positioned at the top or the bottom of the <needle-engine> webcomponent.
62
+ *
63
+ * @example Add a new button using the NeedleMenu
56
64
  * ```typescript
57
65
  * onStart(ctx => {
58
66
  * ctx.menu.appendChild({
@@ -76,6 +84,20 @@ export declare type ButtonInfo = {
76
84
  * }
77
85
  * }, "*");
78
86
  * ```
87
+ *
88
+ * @example Access the menu from a component
89
+ * ```typescript
90
+ * import { Behaviour, OnStart } from '@needle-tools/engine';
91
+ *
92
+ * export class MyComponent extends Behaviour {
93
+ *
94
+ * start() {
95
+ * this.context.menu.appendChild({ ... });
96
+ * }
97
+ * }
98
+ * ```
99
+ *
100
+ * @category HTML
79
101
  */
80
102
  export class NeedleMenu {
81
103
  private readonly _context: Context;
@@ -248,6 +270,16 @@ export class NeedleMenu {
248
270
 
249
271
  }
250
272
 
273
+ /**
274
+ * `<needle-menu>` web component — lightweight menu used by Needle Engine.
275
+ *
276
+ * This element is intended as an internal UI primitive for hosting application
277
+ * menus and buttons. Use the higher-level `NeedleMenu` API from the engine
278
+ * code to manipulate it programmatically. Public DOM-facing methods are
279
+ * documented (appendChild / append / prepend / setPosition / setVisible).
280
+ *
281
+ * @element needle-menu
282
+ */
251
283
  export class NeedleMenuElement extends HTMLElement {
252
284
 
253
285
  static create() {
@@ -835,6 +867,7 @@ export class NeedleMenuElement extends HTMLElement {
835
867
  }
836
868
  }
837
869
 
870
+ /** @private user preference for logo visibility */
838
871
  private _userRequestedLogoVisible?: boolean = undefined;
839
872
  showNeedleLogo(visible: boolean) {
840
873
  this._userRequestedLogoVisible = visible;
@@ -875,6 +908,7 @@ export class NeedleMenuElement extends HTMLElement {
875
908
  this.root.classList.add(position);
876
909
  }
877
910
 
911
+ /** @private user preference for menu visibility */
878
912
  private _userRequestedMenuVisible?: boolean = undefined;
879
913
  setVisible(visible: boolean) {
880
914
  this._userRequestedMenuVisible = visible;
@@ -889,14 +923,17 @@ export class NeedleMenuElement extends HTMLElement {
889
923
  }
890
924
 
891
925
  // private _root: ShadowRoot | null = null;
926
+ /** @private root container element inside shadow DOM */
892
927
  private readonly root: HTMLDivElement;
893
- /** wraps the whole content */
928
+ /** @private wraps the whole content (internal layout) */
894
929
  private readonly wrapper: HTMLDivElement;
895
- /** contains the buttons and dynamic elements */
930
+ /** @private contains the buttons and dynamic elements */
896
931
  private readonly options: HTMLDivElement;
897
- /** contains the needle-logo html element */
932
+ /** @private contains the needle-logo html element */
898
933
  private readonly logoContainer: HTMLDivElement;
934
+ /** @private compact menu button element */
899
935
  private readonly compactMenuButton: HTMLButtonElement;
936
+ /** @private foldout container used in compact mode */
900
937
  private readonly foldout: HTMLDivElement;
901
938
 
902
939
  append(...nodes: (string | Node)[]): void {
@@ -909,6 +946,27 @@ export class NeedleMenuElement extends HTMLElement {
909
946
  }
910
947
  }
911
948
  }
949
+ /**
950
+ * Appends a button or HTML element to the needle-menu options.
951
+ * @param node a Node or ButtonInfo to create a button from
952
+ * @returns the appended Node
953
+ *
954
+ * @example Append a button
955
+ * ```javascript
956
+ * const button = document.createElement("button");
957
+ * button.textContent = "Click Me";
958
+ * needleMenu.appendChild(button);
959
+ * ```
960
+ * @example Append a button using ButtonInfo
961
+ * ```javascript
962
+ * needleMenu.appendChild({
963
+ * label: "Click Me",
964
+ * onClick: () => { alert("Button clicked!"); },
965
+ * icon: "info",
966
+ * title: "This is a button",
967
+ * });
968
+ * ```
969
+ */
912
970
  appendChild<T extends Node>(node: T | ButtonInfo): T {
913
971
 
914
972
  if (!(node instanceof Node)) {
@@ -2,6 +2,12 @@ import { isDevEnvironment } from "../debug/index.js";
2
2
  import { iconFontUrl, loadFont } from "./fonts.js";
3
3
  import { WebXRButtonFactory } from "./WebXRButtons.js";
4
4
 
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ "needle-button": NeedleButtonElement;
8
+ }
9
+ }
10
+
5
11
  const htmlTagName = "needle-button";
6
12
  const isDev = isDevEnvironment();
7
13
 
@@ -28,6 +28,14 @@ type MainAttributes = {
28
28
 
29
29
  addEventListener?(event: "ready", callback: (event: CustomEvent) => void): void;
30
30
  addEventListener?(event: "error", callback: (event: CustomEvent) => void): void;
31
+ addEventListener?(event: "loadstart", callback: (event: CustomEvent) => void): void;
32
+ addEventListener?(event: "progress", callback: (event: CustomEvent) => void): void;
33
+ addEventListener?(event: "loadfinished", callback: (event: CustomEvent) => void): void;
34
+ addEventListener?(event: "xr-session-ended", callback: (event: CustomEvent) => void): void;
35
+ addEventListener?(event: "enter-ar", callback: (event: CustomEvent) => void): void;
36
+ addEventListener?(event: "exit-ar", callback: (event: CustomEvent) => void): void;
37
+ addEventListener?(event: "enter-vr", callback: (event: CustomEvent) => void): void;
38
+ addEventListener?(event: "exit-vr", callback: (event: CustomEvent) => void): void;
31
39
  }
32
40
 
33
41
  type LoadingAttributes = {
@@ -47,7 +55,7 @@ type SkyboxAttributes = {
47
55
  /** @deprecated. Use background-image instead - URL to .exr, .hdr, .png, .jpg to be used as skybox */
48
56
  "skybox-image"?: string,
49
57
  /** URL to .exr, .hdr, .png, .jpg to be used as skybox */
50
- "background-image"?: string,
58
+ "background-image"?: string,
51
59
  /** Blurs the background image (if any) - value between 0 and 1
52
60
  * 0: no blur
53
61
  * 1: full blur
@@ -69,16 +77,17 @@ type RenderingAttributes = {
69
77
  "transparent"?: boolean,
70
78
  "contactshadows"?: boolean,
71
79
  "tone-mapping"?: TonemappingAttributeOptions,
80
+ "tonemapping"?: TonemappingAttributeOptions,
72
81
  "tone-mapping-exposure"?: number,
73
82
  }
74
83
 
75
84
  /**
76
- * Available attributes for the `<needle-engine>` web component
85
+ * Available attributes for the `<needle-engine>` web component.
77
86
  * @inheritdoc
78
87
  */
79
88
  export type NeedleEngineAttributes =
80
89
  MainAttributes
81
- & Partial<Omit<HTMLElement, "style">>
90
+ // & Partial<Omit<HTMLElement, "style">>
82
91
  & LoadingAttributes
83
92
  & SkyboxAttributes
84
93
  & RenderingAttributes