Needle Engine

Changes between version 3.10.7-beta and 3.11.0-beta
Files changed (233) hide show
  1. src/engine/codegen/register_types.js +0 -437
  2. src/engine-components/export/usdz/extensions/behavior/Actions.ts +2 -2
  3. src/engine-components/AlignmentConstraint.ts +3 -3
  4. src/engine-components/Animation.ts +6 -6
  5. src/engine-components/export/usdz/extensions/Animation.ts +4 -4
  6. src/engine-components/AnimationCurve.ts +2 -2
  7. src/engine-components/AnimationUtils.ts +16 -14
  8. src/engine-components/export/usdz/utils/animationutils.ts +4 -4
  9. src/engine-components/Animator.ts +22 -11
  10. src/engine-components/AnimatorController.ts +27 -20
  11. src/engine-components/postprocessing/Effects/Antialiasing.ts +4 -4
  12. src/engine-components-experimental/api.ts +1 -1
  13. src/engine-components/api.ts +13 -13
  14. src/engine/api.ts +49 -49
  15. src/engine-components/export/usdz/extensions/behavior/AudioExtension.ts +4 -4
  16. src/engine-components/AudioListener.ts +3 -3
  17. src/engine-components/AudioSource.ts +5 -5
  18. src/engine-components/avatar/Avatar_Brain_LookAt.ts +7 -7
  19. src/engine-components/avatar/Avatar_MouthShapes.ts +5 -5
  20. src/engine-components/avatar/Avatar_MustacheShake.ts +3 -3
  21. src/engine-components/avatar/AvatarBlink_Simple.ts +3 -3
  22. src/engine-components/avatar/AvatarEyeLook_Rotation.ts +4 -4
  23. src/engine-components/AvatarLoader.ts +8 -8
  24. src/engine-components/AxesHelper.ts +3 -3
  25. src/engine-components/ui/BaseUIComponent.ts +7 -7
  26. src/engine-components/BasicIKConstraint.ts +2 -2
  27. src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +5 -5
  28. src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +12 -12
  29. src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +2 -2
  30. src/engine-components/postprocessing/Effects/Bloom.ts +4 -4
  31. src/engine-components/BoxCollider.ts +1 -1
  32. src/engine-components/BoxHelperComponent.ts +4 -4
  33. src/engine-components/ui/Button.ts +9 -9
  34. src/engine-components/Camera.ts +11 -11
  35. src/engine-components/CameraUtils.ts +9 -9
  36. src/engine-components/ui/Canvas.ts +12 -12
  37. src/engine-components/ui/CanvasGroup.ts +6 -6
  38. src/engine-components/CharacterController.ts +9 -9
  39. src/engine-components/postprocessing/Effects/ChromaticAberration.ts +4 -4
  40. src/engine-components/Collider.ts +7 -7
  41. src/engine-components/postprocessing/Effects/ColorAdjustments.ts +4 -4
  42. src/engine-components/Component.ts +10 -10
  43. src/engine-components/codegen/components.ts +212 -212
  44. src/engine/debug/debug_console.ts +3 -3
  45. src/engine/debug/debug_overlay.ts +3 -3
  46. src/engine/debug/debug.ts +3 -3
  47. src/engine-components/DeleteBox.ts +5 -5
  48. src/engine-components/postprocessing/Effects/DepthOfField.ts +6 -6
  49. src/engine-components/DeviceFlag.ts +2 -2
  50. src/engine-components/export/usdz/extensions/DocumentExtension.ts +1 -1
  51. src/engine-components/DragControls.ts +16 -16
  52. src/engine-components/DropListener.ts +7 -7
  53. src/engine-components/Duplicatable.ts +7 -7
  54. src/engine/engine_addressables.ts +10 -10
  55. src/engine/engine_application.ts +1 -1
  56. src/engine/engine_assetdatabase.ts +3 -3
  57. src/engine/engine_camera.ts +1 -1
  58. src/engine/engine_components_internal.ts +2 -2
  59. src/engine/engine_components.ts +8 -8
  60. src/engine/engine_constants.ts +1 -1
  61. src/engine/engine_context_registry.ts +1 -1
  62. src/engine/engine_context.ts +20 -20
  63. src/engine/engine_coroutine.ts +1 -1
  64. src/engine/engine_default_parameters.ts +1 -1
  65. src/engine/engine_element_extras.ts +1 -1
  66. src/engine/engine_element_loading.ts +6 -6
  67. src/engine/engine_element_overlay.ts +2 -2
  68. src/engine/engine_element.ts +18 -17
  69. src/engine/engine_gameobject.ts +13 -13
  70. src/engine/engine_gizmos.ts +3 -3
  71. src/engine/engine_gltf_builtin_components.ts +15 -15
  72. src/engine/engine_gltf.ts +4 -4
  73. src/engine/engine_hot_reload.ts +5 -6
  74. src/engine/engine_input.ts +5 -5
  75. src/engine/engine_license.ts +5 -5
  76. src/engine/engine_lightdata.ts +4 -4
  77. src/engine/engine_loaders.ts +2 -2
  78. src/engine/engine_mainloop_utils.ts +7 -7
  79. src/engine/engine_math.ts +1 -1
  80. src/engine/engine_networking_auto.ts +3 -3
  81. src/engine/engine_networking_files_default_components.ts +6 -6
  82. src/engine/engine_networking_files.ts +10 -10
  83. src/engine/engine_networking_instantiate.ts +11 -11
  84. src/engine/engine_networking_utils.ts +1 -1
  85. src/engine/engine_networking.ts +8 -8
  86. src/engine/engine_patcher.ts +1 -1
  87. src/engine/engine_physics_rapier.ts +10 -10
  88. src/engine/engine_physics.ts +5 -5
  89. src/engine/engine_playerview.ts +2 -2
  90. src/engine/engine_scenelighting.ts +6 -6
  91. src/engine/engine_scenetools.ts +11 -11
  92. src/engine/engine_serialization_builtin_serializer.ts +10 -10
  93. src/engine/engine_serialization_core.ts +9 -9
  94. src/engine/engine_serialization_decorator.ts +1 -1
  95. src/engine/engine_serialization.ts +3 -3
  96. src/engine/engine_setup.ts +1 -1
  97. src/engine/engine_shaders.ts +4 -4
  98. src/engine/engine_texture.ts +1 -1
  99. src/engine/engine_three_utils.ts +2 -2
  100. src/engine/engine_time.ts +2 -2
  101. src/engine/engine_types.ts +4 -5
  102. src/engine/engine_util_decorator.ts +3 -3
  103. src/engine/engine_utils_screenshot.ts +1 -1
  104. src/engine/engine_utils.ts +3 -2
  105. src/engine/engine.ts +5 -5
  106. src/engine-components/ui/EventSystem.ts +14 -14
  107. src/engine-components/EventTrigger.ts +5 -5
  108. src/engine/extensions/EXT_texture_exr.ts +6 -5
  109. src/engine/extensions/extension_resolver.ts +1 -1
  110. src/engine/extensions/extension_utils.ts +4 -4
  111. src/engine-components/export/usdz/Extension.ts +1 -1
  112. src/engine/extensions/extensions.ts +20 -20
  113. src/engine-components/js-extensions/ExtensionUtils.ts +1 -1
  114. src/engine-components/FlyControls.ts +3 -3
  115. src/engine-components/Fog.ts +2 -2
  116. src/engine-components/Gizmos.ts +5 -5
  117. src/engine-components/export/gltf/GltfExport.ts +6 -6
  118. src/engine-components/ui/Graphic.ts +9 -9
  119. src/engine-components/GridHelper.ts +3 -3
  120. src/engine-components/GroundProjection.ts +3 -3
  121. src/engine-components/ui/Image.ts +2 -2
  122. src/engine-components/export/gltf/index.ts +1 -1
  123. src/engine-components/export/index.ts +1 -1
  124. src/engine-components/export/usdz/index.ts +3 -3
  125. src/engine-components/js-extensions/index.ts +3 -3
  126. src/engine-components/postprocessing/index.ts +4 -4
  127. src/engine-components/timeline/index.ts +3 -3
  128. src/engine-components/ui/index.ts +1 -1
  129. src/engine-components/webxr/index.ts +4 -4
  130. src/engine/debug/index.ts +1 -1
  131. src/engine/extensions/index.ts +5 -5
  132. src/engine/js-extensions/index.ts +2 -2
  133. src/engine-components/ui/InputField.ts +8 -10
  134. src/engine-components/Interactable.ts +2 -2
  135. src/engine-components/ui/Interfaces.ts +2 -2
  136. src/engine-components/Joints.ts +3 -3
  137. src/engine-components/ui/Layout.ts +6 -6
  138. src/engine-components/Light.ts +10 -10
  139. src/engine-components/LODGroup.ts +6 -6
  140. src/engine-components/debug/LogStats.ts +3 -3
  141. src/engine-components/utils/LookAt.ts +6 -6
  142. src/engine-components/LookAtConstraint.ts +2 -2
  143. src/engine/extensions/NEEDLE_animator_controller_model.ts +3 -3
  144. src/engine/extensions/NEEDLE_components.ts +7 -7
  145. src/engine/extensions/NEEDLE_gameobject_data.ts +1 -1
  146. src/engine/extensions/NEEDLE_lighting_settings.ts +9 -9
  147. src/engine/extensions/NEEDLE_lightmaps.ts +5 -5
  148. src/engine/extensions/NEEDLE_persistent_assets.ts +5 -5
  149. src/engine/extensions/NEEDLE_progressive.ts +5 -5
  150. src/engine/extensions/NEEDLE_render_objects.ts +7 -7
  151. src/engine/extensions/NEEDLE_techniques_webgl.ts +8 -8
  152. src/needle-engine.ts +50 -49
  153. src/engine-components/NestedGltf.ts +6 -6
  154. src/engine-components/Networking.ts +5 -5
  155. src/engine-components/js-extensions/Object3D.ts +5 -5
  156. src/engine-components/OffsetConstraint.ts +3 -3
  157. src/engine-components/utils/OpenURL.ts +7 -7
  158. src/engine-components/OrbitControls.ts +32 -30
  159. src/engine-components/ui/Outline.ts +3 -3
  160. src/engine-components/ParticleSystem.ts +15 -15
  161. src/engine-components/ParticleSystemModules.ts +8 -8
  162. src/engine-components/ParticleSystemSubEmitter.ts +3 -3
  163. src/engine-components/postprocessing/Effects/Pixelation.ts +4 -4
  164. src/engine-components/timeline/PlayableDirector.ts +29 -17
  165. src/engine-components/PlayerColor.ts +4 -4
  166. src/engine-components-experimental/networking/PlayerSync.ts +8 -8
  167. src/engine-components/ui/PointerEvents.ts +1 -1
  168. src/engine-components/postprocessing/PostProcessingEffect.ts +6 -6
  169. src/engine-components/postprocessing/PostProcessingHandler.ts +6 -6
  170. src/engine-components-experimental/Presentation.ts +2 -2
  171. src/engine-components/export/usdz/utils/quicklook.ts +1 -1
  172. src/engine-components/ui/Raycaster.ts +3 -3
  173. src/engine-components/ui/RaycastUtils.ts +5 -5
  174. src/engine-components/ui/RectTransform.ts +8 -8
  175. src/engine-components/ReflectionProbe.ts +7 -7
  176. src/engine-components/Renderer.ts +15 -15
  177. src/engine-components/RendererLightmap.ts +3 -3
  178. src/engine-components/js-extensions/RGBAColor.ts +1 -1
  179. src/engine-components/RigidBody.ts +8 -8
  180. src/engine-components/SceneSwitcher.ts +7 -7
  181. src/engine-schemes/schemes.ts +5 -6
  182. src/engine-components/ScreenCapture.ts +11 -11
  183. src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +4 -4
  184. src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +5 -5
  185. src/engine-components/ShadowCatcher.ts +4 -4
  186. src/engine-components/timeline/SignalAsset.ts +4 -4
  187. src/engine-components/Skybox.ts +10 -10
  188. src/engine-components/SmoothFollow.ts +6 -6
  189. src/engine-components/ui/SpatialHtml.ts +2 -2
  190. src/engine-components/SpatialTrigger.ts +5 -5
  191. src/engine-components/SpectatorCamera.ts +16 -16
  192. src/engine-components/SphereCollider.ts +1 -1
  193. src/engine-components/SpriteRenderer.ts +4 -4
  194. src/engine-schemes/synced-camera-model.ts +1 -1
  195. src/engine-schemes/synced-transform-model.ts +1 -1
  196. src/engine-components/SyncedCamera.ts +207 -207
  197. src/engine-components/SyncedRoom.ts +4 -4
  198. src/engine-components/SyncedTransform.ts +336 -336
  199. src/engine/tests/test_utils.ts +2 -2
  200. src/engine-components/TestRunner.ts +6 -6
  201. src/engine-components/ui/Text.ts +7 -7
  202. src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
  203. src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +4 -4
  204. src/engine-components/timeline/TimelineTracks.ts +50 -25
  205. src/engine-components/postprocessing/Effects/Tonemapping.ts +4 -4
  206. src/engine-schemes/transform.ts +1 -1
  207. src/engine-components/TransformGizmo.ts +6 -6
  208. src/engine/extensions/usage_tracker.ts +2 -2
  209. src/engine-components/export/usdz/USDZExporter.ts +19 -19
  210. src/engine-components/export/usdz/extensions/USDZText.ts +7 -7
  211. src/engine-components/export/usdz/extensions/USDZUI.ts +9 -9
  212. src/engine-components/ui/Utils.ts +3 -3
  213. src/engine-components/js-extensions/Vector.ts +2 -2
  214. src/engine-components/VideoPlayer.ts +9 -9
  215. src/engine-components/postprocessing/Effects/Vignette.ts +4 -4
  216. src/engine-components/Voip.ts +5 -5
  217. src/engine-components/postprocessing/Volume.ts +9 -10
  218. src/engine-components/postprocessing/VolumeParameter.ts +1 -1
  219. src/engine-components/postprocessing/VolumeProfile.ts +3 -3
  220. src/engine-schemes/vr-user-state-buffer.ts +2 -2
  221. src/engine-components/webxr/WebARCameraBackground.ts +4 -4
  222. src/engine-components/webxr/WebARSessionRoot.ts +4 -4
  223. src/engine-components/webxr/WebXR.ts +16 -16
  224. src/engine-components/webxr/WebXRAvatar.ts +11 -11
  225. src/engine-components/webxr/WebXRController.ts +14 -14
  226. src/engine-components/webxr/WebXRGrabRendering.ts +6 -6
  227. src/engine-components/webxr/WebXRImageTracking.ts +8 -8
  228. src/engine-components/webxr/WebXRPlaneTracking.ts +7 -7
  229. src/engine-components/webxr/WebXRRig.ts +4 -4
  230. src/engine-components/webxr/WebXRSync.ts +463 -463
  231. src/engine-components/XRFlag.ts +2 -2
  232. src/engine-schemes/api.ts +1 -0
  233. src/engine/codegen/register_types.ts +437 -0
src/engine/codegen/register_types.js DELETED
@@ -1,437 +0,0 @@
1
- import { TypeStore } from "./../engine_typestore"
2
-
3
- // Import types
4
- import { __Ignore } from "../../engine-components/codegen/components";
5
- import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
6
- import { ActionCollection } from "../../engine-components/export/usdz/extensions/behavior/Actions";
7
- import { ActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
8
- import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint";
9
- import { Animation } from "../../engine-components/Animation";
10
- import { AnimationCurve } from "../../engine-components/AnimationCurve";
11
- import { AnimationExtension } from "../../engine-components/export/usdz/extensions/Animation";
12
- import { AnimationTrackHandler } from "../../engine-components/timeline/TimelineTracks";
13
- import { Animator } from "../../engine-components/Animator";
14
- import { AnimatorController } from "../../engine-components/AnimatorController";
15
- import { Antialiasing } from "../../engine-components/postprocessing/Effects/Antialiasing";
16
- import { AttachedObject } from "../../engine-components/webxr/WebXRController";
17
- import { AudioExtension } from "../../engine-components/export/usdz/extensions/behavior/AudioExtension";
18
- import { AudioListener } from "../../engine-components/AudioListener";
19
- import { AudioSource } from "../../engine-components/AudioSource";
20
- import { AudioTrackHandler } from "../../engine-components/timeline/TimelineTracks";
21
- import { Avatar_Brain_LookAt } from "../../engine-components/avatar/Avatar_Brain_LookAt";
22
- import { Avatar_MouthShapes } from "../../engine-components/avatar/Avatar_MouthShapes";
23
- import { Avatar_MustacheShake } from "../../engine-components/avatar/Avatar_MustacheShake";
24
- import { Avatar_POI } from "../../engine-components/avatar/Avatar_Brain_LookAt";
25
- import { AvatarBlink_Simple } from "../../engine-components/avatar/AvatarBlink_Simple";
26
- import { AvatarEyeLook_Rotation } from "../../engine-components/avatar/AvatarEyeLook_Rotation";
27
- import { AvatarLoader } from "../../engine-components/AvatarLoader";
28
- import { AvatarMarker } from "../../engine-components/webxr/WebXRAvatar";
29
- import { AvatarModel } from "../../engine-components/AvatarLoader";
30
- import { AxesHelper } from "../../engine-components/AxesHelper";
31
- import { BaseUIComponent } from "../../engine-components/ui/BaseUIComponent";
32
- import { BasicIKConstraint } from "../../engine-components/BasicIKConstraint";
33
- import { BehaviorExtension } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
34
- import { BehaviorModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
35
- import { Behaviour } from "../../engine-components/Component";
36
- import { Bloom } from "../../engine-components/postprocessing/Effects/Bloom";
37
- import { BoxCollider } from "../../engine-components/Collider";
38
- import { BoxGizmo } from "../../engine-components/Gizmos";
39
- import { BoxHelperComponent } from "../../engine-components/BoxHelperComponent";
40
- import { Button } from "../../engine-components/ui/Button";
41
- import { CallInfo } from "../../engine-components/EventList";
42
- import { Camera } from "../../engine-components/Camera";
43
- import { Canvas } from "../../engine-components/ui/Canvas";
44
- import { CanvasGroup } from "../../engine-components/ui/CanvasGroup";
45
- import { CapsuleCollider } from "../../engine-components/Collider";
46
- import { ChangeMaterialOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
47
- import { ChangeTransformOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
48
- import { CharacterController } from "../../engine-components/CharacterController";
49
- import { CharacterControllerInput } from "../../engine-components/CharacterController";
50
- import { ChromaticAberration } from "../../engine-components/postprocessing/Effects/ChromaticAberration";
51
- import { Collider } from "../../engine-components/Collider";
52
- import { ColorAdjustments } from "../../engine-components/postprocessing/Effects/ColorAdjustments";
53
- import { ColorBySpeedModule } from "../../engine-components/ParticleSystemModules";
54
- import { ColorOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
55
- import { Component } from "../../engine-components/Component";
56
- import { ControlTrackHandler } from "../../engine-components/timeline/TimelineTracks";
57
- import { CustomBranding } from "../../engine-components/export/usdz/USDZExporter";
58
- import { Deletable } from "../../engine-components/DeleteBox";
59
- import { DeleteBox } from "../../engine-components/DeleteBox";
60
- import { DepthOfField } from "../../engine-components/postprocessing/Effects/DepthOfField";
61
- import { DeviceFlag } from "../../engine-components/DeviceFlag";
62
- import { DocumentExtension } from "../../engine-components/export/usdz/extensions/DocumentExtension";
63
- import { DragControls } from "../../engine-components/DragControls";
64
- import { DropListener } from "../../engine-components/DropListener";
65
- import { Duplicatable } from "../../engine-components/Duplicatable";
66
- import { EmissionModule } from "../../engine-components/ParticleSystemModules";
67
- import { EmphasizeOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
68
- import { EventList } from "../../engine-components/EventList";
69
- import { EventListEvent } from "../../engine-components/EventList";
70
- import { EventSystem } from "../../engine-components/ui/EventSystem";
71
- import { EventTrigger } from "../../engine-components/EventTrigger";
72
- import { FieldWithDefault } from "../../engine-components/Renderer";
73
- import { FixedJoint } from "../../engine-components/Joints";
74
- import { FlyControls } from "../../engine-components/FlyControls";
75
- import { Fog } from "../../engine-components/Fog";
76
- import { GltfExport } from "../../engine-components/export/gltf/GltfExport";
77
- import { GltfExportBox } from "../../engine-components/export/gltf/GltfExport";
78
- import { Gradient } from "../../engine-components/ParticleSystemModules";
79
- import { Graphic } from "../../engine-components/ui/Graphic";
80
- import { GraphicRaycaster } from "../../engine-components/ui/Raycaster";
81
- import { GridHelper } from "../../engine-components/GridHelper";
82
- import { GridLayoutGroup } from "../../engine-components/ui/Layout";
83
- import { GroundProjectedEnv } from "../../engine-components/GroundProjection";
84
- import { GroupActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
85
- import { HideOnStart } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
86
- import { HingeJoint } from "../../engine-components/Joints";
87
- import { HorizontalLayoutGroup } from "../../engine-components/ui/Layout";
88
- import { Image } from "../../engine-components/ui/Image";
89
- import { InheritVelocityModule } from "../../engine-components/ParticleSystemModules";
90
- import { InputField } from "../../engine-components/ui/InputField";
91
- import { Interactable } from "../../engine-components/Interactable";
92
- import { Light } from "../../engine-components/Light";
93
- import { LimitVelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
94
- import { LODGroup } from "../../engine-components/LODGroup";
95
- import { LODModel } from "../../engine-components/LODGroup";
96
- import { LogStats } from "../../engine-components/debug/LogStats";
97
- import { LookAt } from "../../engine-components/utils/LookAt";
98
- import { LookAtConstraint } from "../../engine-components/LookAtConstraint";
99
- import { MainModule } from "../../engine-components/ParticleSystemModules";
100
- import { MaskableGraphic } from "../../engine-components/ui/Graphic";
101
- import { MeshCollider } from "../../engine-components/Collider";
102
- import { MeshRenderer } from "../../engine-components/Renderer";
103
- import { MinMaxCurve } from "../../engine-components/ParticleSystemModules";
104
- import { MinMaxGradient } from "../../engine-components/ParticleSystemModules";
105
- import { NestedGltf } from "../../engine-components/NestedGltf";
106
- import { Networking } from "../../engine-components/Networking";
107
- import { NoiseModule } from "../../engine-components/ParticleSystemModules";
108
- import { ObjectRaycaster } from "../../engine-components/ui/Raycaster";
109
- import { OffsetConstraint } from "../../engine-components/OffsetConstraint";
110
- import { OpenURL } from "../../engine-components/utils/OpenURL";
111
- import { OrbitControls } from "../../engine-components/OrbitControls";
112
- import { Outline } from "../../engine-components/ui/Outline";
113
- import { Padding } from "../../engine-components/ui/Layout";
114
- import { ParticleBurst } from "../../engine-components/ParticleSystemModules";
115
- import { ParticleSubEmitter } from "../../engine-components/ParticleSystemSubEmitter";
116
- import { ParticleSystem } from "../../engine-components/ParticleSystem";
117
- import { ParticleSystemRenderer } from "../../engine-components/ParticleSystem";
118
- import { PixelationEffect } from "../../engine-components/postprocessing/Effects/Pixelation";
119
- import { PlayableDirector } from "../../engine-components/timeline/PlayableDirector";
120
- import { PlayAnimationOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
121
- import { PlayAudioOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
122
- import { PlayerColor } from "../../engine-components/PlayerColor";
123
- import { PlayerState } from "../../engine-components-experimental/networking/PlayerSync";
124
- import { PlayerSync } from "../../engine-components-experimental/networking/PlayerSync";
125
- import { PointerEventData } from "../../engine-components/ui/PointerEvents";
126
- import { PostProcessingHandler } from "../../engine-components/postprocessing/PostProcessingHandler";
127
- import { PreliminaryAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
128
- import { PreliminaryTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
129
- import { PresentationMode } from "../../engine-components-experimental/Presentation";
130
- import { RawImage } from "../../engine-components/ui/Image";
131
- import { Raycaster } from "../../engine-components/ui/Raycaster";
132
- import { Rect } from "../../engine-components/ui/RectTransform";
133
- import { RectTransform } from "../../engine-components/ui/RectTransform";
134
- import { ReflectionProbe } from "../../engine-components/ReflectionProbe";
135
- import { RegisteredAnimationInfo } from "../../engine-components/export/usdz/extensions/Animation";
136
- import { RemoteSkybox } from "../../engine-components/Skybox";
137
- import { Renderer } from "../../engine-components/Renderer";
138
- import { RendererLightmap } from "../../engine-components/RendererLightmap";
139
- import { RGBAColor } from "../../engine-components/js-extensions/RGBAColor";
140
- import { Rigidbody } from "../../engine-components/RigidBody";
141
- import { RotationBySpeedModule } from "../../engine-components/ParticleSystemModules";
142
- import { RotationOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
143
- import { SceneSwitcher } from "../../engine-components/SceneSwitcher";
144
- import { ScreenCapture } from "../../engine-components/ScreenCapture";
145
- import { ScreenSpaceAmbientOcclusion } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion";
146
- import { ScreenSpaceAmbientOcclusionN8 } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8";
147
- import { SetActiveOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
148
- import { ShadowCatcher } from "../../engine-components/ShadowCatcher";
149
- import { ShapeModule } from "../../engine-components/ParticleSystemModules";
150
- import { SignalAsset } from "../../engine-components/timeline/SignalAsset";
151
- import { SignalReceiver } from "../../engine-components/timeline/SignalAsset";
152
- import { SignalReceiverEvent } from "../../engine-components/timeline/SignalAsset";
153
- import { SignalTrackHandler } from "../../engine-components/timeline/TimelineTracks";
154
- import { Size } from "../../engine-components/ui/RectTransform";
155
- import { SizeBySpeedModule } from "../../engine-components/ParticleSystemModules";
156
- import { SizeOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
157
- import { SkinnedMeshRenderer } from "../../engine-components/Renderer";
158
- import { SmoothFollow } from "../../engine-components/SmoothFollow";
159
- import { SpatialHtml } from "../../engine-components/ui/SpatialHtml";
160
- import { SpatialTrigger } from "../../engine-components/SpatialTrigger";
161
- import { SpatialTriggerReceiver } from "../../engine-components/SpatialTrigger";
162
- import { SpectatorCamera } from "../../engine-components/SpectatorCamera";
163
- import { SphereCollider } from "../../engine-components/Collider";
164
- import { Sprite } from "../../engine-components/SpriteRenderer";
165
- import { SpriteData } from "../../engine-components/SpriteRenderer";
166
- import { SpriteRenderer } from "../../engine-components/SpriteRenderer";
167
- import { SpriteSheet } from "../../engine-components/SpriteRenderer";
168
- import { SubEmitterSystem } from "../../engine-components/ParticleSystem";
169
- import { SyncedCamera } from "../../engine-components/SyncedCamera";
170
- import { SyncedRoom } from "../../engine-components/SyncedRoom";
171
- import { SyncedTransform } from "../../engine-components/SyncedTransform";
172
- import { TapGestureTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
173
- import { TeleportTarget } from "../../engine-components/webxr/WebXRController";
174
- import { TestRunner } from "../../engine-components/TestRunner";
175
- import { TestSimulateUserData } from "../../engine-components/TestRunner";
176
- import { Text } from "../../engine-components/ui/Text";
177
- import { TextBuilder } from "../../engine-components/export/usdz/extensions/USDZText";
178
- import { TextExtension } from "../../engine-components/export/usdz/extensions/USDZText";
179
- import { TextureSheetAnimationModule } from "../../engine-components/ParticleSystemModules";
180
- import { TiltShiftEffect } from "../../engine-components/postprocessing/Effects/TiltShiftEffect";
181
- import { ToneMapping } from "../../engine-components/postprocessing/Effects/Tonemapping";
182
- import { TrailModule } from "../../engine-components/ParticleSystemModules";
183
- import { TransformData } from "../../engine-components/export/usdz/extensions/Animation";
184
- import { TransformGizmo } from "../../engine-components/TransformGizmo";
185
- import { TriggerBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
186
- import { TriggerModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
187
- import { UIRaycastUtils } from "../../engine-components/ui/RaycastUtils";
188
- import { UIRootComponent } from "../../engine-components/ui/BaseUIComponent";
189
- import { UsageMarker } from "../../engine-components/Interactable";
190
- import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter";
191
- import { USDZText } from "../../engine-components/export/usdz/extensions/USDZText";
192
- import { USDZUIExtension } from "../../engine-components/export/usdz/extensions/USDZUI";
193
- import { VariantAction } from "../../engine-components/export/usdz/extensions/behavior/Actions";
194
- import { VelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
195
- import { VerticalLayoutGroup } from "../../engine-components/ui/Layout";
196
- import { VideoPlayer } from "../../engine-components/VideoPlayer";
197
- import { Vignette } from "../../engine-components/postprocessing/Effects/Vignette";
198
- import { VisibilityAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
199
- import { Voip } from "../../engine-components/Voip";
200
- import { Volume } from "../../engine-components/postprocessing/Volume";
201
- import { VolumeParameter } from "../../engine-components/postprocessing/VolumeParameter";
202
- import { VolumeProfile } from "../../engine-components/postprocessing/VolumeProfile";
203
- import { VRUserState } from "../../engine-components/webxr/WebXRSync";
204
- import { WebAR } from "../../engine-components/webxr/WebXR";
205
- import { WebARCameraBackground } from "../../engine-components/webxr/WebARCameraBackground";
206
- import { WebARSessionRoot } from "../../engine-components/webxr/WebARSessionRoot";
207
- import { WebXR } from "../../engine-components/webxr/WebXR";
208
- import { WebXRAvatar } from "../../engine-components/webxr/WebXRAvatar";
209
- import { WebXRController } from "../../engine-components/webxr/WebXRController";
210
- import { WebXRImageTracking } from "../../engine-components/webxr/WebXRImageTracking";
211
- import { WebXRImageTrackingModel } from "../../engine-components/webxr/WebXRImageTracking";
212
- import { WebXRPlaneTracking } from "../../engine-components/webxr/WebXRPlaneTracking";
213
- import { WebXRSync } from "../../engine-components/webxr/WebXRSync";
214
- import { WebXRTrackedImage } from "../../engine-components/webxr/WebXRImageTracking";
215
- import { XRFlag } from "../../engine-components/XRFlag";
216
- import { XRGrabModel } from "../../engine-components/webxr/WebXRGrabRendering";
217
- import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering";
218
- import { XRRig } from "../../engine-components/webxr/WebXRRig";
219
- import { XRState } from "../../engine-components/XRFlag";
220
-
221
- // Register types
222
- TypeStore.add("__Ignore", __Ignore);
223
- TypeStore.add("ActionBuilder", ActionBuilder);
224
- TypeStore.add("ActionCollection", ActionCollection);
225
- TypeStore.add("ActionModel", ActionModel);
226
- TypeStore.add("AlignmentConstraint", AlignmentConstraint);
227
- TypeStore.add("Animation", Animation);
228
- TypeStore.add("AnimationCurve", AnimationCurve);
229
- TypeStore.add("AnimationExtension", AnimationExtension);
230
- TypeStore.add("AnimationTrackHandler", AnimationTrackHandler);
231
- TypeStore.add("Animator", Animator);
232
- TypeStore.add("AnimatorController", AnimatorController);
233
- TypeStore.add("Antialiasing", Antialiasing);
234
- TypeStore.add("AttachedObject", AttachedObject);
235
- TypeStore.add("AudioExtension", AudioExtension);
236
- TypeStore.add("AudioListener", AudioListener);
237
- TypeStore.add("AudioSource", AudioSource);
238
- TypeStore.add("AudioTrackHandler", AudioTrackHandler);
239
- TypeStore.add("Avatar_Brain_LookAt", Avatar_Brain_LookAt);
240
- TypeStore.add("Avatar_MouthShapes", Avatar_MouthShapes);
241
- TypeStore.add("Avatar_MustacheShake", Avatar_MustacheShake);
242
- TypeStore.add("Avatar_POI", Avatar_POI);
243
- TypeStore.add("AvatarBlink_Simple", AvatarBlink_Simple);
244
- TypeStore.add("AvatarEyeLook_Rotation", AvatarEyeLook_Rotation);
245
- TypeStore.add("AvatarLoader", AvatarLoader);
246
- TypeStore.add("AvatarMarker", AvatarMarker);
247
- TypeStore.add("AvatarModel", AvatarModel);
248
- TypeStore.add("AxesHelper", AxesHelper);
249
- TypeStore.add("BaseUIComponent", BaseUIComponent);
250
- TypeStore.add("BasicIKConstraint", BasicIKConstraint);
251
- TypeStore.add("BehaviorExtension", BehaviorExtension);
252
- TypeStore.add("BehaviorModel", BehaviorModel);
253
- TypeStore.add("Behaviour", Behaviour);
254
- TypeStore.add("Bloom", Bloom);
255
- TypeStore.add("BoxCollider", BoxCollider);
256
- TypeStore.add("BoxGizmo", BoxGizmo);
257
- TypeStore.add("BoxHelperComponent", BoxHelperComponent);
258
- TypeStore.add("Button", Button);
259
- TypeStore.add("CallInfo", CallInfo);
260
- TypeStore.add("Camera", Camera);
261
- TypeStore.add("Canvas", Canvas);
262
- TypeStore.add("CanvasGroup", CanvasGroup);
263
- TypeStore.add("CapsuleCollider", CapsuleCollider);
264
- TypeStore.add("ChangeMaterialOnClick", ChangeMaterialOnClick);
265
- TypeStore.add("ChangeTransformOnClick", ChangeTransformOnClick);
266
- TypeStore.add("CharacterController", CharacterController);
267
- TypeStore.add("CharacterControllerInput", CharacterControllerInput);
268
- TypeStore.add("ChromaticAberration", ChromaticAberration);
269
- TypeStore.add("Collider", Collider);
270
- TypeStore.add("ColorAdjustments", ColorAdjustments);
271
- TypeStore.add("ColorBySpeedModule", ColorBySpeedModule);
272
- TypeStore.add("ColorOverLifetimeModule", ColorOverLifetimeModule);
273
- TypeStore.add("Component", Component);
274
- TypeStore.add("ControlTrackHandler", ControlTrackHandler);
275
- TypeStore.add("CustomBranding", CustomBranding);
276
- TypeStore.add("Deletable", Deletable);
277
- TypeStore.add("DeleteBox", DeleteBox);
278
- TypeStore.add("DepthOfField", DepthOfField);
279
- TypeStore.add("DeviceFlag", DeviceFlag);
280
- TypeStore.add("DocumentExtension", DocumentExtension);
281
- TypeStore.add("DragControls", DragControls);
282
- TypeStore.add("DropListener", DropListener);
283
- TypeStore.add("Duplicatable", Duplicatable);
284
- TypeStore.add("EmissionModule", EmissionModule);
285
- TypeStore.add("EmphasizeOnClick", EmphasizeOnClick);
286
- TypeStore.add("EventList", EventList);
287
- TypeStore.add("EventListEvent", EventListEvent);
288
- TypeStore.add("EventSystem", EventSystem);
289
- TypeStore.add("EventTrigger", EventTrigger);
290
- TypeStore.add("FieldWithDefault", FieldWithDefault);
291
- TypeStore.add("FixedJoint", FixedJoint);
292
- TypeStore.add("FlyControls", FlyControls);
293
- TypeStore.add("Fog", Fog);
294
- TypeStore.add("GltfExport", GltfExport);
295
- TypeStore.add("GltfExportBox", GltfExportBox);
296
- TypeStore.add("Gradient", Gradient);
297
- TypeStore.add("Graphic", Graphic);
298
- TypeStore.add("GraphicRaycaster", GraphicRaycaster);
299
- TypeStore.add("GridHelper", GridHelper);
300
- TypeStore.add("GridLayoutGroup", GridLayoutGroup);
301
- TypeStore.add("GroundProjectedEnv", GroundProjectedEnv);
302
- TypeStore.add("GroupActionModel", GroupActionModel);
303
- TypeStore.add("HideOnStart", HideOnStart);
304
- TypeStore.add("HingeJoint", HingeJoint);
305
- TypeStore.add("HorizontalLayoutGroup", HorizontalLayoutGroup);
306
- TypeStore.add("Image", Image);
307
- TypeStore.add("InheritVelocityModule", InheritVelocityModule);
308
- TypeStore.add("InputField", InputField);
309
- TypeStore.add("Interactable", Interactable);
310
- TypeStore.add("Light", Light);
311
- TypeStore.add("LimitVelocityOverLifetimeModule", LimitVelocityOverLifetimeModule);
312
- TypeStore.add("LODGroup", LODGroup);
313
- TypeStore.add("LODModel", LODModel);
314
- TypeStore.add("LogStats", LogStats);
315
- TypeStore.add("LookAt", LookAt);
316
- TypeStore.add("LookAtConstraint", LookAtConstraint);
317
- TypeStore.add("MainModule", MainModule);
318
- TypeStore.add("MaskableGraphic", MaskableGraphic);
319
- TypeStore.add("MeshCollider", MeshCollider);
320
- TypeStore.add("MeshRenderer", MeshRenderer);
321
- TypeStore.add("MinMaxCurve", MinMaxCurve);
322
- TypeStore.add("MinMaxGradient", MinMaxGradient);
323
- TypeStore.add("NestedGltf", NestedGltf);
324
- TypeStore.add("Networking", Networking);
325
- TypeStore.add("NoiseModule", NoiseModule);
326
- TypeStore.add("ObjectRaycaster", ObjectRaycaster);
327
- TypeStore.add("OffsetConstraint", OffsetConstraint);
328
- TypeStore.add("OpenURL", OpenURL);
329
- TypeStore.add("OrbitControls", OrbitControls);
330
- TypeStore.add("Outline", Outline);
331
- TypeStore.add("Padding", Padding);
332
- TypeStore.add("ParticleBurst", ParticleBurst);
333
- TypeStore.add("ParticleSubEmitter", ParticleSubEmitter);
334
- TypeStore.add("ParticleSystem", ParticleSystem);
335
- TypeStore.add("ParticleSystemRenderer", ParticleSystemRenderer);
336
- TypeStore.add("PixelationEffect", PixelationEffect);
337
- TypeStore.add("PlayableDirector", PlayableDirector);
338
- TypeStore.add("PlayAnimationOnClick", PlayAnimationOnClick);
339
- TypeStore.add("PlayAudioOnClick", PlayAudioOnClick);
340
- TypeStore.add("PlayerColor", PlayerColor);
341
- TypeStore.add("PlayerState", PlayerState);
342
- TypeStore.add("PlayerSync", PlayerSync);
343
- TypeStore.add("PointerEventData", PointerEventData);
344
- TypeStore.add("PostProcessingHandler", PostProcessingHandler);
345
- TypeStore.add("PreliminaryAction", PreliminaryAction);
346
- TypeStore.add("PreliminaryTrigger", PreliminaryTrigger);
347
- TypeStore.add("PresentationMode", PresentationMode);
348
- TypeStore.add("RawImage", RawImage);
349
- TypeStore.add("Raycaster", Raycaster);
350
- TypeStore.add("Rect", Rect);
351
- TypeStore.add("RectTransform", RectTransform);
352
- TypeStore.add("ReflectionProbe", ReflectionProbe);
353
- TypeStore.add("RegisteredAnimationInfo", RegisteredAnimationInfo);
354
- TypeStore.add("RemoteSkybox", RemoteSkybox);
355
- TypeStore.add("Renderer", Renderer);
356
- TypeStore.add("RendererLightmap", RendererLightmap);
357
- TypeStore.add("RGBAColor", RGBAColor);
358
- TypeStore.add("Rigidbody", Rigidbody);
359
- TypeStore.add("RotationBySpeedModule", RotationBySpeedModule);
360
- TypeStore.add("RotationOverLifetimeModule", RotationOverLifetimeModule);
361
- TypeStore.add("SceneSwitcher", SceneSwitcher);
362
- TypeStore.add("ScreenCapture", ScreenCapture);
363
- TypeStore.add("ScreenSpaceAmbientOcclusion", ScreenSpaceAmbientOcclusion);
364
- TypeStore.add("ScreenSpaceAmbientOcclusionN8", ScreenSpaceAmbientOcclusionN8);
365
- TypeStore.add("SetActiveOnClick", SetActiveOnClick);
366
- TypeStore.add("ShadowCatcher", ShadowCatcher);
367
- TypeStore.add("ShapeModule", ShapeModule);
368
- TypeStore.add("SignalAsset", SignalAsset);
369
- TypeStore.add("SignalReceiver", SignalReceiver);
370
- TypeStore.add("SignalReceiverEvent", SignalReceiverEvent);
371
- TypeStore.add("SignalTrackHandler", SignalTrackHandler);
372
- TypeStore.add("Size", Size);
373
- TypeStore.add("SizeBySpeedModule", SizeBySpeedModule);
374
- TypeStore.add("SizeOverLifetimeModule", SizeOverLifetimeModule);
375
- TypeStore.add("SkinnedMeshRenderer", SkinnedMeshRenderer);
376
- TypeStore.add("SmoothFollow", SmoothFollow);
377
- TypeStore.add("SpatialHtml", SpatialHtml);
378
- TypeStore.add("SpatialTrigger", SpatialTrigger);
379
- TypeStore.add("SpatialTriggerReceiver", SpatialTriggerReceiver);
380
- TypeStore.add("SpectatorCamera", SpectatorCamera);
381
- TypeStore.add("SphereCollider", SphereCollider);
382
- TypeStore.add("Sprite", Sprite);
383
- TypeStore.add("SpriteData", SpriteData);
384
- TypeStore.add("SpriteRenderer", SpriteRenderer);
385
- TypeStore.add("SpriteSheet", SpriteSheet);
386
- TypeStore.add("SubEmitterSystem", SubEmitterSystem);
387
- TypeStore.add("SyncedCamera", SyncedCamera);
388
- TypeStore.add("SyncedRoom", SyncedRoom);
389
- TypeStore.add("SyncedTransform", SyncedTransform);
390
- TypeStore.add("TapGestureTrigger", TapGestureTrigger);
391
- TypeStore.add("TeleportTarget", TeleportTarget);
392
- TypeStore.add("TestRunner", TestRunner);
393
- TypeStore.add("TestSimulateUserData", TestSimulateUserData);
394
- TypeStore.add("Text", Text);
395
- TypeStore.add("TextBuilder", TextBuilder);
396
- TypeStore.add("TextExtension", TextExtension);
397
- TypeStore.add("TextureSheetAnimationModule", TextureSheetAnimationModule);
398
- TypeStore.add("TiltShiftEffect", TiltShiftEffect);
399
- TypeStore.add("ToneMapping", ToneMapping);
400
- TypeStore.add("TrailModule", TrailModule);
401
- TypeStore.add("TransformData", TransformData);
402
- TypeStore.add("TransformGizmo", TransformGizmo);
403
- TypeStore.add("TriggerBuilder", TriggerBuilder);
404
- TypeStore.add("TriggerModel", TriggerModel);
405
- TypeStore.add("UIRaycastUtils", UIRaycastUtils);
406
- TypeStore.add("UIRootComponent", UIRootComponent);
407
- TypeStore.add("UsageMarker", UsageMarker);
408
- TypeStore.add("USDZExporter", USDZExporter);
409
- TypeStore.add("USDZText", USDZText);
410
- TypeStore.add("USDZUIExtension", USDZUIExtension);
411
- TypeStore.add("VariantAction", VariantAction);
412
- TypeStore.add("VelocityOverLifetimeModule", VelocityOverLifetimeModule);
413
- TypeStore.add("VerticalLayoutGroup", VerticalLayoutGroup);
414
- TypeStore.add("VideoPlayer", VideoPlayer);
415
- TypeStore.add("Vignette", Vignette);
416
- TypeStore.add("VisibilityAction", VisibilityAction);
417
- TypeStore.add("Voip", Voip);
418
- TypeStore.add("Volume", Volume);
419
- TypeStore.add("VolumeParameter", VolumeParameter);
420
- TypeStore.add("VolumeProfile", VolumeProfile);
421
- TypeStore.add("VRUserState", VRUserState);
422
- TypeStore.add("WebAR", WebAR);
423
- TypeStore.add("WebARCameraBackground", WebARCameraBackground);
424
- TypeStore.add("WebARSessionRoot", WebARSessionRoot);
425
- TypeStore.add("WebXR", WebXR);
426
- TypeStore.add("WebXRAvatar", WebXRAvatar);
427
- TypeStore.add("WebXRController", WebXRController);
428
- TypeStore.add("WebXRImageTracking", WebXRImageTracking);
429
- TypeStore.add("WebXRImageTrackingModel", WebXRImageTrackingModel);
430
- TypeStore.add("WebXRPlaneTracking", WebXRPlaneTracking);
431
- TypeStore.add("WebXRSync", WebXRSync);
432
- TypeStore.add("WebXRTrackedImage", WebXRTrackedImage);
433
- TypeStore.add("XRFlag", XRFlag);
434
- TypeStore.add("XRGrabModel", XRGrabModel);
435
- TypeStore.add("XRGrabRendering", XRGrabRendering);
436
- TypeStore.add("XRRig", XRRig);
437
- TypeStore.add("XRState", XRState);
src/engine-components/export/usdz/extensions/behavior/Actions.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Object3D, Matrix4, Material, BufferGeometry } from "three";
2
- import { ActionBuilder, ActionModel } from "./BehavioursBuilder";
3
- import { USDObject, USDDocument } from "../../ThreeUSDZExporter";
2
+ import { ActionBuilder, ActionModel } from "./BehavioursBuilder.js";
3
+ import { USDObject, USDDocument } from "../../ThreeUSDZExporter.js";
4
4
 
5
5
  export abstract class DocumentAction {
6
6
 
src/engine-components/AlignmentConstraint.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import * as utils from "./../engine/engine_three_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import * as utils from "./../engine/engine_three_utils.js";
3
3
  import { Vector3 } from "three";
4
- import { serializable } from "../engine/engine_serialization_decorator";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
5
 
6
6
  export class AlignmentConstraint extends Behaviour {
7
7
 
src/engine-components/Animation.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import { AnimationAction, AnimationClip, AnimationMixer, LoopOnce, LoopRepeat } from "three";
3
- import { MixerEvent } from "./Animator";
4
- import { serializable } from "../engine/engine_serialization_decorator";
5
- import { Mathf } from "../engine/engine_math";
6
- import { Vec2 } from "../engine/engine_types";
7
- import { getParam } from "../engine/engine_utils";
3
+ import { MixerEvent } from "./Animator.js";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
+ import { Mathf } from "../engine/engine_math.js";
6
+ import { Vec2 } from "../engine/engine_types.js";
7
+ import { getParam } from "../engine/engine_utils.js";
8
8
 
9
9
  const debug = getParam("debuganimation");
10
10
 
src/engine-components/export/usdz/extensions/Animation.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { GameObject } from "../../../Component";
2
- import { getParam } from "../../../../engine/engine_utils";
1
+ import { GameObject } from "../../../Component.js";
2
+ import { getParam } from "../../../../engine/engine_utils.js";
3
3
 
4
- import { USDObject, buildMatrix } from "../ThreeUSDZExporter";
5
- import { IUSDExporterExtension } from "../Extension";
4
+ import { USDObject, buildMatrix } from "../ThreeUSDZExporter.js";
5
+ import { IUSDExporterExtension } from "../Extension.js";
6
6
 
7
7
  import { Object3D, Matrix4, Vector3, Quaternion, Interpolant, AnimationClip, KeyframeTrack } from "three";
8
8
 
src/engine-components/AnimationCurve.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Mathf } from "../engine/engine_math";
2
- import { serializable } from "../engine/engine_serialization_decorator";
1
+ import { Mathf } from "../engine/engine_math.js";
2
+ import { serializable } from "../engine/engine_serialization_decorator.js";
3
3
 
4
4
  class Keyframe {
5
5
  @serializable()
src/engine-components/AnimationUtils.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
2
- import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry";
3
- import { addNewComponent } from "../engine/engine_components";
4
- import { Animator } from "./Animator";
5
- import { Animation } from "./Animation";
6
- import { GameObject } from "./Component";
7
- import { PlayableDirector } from "./timeline/PlayableDirector";
2
+ import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry.js";
3
+ import { addNewComponent } from "../engine/engine_components.js";
4
+ import { Animator } from "./Animator.js";
5
+ import { Animation } from "./Animation.js";
6
+ import { GameObject } from "./Component.js";
7
+ import { PlayableDirector } from "./timeline/PlayableDirector.js";
8
8
  import { Object3D } from "three";
9
9
 
10
10
 
@@ -14,22 +14,24 @@
14
14
  * @param obj The object to mark
15
15
  * @param isAnimated Whether the object is animated or not
16
16
  */
17
- export function setObjectAnimated(obj: Object3D, isAnimated: boolean) {
17
+ export function setObjectAnimated(obj: Object3D, animatedBy: object, isAnimated: boolean) {
18
18
  if (obj[$objectAnimationKey] === undefined) {
19
19
  if (!isAnimated) return;
20
- obj[$objectAnimationKey] = 1;
20
+ obj[$objectAnimationKey] = new Set<object>();
21
21
  }
22
- else {
23
- if (isAnimated)
24
- obj[$objectAnimationKey] += 1;
25
- else if (obj[$objectAnimationKey] > 0)
26
- obj[$objectAnimationKey] -= 1;
22
+
23
+ const set = obj[$objectAnimationKey] as Set<object>;
24
+ if (isAnimated) {
25
+ set.add(animatedBy);
27
26
  }
27
+ else if (set.has(animatedBy))
28
+ set.delete(animatedBy);
28
29
  }
29
30
 
30
31
  /** Get is the object is currently animated. Currently used by the Animator to check if a timeline animationtrack is actively animating an object */
31
32
  export function getObjectAnimated(obj: Object3D): boolean {
32
- return obj[$objectAnimationKey] !== undefined && obj[$objectAnimationKey] > 0;
33
+ const set = obj[$objectAnimationKey] as Set<object>;
34
+ return set !== undefined && set.size > 0;
33
35
  }
34
36
 
35
37
  ContextRegistry.registerCallback(ContextEvent.ContextCreated, args => {
src/engine-components/export/usdz/utils/animationutils.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Animator } from "../../../Animator";
1
+ import { Animator } from "../../../Animator.js";
2
2
  import { Object3D, Color, AnimationClip, KeyframeTrack } from "three";
3
- import { AnimationExtension } from "../extensions/Animation";
4
- import { GameObject } from "../../../Component";
5
- import { getParam } from "../../../../engine/engine_utils";
3
+ import { AnimationExtension } from "../extensions/Animation.js";
4
+ import { GameObject } from "../../../Component.js";
5
+ import { getParam } from "../../../../engine/engine_utils.js";
6
6
 
7
7
  const debug = getParam("debugusdz");
8
8
 
src/engine-components/Animator.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import { AnimationActionLoopStyles, AnimationAction, AnimationMixer } from "three";
3
- import { getParam } from "../engine/engine_utils";
4
- import { AnimatorControllerModel } from "../engine/extensions/NEEDLE_animator_controller_model";
5
- import { AnimatorController } from "./AnimatorController";
6
- import { serializable } from "../engine/engine_serialization_decorator";
7
- import { Mathf } from "../engine/engine_math";
8
- import { getObjectAnimated } from "./AnimationUtils";
3
+ import { getParam } from "../engine/engine_utils.js";
4
+ import { AnimatorControllerModel } from "../engine/extensions/NEEDLE_animator_controller_model.js";
5
+ import { AnimatorController } from "./AnimatorController.js";
6
+ import { serializable } from "../engine/engine_serialization_decorator.js";
7
+ import { Mathf } from "../engine/engine_math.js";
8
+ import { getObjectAnimated } from "./AnimationUtils.js";
9
9
 
10
10
  const debug = getParam("debuganimator");
11
11
 
@@ -149,8 +149,19 @@
149
149
  if (debug)
150
150
  console.log("ANIMATOR", this.name, this);
151
151
  if (!this.gameObject) return;
152
- if (this.runtimeAnimatorController) {
152
+ this.initializeRuntimeAnimatorController();
153
+ }
154
+
155
+ // Why do we jump through hoops like this? It's because of the PlayableDirector and animation tracks
156
+ // they NEED to use the same mixer when binding/creating the animation clips
157
+ // so when the playable director runs it takes over updating the mixer for blending and then calls the runtimeAnimatorController.update
158
+ // so they effectively share the same mixer. There might be cases still where not the same mixer is being used but then the animation track prints an error in dev
159
+ private _initializeWithRuntimeAnimatorController?: AnimatorController | null;
160
+ initializeRuntimeAnimatorController(force: boolean = false) {
161
+ const shouldRun = (force || this.runtimeAnimatorController !== this._initializeWithRuntimeAnimatorController);
162
+ if (this.runtimeAnimatorController && shouldRun) {
153
163
  const clone = this.runtimeAnimatorController.clone();
164
+ this._initializeWithRuntimeAnimatorController = clone;
154
165
  if (clone) {
155
166
  console.assert(this.runtimeAnimatorController !== clone);
156
167
  this.runtimeAnimatorController = clone;
@@ -169,11 +180,11 @@
169
180
  }
170
181
 
171
182
  onBeforeRender() {
172
- if (getObjectAnimated(this.gameObject)) return;
183
+ const isAnimatedExternally = getObjectAnimated(this.gameObject);
184
+ if (isAnimatedExternally) return;
173
185
 
174
186
  if (this._animatorController) {
175
- this._animatorController.update();
187
+ this._animatorController.update(1);
176
188
  }
177
-
178
189
  }
179
190
  }
src/engine-components/AnimatorController.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { Animator } from "./Animator";
2
- import { AnimatorConditionMode, AnimatorControllerModel, AnimatorControllerParameterType, AnimatorStateInfo, Condition, createMotion, State, StateMachineBehaviour } from "../engine/extensions/NEEDLE_animator_controller_model";
1
+ import { Animator } from "./Animator.js";
2
+ import { AnimatorConditionMode, AnimatorControllerModel, AnimatorControllerParameterType, AnimatorStateInfo, Condition, createMotion, State, StateMachineBehaviour } from "../engine/extensions/NEEDLE_animator_controller_model.js";
3
3
  import { AnimationAction, AnimationClip, AnimationMixer, AxesHelper, Euler, KeyframeTrack, LoopOnce, Object3D, Quaternion, Vector3 } from "three";
4
- import { deepClone, getParam } from "../engine/engine_utils";
5
- import { Context } from "../engine/engine_setup";
6
- import { TypeStore } from "../engine/engine_typestore";
7
- import { assign } from "../engine/engine_serialization_core";
8
- import { Mathf } from "../engine/engine_math";
9
- import { isAnimationAction } from "../engine/engine_three_utils";
10
- import { isDevEnvironment } from "../engine/debug";
4
+ import { deepClone, getParam } from "../engine/engine_utils.js";
5
+ import { Context } from "../engine/engine_setup.js";
6
+ import { TypeStore } from "../engine/engine_typestore.js";
7
+ import { assign } from "../engine/engine_serialization_core.js";
8
+ import { Mathf } from "../engine/engine_math.js";
9
+ import { isAnimationAction } from "../engine/engine_three_utils.js";
10
+ import { isDevEnvironment } from "../engine/debug/index.js";
11
11
 
12
12
  const debug = getParam("debuganimatorcontroller");
13
13
  const debugRootMotion = getParam("debugrootmotion");
@@ -108,16 +108,20 @@
108
108
  animator?: Animator;
109
109
  model: AnimatorControllerModel;
110
110
  get context(): Context | undefined | null { return this.animator?.context; }
111
+ get mixer() {
112
+ return this._mixer;
113
+ }
111
114
 
112
-
113
115
  // applyRootMotion(obj: Object3D) {
114
116
  // // this.internalApplyRootMotion(obj);
115
117
  // }
116
118
 
117
119
  bind(animator: Animator) {
118
- this.animator = animator;
119
- this._mixer = new AnimationMixer(this.animator.gameObject);
120
- this.createActions(this.animator);
120
+ if (this.animator !== animator) {
121
+ this.animator = animator;
122
+ this._mixer = new AnimationMixer(this.animator.gameObject);
123
+ this.createActions(this.animator);
124
+ }
121
125
  }
122
126
 
123
127
  clone() {
@@ -144,11 +148,11 @@
144
148
  return controller;
145
149
  }
146
150
 
147
- update() {
151
+ update(weight: number) {
148
152
  if (!this.animator) return;
149
153
  this.evaluateTransitions();
150
- this.updateActiveStates();
151
- if(!this._activeState) return;
154
+ this.updateActiveStates(weight);
155
+ if (!this._activeState) return;
152
156
  const dt = this.animator.context.time.deltaTime;
153
157
  if (this.animator.applyRootMotion) {
154
158
  this.rootMotionHandler?.onBeforeUpdate();
@@ -170,7 +174,7 @@
170
174
 
171
175
  private _activeStates: State[] = [];
172
176
 
173
- private updateActiveStates() {
177
+ private updateActiveStates(weight: number) {
174
178
  for (let i = 0; i < this._activeStates.length; i++) {
175
179
  const state = this._activeStates[i];
176
180
  const motion = state.motion;
@@ -180,6 +184,7 @@
180
184
  }
181
185
  else {
182
186
  const action = motion.action;
187
+ action.weight = weight;
183
188
  // console.log(action.getClip().name, action.getEffectiveWeight(), action.isScheduled());
184
189
  if ((action.getEffectiveWeight() <= 0 && !action.isRunning())) {
185
190
  if (debug)
@@ -279,6 +284,9 @@
279
284
  // if none of the transitions can be made continue searching for another transition meeting the conditions
280
285
  }
281
286
 
287
+ // action.time += this.context.time.deltaTime
288
+ // console.log(action?.time, action?.getEffectiveWeight())
289
+
282
290
  let didTriggerLooping = false;
283
291
  if (state.motion.isLooping && action) {
284
292
  // we dont use the three loop state here because it prevents the transition check above
@@ -384,15 +392,14 @@
384
392
  action.enabled = true;
385
393
  const duration = state.motion.clip!.duration;
386
394
  action.time = offsetNormalized * duration;
387
- if(action.timeScale < 0) action.time = duration - action.time;
395
+ if (action.timeScale < 0) action.time = duration - action.time;
388
396
  action.clampWhenFinished = true;
389
397
  action.setLoop(LoopOnce, 0);
390
398
  if (durationInSec > 0)
391
399
  action.fadeIn(durationInSec);
392
- else action.setEffectiveWeight(1);
400
+ else action.weight = 1;
393
401
  action.play();
394
402
 
395
-
396
403
  if (this.rootMotionHandler) {
397
404
  this.rootMotionHandler.onStart(action);
398
405
  }
src/engine-components/postprocessing/Effects/Antialiasing.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EdgeDetectionMode, SMAAEffect, SMAAPreset } from "postprocessing";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { registerCustomEffectType } from "../VolumeProfile";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { registerCustomEffectType } from "../VolumeProfile.js";
6
6
 
7
7
 
8
8
 
src/engine-components-experimental/api.ts CHANGED
@@ -1,1 +1,1 @@
1
- export * from "./networking/PlayerSync";
1
+ export * from "./networking/PlayerSync.js";
src/engine-components/api.ts CHANGED
@@ -1,19 +1,19 @@
1
- export { Behaviour, Component, GameObject } from "./Component"
2
- export * from "./codegen/components";
1
+ export { Behaviour, Component, GameObject } from "./Component.js"
2
+ export * from "./codegen/components.js";
3
3
 
4
4
  // We dont want to export everything in the extensions
5
- export * from "./js-extensions/RGBAColor";
6
- export * from "./js-extensions/Object3D";
7
- export * from "./XRFlag"
5
+ export * from "./js-extensions/RGBAColor.js";
6
+ export * from "./js-extensions/Object3D.js";
7
+ export * from "./XRFlag.js"
8
8
 
9
- export * from "./export"
10
- export * from "./postprocessing"
11
- export * from "./timeline"
12
- export * from "./ui"
13
- export * from "./webxr"
9
+ export * from "./export/index.js"
10
+ export * from "./postprocessing/index.js"
11
+ export * from "./timeline/index.js"
12
+ export * from "./ui/index.js"
13
+ export * from "./webxr/index.js"
14
14
 
15
- export { ClearFlags } from "./Camera"
15
+ export { ClearFlags } from "./Camera.js"
16
16
 
17
17
 
18
- import "./CameraUtils"
19
- import "./AnimationUtils"
18
+ import "./CameraUtils.js"
19
+ import "./AnimationUtils.js"
src/engine/api.ts CHANGED
@@ -1,52 +1,52 @@
1
1
 
2
- export * from "./extensions";
3
- export * from "./engine_addressables";
4
- export * from "./engine_application";
5
- export * from "./engine_assetdatabase";
6
- export * from "./engine_create_objects";
7
- export * from "./engine_components_internal";
8
- export * from "./engine_components";
9
- export * from "./engine_components_internal";
10
- export * from "./engine_context_registry";
11
- export * from "./engine_context";
12
- export * from "./engine_coroutine"
13
- export * from "./engine_constants";
14
- export * from "./debug";
15
- export * from "./engine_element";
16
- export * from "./engine_element_loading";
17
- export * from "./engine_element_attributes";
18
- export { Gizmos } from "./engine_gizmos"
19
- export * from "./engine_gltf";
20
- export * from "./engine_hot_reload";
21
- export * from "./engine_gameobject";
22
- export * from "./engine_networking";
23
- export * from "./engine_networking_types";
24
- export { syncField } from "./engine_networking_auto";
25
- export * from "./engine_networking_files";
26
- export * from "./engine_networking_instantiate";
27
- export * from "./engine_networking_utils";
28
- export * from "./engine_patcher";
29
- export * from "./engine_playerview";
30
- export * from "./engine_physics";
31
- export * from "./engine_physics.types";
32
- export * from "./engine_physics_rapier";
33
- export * from "./engine_scenelighting";
34
- export * from "./engine_input";
35
- export * from "./engine_math";
36
- export * from "./js-extensions";
37
- export * from "./engine_scenetools";
38
- export * from "./engine_serialization";
39
- export { type ISerializable } from "./engine_serialization_core";
40
- export * from "./engine_texture";
41
- export * from "./engine_three_utils";
42
- export * from "./engine_time";
43
- export * from "./engine_types";
44
- export * from "./engine_utils_screenshot";
45
- export * from "./engine_web_api";
46
- export * from "./engine_utils";
2
+ export * from "./extensions/index.js";
3
+ export * from "./engine_addressables.js";
4
+ export * from "./engine_application.js";
5
+ export * from "./engine_assetdatabase.js";
6
+ export * from "./engine_create_objects.js";
7
+ export * from "./engine_components_internal.js";
8
+ export * from "./engine_components.js";
9
+ export * from "./engine_components_internal.js";
10
+ export * from "./engine_context_registry.js";
11
+ export * from "./engine_context.js";
12
+ export * from "./engine_coroutine.js"
13
+ export * from "./engine_constants.js";
14
+ export * from "./debug/index.js";
15
+ export * from "./engine_element.js";
16
+ export * from "./engine_element_loading.js";
17
+ export * from "./engine_element_attributes.js";
18
+ export { Gizmos } from "./engine_gizmos.js"
19
+ export * from "./engine_gltf.js";
20
+ export * from "./engine_hot_reload.js";
21
+ export * from "./engine_gameobject.js";
22
+ export * from "./engine_networking.js";
23
+ export * from "./engine_networking_types.js";
24
+ export { syncField } from "./engine_networking_auto.js";
25
+ export * from "./engine_networking_files.js";
26
+ export * from "./engine_networking_instantiate.js";
27
+ export * from "./engine_networking_utils.js";
28
+ export * from "./engine_patcher.js";
29
+ export * from "./engine_playerview.js";
30
+ export * from "./engine_physics.js";
31
+ export * from "./engine_physics.types.js";
32
+ export * from "./engine_physics_rapier.js";
33
+ export * from "./engine_scenelighting.js";
34
+ export * from "./engine_input.js";
35
+ export * from "./engine_math.js";
36
+ export * from "./js-extensions/index.js";
37
+ export * from "./engine_scenetools.js";
38
+ export * from "./engine_serialization.js";
39
+ export { type ISerializable } from "./engine_serialization_core.js";
40
+ export * from "./engine_texture.js";
41
+ export * from "./engine_three_utils.js";
42
+ export * from "./engine_time.js";
43
+ export * from "./engine_types.js";
44
+ export * from "./engine_utils_screenshot.js";
45
+ export * from "./engine_web_api.js";
46
+ export * from "./engine_utils.js";
47
47
 
48
- export { TypeStore, registerType } from "./engine_typestore";
48
+ export { TypeStore, registerType } from "./engine_typestore.js";
49
49
 
50
- export { InstancingUtil } from "./engine_instancing";
51
- export { validate, prefix } from "./engine_util_decorator";
52
- export { hasProLicense, hasIndieLicense } from "./engine_license";
50
+ export { InstancingUtil } from "./engine_instancing.js";
51
+ export { validate, prefix } from "./engine_util_decorator.js";
52
+ export { hasProLicense, hasIndieLicense } from "./engine_license.js";
src/engine-components/export/usdz/extensions/behavior/AudioExtension.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { GameObject } from "../../../../Component";
2
- import { IUSDExporterExtension } from "../../Extension";
3
- import { USDObject, USDWriter, USDZExporterContext } from "../../ThreeUSDZExporter";
1
+ import { GameObject } from "../../../../Component.js";
2
+ import { IUSDExporterExtension } from "../../Extension.js";
3
+ import { USDObject, USDWriter, USDZExporterContext } from "../../ThreeUSDZExporter.js";
4
4
  import { Object3D } from "three";
5
- import { AudioSource } from "../../../../AudioSource";
5
+ import { AudioSource } from "../../../../AudioSource.js";
6
6
 
7
7
  export class AudioExtension implements IUSDExporterExtension {
8
8
 
src/engine-components/AudioListener.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import { AudioListener as ThreeAudioListener } from "three";
3
- import { AudioSource } from "./AudioSource";
4
- import { Camera } from "./Camera";
3
+ import { AudioSource } from "./AudioSource.js";
4
+ import { Camera } from "./Camera.js";
5
5
 
6
6
 
7
7
  export class AudioListener extends Behaviour {
src/engine-components/AudioSource.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import { PositionalAudioHelper } from 'three/examples/jsm/helpers/PositionalAudioHelper.js';
3
- import { AudioListener } from "./AudioListener";
4
- import * as utils from "../engine/engine_utils";
5
- import { serializable } from "../engine/engine_serialization_decorator";
6
- import { ApplicationEvents } from "../engine/engine_application";
3
+ import { AudioListener } from "./AudioListener.js";
4
+ import * as utils from "../engine/engine_utils.js";
5
+ import { serializable } from "../engine/engine_serialization_decorator.js";
6
+ import { ApplicationEvents } from "../engine/engine_application.js";
7
7
  import { AudioLoader, PositionalAudio } from "three";
8
8
 
9
9
 
src/engine-components/avatar/Avatar_Brain_LookAt.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as THREE from "three";
2
- import { TypeStore } from "../../engine/engine_typestore";
3
- import { Behaviour, GameObject } from "../Component";
4
- import { AvatarMarker } from "../webxr/WebXRAvatar";
5
- import * as utils from "../../engine/engine_three_utils";
6
- import { OwnershipModel } from "../../engine/engine_networking";
2
+ import { TypeStore } from "../../engine/engine_typestore.js";
3
+ import { Behaviour, GameObject } from "../Component.js";
4
+ import { AvatarMarker } from "../webxr/WebXRAvatar.js";
5
+ import * as utils from "../../engine/engine_three_utils.js";
6
+ import { OwnershipModel } from "../../engine/engine_networking.js";
7
7
  import { Int8BufferAttribute } from "three";
8
- import { Context } from "../../engine/engine_setup";
9
- import { IModel } from "../../engine/engine_networking_types";
8
+ import { Context } from "../../engine/engine_setup.js";
9
+ import { IModel } from "../../engine/engine_networking_types.js";
10
10
 
11
11
  export class Avatar_POI {
12
12
 
src/engine-components/avatar/Avatar_MouthShapes.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { Voip } from "../Voip";
3
- import { AvatarMarker } from "../webxr/WebXRAvatar";
4
- import * as utils from "../../engine/engine_utils";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { Voip } from "../Voip.js";
3
+ import { AvatarMarker } from "../webxr/WebXRAvatar.js";
4
+ import * as utils from "../../engine/engine_utils.js";
5
5
  import { Object3D } from "three";
6
- import { serializable } from "../../engine/engine_serialization_decorator";
6
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
7
7
 
8
8
  const debug = utils.getParam("debugmouth");
9
9
 
src/engine-components/avatar/Avatar_MustacheShake.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { Voip } from "../Voip";
3
- import { AvatarMarker } from "../webxr/WebXRAvatar";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { Voip } from "../Voip.js";
3
+ import { AvatarMarker } from "../webxr/WebXRAvatar.js";
4
4
 
5
5
  export class Avatar_MustacheShake extends Behaviour {
6
6
  private voip: Voip | null = null;
src/engine-components/avatar/AvatarBlink_Simple.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Object3D } from "three";
2
- import { Behaviour, GameObject } from "../Component";
3
- import { XRFlag, XRState } from "../XRFlag";
4
- import { serializable } from "../../engine/engine_serialization_decorator";
2
+ import { Behaviour, GameObject } from "../Component.js";
3
+ import { XRFlag, XRState } from "../XRFlag.js";
4
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
5
5
 
6
6
 
7
7
  export class AvatarBlink_Simple extends Behaviour {
src/engine-components/avatar/AvatarEyeLook_Rotation.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import * as utils from "../../engine/engine_three_utils"
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import * as utils from "../../engine/engine_three_utils.js"
3
3
  import * as THREE from "three";
4
- import { Avatar_Brain_LookAt } from "./Avatar_Brain_LookAt";
5
- import { serializable } from "../../engine/engine_serialization_decorator";
4
+ import { Avatar_Brain_LookAt } from "./Avatar_Brain_LookAt.js";
5
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
6
6
  import { Object3D } from "three";
7
7
 
8
8
  export class AvatarEyeLook_Rotation extends Behaviour {
src/engine-components/AvatarLoader.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
2
- import * as utils from "../engine/engine_utils"
3
- import * as loaders from "../engine/engine_loaders"
4
- import { Context } from "../engine/engine_setup";
5
- import { GameObject } from "./Component";
6
- import { download_file } from "../engine/engine_web_api";
7
- import { getLoader } from "../engine/engine_gltf";
8
- import { InstantiateOptions } from "../engine/engine_gameobject";
1
+ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
2
+ import * as utils from "../engine/engine_utils.js"
3
+ import * as loaders from "../engine/engine_loaders.js"
4
+ import { Context } from "../engine/engine_setup.js";
5
+ import { GameObject } from "./Component.js";
6
+ import { download_file } from "../engine/engine_web_api.js";
7
+ import { getLoader } from "../engine/engine_gltf.js";
8
+ import { InstantiateOptions } from "../engine/engine_gameobject.js";
9
9
  import { Box3, Object3D, Vector3 } from "three";
10
10
 
11
11
  const debug = utils.getParam("debugavatar");
src/engine-components/AxesHelper.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour } from "./Component";
2
- import * as params from "../engine/engine_default_parameters";
3
- import { serializable } from "../engine/engine_serialization_decorator";
1
+ import { Behaviour } from "./Component.js";
2
+ import * as params from "../engine/engine_default_parameters.js";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
4
  import { AxesHelper as _AxesHelper } from "three";
5
5
 
6
6
  export class AxesHelper extends Behaviour {
src/engine-components/ui/BaseUIComponent.ts CHANGED
@@ -1,12 +1,12 @@
1
- // import { Canvas } from './Canvas';
1
+ // import { Canvas } from './Canvas.js';
2
2
  import * as ThreeMeshUI from 'three-mesh-ui';
3
- import { Behaviour, GameObject } from "../Component";
4
- import { EventSystem } from "./EventSystem";
5
- import { showGizmos } from '../../engine/engine_default_parameters';
3
+ import { Behaviour, GameObject } from "../Component.js";
4
+ import { EventSystem } from "./EventSystem.js";
5
+ import { showGizmos } from '../../engine/engine_default_parameters.js';
6
6
  import { AxesHelper, Object3D } from 'three';
7
- import { ICanvas, IGraphic } from './Interfaces';
8
- import { ShadowCastingMode } from '../Renderer';
9
- import { getParam } from '../../engine/engine_utils';
7
+ import { ICanvas, IGraphic } from './Interfaces.js';
8
+ import { ShadowCastingMode } from '../Renderer.js';
9
+ import { getParam } from '../../engine/engine_utils.js';
10
10
  export const includesDir = "./include";
11
11
 
12
12
  const debug = getParam("debugshadowcomponents");
src/engine-components/BasicIKConstraint.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import * as utils from "./../engine/engine_three_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import * as utils from "./../engine/engine_three_utils.js";
3
3
  import { Vector3 } from "three";
4
4
 
5
5
  export class BasicIKConstraint extends Behaviour {
src/engine-components/export/usdz/extensions/behavior/Behaviour.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { GameObject } from "../../../../Component";
2
- import { IContext } from "../../../../../engine/engine_types";
3
- import { IUSDExporterExtension } from "../../Extension";
4
- import { USDObject, USDWriter } from "../../ThreeUSDZExporter";
5
- import { BehaviorModel } from "./BehavioursBuilder";
1
+ import { GameObject } from "../../../../Component.js";
2
+ import { IContext } from "../../../../../engine/engine_types.js";
3
+ import { IUSDExporterExtension } from "../../Extension.js";
4
+ import { USDObject, USDWriter } from "../../ThreeUSDZExporter.js";
5
+ import { BehaviorModel } from "./BehavioursBuilder.js";
6
6
 
7
7
  export interface UsdzBehaviour {
8
8
  createBehaviours?(ext: BehaviorExtension, model: USDObject, context: IContext): void;
src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { Behaviour, GameObject } from "../../../../Component";
2
- import { Animator } from "../../../../Animator";
3
- import { Renderer } from "../../../../Renderer";
4
- import { serializable } from "../../../../../engine/engine_serialization_decorator";
5
- import { IPointerClickHandler } from "../../../../ui/PointerEvents";
6
- import { RegisteredAnimationInfo, UsdzAnimation } from "../Animation";
7
- import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldPosition, setWorldQuaternion, setWorldScale } from "../../../../../engine/engine_three_utils";
1
+ import { Behaviour, GameObject } from "../../../../Component.js";
2
+ import { Animator } from "../../../../Animator.js";
3
+ import { Renderer } from "../../../../Renderer.js";
4
+ import { serializable } from "../../../../../engine/engine_serialization_decorator.js";
5
+ import { IPointerClickHandler } from "../../../../ui/PointerEvents.js";
6
+ import { RegisteredAnimationInfo, UsdzAnimation } from "../Animation.js";
7
+ import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldPosition, setWorldQuaternion, setWorldScale } from "../../../../../engine/engine_three_utils.js";
8
8
 
9
9
  import { Object3D, Material, Vector3, Quaternion } from "three";
10
- import { USDDocument, USDObject } from "../../ThreeUSDZExporter";
10
+ import { USDDocument, USDObject } from "../../ThreeUSDZExporter.js";
11
11
 
12
- import { BehaviorExtension, UsdzBehaviour } from "./Behaviour";
13
- import { ActionBuilder, ActionModel, AuralMode, BehaviorModel, IBehaviorElement, MotionType, PlayAction, Space, TriggerBuilder } from "./BehavioursBuilder";
14
- import { AudioSource } from "../../../../AudioSource";
15
- import { NEEDLE_progressive } from "../../../../../engine/extensions/NEEDLE_progressive";
12
+ import { BehaviorExtension, UsdzBehaviour } from "./Behaviour.js";
13
+ import { ActionBuilder, ActionModel, AuralMode, BehaviorModel, IBehaviorElement, MotionType, PlayAction, Space, TriggerBuilder } from "./BehavioursBuilder.js";
14
+ import { AudioSource } from "../../../../AudioSource.js";
15
+ import { NEEDLE_progressive } from "../../../../../engine/extensions/NEEDLE_progressive.js";
16
16
 
17
17
  export class ChangeTransformOnClick extends Behaviour implements IPointerClickHandler, UsdzBehaviour {
18
18
 
src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Object3D } from "three";
2
- import { USDDocument, USDObject, USDWriter, makeNameSafeForUSD } from "../../ThreeUSDZExporter";
2
+ import { USDDocument, USDObject, USDWriter, makeNameSafeForUSD } from "../../ThreeUSDZExporter.js";
3
3
 
4
- import { BehaviorExtension } from "./Behaviour";
4
+ import { BehaviorExtension } from "./Behaviour.js";
5
5
 
6
6
  // TODO: rename to usdz element
7
7
  export interface IBehaviorElement {
src/engine-components/postprocessing/Effects/Bloom.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BlendFunction, BloomEffect, SelectiveBloomEffect } from "postprocessing";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { PostProcessingEffect } from "../PostProcessingEffect";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { registerCustomEffectType } from "../VolumeProfile";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { registerCustomEffectType } from "../VolumeProfile.js";
6
6
 
7
7
  export class Bloom extends PostProcessingEffect {
8
8
 
src/engine-components/BoxCollider.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { BoxCollider } from "./Collider";
1
+ import { BoxCollider } from "./Collider.js";
2
2
  export default BoxCollider;
src/engine-components/BoxHelperComponent.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour } from "./Component";
2
- import { getParam } from "../engine/engine_utils";
3
- import { CreateWireCube, Gizmos } from "../engine/engine_gizmos";
4
- import { getWorldPosition, getWorldScale } from "../engine/engine_three_utils";
1
+ import { Behaviour } from "./Component.js";
2
+ import { getParam } from "../engine/engine_utils.js";
3
+ import { CreateWireCube, Gizmos } from "../engine/engine_gizmos.js";
4
+ import { getWorldPosition, getWorldScale } from "../engine/engine_three_utils.js";
5
5
  import { Box3, Color, ColorRepresentation, LineSegments, Object3D, Vector3 } from "three";
6
6
 
7
7
  const gizmos = getParam("gizmos");
src/engine-components/ui/Button.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { EventList } from "../EventList";
3
- import { IPointerClickHandler, IPointerEnterHandler, IPointerEventHandler, IPointerExitHandler, PointerEventData } from "./PointerEvents";
4
- import { Image } from "./Image";
5
- import { RGBAColor } from "../js-extensions/RGBAColor";
6
- import { serializable } from "../../engine/engine_serialization_decorator";
7
- import { Animator } from "../Animator";
8
- import { getParam } from "../../engine/engine_utils";
9
- import { showBalloonMessage } from "../../engine/debug";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { EventList } from "../EventList.js";
3
+ import { IPointerClickHandler, IPointerEnterHandler, IPointerEventHandler, IPointerExitHandler, PointerEventData } from "./PointerEvents.js";
4
+ import { Image } from "./Image.js";
5
+ import { RGBAColor } from "../js-extensions/RGBAColor.js";
6
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
7
+ import { Animator } from "../Animator.js";
8
+ import { getParam } from "../../engine/engine_utils.js";
9
+ import { showBalloonMessage } from "../../engine/debug/index.js";
10
10
 
11
11
  const debug = getParam("debugbutton");
12
12
 
src/engine-components/Camera.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { getParam } from "../engine/engine_utils";
3
- import { serializable } from "../engine/engine_serialization_decorator";
4
- import { RGBAColor } from "./js-extensions/RGBAColor";
5
- import { Context, XRSessionMode } from "../engine/engine_setup";
6
- import { ICamera } from "../engine/engine_types"
7
- import { showBalloonMessage } from "../engine/debug/debug";
8
- import { getWorldPosition, Graphics } from "../engine/engine_three_utils";
9
- import { Gizmos } from "../engine/engine_gizmos";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { getParam } from "../engine/engine_utils.js";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
5
+ import { Context, XRSessionMode } from "../engine/engine_setup.js";
6
+ import { ICamera } from "../engine/engine_types.js"
7
+ import { showBalloonMessage } from "../engine/debug/index.js";
8
+ import { getWorldPosition, Graphics } from "../engine/engine_three_utils.js";
9
+ import { Gizmos } from "../engine/engine_gizmos.js";
10
10
 
11
11
  import { EquirectangularReflectionMapping, OrthographicCamera, PerspectiveCamera, Ray, SRGBColorSpace, sRGBEncoding, Vector3 } from "three";
12
- import { OrbitControls } from "./OrbitControls";
13
- import { RenderTexture } from "../engine/engine_texture";
12
+ import { OrbitControls } from "./OrbitControls.js";
13
+ import { RenderTexture } from "../engine/engine_texture.js";
14
14
 
15
15
  export enum ClearFlags {
16
16
  Skybox = 1,
src/engine-components/CameraUtils.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { OrbitControls } from "./OrbitControls";
2
- import { addNewComponent, getOrAddComponent } from "../engine/engine_components";
1
+ import { OrbitControls } from "./OrbitControls.js";
2
+ import { addNewComponent, getOrAddComponent } from "../engine/engine_components.js";
3
3
  import { Object3D } from "three";
4
- import { ICamera } from "../engine/engine_types";
5
- import { RGBAColor } from "./js-extensions/RGBAColor";
6
- import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry";
7
- import { getCameraController } from "../engine/engine_camera";
8
- import { Camera } from "./Camera";
9
- import { NeedleEngineHTMLElement } from "../engine/engine_element";
10
- import { getParam } from "../engine/engine_utils";
4
+ import { ICamera } from "../engine/engine_types.js";
5
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
6
+ import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry.js";
7
+ import { getCameraController } from "../engine/engine_camera.js";
8
+ import { Camera } from "./Camera.js";
9
+ import { NeedleEngineHTMLElement } from "../engine/engine_element.js";
10
+ import { getParam } from "../engine/engine_utils.js";
11
11
 
12
12
  const debug = getParam("debugmissingcamera");
13
13
 
src/engine-components/ui/Canvas.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { onChange, updateRenderSettings as updateRenderSettingsRecursive } from "./Utils";
2
- import { serializable } from "../../engine/engine_serialization_decorator";
3
- import { FrameEvent } from "../../engine/engine_setup";
4
- import { BaseUIComponent, UIRootComponent } from "./BaseUIComponent";
5
- import { GameObject } from "../Component";
1
+ import { onChange, updateRenderSettings as updateRenderSettingsRecursive } from "./Utils.js";
2
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
3
+ import { FrameEvent } from "../../engine/engine_setup.js";
4
+ import { BaseUIComponent, UIRootComponent } from "./BaseUIComponent.js";
5
+ import { GameObject } from "../Component.js";
6
6
  import { Matrix4, Object3D } from "three";
7
- import { RectTransform } from "./RectTransform";
8
- import { ICanvas, ILayoutGroup, IRectTransform } from "./Interfaces";
9
- import { Camera } from "../Camera";
10
- import { EventSystem } from "./EventSystem";
7
+ import { RectTransform } from "./RectTransform.js";
8
+ import { ICanvas, ILayoutGroup, IRectTransform } from "./Interfaces.js";
9
+ import { Camera } from "../Camera.js";
10
+ import { EventSystem } from "./EventSystem.js";
11
11
  import * as ThreeMeshUI from 'three-mesh-ui'
12
- import { getParam } from "../../engine/engine_utils";
13
- import { LayoutGroup } from "./Layout";
14
- import { Mathf } from "../../engine/engine_math";
12
+ import { getParam } from "../../engine/engine_utils.js";
13
+ import { LayoutGroup } from "./Layout.js";
14
+ import { Mathf } from "../../engine/engine_math.js";
15
15
 
16
16
  export enum RenderMode {
17
17
  ScreenSpaceOverlay = 0,
src/engine-components/ui/CanvasGroup.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Graphic } from "./Graphic";
2
- import { FrameEvent } from "../../engine/engine_setup";
3
- import { Behaviour, GameObject } from "../Component";
4
- import { ICanvasGroup, IHasAlphaFactor } from "./Interfaces";
5
- import { serializable } from "../../engine/engine_serialization_decorator";
6
- import { BaseUIComponent } from "./BaseUIComponent";
1
+ import { Graphic } from "./Graphic.js";
2
+ import { FrameEvent } from "../../engine/engine_setup.js";
3
+ import { Behaviour, GameObject } from "../Component.js";
4
+ import { ICanvasGroup, IHasAlphaFactor } from "./Interfaces.js";
5
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
6
+ import { BaseUIComponent } from "./BaseUIComponent.js";
7
7
 
8
8
 
9
9
  export class CanvasGroup extends Behaviour implements ICanvasGroup {
src/engine-components/CharacterController.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Quaternion, Ray, Vector3 } from "three";
2
- import { Mathf } from "../engine/engine_math";
3
- import { serializable } from "../engine/engine_serialization";
4
- import { Collision } from "../engine/engine_types";
5
- import { CapsuleCollider } from "./Collider";
6
- import { Behaviour, GameObject } from "./Component";
7
- import { Rigidbody } from "./RigidBody";
8
- import { Animator } from "./Animator"
9
- import { RaycastOptions } from "../engine/engine_physics";
10
- import { getWorldPosition } from "../engine/engine_three_utils";
2
+ import { Mathf } from "../engine/engine_math.js";
3
+ import { serializable } from "../engine/engine_serialization.js";
4
+ import { Collision } from "../engine/engine_types.js";
5
+ import { CapsuleCollider } from "./Collider.js";
6
+ import { Behaviour, GameObject } from "./Component.js";
7
+ import { Rigidbody } from "./RigidBody.js";
8
+ import { Animator } from "./Animator.js"
9
+ import { RaycastOptions } from "../engine/engine_physics.js";
10
+ import { getWorldPosition } from "../engine/engine_three_utils.js";
11
11
 
12
12
  export class CharacterController extends Behaviour {
13
13
 
src/engine-components/postprocessing/Effects/ChromaticAberration.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ChromaticAberrationEffect } from "postprocessing";
2
2
  import { Vector2 } from "three";
3
- import { serializable } from "../../../engine/engine_serialization";
4
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
5
- import { VolumeParameter } from "../VolumeParameter";
6
- import { registerCustomEffectType, VolumeProfile } from "../VolumeProfile";
3
+ import { serializable } from "../../../engine/engine_serialization.js";
4
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
5
+ import { VolumeParameter } from "../VolumeParameter.js";
6
+ import { registerCustomEffectType, VolumeProfile } from "../VolumeProfile.js";
7
7
 
8
8
  export class ChromaticAberration extends PostProcessingEffect {
9
9
 
src/engine-components/Collider.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour } from "./Component";
2
- import { Rigidbody } from "./RigidBody";
3
- import { serializable } from "../engine/engine_serialization_decorator";
1
+ import { Behaviour } from "./Component.js";
2
+ import { Rigidbody } from "./RigidBody.js";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
4
  import { Event, Group, Mesh, Object3D, Vector3 } from "three"
5
- // import { IColliderProvider, registerColliderProvider } from "../engine/engine_physics";
6
- import { ICollider } from "../engine/engine_types";
7
- import { getWorldScale } from "../engine/engine_three_utils";
8
- import { PhysicsMaterial } from "../engine/engine_physics.types";
5
+ // import { IColliderProvider, registerColliderProvider } from "../engine/engine_physics.js";
6
+ import { ICollider } from "../engine/engine_types.js";
7
+ import { getWorldScale } from "../engine/engine_three_utils.js";
8
+ import { PhysicsMaterial } from "../engine/engine_physics.types.js";
9
9
 
10
10
 
11
11
  export class Collider extends Behaviour implements ICollider {
src/engine-components/postprocessing/Effects/ColorAdjustments.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BrightnessContrastEffect, HueSaturationEffect } from "postprocessing";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { registerCustomEffectType } from "../VolumeProfile";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { registerCustomEffectType } from "../VolumeProfile.js";
6
6
  import { CustomToneMapping, LinearToneMapping, NoToneMapping } from "three";
7
7
 
8
8
 
src/engine-components/Component.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { Mathf } from "../engine/engine_math";
2
- import * as threeutils from "../engine/engine_three_utils";
3
- import { activeInHierarchyFieldName } from "../engine/engine_constants";
4
- import { Context, FrameEvent } from "../engine/engine_setup";
5
- import * as main from "../engine/engine_mainloop_utils";
6
- import { syncDestroy, syncInstantiate } from "../engine/engine_networking_instantiate";
7
- import { ConstructorConcrete, SourceIdentifier, IComponent, IGameObject, Constructor, GuidsMap, Collision, ICollider } from "../engine/engine_types";
8
- import { addNewComponent, destroyComponentInstance, findObjectOfType, findObjectsOfType, getComponent, getComponentInChildren, getComponentInParent, getComponents, getComponentsInChildren, getComponentsInParent, getOrAddComponent, moveComponentInstance, removeComponent } from "../engine/engine_components";
9
- import { findByGuid, destroy, InstantiateOptions, instantiate, HideFlags, foreachComponent, markAsInstancedRendered, isActiveInHierarchy, isActiveSelf, isUsingInstancing, setActive, isDestroyed } from "../engine/engine_gameobject";
1
+ import { Mathf } from "../engine/engine_math.js";
2
+ import * as threeutils from "../engine/engine_three_utils.js";
3
+ import { activeInHierarchyFieldName } from "../engine/engine_constants.js";
4
+ import { Context, FrameEvent } from "../engine/engine_setup.js";
5
+ import * as main from "../engine/engine_mainloop_utils.js";
6
+ import { syncDestroy, syncInstantiate } from "../engine/engine_networking_instantiate.js";
7
+ import { ConstructorConcrete, SourceIdentifier, IComponent, IGameObject, Constructor, GuidsMap, Collision, ICollider } from "../engine/engine_types.js";
8
+ import { addNewComponent, destroyComponentInstance, findObjectOfType, findObjectsOfType, getComponent, getComponentInChildren, getComponentInParent, getComponents, getComponentsInChildren, getComponentsInParent, getOrAddComponent, moveComponentInstance, removeComponent } from "../engine/engine_components.js";
9
+ import { findByGuid, destroy, InstantiateOptions, instantiate, HideFlags, foreachComponent, markAsInstancedRendered, isActiveInHierarchy, isActiveSelf, isUsingInstancing, setActive, isDestroyed } from "../engine/engine_gameobject.js";
10
10
 
11
11
  import { Euler, Object3D, Quaternion, Scene, Vector3 } from "three";
12
- import { showBalloonWarning, isDevEnvironment } from "../engine/debug";
12
+ import { showBalloonWarning, isDevEnvironment } from "../engine/debug/index.js";
13
13
 
14
14
  // export interface ISerializationCallbackReceiver {
15
15
  // onBeforeSerialize?(): object | void;
src/engine-components/codegen/components.ts CHANGED
@@ -1,214 +1,214 @@
1
1
  // Export types
2
2
  export class __Ignore {}
3
- export { ActionBuilder } from "../export/usdz/extensions/behavior/BehavioursBuilder";
4
- export { ActionCollection } from "../export/usdz/extensions/behavior/Actions";
5
- export { ActionModel } from "../export/usdz/extensions/behavior/BehavioursBuilder";
6
- export { AlignmentConstraint } from "../AlignmentConstraint";
7
- export { Animation } from "../Animation";
8
- export { AnimationCurve } from "../AnimationCurve";
9
- export { AnimationExtension } from "../export/usdz/extensions/Animation";
10
- export { AnimationTrackHandler } from "../timeline/TimelineTracks";
11
- export { Animator } from "../Animator";
12
- export { AnimatorController } from "../AnimatorController";
13
- export { Antialiasing } from "../postprocessing/Effects/Antialiasing";
14
- export { AttachedObject } from "../webxr/WebXRController";
15
- export { AudioExtension } from "../export/usdz/extensions/behavior/AudioExtension";
16
- export { AudioListener } from "../AudioListener";
17
- export { AudioSource } from "../AudioSource";
18
- export { AudioTrackHandler } from "../timeline/TimelineTracks";
19
- export { Avatar_Brain_LookAt } from "../avatar/Avatar_Brain_LookAt";
20
- export { Avatar_MouthShapes } from "../avatar/Avatar_MouthShapes";
21
- export { Avatar_MustacheShake } from "../avatar/Avatar_MustacheShake";
22
- export { Avatar_POI } from "../avatar/Avatar_Brain_LookAt";
23
- export { AvatarBlink_Simple } from "../avatar/AvatarBlink_Simple";
24
- export { AvatarEyeLook_Rotation } from "../avatar/AvatarEyeLook_Rotation";
25
- export { AvatarLoader } from "../AvatarLoader";
26
- export { AvatarMarker } from "../webxr/WebXRAvatar";
27
- export { AvatarModel } from "../AvatarLoader";
28
- export { AxesHelper } from "../AxesHelper";
29
- export { BaseUIComponent } from "../ui/BaseUIComponent";
30
- export { BasicIKConstraint } from "../BasicIKConstraint";
31
- export { BehaviorExtension } from "../export/usdz/extensions/behavior/Behaviour";
32
- export { BehaviorModel } from "../export/usdz/extensions/behavior/BehavioursBuilder";
33
- export { Behaviour } from "../Component";
34
- export { Bloom } from "../postprocessing/Effects/Bloom";
35
- export { BoxCollider } from "../Collider";
36
- export { BoxGizmo } from "../Gizmos";
37
- export { BoxHelperComponent } from "../BoxHelperComponent";
38
- export { Button } from "../ui/Button";
39
- export { CallInfo } from "../EventList";
40
- export { Camera } from "../Camera";
41
- export { Canvas } from "../ui/Canvas";
42
- export { CanvasGroup } from "../ui/CanvasGroup";
43
- export { CapsuleCollider } from "../Collider";
44
- export { ChangeMaterialOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
45
- export { ChangeTransformOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
46
- export { CharacterController } from "../CharacterController";
47
- export { CharacterControllerInput } from "../CharacterController";
48
- export { ChromaticAberration } from "../postprocessing/Effects/ChromaticAberration";
49
- export { Collider } from "../Collider";
50
- export { ColorAdjustments } from "../postprocessing/Effects/ColorAdjustments";
51
- export { ColorBySpeedModule } from "../ParticleSystemModules";
52
- export { ColorOverLifetimeModule } from "../ParticleSystemModules";
53
- export { Component } from "../Component";
54
- export { ControlTrackHandler } from "../timeline/TimelineTracks";
55
- export { CustomBranding } from "../export/usdz/USDZExporter";
56
- export { Deletable } from "../DeleteBox";
57
- export { DeleteBox } from "../DeleteBox";
58
- export { DepthOfField } from "../postprocessing/Effects/DepthOfField";
59
- export { DeviceFlag } from "../DeviceFlag";
60
- export { DocumentExtension } from "../export/usdz/extensions/DocumentExtension";
61
- export { DragControls } from "../DragControls";
62
- export { DropListener } from "../DropListener";
63
- export { Duplicatable } from "../Duplicatable";
64
- export { EmissionModule } from "../ParticleSystemModules";
65
- export { EmphasizeOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
66
- export { EventList } from "../EventList";
67
- export { EventListEvent } from "../EventList";
68
- export { EventSystem } from "../ui/EventSystem";
69
- export { EventTrigger } from "../EventTrigger";
70
- export { FieldWithDefault } from "../Renderer";
71
- export { FixedJoint } from "../Joints";
72
- export { FlyControls } from "../FlyControls";
73
- export { Fog } from "../Fog";
74
- export { GltfExport } from "../export/gltf/GltfExport";
75
- export { GltfExportBox } from "../export/gltf/GltfExport";
76
- export { Gradient } from "../ParticleSystemModules";
77
- export { Graphic } from "../ui/Graphic";
78
- export { GraphicRaycaster } from "../ui/Raycaster";
79
- export { GridHelper } from "../GridHelper";
80
- export { GridLayoutGroup } from "../ui/Layout";
81
- export { GroundProjectedEnv } from "../GroundProjection";
82
- export { GroupActionModel } from "../export/usdz/extensions/behavior/BehavioursBuilder";
83
- export { HideOnStart } from "../export/usdz/extensions/behavior/BehaviourComponents";
84
- export { HingeJoint } from "../Joints";
85
- export { HorizontalLayoutGroup } from "../ui/Layout";
86
- export { Image } from "../ui/Image";
87
- export { InheritVelocityModule } from "../ParticleSystemModules";
88
- export { InputField } from "../ui/InputField";
89
- export { Interactable } from "../Interactable";
90
- export { Light } from "../Light";
91
- export { LimitVelocityOverLifetimeModule } from "../ParticleSystemModules";
92
- export { LODGroup } from "../LODGroup";
93
- export { LODModel } from "../LODGroup";
94
- export { LogStats } from "../debug/LogStats";
95
- export { LookAt } from "../utils/LookAt";
96
- export { LookAtConstraint } from "../LookAtConstraint";
97
- export { MainModule } from "../ParticleSystemModules";
98
- export { MaskableGraphic } from "../ui/Graphic";
99
- export { MeshCollider } from "../Collider";
100
- export { MeshRenderer } from "../Renderer";
101
- export { MinMaxCurve } from "../ParticleSystemModules";
102
- export { MinMaxGradient } from "../ParticleSystemModules";
103
- export { NestedGltf } from "../NestedGltf";
104
- export { Networking } from "../Networking";
105
- export { NoiseModule } from "../ParticleSystemModules";
106
- export { ObjectRaycaster } from "../ui/Raycaster";
107
- export { OffsetConstraint } from "../OffsetConstraint";
108
- export { OpenURL } from "../utils/OpenURL";
109
- export { OrbitControls } from "../OrbitControls";
110
- export { Outline } from "../ui/Outline";
111
- export { Padding } from "../ui/Layout";
112
- export { ParticleBurst } from "../ParticleSystemModules";
113
- export { ParticleSubEmitter } from "../ParticleSystemSubEmitter";
114
- export { ParticleSystem } from "../ParticleSystem";
115
- export { ParticleSystemRenderer } from "../ParticleSystem";
116
- export { PixelationEffect } from "../postprocessing/Effects/Pixelation";
117
- export { PlayableDirector } from "../timeline/PlayableDirector";
118
- export { PlayAnimationOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
119
- export { PlayAudioOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
120
- export { PlayerColor } from "../PlayerColor";
121
- export { PointerEventData } from "../ui/PointerEvents";
122
- export { PostProcessingHandler } from "../postprocessing/PostProcessingHandler";
123
- export { PreliminaryAction } from "../export/usdz/extensions/behavior/BehaviourComponents";
124
- export { PreliminaryTrigger } from "../export/usdz/extensions/behavior/BehaviourComponents";
125
- export { RawImage } from "../ui/Image";
126
- export { Raycaster } from "../ui/Raycaster";
127
- export { Rect } from "../ui/RectTransform";
128
- export { RectTransform } from "../ui/RectTransform";
129
- export { ReflectionProbe } from "../ReflectionProbe";
130
- export { RegisteredAnimationInfo } from "../export/usdz/extensions/Animation";
131
- export { RemoteSkybox } from "../Skybox";
132
- export { Renderer } from "../Renderer";
133
- export { RendererLightmap } from "../RendererLightmap";
134
- export { RGBAColor } from "../js-extensions/RGBAColor";
135
- export { Rigidbody } from "../RigidBody";
136
- export { RotationBySpeedModule } from "../ParticleSystemModules";
137
- export { RotationOverLifetimeModule } from "../ParticleSystemModules";
138
- export { SceneSwitcher } from "../SceneSwitcher";
139
- export { ScreenCapture } from "../ScreenCapture";
140
- export { ScreenSpaceAmbientOcclusion } from "../postprocessing/Effects/ScreenspaceAmbientOcclusion";
141
- export { ScreenSpaceAmbientOcclusionN8 } from "../postprocessing/Effects/ScreenspaceAmbientOcclusionN8";
142
- export { SetActiveOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents";
143
- export { ShadowCatcher } from "../ShadowCatcher";
144
- export { ShapeModule } from "../ParticleSystemModules";
145
- export { SignalAsset } from "../timeline/SignalAsset";
146
- export { SignalReceiver } from "../timeline/SignalAsset";
147
- export { SignalReceiverEvent } from "../timeline/SignalAsset";
148
- export { SignalTrackHandler } from "../timeline/TimelineTracks";
149
- export { Size } from "../ui/RectTransform";
150
- export { SizeBySpeedModule } from "../ParticleSystemModules";
151
- export { SizeOverLifetimeModule } from "../ParticleSystemModules";
152
- export { SkinnedMeshRenderer } from "../Renderer";
153
- export { SmoothFollow } from "../SmoothFollow";
154
- export { SpatialHtml } from "../ui/SpatialHtml";
155
- export { SpatialTrigger } from "../SpatialTrigger";
156
- export { SpatialTriggerReceiver } from "../SpatialTrigger";
157
- export { SpectatorCamera } from "../SpectatorCamera";
158
- export { SphereCollider } from "../Collider";
159
- export { Sprite } from "../SpriteRenderer";
160
- export { SpriteData } from "../SpriteRenderer";
161
- export { SpriteRenderer } from "../SpriteRenderer";
162
- export { SpriteSheet } from "../SpriteRenderer";
163
- export { SubEmitterSystem } from "../ParticleSystem";
164
- export { SyncedCamera } from "../SyncedCamera";
165
- export { SyncedRoom } from "../SyncedRoom";
166
- export { SyncedTransform } from "../SyncedTransform";
167
- export { TapGestureTrigger } from "../export/usdz/extensions/behavior/BehaviourComponents";
168
- export { TeleportTarget } from "../webxr/WebXRController";
169
- export { TestRunner } from "../TestRunner";
170
- export { TestSimulateUserData } from "../TestRunner";
171
- export { Text } from "../ui/Text";
172
- export { TextBuilder } from "../export/usdz/extensions/USDZText";
173
- export { TextExtension } from "../export/usdz/extensions/USDZText";
174
- export { TextureSheetAnimationModule } from "../ParticleSystemModules";
175
- export { TiltShiftEffect } from "../postprocessing/Effects/TiltShiftEffect";
176
- export { ToneMapping } from "../postprocessing/Effects/Tonemapping";
177
- export { TrailModule } from "../ParticleSystemModules";
178
- export { TransformData } from "../export/usdz/extensions/Animation";
179
- export { TransformGizmo } from "../TransformGizmo";
180
- export { TriggerBuilder } from "../export/usdz/extensions/behavior/BehavioursBuilder";
181
- export { TriggerModel } from "../export/usdz/extensions/behavior/BehavioursBuilder";
182
- export { UIRaycastUtils } from "../ui/RaycastUtils";
183
- export { UIRootComponent } from "../ui/BaseUIComponent";
184
- export { UsageMarker } from "../Interactable";
185
- export { USDZExporter } from "../export/usdz/USDZExporter";
186
- export { USDZText } from "../export/usdz/extensions/USDZText";
187
- export { USDZUIExtension } from "../export/usdz/extensions/USDZUI";
188
- export { VariantAction } from "../export/usdz/extensions/behavior/Actions";
189
- export { VelocityOverLifetimeModule } from "../ParticleSystemModules";
190
- export { VerticalLayoutGroup } from "../ui/Layout";
191
- export { VideoPlayer } from "../VideoPlayer";
192
- export { Vignette } from "../postprocessing/Effects/Vignette";
193
- export { VisibilityAction } from "../export/usdz/extensions/behavior/BehaviourComponents";
194
- export { Voip } from "../Voip";
195
- export { Volume } from "../postprocessing/Volume";
196
- export { VolumeParameter } from "../postprocessing/VolumeParameter";
197
- export { VolumeProfile } from "../postprocessing/VolumeProfile";
198
- export { VRUserState } from "../webxr/WebXRSync";
199
- export { WebAR } from "../webxr/WebXR";
200
- export { WebARCameraBackground } from "../webxr/WebARCameraBackground";
201
- export { WebARSessionRoot } from "../webxr/WebARSessionRoot";
202
- export { WebXR } from "../webxr/WebXR";
203
- export { WebXRAvatar } from "../webxr/WebXRAvatar";
204
- export { WebXRController } from "../webxr/WebXRController";
205
- export { WebXRImageTracking } from "../webxr/WebXRImageTracking";
206
- export { WebXRImageTrackingModel } from "../webxr/WebXRImageTracking";
207
- export { WebXRPlaneTracking } from "../webxr/WebXRPlaneTracking";
208
- export { WebXRSync } from "../webxr/WebXRSync";
209
- export { WebXRTrackedImage } from "../webxr/WebXRImageTracking";
210
- export { XRFlag } from "../XRFlag";
211
- export { XRGrabModel } from "../webxr/WebXRGrabRendering";
212
- export { XRGrabRendering } from "../webxr/WebXRGrabRendering";
213
- export { XRRig } from "../webxr/WebXRRig";
214
- export { XRState } from "../XRFlag";
3
+ export { ActionBuilder } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
4
+ export { ActionCollection } from "../export/usdz/extensions/behavior/Actions.js";
5
+ export { ActionModel } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
6
+ export { AlignmentConstraint } from "../AlignmentConstraint.js";
7
+ export { Animation } from "../Animation.js";
8
+ export { AnimationCurve } from "../AnimationCurve.js";
9
+ export { AnimationExtension } from "../export/usdz/extensions/Animation.js";
10
+ export { AnimationTrackHandler } from "../timeline/TimelineTracks.js";
11
+ export { Animator } from "../Animator.js";
12
+ export { AnimatorController } from "../AnimatorController.js";
13
+ export { Antialiasing } from "../postprocessing/Effects/Antialiasing.js";
14
+ export { AttachedObject } from "../webxr/WebXRController.js";
15
+ export { AudioExtension } from "../export/usdz/extensions/behavior/AudioExtension.js";
16
+ export { AudioListener } from "../AudioListener.js";
17
+ export { AudioSource } from "../AudioSource.js";
18
+ export { AudioTrackHandler } from "../timeline/TimelineTracks.js";
19
+ export { Avatar_Brain_LookAt } from "../avatar/Avatar_Brain_LookAt.js";
20
+ export { Avatar_MouthShapes } from "../avatar/Avatar_MouthShapes.js";
21
+ export { Avatar_MustacheShake } from "../avatar/Avatar_MustacheShake.js";
22
+ export { Avatar_POI } from "../avatar/Avatar_Brain_LookAt.js";
23
+ export { AvatarBlink_Simple } from "../avatar/AvatarBlink_Simple.js";
24
+ export { AvatarEyeLook_Rotation } from "../avatar/AvatarEyeLook_Rotation.js";
25
+ export { AvatarLoader } from "../AvatarLoader.js";
26
+ export { AvatarMarker } from "../webxr/WebXRAvatar.js";
27
+ export { AvatarModel } from "../AvatarLoader.js";
28
+ export { AxesHelper } from "../AxesHelper.js";
29
+ export { BaseUIComponent } from "../ui/BaseUIComponent.js";
30
+ export { BasicIKConstraint } from "../BasicIKConstraint.js";
31
+ export { BehaviorExtension } from "../export/usdz/extensions/behavior/Behaviour.js";
32
+ export { BehaviorModel } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
33
+ export { Behaviour } from "../Component.js";
34
+ export { Bloom } from "../postprocessing/Effects/Bloom.js";
35
+ export { BoxCollider } from "../Collider.js";
36
+ export { BoxGizmo } from "../Gizmos.js";
37
+ export { BoxHelperComponent } from "../BoxHelperComponent.js";
38
+ export { Button } from "../ui/Button.js";
39
+ export { CallInfo } from "../EventList.js";
40
+ export { Camera } from "../Camera.js";
41
+ export { Canvas } from "../ui/Canvas.js";
42
+ export { CanvasGroup } from "../ui/CanvasGroup.js";
43
+ export { CapsuleCollider } from "../Collider.js";
44
+ export { ChangeMaterialOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
45
+ export { ChangeTransformOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
46
+ export { CharacterController } from "../CharacterController.js";
47
+ export { CharacterControllerInput } from "../CharacterController.js";
48
+ export { ChromaticAberration } from "../postprocessing/Effects/ChromaticAberration.js";
49
+ export { Collider } from "../Collider.js";
50
+ export { ColorAdjustments } from "../postprocessing/Effects/ColorAdjustments.js";
51
+ export { ColorBySpeedModule } from "../ParticleSystemModules.js";
52
+ export { ColorOverLifetimeModule } from "../ParticleSystemModules.js";
53
+ export { Component } from "../Component.js";
54
+ export { ControlTrackHandler } from "../timeline/TimelineTracks.js";
55
+ export { CustomBranding } from "../export/usdz/USDZExporter.js";
56
+ export { Deletable } from "../DeleteBox.js";
57
+ export { DeleteBox } from "../DeleteBox.js";
58
+ export { DepthOfField } from "../postprocessing/Effects/DepthOfField.js";
59
+ export { DeviceFlag } from "../DeviceFlag.js";
60
+ export { DocumentExtension } from "../export/usdz/extensions/DocumentExtension.js";
61
+ export { DragControls } from "../DragControls.js";
62
+ export { DropListener } from "../DropListener.js";
63
+ export { Duplicatable } from "../Duplicatable.js";
64
+ export { EmissionModule } from "../ParticleSystemModules.js";
65
+ export { EmphasizeOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
66
+ export { EventList } from "../EventList.js";
67
+ export { EventListEvent } from "../EventList.js";
68
+ export { EventSystem } from "../ui/EventSystem.js";
69
+ export { EventTrigger } from "../EventTrigger.js";
70
+ export { FieldWithDefault } from "../Renderer.js";
71
+ export { FixedJoint } from "../Joints.js";
72
+ export { FlyControls } from "../FlyControls.js";
73
+ export { Fog } from "../Fog.js";
74
+ export { GltfExport } from "../export/gltf/GltfExport.js";
75
+ export { GltfExportBox } from "../export/gltf/GltfExport.js";
76
+ export { Gradient } from "../ParticleSystemModules.js";
77
+ export { Graphic } from "../ui/Graphic.js";
78
+ export { GraphicRaycaster } from "../ui/Raycaster.js";
79
+ export { GridHelper } from "../GridHelper.js";
80
+ export { GridLayoutGroup } from "../ui/Layout.js";
81
+ export { GroundProjectedEnv } from "../GroundProjection.js";
82
+ export { GroupActionModel } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
83
+ export { HideOnStart } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
84
+ export { HingeJoint } from "../Joints.js";
85
+ export { HorizontalLayoutGroup } from "../ui/Layout.js";
86
+ export { Image } from "../ui/Image.js";
87
+ export { InheritVelocityModule } from "../ParticleSystemModules.js";
88
+ export { InputField } from "../ui/InputField.js";
89
+ export { Interactable } from "../Interactable.js";
90
+ export { Light } from "../Light.js";
91
+ export { LimitVelocityOverLifetimeModule } from "../ParticleSystemModules.js";
92
+ export { LODGroup } from "../LODGroup.js";
93
+ export { LODModel } from "../LODGroup.js";
94
+ export { LogStats } from "../debug/LogStats.js";
95
+ export { LookAt } from "../utils/LookAt.js";
96
+ export { LookAtConstraint } from "../LookAtConstraint.js";
97
+ export { MainModule } from "../ParticleSystemModules.js";
98
+ export { MaskableGraphic } from "../ui/Graphic.js";
99
+ export { MeshCollider } from "../Collider.js";
100
+ export { MeshRenderer } from "../Renderer.js";
101
+ export { MinMaxCurve } from "../ParticleSystemModules.js";
102
+ export { MinMaxGradient } from "../ParticleSystemModules.js";
103
+ export { NestedGltf } from "../NestedGltf.js";
104
+ export { Networking } from "../Networking.js";
105
+ export { NoiseModule } from "../ParticleSystemModules.js";
106
+ export { ObjectRaycaster } from "../ui/Raycaster.js";
107
+ export { OffsetConstraint } from "../OffsetConstraint.js";
108
+ export { OpenURL } from "../utils/OpenURL.js";
109
+ export { OrbitControls } from "../OrbitControls.js";
110
+ export { Outline } from "../ui/Outline.js";
111
+ export { Padding } from "../ui/Layout.js";
112
+ export { ParticleBurst } from "../ParticleSystemModules.js";
113
+ export { ParticleSubEmitter } from "../ParticleSystemSubEmitter.js";
114
+ export { ParticleSystem } from "../ParticleSystem.js";
115
+ export { ParticleSystemRenderer } from "../ParticleSystem.js";
116
+ export { PixelationEffect } from "../postprocessing/Effects/Pixelation.js";
117
+ export { PlayableDirector } from "../timeline/PlayableDirector.js";
118
+ export { PlayAnimationOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
119
+ export { PlayAudioOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
120
+ export { PlayerColor } from "../PlayerColor.js";
121
+ export { PointerEventData } from "../ui/PointerEvents.js";
122
+ export { PostProcessingHandler } from "../postprocessing/PostProcessingHandler.js";
123
+ export { PreliminaryAction } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
124
+ export { PreliminaryTrigger } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
125
+ export { RawImage } from "../ui/Image.js";
126
+ export { Raycaster } from "../ui/Raycaster.js";
127
+ export { Rect } from "../ui/RectTransform.js";
128
+ export { RectTransform } from "../ui/RectTransform.js";
129
+ export { ReflectionProbe } from "../ReflectionProbe.js";
130
+ export { RegisteredAnimationInfo } from "../export/usdz/extensions/Animation.js";
131
+ export { RemoteSkybox } from "../Skybox.js";
132
+ export { Renderer } from "../Renderer.js";
133
+ export { RendererLightmap } from "../RendererLightmap.js";
134
+ export { RGBAColor } from "../js-extensions/RGBAColor.js";
135
+ export { Rigidbody } from "../RigidBody.js";
136
+ export { RotationBySpeedModule } from "../ParticleSystemModules.js";
137
+ export { RotationOverLifetimeModule } from "../ParticleSystemModules.js";
138
+ export { SceneSwitcher } from "../SceneSwitcher.js";
139
+ export { ScreenCapture } from "../ScreenCapture.js";
140
+ export { ScreenSpaceAmbientOcclusion } from "../postprocessing/Effects/ScreenspaceAmbientOcclusion.js";
141
+ export { ScreenSpaceAmbientOcclusionN8 } from "../postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js";
142
+ export { SetActiveOnClick } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
143
+ export { ShadowCatcher } from "../ShadowCatcher.js";
144
+ export { ShapeModule } from "../ParticleSystemModules.js";
145
+ export { SignalAsset } from "../timeline/SignalAsset.js";
146
+ export { SignalReceiver } from "../timeline/SignalAsset.js";
147
+ export { SignalReceiverEvent } from "../timeline/SignalAsset.js";
148
+ export { SignalTrackHandler } from "../timeline/TimelineTracks.js";
149
+ export { Size } from "../ui/RectTransform.js";
150
+ export { SizeBySpeedModule } from "../ParticleSystemModules.js";
151
+ export { SizeOverLifetimeModule } from "../ParticleSystemModules.js";
152
+ export { SkinnedMeshRenderer } from "../Renderer.js";
153
+ export { SmoothFollow } from "../SmoothFollow.js";
154
+ export { SpatialHtml } from "../ui/SpatialHtml.js";
155
+ export { SpatialTrigger } from "../SpatialTrigger.js";
156
+ export { SpatialTriggerReceiver } from "../SpatialTrigger.js";
157
+ export { SpectatorCamera } from "../SpectatorCamera.js";
158
+ export { SphereCollider } from "../Collider.js";
159
+ export { Sprite } from "../SpriteRenderer.js";
160
+ export { SpriteData } from "../SpriteRenderer.js";
161
+ export { SpriteRenderer } from "../SpriteRenderer.js";
162
+ export { SpriteSheet } from "../SpriteRenderer.js";
163
+ export { SubEmitterSystem } from "../ParticleSystem.js";
164
+ export { SyncedCamera } from "../SyncedCamera.js";
165
+ export { SyncedRoom } from "../SyncedRoom.js";
166
+ export { SyncedTransform } from "../SyncedTransform.js";
167
+ export { TapGestureTrigger } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
168
+ export { TeleportTarget } from "../webxr/WebXRController.js";
169
+ export { TestRunner } from "../TestRunner.js";
170
+ export { TestSimulateUserData } from "../TestRunner.js";
171
+ export { Text } from "../ui/Text.js";
172
+ export { TextBuilder } from "../export/usdz/extensions/USDZText.js";
173
+ export { TextExtension } from "../export/usdz/extensions/USDZText.js";
174
+ export { TextureSheetAnimationModule } from "../ParticleSystemModules.js";
175
+ export { TiltShiftEffect } from "../postprocessing/Effects/TiltShiftEffect.js";
176
+ export { ToneMapping } from "../postprocessing/Effects/Tonemapping.js";
177
+ export { TrailModule } from "../ParticleSystemModules.js";
178
+ export { TransformData } from "../export/usdz/extensions/Animation.js";
179
+ export { TransformGizmo } from "../TransformGizmo.js";
180
+ export { TriggerBuilder } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
181
+ export { TriggerModel } from "../export/usdz/extensions/behavior/BehavioursBuilder.js";
182
+ export { UIRaycastUtils } from "../ui/RaycastUtils.js";
183
+ export { UIRootComponent } from "../ui/BaseUIComponent.js";
184
+ export { UsageMarker } from "../Interactable.js";
185
+ export { USDZExporter } from "../export/usdz/USDZExporter.js";
186
+ export { USDZText } from "../export/usdz/extensions/USDZText.js";
187
+ export { USDZUIExtension } from "../export/usdz/extensions/USDZUI.js";
188
+ export { VariantAction } from "../export/usdz/extensions/behavior/Actions.js";
189
+ export { VelocityOverLifetimeModule } from "../ParticleSystemModules.js";
190
+ export { VerticalLayoutGroup } from "../ui/Layout.js";
191
+ export { VideoPlayer } from "../VideoPlayer.js";
192
+ export { Vignette } from "../postprocessing/Effects/Vignette.js";
193
+ export { VisibilityAction } from "../export/usdz/extensions/behavior/BehaviourComponents.js";
194
+ export { Voip } from "../Voip.js";
195
+ export { Volume } from "../postprocessing/Volume.js";
196
+ export { VolumeParameter } from "../postprocessing/VolumeParameter.js";
197
+ export { VolumeProfile } from "../postprocessing/VolumeProfile.js";
198
+ export { VRUserState } from "../webxr/WebXRSync.js";
199
+ export { WebAR } from "../webxr/WebXR.js";
200
+ export { WebARCameraBackground } from "../webxr/WebARCameraBackground.js";
201
+ export { WebARSessionRoot } from "../webxr/WebARSessionRoot.js";
202
+ export { WebXR } from "../webxr/WebXR.js";
203
+ export { WebXRAvatar } from "../webxr/WebXRAvatar.js";
204
+ export { WebXRController } from "../webxr/WebXRController.js";
205
+ export { WebXRImageTracking } from "../webxr/WebXRImageTracking.js";
206
+ export { WebXRImageTrackingModel } from "../webxr/WebXRImageTracking.js";
207
+ export { WebXRPlaneTracking } from "../webxr/WebXRPlaneTracking.js";
208
+ export { WebXRSync } from "../webxr/WebXRSync.js";
209
+ export { WebXRTrackedImage } from "../webxr/WebXRImageTracking.js";
210
+ export { XRFlag } from "../XRFlag.js";
211
+ export { XRGrabModel } from "../webxr/WebXRGrabRendering.js";
212
+ export { XRGrabRendering } from "../webxr/WebXRGrabRendering.js";
213
+ export { XRRig } from "../webxr/WebXRRig.js";
214
+ export { XRState } from "../XRFlag.js";
src/engine/debug/debug_console.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { getErrorCount } from "./debug_overlay";
2
- import { getParam, isMobileDevice } from "../engine_utils";
3
- import { isLocalNetwork } from "../engine_networking_utils";
1
+ import { getErrorCount } from "./debug_overlay.js";
2
+ import { getParam, isMobileDevice } from "../engine_utils.js";
3
+ import { isLocalNetwork } from "../engine_networking_utils.js";
4
4
 
5
5
  let consoleInstance: any = null;
6
6
  let consoleHtmlElement: HTMLElement | null = null;
src/engine/debug/debug_overlay.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { getParam } from "../engine_utils";
2
- import { isLocalNetwork } from "../engine_networking_utils";
3
- import { ContextRegistry } from "../engine_context_registry";
1
+ import { getParam } from "../engine_utils.js";
2
+ import { isLocalNetwork } from "../engine_networking_utils.js";
3
+ import { ContextRegistry } from "../engine_context_registry.js";
4
4
 
5
5
 
6
6
 
src/engine/debug/debug.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { addLog, LogType, setAllowOverlayMessages } from "./debug_overlay";
2
- import { showDebugConsole } from "./debug_console";
3
- import { isLocalNetwork } from "../engine_networking_utils";
1
+ import { addLog, LogType, setAllowOverlayMessages } from "./debug_overlay.js";
2
+ import { showDebugConsole } from "./debug_console.js";
3
+ import { isLocalNetwork } from "../engine_networking_utils.js";
4
4
 
5
5
  export { showDebugConsole }
6
6
  export { LogType, setAllowOverlayMessages };
src/engine-components/DeleteBox.ts CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
2
  import * as THREE from "three";
3
- import { syncDestroy } from "../engine/engine_networking_instantiate";
4
- import { getParam } from "../engine/engine_utils";
5
- import { BoxHelperComponent } from "./BoxHelperComponent";
6
- import { Behaviour, GameObject } from "./Component";
7
- import { UsageMarker } from "./Interactable";
3
+ import { syncDestroy } from "../engine/engine_networking_instantiate.js";
4
+ import { getParam } from "../engine/engine_utils.js";
5
+ import { BoxHelperComponent } from "./BoxHelperComponent.js";
6
+ import { Behaviour, GameObject } from "./Component.js";
7
+ import { UsageMarker } from "./Interactable.js";
8
8
 
9
9
  const debug = getParam("debugdeletable");
10
10
 
src/engine-components/postprocessing/Effects/DepthOfField.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { DepthOfFieldEffect } from "postprocessing";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { Mathf } from "../../../engine/engine_math";
4
- import { PostProcessingEffect } from "../PostProcessingEffect";
5
- import { VolumeParameter } from "../VolumeParameter";
6
- import { registerCustomEffectType } from "../VolumeProfile";
7
- import { isMobileDevice } from "../../../engine/engine_utils";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { Mathf } from "../../../engine/engine_math.js";
4
+ import { PostProcessingEffect } from "../PostProcessingEffect.js";
5
+ import { VolumeParameter } from "../VolumeParameter.js";
6
+ import { registerCustomEffectType } from "../VolumeProfile.js";
7
+ import { isMobileDevice } from "../../../engine/engine_utils.js";
8
8
 
9
9
  export enum DepthOfFieldMode {
10
10
  Off = 0,
src/engine-components/DeviceFlag.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { serializable } from "../engine/engine_serialization_decorator";
2
- import { Behaviour, GameObject } from "./Component";
1
+ import { serializable } from "../engine/engine_serialization_decorator.js";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
3
 
4
4
 
5
5
  export enum DeviceType {
src/engine-components/export/usdz/extensions/DocumentExtension.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IUSDExporterExtension } from "../Extension";
1
+ import { IUSDExporterExtension } from "../Extension.js";
2
2
 
3
3
  export class DocumentExtension implements IUSDExporterExtension {
4
4
 
src/engine-components/DragControls.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { GameObject } from "./Component";
2
- import { SyncedTransform } from "./SyncedTransform";
3
- import { IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler, IPointerUpHandler, PointerEventData } from "./ui/PointerEvents";
4
- import { Context } from "../engine/engine_setup";
5
- import { Interactable, UsageMarker } from "./Interactable";
6
- import { Rigidbody } from "./RigidBody";
7
- import { WebXR } from "./webxr/WebXR";
8
- import { Avatar_POI } from "./avatar/Avatar_Brain_LookAt";
9
- import { RaycastOptions } from "../engine/engine_physics";
10
- import { getWorldPosition, setWorldPosition } from "../engine/engine_three_utils";
11
- import { KeyCode } from "../engine/engine_input";
12
- import { nameofFactory } from "../engine/engine_utils";
13
- import { InstancingUtil } from "../engine/engine_instancing";
14
- import { OrbitControls } from "./OrbitControls";
1
+ import { GameObject } from "./Component.js";
2
+ import { SyncedTransform } from "./SyncedTransform.js";
3
+ import { IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler, IPointerUpHandler, PointerEventData } from "./ui/PointerEvents.js";
4
+ import { Context } from "../engine/engine_setup.js";
5
+ import { Interactable, UsageMarker } from "./Interactable.js";
6
+ import { Rigidbody } from "./RigidBody.js";
7
+ import { WebXR } from "./webxr/WebXR.js";
8
+ import { Avatar_POI } from "./avatar/Avatar_Brain_LookAt.js";
9
+ import { RaycastOptions } from "../engine/engine_physics.js";
10
+ import { getWorldPosition, setWorldPosition } from "../engine/engine_three_utils.js";
11
+ import { KeyCode } from "../engine/engine_input.js";
12
+ import { nameofFactory } from "../engine/engine_utils.js";
13
+ import { InstancingUtil } from "../engine/engine_instancing.js";
14
+ import { OrbitControls } from "./OrbitControls.js";
15
15
  import { BufferGeometry, Camera, Color, Line, LineBasicMaterial, Matrix4, Mesh, MeshBasicMaterial, Object3D, Plane, Ray, Raycaster, SphereGeometry, Vector2, Vector3 } from "three";
16
- import { ObjectRaycaster } from "./ui/Raycaster";
17
- import { serializable } from "../engine/engine_serialization_decorator";
16
+ import { ObjectRaycaster } from "./ui/Raycaster.js";
17
+ import { serializable } from "../engine/engine_serialization_decorator.js";
18
18
 
19
19
  const debug = false;
20
20
 
src/engine-components/DropListener.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { RaycastOptions } from "../engine/engine_physics";
3
- import * as files from "../engine/engine_networking_files";
4
- import { serializable } from "../engine/engine_serialization_decorator";
5
- import { Networking } from "../engine-components/Networking";
6
- import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
7
- import { getParam } from "../engine/engine_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { RaycastOptions } from "../engine/engine_physics.js";
3
+ import * as files from "../engine/engine_networking_files.js";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
+ import { Networking } from "../engine-components/Networking.js";
6
+ import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
7
+ import { getParam } from "../engine/engine_utils.js";
8
8
 
9
9
  const debug = getParam("debugdroplistener");
10
10
 
src/engine-components/Duplicatable.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { WebXRController, ControllerEvents } from "./webxr/WebXRController";
3
- import { DragControls, DragEvents } from "./DragControls";
4
- import { Interactable } from "./Interactable";
5
- import { Animation } from "./Animation";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { WebXRController, ControllerEvents } from "./webxr/WebXRController.js";
3
+ import { DragControls, DragEvents } from "./DragControls.js";
4
+ import { Interactable } from "./Interactable.js";
5
+ import { Animation } from "./Animation.js";
6
6
  import { Vector3, Quaternion, Object3D } from "three";
7
- import { serializable } from "../engine/engine_serialization_decorator";
8
- import { InstantiateOptions } from "../engine/engine_gameobject";
7
+ import { serializable } from "../engine/engine_serialization_decorator.js";
8
+ import { InstantiateOptions } from "../engine/engine_gameobject.js";
9
9
 
10
10
  export class Duplicatable extends Interactable {
11
11
 
src/engine/engine_addressables.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { getParam, resolveUrl } from "../engine/engine_utils";
2
- import { SerializationContext, TypeSerializer } from "./engine_serialization_core";
3
- import { Context } from "./engine_setup";
1
+ import { getParam, resolveUrl } from "../engine/engine_utils.js";
2
+ import { SerializationContext, TypeSerializer } from "./engine_serialization_core.js";
3
+ import { Context } from "./engine_setup.js";
4
4
  import { Group, Object3D, Texture, TextureLoader } from "three";
5
- import { processNewScripts } from "./engine_mainloop_utils";
6
- import { registerPrefabProvider, syncInstantiate } from "./engine_networking_instantiate";
7
- import { download } from "./engine_web_api";
8
- import { getLoader } from "./engine_gltf";
9
- import { SourceIdentifier } from "./engine_types";
10
- import { destroy, instantiate, InstantiateOptions, isDestroyed } from "./engine_gameobject";
11
- import { IGameObject } from "./engine_types";
5
+ import { processNewScripts } from "./engine_mainloop_utils.js";
6
+ import { registerPrefabProvider, syncInstantiate } from "./engine_networking_instantiate.js";
7
+ import { download } from "./engine_web_api.js";
8
+ import { getLoader } from "./engine_gltf.js";
9
+ import { SourceIdentifier } from "./engine_types.js";
10
+ import { destroy, instantiate, InstantiateOptions, isDestroyed } from "./engine_gameobject.js";
11
+ import { IGameObject } from "./engine_types.js";
12
12
 
13
13
  const debug = getParam("debugaddressables");
14
14
 
src/engine/engine_application.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "./engine_setup";
1
+ import { Context } from "./engine_setup.js";
2
2
 
3
3
  export enum ApplicationEvents {
4
4
  Visible = "application-visible",
src/engine/engine_assetdatabase.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { InternalUsageTrackerPlugin } from "./extensions/usage_tracker";
1
+ import { InternalUsageTrackerPlugin } from "./extensions/usage_tracker.js";
2
2
  import { Bone, BufferAttribute, BufferGeometry, InterleavedBuffer, InterleavedBufferAttribute, Material, Mesh, NeverCompare, Object3D, Scene, Skeleton, SkinnedMesh, Source, Texture, Uniform, WebGLRenderer } from "three";
3
- import { addPatch } from "./engine_patcher";
4
- import { getParam } from "./engine_utils";
3
+ import { addPatch } from "./engine_patcher.js";
4
+ import { getParam } from "./engine_utils.js";
5
5
 
6
6
 
7
7
  export class AssetDatabase {
src/engine/engine_camera.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICameraController } from "./engine_types";
1
+ import { ICameraController } from "./engine_types.js";
2
2
  import { Camera } from "three";
3
3
 
4
4
 
src/engine/engine_components_internal.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { IComponent } from "./engine_types";
2
- import { getParam } from "./engine_utils";
1
+ import { IComponent } from "./engine_types.js";
2
+ import { getParam } from "./engine_utils.js";
3
3
 
4
4
  export enum ComponentEvents {
5
5
  Added = "component-added",
src/engine/engine_components.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Object3D, Scene } from "three";
2
- import { Constructor, ConstructorConcrete, IComponent as Component, IComponent, IGameObject } from "./engine_types";
3
- import { Context, registerComponent } from "./engine_setup";
4
- import { getParam } from "./engine_utils";
5
- import { removeScriptFromContext, updateActiveInHierarchyWithoutEventCall } from "./engine_mainloop_utils";
6
- import { activeInHierarchyFieldName } from "./engine_constants";
7
- import { apply } from "../engine-components/js-extensions/Object3D";
8
- import { InstantiateIdProvider } from "./engine_networking_instantiate";
9
- import { ComponentEvents, ComponentLifecycleEvents } from "./engine_components_internal";
2
+ import { Constructor, ConstructorConcrete, IComponent as Component, IComponent, IGameObject } from "./engine_types.js";
3
+ import { Context, registerComponent } from "./engine_setup.js";
4
+ import { getParam } from "./engine_utils.js";
5
+ import { removeScriptFromContext, updateActiveInHierarchyWithoutEventCall } from "./engine_mainloop_utils.js";
6
+ import { activeInHierarchyFieldName } from "./engine_constants.js";
7
+ import { apply } from "../engine-components/js-extensions/Object3D.js";
8
+ import { InstantiateIdProvider } from "./engine_networking_instantiate.js";
9
+ import { ComponentEvents, ComponentLifecycleEvents } from "./engine_components_internal.js";
10
10
 
11
11
  const debug = getParam("debuggetcomponent");
12
12
 
src/engine/engine_constants.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getParam } from "../engine/engine_utils";
1
+ import { getParam } from "../engine/engine_utils.js";
2
2
  const debug = getParam("debugdefines");
3
3
 
4
4
  // We jump through hoops like this to support 3 cases:
src/engine/engine_context_registry.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IComponent, IContext, LoadedGLTF } from "./engine_types";
1
+ import { IComponent, IContext, LoadedGLTF } from "./engine_types.js";
2
2
 
3
3
  export enum ContextEvent {
4
4
  /** called when the context is registered to the registry, the context is not fully initialized at this point */
src/engine/engine_context.ts CHANGED
@@ -4,33 +4,33 @@
4
4
  PerspectiveCamera, RGBAFormat, Scene, SRGBColorSpace,
5
5
  Texture, WebGLRenderer, WebGLRendererParameters, WebGLRenderTarget, WebXRArrayCamera
6
6
  } from 'three'
7
- import { Input } from './engine_input';
8
- import { Physics } from './engine_physics';
9
- import { Time } from './engine_time';
10
- import { NetworkConnection } from './engine_networking';
7
+ import { Input } from './engine_input.js';
8
+ import { Physics } from './engine_physics.js';
9
+ import { Time } from './engine_time.js';
10
+ import { NetworkConnection } from './engine_networking.js';
11
11
 
12
- import * as looputils from './engine_mainloop_utils';
13
- import * as utils from "./engine_utils";
12
+ import * as looputils from './engine_mainloop_utils.js';
13
+ import * as utils from "./engine_utils.js";
14
14
 
15
15
  import { EffectComposer, RenderPass } from "postprocessing";
16
16
 
17
- import { AssetDatabase } from './engine_assetdatabase';
17
+ import { AssetDatabase } from './engine_assetdatabase.js';
18
18
 
19
- import { logHierarchy } from './engine_three_utils';
19
+ import { logHierarchy } from './engine_three_utils.js';
20
20
 
21
- import * as Stats from 'three/examples/jsm/libs/stats.module';
22
- import { RendererData as SceneLighting } from './engine_scenelighting';
23
- import { Addressables } from './engine_addressables';
24
- import { Application } from './engine_application';
25
- import { LightDataRegistry, ILightDataRegistry } from './engine_lightdata';
26
- import { PlayerViewManager } from './engine_playerview';
21
+ import * as Stats from 'three/examples/jsm/libs/stats.module.js';
22
+ import { RendererData as SceneLighting } from './engine_scenelighting.js';
23
+ import { Addressables } from './engine_addressables.js';
24
+ import { Application } from './engine_application.js';
25
+ import { LightDataRegistry, ILightDataRegistry } from './engine_lightdata.js';
26
+ import { PlayerViewManager } from './engine_playerview.js';
27
27
 
28
- import { CoroutineData, GLTF, ICamera, IComponent, IContext, ILight } from "./engine_types"
29
- import { destroy, foreachComponent } from './engine_gameobject';
30
- import { ContextEvent, ContextRegistry } from './engine_context_registry';
31
- import { delay, getParam } from './engine_utils';
32
- import { VERSION } from './engine_constants';
33
- import { isDevEnvironment, LogType, showBalloonMessage } from './debug';
28
+ import { CoroutineData, GLTF, ICamera, IComponent, IContext, ILight } from "./engine_types.js"
29
+ import { destroy, foreachComponent } from './engine_gameobject.js';
30
+ import { ContextEvent, ContextRegistry } from './engine_context_registry.js';
31
+ import { delay, getParam } from './engine_utils.js';
32
+ import { VERSION } from './engine_constants.js';
33
+ import { isDevEnvironment, LogType, showBalloonMessage } from './debug/index.js';
34
34
 
35
35
 
36
36
  const debug = utils.getParam("debugcontext");
src/engine/engine_coroutine.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "./engine_setup";
1
+ import { Context } from "./engine_setup.js";
2
2
 
3
3
 
4
4
  export function* WaitForSeconds(seconds: number, context: Context | null = null) {
src/engine/engine_default_parameters.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getParam } from "./engine_utils";
1
+ import { getParam } from "./engine_utils.js";
2
2
 
3
3
  export const showGizmos = getParam("gizmos");
4
4
  export const debugExtension = getParam("debugextension");
src/engine/engine_element_extras.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * Use the addAttributeChangeCallback utility methods to register callback events
11
11
  */
12
12
  export async function registerObservableAttribute(name: string) {
13
- const { NeedleEngineHTMLElement } = await import("./engine_element");
13
+ const { NeedleEngineHTMLElement } = await import("./engine_element.js");
14
14
  if (!NeedleEngineHTMLElement.observedAttributes.includes(name))
15
15
  NeedleEngineHTMLElement.observedAttributes.push(name);
16
16
  }
src/engine/engine_element_loading.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { showBalloonWarning } from "./debug";
2
- import { Mathf } from "./engine_math";
3
- import { LoadingProgressArgs } from "./engine_setup";
4
- import { getParam } from "./engine_utils";
5
- import { logoSVG } from "./assets"
6
- import { hasCommercialLicense, hasProLicense, runtimeLicenseCheckPromise } from "./engine_license";
1
+ import { showBalloonWarning } from "./debug/index.js";
2
+ import { Mathf } from "./engine_math.js";
3
+ import { LoadingProgressArgs } from "./engine_setup.js";
4
+ import { getParam } from "./engine_utils.js";
5
+ import { logoSVG } from "./assets/index.js"
6
+ import { hasCommercialLicense, hasProLicense, runtimeLicenseCheckPromise } from "./engine_license.js";
7
7
 
8
8
  const debug = getParam("debugloading");
9
9
  const debugRendering = getParam("debugloadingrendering");
src/engine/engine_element_overlay.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Context } from "./engine_setup";
2
- import { getParam, isMobileDevice, isMozillaXR } from "./engine_utils";
1
+ import { Context } from "./engine_setup.js";
2
+ import { getParam, isMobileDevice, isMozillaXR } from "./engine_utils.js";
3
3
 
4
4
  const debug = getParam("debugoverlay");
5
5
  export const arContainerClassName = "ar";
src/engine/engine_element.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { Context, LoadingProgressArgs } from "./engine_setup";
2
- import { AROverlayHandler, arContainerClassName } from "./engine_element_overlay";
3
- import { GameObject } from "../engine-components/Component";
4
- import { calculateProgress01, EngineLoadingView, ILoadingViewHandler } from "./engine_element_loading";
5
- import { getParam } from "./engine_utils";
6
- import { setDracoDecoderPath, setDracoDecoderType, setKtx2TranscoderPath } from "./engine_loaders";
7
- import { getLoader, registerLoader } from "../engine/engine_gltf";
8
- import { NeedleGltfLoader } from "./engine_scenetools";
9
- import { GLTF, INeedleEngineComponent, LoadedGLTF } from "./engine_types";
10
- import { isLocalNetwork } from "./engine_networking_utils";
11
- import { isDevEnvironment, showBalloonWarning } from "./debug";
12
- import { destroy } from "./engine_gameobject";
13
- import { hasCommercialLicense } from "./engine_license";
1
+ import { Context, LoadingProgressArgs } from "./engine_setup.js";
2
+ import { AROverlayHandler, arContainerClassName } from "./engine_element_overlay.js";
3
+ import { GameObject } from "../engine-components/Component.js";
4
+ import { calculateProgress01, EngineLoadingView, ILoadingViewHandler } from "./engine_element_loading.js";
5
+ import { getParam } from "./engine_utils.js";
6
+ import { setDracoDecoderPath, setDracoDecoderType, setKtx2TranscoderPath } from "./engine_loaders.js";
7
+ import { getLoader, registerLoader } from "../engine/engine_gltf.js";
8
+ import { NeedleGltfLoader } from "./engine_scenetools.js";
9
+ import { GLTF, INeedleEngineComponent, LoadedGLTF } from "./engine_types.js";
10
+ import { isLocalNetwork } from "./engine_networking_utils.js";
11
+ import { isDevEnvironment, showBalloonWarning } from "./debug/index.js";
12
+ import { destroy } from "./engine_gameobject.js";
13
+ import { hasCommercialLicense } from "./engine_license.js";
14
14
 
15
15
  //
16
16
  // registering loader here too to make sure it's imported when using engine via vanilla js
@@ -262,9 +262,10 @@
262
262
  cancelable: true
263
263
  }));
264
264
  if (useDefaultLoading === false && !allowOverridingDefaultLoading) {
265
- useDefaultLoading = true;
266
- console.warn("Needle Engine: You need a commercial license to override the default loading view. Visit https://needle.tools/pricing to buy a license.");
267
- if(isDevEnvironment()) showBalloonWarning("You need a <a target=\"_blank\" href=\"https://needle.tools/pricing\">commercial license</a> to override the default loading view");
265
+ if (!isDevEnvironment())
266
+ useDefaultLoading = true;
267
+ console.warn("Needle Engine: You need a commercial license to override the default loading view. Visit https://needle.tools/pricing");
268
+ if (isDevEnvironment()) showBalloonWarning("You need a <a target=\"_blank\" href=\"https://needle.tools/pricing\">commercial license</a> to override the default loading view. This will not work in production.");
268
269
  }
269
270
  if (!this._loadingView && useDefaultLoading)
270
271
  this._loadingView = new EngineLoadingView(this);
@@ -531,7 +532,7 @@
531
532
  }
532
533
  }
533
534
 
534
- if (!window.customElements.get(htmlTagName))
535
+ if (typeof window !== "undefined" && !window.customElements.get(htmlTagName))
535
536
  window.customElements.define(htmlTagName, NeedleEngineHTMLElement);
536
537
 
537
538
 
src/engine/engine_gameobject.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { Bone, Object3D, Quaternion, SkinnedMesh, Vector3 } from "three";
2
- import { processNewScripts } from "./engine_mainloop_utils";
3
- import { InstantiateIdProvider } from "./engine_networking_instantiate";
4
- import { Context, registerComponent } from "./engine_setup";
5
- import { logHierarchy, setWorldPosition, setWorldQuaternion } from "./engine_three_utils";
6
- import { GuidsMap, IComponent as Component, IComponent, IGameObject as GameObject, UIDProvider, Constructor } from "./engine_types";
7
- import { getParam, tryFindObject } from "./engine_utils";
8
- import { apply } from "../engine-components/js-extensions/Object3D";
9
- import { $isUsingInstancing, InstancingUtil } from "./engine_instancing";
10
- import { activeInHierarchyFieldName } from "./engine_constants";
11
- import { assign } from "./engine_serialization_core";
12
- import { disposeObjectResources, __internalNotifyObjectDestroyed as __internalRemoveReferences } from "./engine_assetdatabase";
13
- import { editorGuidKeyName } from "./engine_constants";
14
- import { ComponentLifecycleEvents, ComponentEvents } from "./engine_components_internal";
2
+ import { processNewScripts } from "./engine_mainloop_utils.js";
3
+ import { InstantiateIdProvider } from "./engine_networking_instantiate.js";
4
+ import { Context, registerComponent } from "./engine_setup.js";
5
+ import { logHierarchy, setWorldPosition, setWorldQuaternion } from "./engine_three_utils.js";
6
+ import { GuidsMap, IComponent as Component, IComponent, IGameObject as GameObject, UIDProvider, Constructor } from "./engine_types.js";
7
+ import { getParam, tryFindObject } from "./engine_utils.js";
8
+ import { apply } from "../engine-components/js-extensions/Object3D.js";
9
+ import { $isUsingInstancing, InstancingUtil } from "./engine_instancing.js";
10
+ import { activeInHierarchyFieldName } from "./engine_constants.js";
11
+ import { assign } from "./engine_serialization_core.js";
12
+ import { disposeObjectResources, __internalNotifyObjectDestroyed as __internalRemoveReferences } from "./engine_assetdatabase.js";
13
+ import { editorGuidKeyName } from "./engine_constants.js";
14
+ import { ComponentLifecycleEvents, ComponentEvents } from "./engine_components_internal.js";
15
15
 
16
16
  const debug = getParam("debuggetcomponent");
17
17
  const debugInstantiate = getParam("debuginstantiate");
src/engine/engine_gizmos.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BufferAttribute, Line, BoxGeometry, EdgesGeometry, Color, LineSegments, LineBasicMaterial, Object3D, Mesh, SphereGeometry, ColorRepresentation, Vector3, Box3, Quaternion, CylinderGeometry } from 'three';
2
- import { Context } from './engine_setup';
3
- import { setWorldPositionXYZ } from './engine_three_utils';
4
- import { Vec3, Vec4 } from './engine_types';
2
+ import { Context } from './engine_setup.js';
3
+ import { setWorldPositionXYZ } from './engine_three_utils.js';
4
+ import { Vec3, Vec4 } from './engine_types.js';
5
5
 
6
6
  const _tmp = new Vector3();
7
7
  const _tmp2 = new Vector3();
src/engine/engine_gltf_builtin_components.ts CHANGED
@@ -1,18 +1,18 @@
1
- import "./codegen/register_types";
2
- import { TypeStore } from "./engine_typestore";
3
- import { InstantiateIdProvider } from "./engine_networking_instantiate"
4
- import { Context } from "./engine_setup";
5
- import { deserializeObject, serializeObject } from "./engine_serialization";
6
- import { assign, ImplementationInformation, ISerializable, SerializationContext } from "./engine_serialization_core";
7
- import { NEEDLE_components } from "./extensions/NEEDLE_components";
8
- import { debugExtension } from "./engine_default_parameters";
9
- import { editorGuidKeyName, builtinComponentKeyName } from "./engine_constants";
10
- import { GuidsMap, ICamera, IComponent, IGameObject, SourceIdentifier } from "./engine_types";
11
- import { UIDProvider } from "./engine_types";
12
- import { addNewComponent } from "./engine_components";
13
- import { getParam } from "./engine_utils";
14
- import { LogType, showBalloonMessage } from "./debug/debug";
15
- import { isLocalNetwork } from "./engine_networking_utils";
1
+ import "./codegen/register_types.js";
2
+ import { TypeStore } from "./engine_typestore.js";
3
+ import { InstantiateIdProvider } from "./engine_networking_instantiate.js"
4
+ import { Context } from "./engine_setup.js";
5
+ import { deserializeObject, serializeObject } from "./engine_serialization.js";
6
+ import { assign, ImplementationInformation, ISerializable, SerializationContext } from "./engine_serialization_core.js";
7
+ import { NEEDLE_components } from "./extensions/NEEDLE_components.js";
8
+ import { debugExtension } from "./engine_default_parameters.js";
9
+ import { editorGuidKeyName, builtinComponentKeyName } from "./engine_constants.js";
10
+ import { GuidsMap, ICamera, IComponent, IGameObject, SourceIdentifier } from "./engine_types.js";
11
+ import { UIDProvider } from "./engine_types.js";
12
+ import { addNewComponent } from "./engine_components.js";
13
+ import { getParam } from "./engine_utils.js";
14
+ import { LogType, showBalloonMessage } from "./debug/index.js";
15
+ import { isLocalNetwork } from "./engine_networking_utils.js";
16
16
  import { Object3D } from "three";
17
17
 
18
18
 
src/engine/engine_gltf.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Constructor, ConstructorConcrete, SourceIdentifier, UIDProvider } from "./engine_types";
2
- import { Context } from "./engine_setup";
3
- import { NEEDLE_components } from "./extensions/NEEDLE_components";
4
- import { SerializationContext } from "./engine_serialization_core";
1
+ import { Constructor, ConstructorConcrete, SourceIdentifier, UIDProvider } from "./engine_types.js";
2
+ import { Context } from "./engine_setup.js";
3
+ import { NEEDLE_components } from "./extensions/NEEDLE_components.js";
4
+ import { SerializationContext } from "./engine_serialization_core.js";
5
5
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js'
6
6
 
7
7
 
src/engine/engine_hot_reload.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { IComponent } from "./engine_types";
2
- import { TypeStore } from "./engine_typestore";
3
- import { addScriptToArrays, removeScriptFromContext } from "./engine_mainloop_utils"
4
- import { showBalloonWarning } from "./debug/debug";
5
- import { getParam } from "./engine_utils";
6
- import { addLog, LogType } from "./debug/debug_overlay";
1
+ import { IComponent } from "./engine_types.js";
2
+ import { TypeStore } from "./engine_typestore.js";
3
+ import { addScriptToArrays, removeScriptFromContext } from "./engine_mainloop_utils.js"
4
+ import { getParam } from "./engine_utils.js";
5
+ import { addLog, LogType } from "./debug/debug_overlay.js";
7
6
 
8
7
  const debug = getParam("debughotreload");
9
8
 
src/engine/engine_input.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Vector2 } from 'three';
2
- import { showBalloonMessage, showBalloonWarning } from './debug/debug';
3
- import { assign } from './engine_serialization_core';
4
- import { Context } from './engine_setup';
5
- import { IInput, Vec2 } from './engine_types';
6
- import { getParam } from './engine_utils';
2
+ import { showBalloonMessage, showBalloonWarning } from './debug/debug.js';
3
+ import { assign } from './engine_serialization_core.js';
4
+ import { Context } from './engine_setup.js';
5
+ import { IInput, Vec2 } from './engine_types.js';
6
+ import { getParam } from './engine_utils.js';
7
7
 
8
8
  const debug = getParam("debuginput");
9
9
 
src/engine/engine_license.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { getParam, isMobileDevice } from "./engine_utils";
2
- import { ContextEvent, ContextRegistry } from "./engine_context_registry";
3
- import { IContext } from "./engine_types";
4
- import { logoSVG } from "./assets";
5
- import { GENERATOR, VERSION } from "./engine_constants";
1
+ import { getParam, isMobileDevice } from "./engine_utils.js";
2
+ import { ContextEvent, ContextRegistry } from "./engine_context_registry.js";
3
+ import { IContext } from "./engine_types.js";
4
+ import { logoSVG } from "./assets/index.js";
5
+ import { GENERATOR, VERSION } from "./engine_constants.js";
6
6
 
7
7
  const debug = getParam("debuglicense");
8
8
 
src/engine/engine_lightdata.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { LightmapType } from "./extensions/NEEDLE_lightmaps";
1
+ import { LightmapType } from "./extensions/NEEDLE_lightmaps.js";
2
2
  import { Texture, ShaderChunk, UniformsLib, Vector4 } from "three";
3
- import { Context } from "./engine_setup";
4
- import { getParam } from "./engine_utils";
5
- import { SourceIdentifier } from "./engine_types";
3
+ import { Context } from "./engine_setup.js";
4
+ import { getParam } from "./engine_utils.js";
5
+ import { SourceIdentifier } from "./engine_types.js";
6
6
 
7
7
  const debugLightmap = getParam("debuglightmaps") ? true : false;
8
8
 
src/engine/engine_loaders.ts CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
- import { Context } from "./engine_setup"
2
+ import { Context } from "./engine_setup.js"
3
3
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
4
4
  import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
5
5
  import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
6
6
  import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
7
7
 
8
- import { getParam } from "./engine_utils";
8
+ import { getParam } from "./engine_utils.js";
9
9
 
10
10
  const debug = getParam("debugdecoders");
11
11
 
src/engine/engine_mainloop_utils.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as utils from "./engine_generic_utils";
2
- import * as constants from "./engine_constants";
3
- import { getParam } from './engine_utils';
1
+ import * as utils from "./engine_generic_utils.js";
2
+ import * as constants from "./engine_constants.js";
3
+ import { getParam } from './engine_utils.js';
4
4
  import { CubeCamera, Object3D, Scene, WebGLCubeRenderTarget } from 'three';
5
- import { IComponent, IContext } from './engine_types';
6
- import { isActiveSelf } from './engine_gameobject';
7
- import { ContextRegistry } from "./engine_context_registry";
8
- import { showBalloonWarning, isDevEnvironment, showBalloonMessage, LogType } from "./debug";
5
+ import { IComponent, IContext } from './engine_types.js';
6
+ import { isActiveSelf } from './engine_gameobject.js';
7
+ import { ContextRegistry } from "./engine_context_registry.js";
8
+ import { showBalloonWarning, isDevEnvironment, showBalloonMessage, LogType } from "./debug/index.js";
9
9
 
10
10
  const debug = getParam("debugnewscripts");
11
11
  const debugHierarchy = getParam("debughierarchy");
src/engine/engine_math.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { inverseLerp } from "three/src/math/MathUtils";
1
+ import { inverseLerp } from "three/src/math/MathUtils.js";
2
2
 
3
3
 
4
4
 
src/engine/engine_networking_auto.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { getParam } from "./engine_utils";
2
- import { isDevEnvironment } from "./debug";
3
- import { IComponent } from "./engine_types";
1
+ import { getParam } from "./engine_utils.js";
2
+ import { isDevEnvironment } from "./debug/index.js";
3
+ import { IComponent } from "./engine_types.js";
4
4
 
5
5
  const debug = getParam("debugautosync");
6
6
 
src/engine/engine_networking_files_default_components.ts CHANGED
@@ -1,9 +1,9 @@
1
- // import { SyncedTransform } from "../engine-components/SyncedTransform";
2
- // import { DragControls } from "../engine-components/DragControls"
3
- // import { ObjectRaycaster } from "../engine-components/ui/Raycaster";
4
- import { UIDProvider } from "./engine_types";
5
- import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
6
- // import { Animation } from "../engine-components/Animation";
1
+ // import { SyncedTransform } from "../engine-components/SyncedTransform.js";
2
+ // import { DragControls } from "../engine-components/DragControls.js"
3
+ // import { ObjectRaycaster } from "../engine-components/ui/Raycaster.js";
4
+ import { UIDProvider } from "./engine_types.js";
5
+ import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
6
+ // import { Animation } from "../engine-components/Animation.js";
7
7
 
8
8
 
9
9
  export function onDynamicObjectAdded(_obj: THREE.Object3D, _idProv: UIDProvider, _gltf?: GLTF) {
src/engine/engine_networking_files.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { Context } from "../engine/engine_setup";
2
- import * as web from "../engine/engine_web_api";
3
- import { NetworkConnection } from "../engine/engine_networking";
4
- import { generateSeed, InstantiateIdProvider } from "../engine/engine_networking_instantiate";
5
- import * as def from "./engine_networking_files_default_components"
1
+ import { Context } from "../engine/engine_setup.js";
2
+ import * as web from "../engine/engine_web_api.js";
3
+ import { NetworkConnection } from "../engine/engine_networking.js";
4
+ import { generateSeed, InstantiateIdProvider } from "../engine/engine_networking_instantiate.js";
5
+ import * as def from "./engine_networking_files_default_components.js"
6
6
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js'
7
- import { getLoader } from "../engine/engine_gltf";
8
- import { IModel } from "./engine_networking_types";
9
- import { IGameObject } from "./engine_types";
10
- import { findByGuid } from "./engine_gameobject";
11
- import { ContextEvent, ContextRegistry } from "./engine_context_registry";
7
+ import { getLoader } from "../engine/engine_gltf.js";
8
+ import { IModel } from "./engine_networking_types.js";
9
+ import { IGameObject } from "./engine_types.js";
10
+ import { findByGuid } from "./engine_gameobject.js";
11
+ import { ContextEvent, ContextRegistry } from "./engine_context_registry.js";
12
12
  import { BoxGeometry, BoxHelper, Mesh, MeshBasicMaterial, Object3D, Vector3 } from "three";
13
13
 
14
14
  export enum File_Event {
src/engine/engine_networking_instantiate.ts CHANGED
@@ -1,20 +1,20 @@
1
- // import { IModel, NetworkConnection } from "./engine_networking"
1
+ // import { IModel, NetworkConnection } from "./engine_networking.js"
2
2
  import * as THREE from "three";
3
- import { Context } from "./engine_setup"
4
- import * as utils from "./engine_utils"
5
- import { INetworkConnection } from "./engine_networking_types";
6
- import { IGameObject as GameObject, IComponent as Component } from "./engine_types"
3
+ import { Context } from "./engine_setup.js"
4
+ import * as utils from "./engine_utils.js"
5
+ import { INetworkConnection } from "./engine_networking_types.js";
6
+ import { IGameObject as GameObject, IComponent as Component } from "./engine_types.js"
7
7
 
8
8
  // https://github.com/uuidjs/uuid
9
9
  // v5 takes string and namespace
10
10
  import { v5 } from 'uuid';
11
- import { UIDProvider } from "./engine_types";
12
- import { IModel } from "./engine_networking_types";
13
- import { SendQueue } from "./engine_networking_types";
14
- import { destroy, findByGuid, instantiate } from "./engine_gameobject";
11
+ import { UIDProvider } from "./engine_types.js";
12
+ import { IModel } from "./engine_networking_types.js";
13
+ import { SendQueue } from "./engine_networking_types.js";
14
+ import { destroy, findByGuid, instantiate } from "./engine_gameobject.js";
15
15
  import { Object3D } from "three";
16
- import { InstantiateOptions } from "./engine_gameobject";
17
- import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry";
16
+ import { InstantiateOptions } from "./engine_gameobject.js";
17
+ import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry.js";
18
18
 
19
19
 
20
20
 
src/engine/engine_networking_utils.ts CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  const localNetworkResults = new Map<string, boolean>();
8
8
 
9
- export function isLocalNetwork(hostname = window.location.hostname) {
9
+ export function isLocalNetwork(hostname = globalThis.location?.hostname) {
10
10
  if(localNetworkResults.has(hostname)) return localNetworkResults.get(hostname)!;
11
11
  const isLocalNetwork = new RegExp("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|localhost", "gm").test(hostname);
12
12
  localNetworkResults.set(hostname, isLocalNetwork);
src/engine/engine_networking.ts CHANGED
@@ -2,14 +2,14 @@
2
2
  let serverUrl : string | undefined = "wss://needle-tiny-starter.glitch.me/socket";
3
3
 
4
4
  import { Websocket, WebsocketBuilder } from 'websocket-ts';
5
- // import { Networking } from '../engine-components/Networking';
6
- import { Context } from './engine_setup';
7
- import * as utils from "./engine_utils";
5
+ // import { Networking } from '../engine-components/Networking.js';
6
+ import { Context } from './engine_setup.js';
7
+ import * as utils from "./engine_utils.js";
8
8
  import * as flatbuffers from 'flatbuffers';
9
- import * as schemes from "../engine-schemes/schemes";
10
- import { PeerNetworking } from './engine_networking_peer';
11
- import { IModel, INetworkConnection, SendQueue } from './engine_networking_types';
12
- import { isHostedOnGlitch } from './engine_networking_utils';
9
+ import * as schemes from "../engine-schemes/schemes.js";
10
+ import { PeerNetworking } from './engine_networking_peer.js';
11
+ import { IModel, INetworkConnection, SendQueue } from './engine_networking_types.js';
12
+ import { isHostedOnGlitch } from './engine_networking_utils.js';
13
13
 
14
14
  export const debugNet = utils.getParam("debugnet") ? true : false;
15
15
  export const debugOwner = debugNet || utils.getParam("debugowner") ? true : false;
@@ -537,7 +537,7 @@
537
537
  const id = bb.getBufferIdentifier();
538
538
  const callbacks = this._listenersBinary[id];
539
539
  // use registered cast methods to get the correct type from the flatbuffer
540
- const obj = schemes.tryCast(bb);
540
+ const obj = schemes.tryCastBinary(bb);
541
541
  const guid = schemes.tryGetGuid(obj);
542
542
  if (guid && typeof guid === "string") {
543
543
  this._state[guid] = obj;
src/engine/engine_patcher.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn
3
3
 
4
- import { getParam } from "./engine_utils";
4
+ import { getParam } from "./engine_utils.js";
5
5
 
6
6
  // const _wrappedMethods = new WeakSet();
7
7
 
src/engine/engine_physics_rapier.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BufferAttribute, BufferGeometry, LineBasicMaterial, LineSegments, Matrix4, Mesh, Object3D, Quaternion, Vector3 } from 'three'
2
- import { CircularBuffer, getParam } from "./engine_utils"
3
- import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldPositionXYZ, setWorldQuaternionXYZW } from "./engine_three_utils"
2
+ import { CircularBuffer, getParam } from "./engine_utils.js"
3
+ import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldPositionXYZ, setWorldQuaternionXYZW } from "./engine_three_utils.js"
4
4
  import {
5
5
  IPhysicsEngine,
6
6
  IComponent,
@@ -12,16 +12,16 @@
12
12
  IGameObject,
13
13
  Vec2,
14
14
  IContext,
15
- } from './engine_types';
16
- import { foreachComponent } from './engine_gameobject';
15
+ } from './engine_types.js';
16
+ import { foreachComponent } from './engine_gameobject.js';
17
17
 
18
18
  import { ActiveCollisionTypes, ActiveEvents, CoefficientCombineRule, Ball, Collider, ColliderDesc, EventQueue, JointData, QueryFilterFlags, RigidBody, RigidBodyType, ShapeColliderTOI, World, Ray } from '@dimforge/rapier3d-compat';
19
- import { CollisionDetectionMode, PhysicsMaterialCombine } from '../engine/engine_physics.types';
20
- import { Gizmos } from './engine_gizmos';
21
- import { Mathf } from './engine_math';
22
- import { SphereOverlapResult } from './engine_types';
23
- import { ContextEvent, ContextRegistry } from './engine_context_registry';
24
- import { isDevEnvironment } from './debug/debug';
19
+ import { CollisionDetectionMode, PhysicsMaterialCombine } from '../engine/engine_physics.types.js';
20
+ import { Gizmos } from './engine_gizmos.js';
21
+ import { Mathf } from './engine_math.js';
22
+ import { SphereOverlapResult } from './engine_types.js';
23
+ import { ContextEvent, ContextRegistry } from './engine_context_registry.js';
24
+ import { isDevEnvironment } from './debug/debug.js';
25
25
 
26
26
  const debugPhysics = getParam("debugphysics");
27
27
  const debugColliderPlacement = getParam("debugcolliderplacement");
src/engine/engine_physics.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Box3, Camera, Intersection, Layers, Mesh, Object3D, Ray, Raycaster, Sphere, Vector2, Vector3 } from 'three'
2
- import { Context } from './engine_setup';
3
- import { getParam } from "./engine_utils"
4
- import { getWorldPosition } from "./engine_three_utils"
5
- import { Vec2, Vec3, } from './engine_types';
6
- import { IPhysicsEngine } from './engine_types';
2
+ import { Context } from './engine_setup.js';
3
+ import { getParam } from "./engine_utils.js"
4
+ import { getWorldPosition } from "./engine_three_utils.js"
5
+ import { Vec2, Vec3, } from './engine_types.js';
6
+ import { IPhysicsEngine } from './engine_types.js';
7
7
 
8
8
  const debugPhysics = getParam("debugphysics");
9
9
  const layerMaskHelper: Layers = new Layers();
src/engine/engine_playerview.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { getParam } from "./engine_utils";
1
+ import { getParam } from "./engine_utils.js";
2
2
  import { Object3D } from "three";
3
- import { Context } from "./engine_setup";
3
+ import { Context } from "./engine_setup.js";
4
4
 
5
5
  const debug = getParam("debugplayerview");
6
6
 
src/engine/engine_scenelighting.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Vector4, EquirectangularReflectionMapping, sRGBEncoding, WebGLCubeRenderTarget, Texture, LightProbe, Color, SphericalHarmonics3, SRGBColorSpace } from "three";
2
2
  import { LightProbeGenerator } from "three/examples/jsm/lights/LightProbeGenerator.js"
3
- import { Context } from "./engine_setup";
4
- import { SceneLightSettings } from "./extensions/NEEDLE_lighting_settings";
5
- import { createFlatTexture, createTrilightTexture } from "./engine_shaders";
6
- import { getParam } from "./engine_utils";
7
- import { SourceIdentifier } from "./engine_types";
8
- import { AssetReference } from "./engine_addressables";
3
+ import { Context } from "./engine_setup.js";
4
+ import { SceneLightSettings } from "./extensions/NEEDLE_lighting_settings.js";
5
+ import { createFlatTexture, createTrilightTexture } from "./engine_shaders.js";
6
+ import { getParam } from "./engine_utils.js";
7
+ import { SourceIdentifier } from "./engine_types.js";
8
+ import { AssetReference } from "./engine_addressables.js";
9
9
 
10
10
  const debug = getParam("debugenvlight");
11
11
 
src/engine/engine_scenetools.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { Context } from "./engine_setup"
1
+ import { Context } from "./engine_setup.js"
2
2
  import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
3
- // import * as object from "./engine_gltf_builtin_components";
4
- import * as loaders from "./engine_loaders"
5
- import * as utils from "./engine_utils";
6
- import { registerComponentExtension, registerExtensions } from "./extensions/extensions";
7
- import { getLoader, INeedleGltfLoader, registerLoader } from "./engine_gltf";
8
- import { SourceIdentifier, UIDProvider } from "./engine_types";
9
- import { createBuiltinComponents, writeBuiltinComponentData } from "./engine_gltf_builtin_components";
10
- import { SerializationContext } from "./engine_serialization_core";
11
- import { NEEDLE_components } from "./extensions/NEEDLE_components";
12
- import { registerPrewarmObject } from "./engine_mainloop_utils";
3
+ // import * as object from "./engine_gltf_builtin_components.js";
4
+ import * as loaders from "./engine_loaders.js"
5
+ import * as utils from "./engine_utils.js";
6
+ import { registerComponentExtension, registerExtensions } from "./extensions/extensions.js";
7
+ import { getLoader, INeedleGltfLoader, registerLoader } from "./engine_gltf.js";
8
+ import { SourceIdentifier, UIDProvider } from "./engine_types.js";
9
+ import { createBuiltinComponents, writeBuiltinComponentData } from "./engine_gltf_builtin_components.js";
10
+ import { SerializationContext } from "./engine_serialization_core.js";
11
+ import { NEEDLE_components } from "./extensions/NEEDLE_components.js";
12
+ import { registerPrewarmObject } from "./engine_mainloop_utils.js";
13
13
  import { Object3D } from "three";
14
14
 
15
15
 
src/engine/engine_serialization_builtin_serializer.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as THREE from "three";
2
- import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
3
- import { SerializationContext, TypeSerializer } from "./engine_serialization_core";
4
- import { Behaviour, Component, GameObject } from "../engine-components/Component";
5
- import { debugExtension } from "./engine_default_parameters";
6
- import { CallInfo, EventList } from "../engine-components/EventList";
2
+ import { RGBAColor } from "../engine-components/js-extensions/RGBAColor.js";
3
+ import { SerializationContext, TypeSerializer } from "./engine_serialization_core.js";
4
+ import { Behaviour, Component, GameObject } from "../engine-components/Component.js";
5
+ import { debugExtension } from "./engine_default_parameters.js";
6
+ import { CallInfo, EventList } from "../engine-components/EventList.js";
7
7
  import { Color, CompressedTexture, Object3D, Texture, WebGLRenderTarget } from "three";
8
- import { RenderTexture } from "./engine_texture";
9
- import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../engine/debug/debug";
10
- import { resolveUrl } from "./engine_utils";
8
+ import { RenderTexture } from "./engine_texture.js";
9
+ import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../engine/debug/index.js";
10
+ import { resolveUrl } from "./engine_utils.js";
11
11
 
12
12
  // export class SourcePath {
13
13
  // src?:string
@@ -248,12 +248,12 @@
248
248
  const printWarningMethodNotFound = () => {
249
249
  const uppercaseMethodName = call.method[0].toUpperCase() + call.method.slice(1);
250
250
  if (typeof target[uppercaseMethodName] === "function") {
251
- console.warn(`Could not find method ${call.method} on object ${target.name}. Please rename ${call.method} to ${uppercaseMethodName}?`, target[uppercaseMethodName], " in script: ", target);
251
+ console.warn(`EventList method:\nCould not find method ${call.method} on object ${target.name}. Please rename ${call.method} to ${uppercaseMethodName}?\n`, target[uppercaseMethodName], "\n in script: ", target);
252
252
  showBalloonWarning("EventList methods must start with lowercase letter, see console for details");
253
253
  return;
254
254
  }
255
255
  else {
256
- console.warn(`Could not find method ${call.method} on object ${target.name}`, target, typeof target[call.method]);
256
+ console.warn(`EventList method:\nCould not find method ${call.method} on object ${target.name}`, target, typeof target[call.method]);
257
257
  }
258
258
  }
259
259
  const method = target[call.method];
src/engine/engine_serialization_core.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
2
- import { getParam } from "./engine_utils";
1
+ import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
2
+ import { getParam } from "./engine_utils.js";
3
3
  import { AnimationClip, Material, Mesh, Object3D, Texture } from "three";
4
- import { Context } from "./engine_setup";
5
- import { isPersistentAsset } from "./extensions/NEEDLE_persistent_assets";
6
- import { ConstructorConcrete, SourceIdentifier } from "./engine_types";
7
- import { debugExtension } from "../engine/engine_default_parameters";
8
- import { LogType, addLog } from "./debug/debug_overlay";
9
- import { isLocalNetwork } from "./engine_networking_utils";
10
- import { $BuiltInTypeFlag } from "./engine_typestore";
4
+ import { Context } from "./engine_setup.js";
5
+ import { isPersistentAsset } from "./extensions/NEEDLE_persistent_assets.js";
6
+ import { ConstructorConcrete, SourceIdentifier } from "./engine_types.js";
7
+ import { debugExtension } from "../engine/engine_default_parameters.js";
8
+ import { LogType, addLog } from "./debug/debug_overlay.js";
9
+ import { isLocalNetwork } from "./engine_networking_utils.js";
10
+ import { $BuiltInTypeFlag } from "./engine_typestore.js";
11
11
 
12
12
  const debug = getParam("debugserializer");
13
13
 
src/engine/engine_serialization_decorator.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Constructor } from "./engine_types";
1
+ import { Constructor } from "./engine_types.js";
2
2
 
3
3
  export declare type TypeResolver<T> = (data) => Constructor<T> | null;
4
4
 
src/engine/engine_serialization.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { serializeObject, deserializeObject } from "./engine_serialization_core";
1
+ import { serializeObject, deserializeObject } from "./engine_serialization_core.js";
2
2
 
3
3
  export { serializeObject, deserializeObject };
4
4
 
5
- export { serializable, serializeable } from "./engine_serialization_decorator"
5
+ export { serializable, serializeable } from "./engine_serialization_decorator.js"
6
6
 
7
- export * from "./engine_serialization_builtin_serializer";
7
+ export * from "./engine_serialization_builtin_serializer.js";
src/engine/engine_setup.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // TODO: change all usings to the new path:
2
- export * from "./engine_context"
2
+ export * from "./engine_context.js"
src/engine/engine_shaders.ts CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
- import * as loader from "./engine_fileloader"
3
- import * as SHADERDATA from "./shaders/shaderData"
2
+ import * as loader from "./engine_fileloader.js"
3
+ import * as SHADERDATA from "./shaders/shaderData.js"
4
4
  import { Vector4, FileLoader, DataTexture, RGBAFormat, Color, TextureDataType } from "three";
5
- import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
6
- import { Mathf } from "./engine_math";
5
+ import { RGBAColor } from "../engine-components/js-extensions/RGBAColor.js";
6
+ import { Mathf } from "./engine_math.js";
7
7
 
8
8
 
9
9
  const white = new Uint8Array(4);
src/engine/engine_texture.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Camera, Mesh, Object3D, Texture, WebGLRenderer, WebGLRenderTarget } from "three";
2
2
  import { EffectComposer } from "postprocessing";
3
- import { findResourceUsers } from "./engine_assetdatabase";
3
+ import { findResourceUsers } from "./engine_assetdatabase.js";
4
4
 
5
5
 
6
6
  const _prevVisible = Symbol("previous-visibility");
src/engine/engine_three_utils.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as THREE from "three";
2
- import { Mathf } from "./engine_math"
2
+ import { Mathf } from "./engine_math.js"
3
3
  import { WebGLRenderer, Vector3, Quaternion, Uniform, Texture, Material, ShaderMaterial, CanvasTexture, AnimationAction, Camera, PerspectiveCamera, Object3D, Euler, PlaneGeometry, Scene, Mesh } from "three";
4
- import { CircularBuffer } from "./engine_utils";
4
+ import { CircularBuffer } from "./engine_utils.js";
5
5
 
6
6
 
7
7
  export function slerp(vec: Vector3, end: Vector3, t: number) {
src/engine/engine_time.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Clock } from 'three'
2
- import { getParam } from './engine_utils';
3
- import { ITime } from './engine_types';
2
+ import { getParam } from './engine_utils.js';
3
+ import { ITime } from './engine_types.js';
4
4
 
5
5
  const timescaleUrl = getParam("timescale");
6
6
  let timeScale = 1;
src/engine/engine_types.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { RenderTexture } from "./engine_texture";
1
+ import { RenderTexture } from "./engine_texture.js";
2
2
  import { Camera, Color, Material, Object3D, Vector3, Quaternion, Ray, Scene, Renderer, WebGLRenderer, Mesh, AnimationClip } from "three";
3
- import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
4
- import { CollisionDetectionMode, PhysicsMaterial, RigidbodyConstraints } from "./engine_physics.types";
5
- import { CircularBuffer } from "./engine_utils";
3
+ import { RGBAColor } from "../engine-components/js-extensions/RGBAColor.js";
4
+ import { CollisionDetectionMode, PhysicsMaterial, RigidbodyConstraints } from "./engine_physics.types.js";
5
+ import { CircularBuffer } from "./engine_utils.js";
6
6
 
7
7
  export type GLTF = {
8
8
  asset: { generator: string, version: string }
@@ -92,7 +92,6 @@
92
92
  stopAllCoroutinesFrom(script: IComponent);
93
93
  }
94
94
 
95
-
96
95
  export declare interface INeedleEngineComponent extends HTMLElement {
97
96
  getAROverlayContainer(): HTMLElement;
98
97
  onEnterAR(session: XRSession, overlayContainer: HTMLElement);
src/engine/engine_util_decorator.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $isAssigningProperties } from "./engine_serialization_core";
2
- import { LogType, showBalloonMessage } from "./debug/debug";
3
- import { Constructor, IComponent } from "./engine_types";
1
+ import { $isAssigningProperties } from "./engine_serialization_core.js";
2
+ import { LogType, showBalloonMessage } from "./debug/index.js";
3
+ import { Constructor, IComponent } from "./engine_types.js";
4
4
 
5
5
 
6
6
  declare type setter = (v: any) => void;
src/engine/engine_utils_screenshot.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "./engine_setup";
1
+ import { Context } from "./engine_setup.js";
2
2
  import { PerspectiveCamera, Camera } from "three";
3
3
 
4
4
  declare type ImageMimeType = "image/webp" | "image/png";
src/engine/engine_utils.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // use for typesafe interface method calls
2
- import { SourceIdentifier } from "./engine_types";
2
+ import { SourceIdentifier } from "./engine_types.js";
3
3
 
4
4
  // https://schneidenbach.gitbooks.io/typescript-cookbook/content/nameof-operator.html
5
5
  export const nameofFactory = <T>() => (name: keyof T) => name;
@@ -46,7 +46,8 @@
46
46
  }, 100);
47
47
 
48
48
  export function getUrlParams() {
49
- return new URLSearchParams(window.location.search);
49
+ // "window" may not exist in node.js
50
+ return new URLSearchParams(globalThis.location?.search);
50
51
  }
51
52
 
52
53
  /** Checks if a url parameter exists.
src/engine/engine.ts CHANGED
@@ -1,9 +1,9 @@
1
- import "./engine_hot_reload"
1
+ import "./engine_hot_reload.js"
2
2
 
3
- import * as engine_setup from "./engine_setup";
4
- import * as engine_scenetools from "./engine_scenetools";
5
- import "./tests/test_utils";
6
- import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
3
+ import * as engine_setup from "./engine_setup.js";
4
+ import * as engine_scenetools from "./engine_scenetools.js";
5
+ import "./tests/test_utils.js";
6
+ import { RGBAColor } from "../engine-components/js-extensions/RGBAColor.js";
7
7
 
8
8
 
9
9
  const engine : any = {
src/engine-components/ui/EventSystem.ts CHANGED
@@ -1,19 +1,19 @@
1
- import { RaycastOptions } from "../../engine/engine_physics";
2
- import { Behaviour, Component, GameObject } from "../Component";
3
- import { WebXR } from "../webxr/WebXR";
4
- import { ControllerEvents, WebXRController } from "../webxr/WebXRController";
1
+ import { RaycastOptions } from "../../engine/engine_physics.js";
2
+ import { Behaviour, Component, GameObject } from "../Component.js";
3
+ import { WebXR } from "../webxr/WebXR.js";
4
+ import { ControllerEvents, WebXRController } from "../webxr/WebXRController.js";
5
5
  import * as ThreeMeshUI from 'three-mesh-ui'
6
- import { Context } from "../../engine/engine_setup";
7
- import { OrbitControls } from "../OrbitControls";
8
- import { IPointerEventHandler, PointerEventData } from "./PointerEvents";
9
- import { ObjectRaycaster, Raycaster } from "./Raycaster";
10
- import { InputEvents, PointerEventArgs } from "../../engine/engine_input";
6
+ import { Context } from "../../engine/engine_setup.js";
7
+ import { OrbitControls } from "../OrbitControls.js";
8
+ import { IPointerEventHandler, PointerEventData } from "./PointerEvents.js";
9
+ import { ObjectRaycaster, Raycaster } from "./Raycaster.js";
10
+ import { InputEvents, PointerEventArgs } from "../../engine/engine_input.js";
11
11
  import { Object3D } from "three";
12
- import { ICanvasGroup, IGraphic } from "./Interfaces";
13
- import { getParam } from "../../engine/engine_utils";
14
- import { UIRaycastUtils } from "./RaycastUtils";
15
- import { $shadowDomOwner } from "./BaseUIComponent";
16
- import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../../engine/debug";
12
+ import { ICanvasGroup, IGraphic } from "./Interfaces.js";
13
+ import { getParam } from "../../engine/engine_utils.js";
14
+ import { UIRaycastUtils } from "./RaycastUtils.js";
15
+ import { $shadowDomOwner } from "./BaseUIComponent.js";
16
+ import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../../engine/debug/index.js";
17
17
 
18
18
  const debug = getParam("debugeventsystem");
19
19
 
src/engine-components/EventTrigger.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { serializable } from "../engine/engine_serialization";
2
- import { EventList } from "./EventList";
3
- import { IPointerEventHandler, PointerEventData } from "./ui/PointerEvents"
4
- import { Behaviour } from "./Component"
5
- import { EventType } from "./EventType"
1
+ import { serializable } from "../engine/engine_serialization.js";
2
+ import { EventList } from "./EventList.js";
3
+ import { IPointerEventHandler, PointerEventData } from "./ui/PointerEvents.js"
4
+ import { Behaviour } from "./Component.js"
5
+ import { EventType } from "./EventType.js"
6
6
 
7
7
  class TriggerEvent {
8
8
  @serializable()
src/engine/extensions/EXT_texture_exr.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { getParam } from "../engine_utils";
2
- import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader";
1
+ import { getParam } from "../engine_utils.js";
2
+ import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader.js";
3
3
  import { Texture } from "three";
4
- import { GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
4
+ import { GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
5
5
 
6
6
 
7
7
  const debug = getParam("debugexr");
@@ -46,5 +46,6 @@
46
46
  return promise;
47
47
  }
48
48
  }
49
- window.addEventListener('unhandledrejection', (_event: PromiseRejectionEvent) => {
50
- });
49
+
50
+ if (typeof window !== "undefined")
51
+ window.addEventListener('unhandledrejection', (_event: PromiseRejectionEvent) => {});
src/engine/extensions/extension_resolver.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
1
+ import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
2
2
 
3
3
  export interface IExtensionReferenceResolver {
4
4
  resolve(parser: GLTFParser, path: string): Promise<void> | null
src/engine/extensions/extension_utils.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { IExtensionReferenceResolver } from "./extension_resolver";
2
- import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
3
- import { debugExtension } from "../engine_default_parameters";
4
- import { getParam } from "../engine_utils";
1
+ import { IExtensionReferenceResolver } from "./extension_resolver.js";
2
+ import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
+ import { debugExtension } from "../engine_default_parameters.js";
4
+ import { getParam } from "../engine_utils.js";
5
5
 
6
6
  const debug = getParam("debugresolvedependencies");
7
7
 
src/engine-components/export/usdz/Extension.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { USDObject, USDZExporterContext } from "./ThreeUSDZExporter";
1
+ import { USDObject, USDZExporterContext } from "./ThreeUSDZExporter.js";
2
2
  import { Object3D } from "three";
3
3
 
4
4
  export interface IUSDExporterExtension {
src/engine/extensions/extensions.ts CHANGED
@@ -1,24 +1,24 @@
1
- import { NEEDLE_techniques_webgl } from "./NEEDLE_techniques_webgl";
2
- import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
3
- import { NEEDLE_components } from "./NEEDLE_components";
4
- import { EXT_texture_exr } from "./EXT_texture_exr";
5
- import { NEEDLE_gameobject_data } from "./NEEDLE_gameobject_data";
6
- // import { NEEDLE_timeline } from "./NEEDLE_timeline";
7
- // import { NEEDLE_animator_controller } from "./NEEDLE_animator_controller";
8
- import { NEEDLE_persistent_assets } from "./NEEDLE_persistent_assets";
9
- // import { KHR_animation_pointer } from "./KHR_animation_pointer";
10
- import { NEEDLE_lightmaps } from "../extensions/NEEDLE_lightmaps";
11
- import { Constructor, ConstructorConcrete, SourceIdentifier } from "../engine_types";
12
- import { Context } from "../engine_setup";
13
- import { NEEDLE_lighting_settings } from "./NEEDLE_lighting_settings";
14
- import { NEEDLE_render_objects } from "./NEEDLE_render_objects";
15
- import { NEEDLE_progressive } from "./NEEDLE_progressive";
16
- import { InternalUsageTrackerPlugin } from "./usage_tracker";
17
- import { isResourceTrackingEnabled } from "../engine_assetdatabase";
1
+ import { NEEDLE_techniques_webgl } from "./NEEDLE_techniques_webgl.js";
2
+ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
3
+ import { NEEDLE_components } from "./NEEDLE_components.js";
4
+ import { EXT_texture_exr } from "./EXT_texture_exr.js";
5
+ import { NEEDLE_gameobject_data } from "./NEEDLE_gameobject_data.js";
6
+ // import { NEEDLE_timeline } from "./NEEDLE_timeline.js";
7
+ // import { NEEDLE_animator_controller } from "./NEEDLE_animator_controller.js";
8
+ import { NEEDLE_persistent_assets } from "./NEEDLE_persistent_assets.js";
9
+ // import { KHR_animation_pointer } from "./KHR_animation_pointer.js";
10
+ import { NEEDLE_lightmaps } from "../extensions/NEEDLE_lightmaps.js";
11
+ import { Constructor, ConstructorConcrete, SourceIdentifier } from "../engine_types.js";
12
+ import { Context } from "../engine_setup.js";
13
+ import { NEEDLE_lighting_settings } from "./NEEDLE_lighting_settings.js";
14
+ import { NEEDLE_render_objects } from "./NEEDLE_render_objects.js";
15
+ import { NEEDLE_progressive } from "./NEEDLE_progressive.js";
16
+ import { InternalUsageTrackerPlugin } from "./usage_tracker.js";
17
+ import { isResourceTrackingEnabled } from "../engine_assetdatabase.js";
18
18
  import { GLTFLoaderPlugin } from "three/examples/jsm/loaders/GLTFLoader.js";
19
- import { getParam } from "../engine_utils";
20
- import { isDevEnvironment } from "../debug";
21
- // import { GLTFAnimationPointerExtension } from "three/examples/jsm/loaders/GLTFLoaderAnimationPointer";
19
+ import { getParam } from "../engine_utils.js";
20
+ import { isDevEnvironment } from "../debug/index.js";
21
+ // import { GLTFAnimationPointerExtension } from "three/examples/jsm/loaders/GLTFLoaderAnimationPointer.js";
22
22
 
23
23
  const debug = getParam("debugextensions");
24
24
 
src/engine-components/js-extensions/ExtensionUtils.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Object3D } from "three";
2
- import { Constructor } from "../../engine/engine_types";
2
+ import { Constructor } from "../../engine/engine_types.js";
3
3
 
4
4
  const handlers: Map<any, ApplyPrototypeExtension> = new Map();
5
5
 
src/engine-components/FlyControls.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { FlyControls as ThreeFlyControls } from "three/examples/jsm/controls/FlyControls";
3
- import { Camera } from "./Camera";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { FlyControls as ThreeFlyControls } from "three/examples/jsm/controls/FlyControls.js";
3
+ import { Camera } from "./Camera.js";
4
4
 
5
5
  export class FlyControls extends Behaviour {
6
6
  private _controls: ThreeFlyControls | null = null;
src/engine-components/Fog.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import { Color, Fog as Fog3 } from "three";
3
- import { serializable } from "../engine/engine_serialization";
3
+ import { serializable } from "../engine/engine_serialization.js";
4
4
 
5
5
 
6
6
  export enum FogMode {
src/engine-components/Gizmos.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import * as Gizmos from "../engine/engine_gizmos";
4
- import * as params from "../engine/engine_default_parameters";
5
- import { FrameEvent } from "../engine/engine_setup";
3
+ import * as Gizmos from "../engine/engine_gizmos.js";
4
+ import * as params from "../engine/engine_default_parameters.js";
5
+ import { FrameEvent } from "../engine/engine_setup.js";
6
6
  import { BoxHelper, Color } from "three";
7
- import { serializable } from "../engine/engine_serialization_decorator";
7
+ import { serializable } from "../engine/engine_serialization_decorator.js";
8
8
 
9
9
 
10
10
  export class BoxGizmo extends Behaviour {
src/engine-components/export/gltf/GltfExport.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { Behaviour, GameObject } from "../../Component";
1
+ import { Behaviour, GameObject } from "../../Component.js";
2
2
  import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
3
3
  import GLTFMeshGPUInstancingExtension from '../../../include/three/EXT_mesh_gpu_instancing_exporter.js';
4
- import { Renderer } from "../../Renderer";
4
+ import { Renderer } from "../../Renderer.js";
5
5
  import { Object3D, Vector3 } from "three";
6
- import { SerializationContext } from "../../../engine/engine_serialization_core";
7
- import { NEEDLE_components } from "../../../engine/extensions/NEEDLE_components";
8
- import { getWorldPosition } from "../../../engine/engine_three_utils";
9
- import { BoxHelperComponent } from "../../BoxHelperComponent";
6
+ import { SerializationContext } from "../../../engine/engine_serialization_core.js";
7
+ import { NEEDLE_components } from "../../../engine/extensions/NEEDLE_components.js";
8
+ import { getWorldPosition } from "../../../engine/engine_three_utils.js";
9
+ import { BoxHelperComponent } from "../../BoxHelperComponent.js";
10
10
  import { AnimationClip } from "three";
11
11
 
12
12
 
src/engine-components/ui/Graphic.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { IGraphic, IRectTransformChangedReceiver } from './Interfaces';
1
+ import { IGraphic, IRectTransformChangedReceiver } from './Interfaces.js';
2
2
  import * as ThreeMeshUI from 'three-mesh-ui'
3
- import { RGBAColor } from "../js-extensions/RGBAColor"
4
- import { BaseUIComponent } from "./BaseUIComponent";
5
- import { serializable } from '../../engine/engine_serialization_decorator';
3
+ import { RGBAColor } from "../js-extensions/RGBAColor.js"
4
+ import { BaseUIComponent } from "./BaseUIComponent.js";
5
+ import { serializable } from '../../engine/engine_serialization_decorator.js';
6
6
  import { Color, LinearSRGBColorSpace, SRGBColorSpace, Texture } from 'three';
7
- import { RectTransform } from './RectTransform';
8
- import { onChange, scheduleAction } from "./Utils"
9
- import { GameObject } from '../Component';
10
- import SimpleStateBehavior from "three-mesh-ui/examples/behaviors/states/SimpleStateBehavior"
11
- import { Outline } from './Outline';
7
+ import { RectTransform } from './RectTransform.js';
8
+ import { onChange, scheduleAction } from "./Utils.js"
9
+ import { GameObject } from '../Component.js';
10
+ import SimpleStateBehavior from "three-mesh-ui/examples/behaviors/states/SimpleStateBehavior.js"
11
+ import { Outline } from './Outline.js';
12
12
 
13
13
  const _colorStateObject: { backgroundColor: Color, backgroundOpacity: number, borderColor: Color, borderOpacity: number } = {
14
14
  backgroundColor: new Color(1, 1, 1),
src/engine-components/GridHelper.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour } from "./Component";
2
- import { serializable } from "../engine/engine_serialization_decorator";
3
- import * as params from "../engine/engine_default_parameters";
1
+ import { Behaviour } from "./Component.js";
2
+ import { serializable } from "../engine/engine_serialization_decorator.js";
3
+ import * as params from "../engine/engine_default_parameters.js";
4
4
  import { Color, GridHelper as _GridHelper } from "three";
5
5
 
6
6
  export class GridHelper extends Behaviour {
src/engine-components/GroundProjection.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import { GroundProjectedSkybox as GroundProjection } from 'three/examples/jsm/objects/GroundProjectedSkybox.js';
3
- import { serializable } from "../engine/engine_serialization_decorator";
4
- import { Watch as Watch } from "../engine/engine_utils";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
+ import { Watch as Watch } from "../engine/engine_utils.js";
5
5
  import { Texture } from "three";
6
6
 
7
7
 
src/engine-components/ui/Image.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { serializable } from '../../engine/engine_serialization_decorator';
1
+ import { serializable } from '../../engine/engine_serialization_decorator.js';
2
2
  import { Color, Texture } from 'three';
3
- import { MaskableGraphic } from './Graphic';
3
+ import { MaskableGraphic } from './Graphic.js';
4
4
 
5
5
 
6
6
  class Sprite {
src/engine-components/export/gltf/index.ts CHANGED
@@ -1,1 +1,1 @@
1
- export * from "./GltfExport"
1
+ export * from "./GltfExport.js"
src/engine-components/export/index.ts CHANGED
@@ -1,1 +1,1 @@
1
- export * from "./usdz"
1
+ export * from "./usdz/index.js"
src/engine-components/export/usdz/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { USDZExporter } from "./USDZExporter";
2
- export { USDObject } from "./ThreeUSDZExporter";
3
- export { type UsdzBehaviour } from "./extensions/behavior/Behaviour";
1
+ export { USDZExporter } from "./USDZExporter.js";
2
+ export { USDObject } from "./ThreeUSDZExporter.js";
3
+ export { type UsdzBehaviour } from "./extensions/behavior/Behaviour.js";
src/engine-components/js-extensions/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./ExtensionUtils"
2
- export * from "./Object3D"
3
- export * from "./RGBAColor"
1
+ export * from "./ExtensionUtils.js"
2
+ export * from "./Object3D.js"
3
+ export * from "./RGBAColor.js"
src/engine-components/postprocessing/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./VolumeParameter"
2
- export * from "./PostProcessingHandler"
3
- export * from "./PostProcessingEffect";
4
- export * from "./VolumeProfile";
1
+ export * from "./VolumeParameter.js"
2
+ export * from "./PostProcessingHandler.js"
3
+ export * from "./PostProcessingEffect.js";
4
+ export * from "./VolumeProfile.js";
src/engine-components/timeline/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./SignalAsset"
2
- export * from "./TimelineTracks"
3
- export * from "./TimelineModels"
1
+ export * from "./SignalAsset.js"
2
+ export * from "./TimelineTracks.js"
3
+ export * from "./TimelineModels.js"
src/engine-components/ui/index.ts CHANGED
@@ -1,1 +1,1 @@
1
- export * from "./PointerEvents"
1
+ export * from "./PointerEvents.js"
src/engine-components/webxr/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./WebXR";
2
- export * from "./WebXRPlaneTracking";
3
- export * from "./WebXRImageTracking";
4
- export * from "./WebXRController";
1
+ export * from "./WebXR.js";
2
+ export * from "./WebXRPlaneTracking.js";
3
+ export * from "./WebXRImageTracking.js";
4
+ export * from "./WebXRController.js";
src/engine/debug/index.ts CHANGED
@@ -1,1 +1,1 @@
1
- export * from "./debug";
1
+ export * from "./debug.js";
src/engine/extensions/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./extensions"
2
- export * from "./NEEDLE_animator_controller_model"
3
- export * from "./NEEDLE_progressive"
4
- export { CustomShader } from "./NEEDLE_techniques_webgl"
5
- export { SceneLightSettings } from "./NEEDLE_lighting_settings"
1
+ export * from "./extensions.js"
2
+ export * from "./NEEDLE_animator_controller_model.js"
3
+ export * from "./NEEDLE_progressive.js"
4
+ export { CustomShader } from "./NEEDLE_techniques_webgl.js"
5
+ export { SceneLightSettings } from "./NEEDLE_lighting_settings.js"
src/engine/js-extensions/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- import "./Layers"
2
- import "./Camera"
1
+ import "./Layers.js"
2
+ import "./Camera.js"
src/engine-components/ui/InputField.ts CHANGED
@@ -1,13 +1,11 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { IPointerClickHandler, IPointerEventHandler, PointerEventData } from "./PointerEvents";
3
- import { FrameEvent } from "../../engine/engine_setup";
4
- import { serializable } from "../../engine/engine_serialization_decorator";
5
- import { Text } from "./Text";
6
- import { getParam, isiOS } from "../../engine/engine_utils";
7
- import { EventList } from "../EventList";
8
- import { showBalloonMessage } from "../../engine/debug/debug";
9
- import { Physics } from "../../engine/engine_physics";
10
- import { tryGetUIComponent } from "./Utils";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { IPointerEventHandler } from "./PointerEvents.js";
3
+ import { FrameEvent } from "../../engine/engine_setup.js";
4
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
5
+ import { Text } from "./Text.js";
6
+ import { getParam, isiOS } from "../../engine/engine_utils.js";
7
+ import { EventList } from "../EventList.js";
8
+ import { tryGetUIComponent } from "./Utils.js";
11
9
 
12
10
  const debug = getParam("debuginputfield");
13
11
 
src/engine-components/Interactable.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Behaviour } from "./Component";
2
- import { IPointerClickHandler, IPointerEnterHandler, PointerEventData } from "./ui/PointerEvents";
1
+ import { Behaviour } from "./Component.js";
2
+ import { IPointerClickHandler, IPointerEnterHandler, PointerEventData } from "./ui/PointerEvents.js";
3
3
 
4
4
 
5
5
  export class Interactable extends Behaviour implements IPointerClickHandler {
src/engine-components/ui/Interfaces.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Behaviour } from "../Component";
2
- import { IComponent } from "../../engine/engine_types";
1
+ import { Behaviour } from "../Component.js";
2
+ import { IComponent } from "../../engine/engine_types.js";
3
3
 
4
4
  export interface ICanvas extends IComponent {
5
5
  get isCanvas(): boolean;
src/engine-components/Joints.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Vector3 } from "three";
2
- import { serializable } from "../engine/engine_serialization";
3
- import { Behaviour } from "./Component";
4
- import { Rigidbody } from "./RigidBody";
2
+ import { serializable } from "../engine/engine_serialization.js";
3
+ import { Behaviour } from "./Component.js";
4
+ import { Rigidbody } from "./RigidBody.js";
5
5
 
6
6
  export abstract class Joint extends Behaviour {
7
7
  @serializable(Rigidbody)
src/engine-components/ui/Layout.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ILayoutGroup, IRectTransform, IRectTransformChangedReceiver } from "./Interfaces";
2
- import { Behaviour, GameObject } from "../Component";
3
- import { serializable } from "../../engine/engine_serialization";
4
- import { Canvas } from "./Canvas";
5
- import { RectTransform } from "./RectTransform";
6
- import { getParam } from "../../engine/engine_utils";
1
+ import { ILayoutGroup, IRectTransform, IRectTransformChangedReceiver } from "./Interfaces.js";
2
+ import { Behaviour, GameObject } from "../Component.js";
3
+ import { serializable } from "../../engine/engine_serialization.js";
4
+ import { Canvas } from "./Canvas.js";
5
+ import { RectTransform } from "./RectTransform.js";
6
+ import { getParam } from "../../engine/engine_utils.js";
7
7
 
8
8
  const debug = getParam("debuguilayout");
9
9
 
src/engine-components/Light.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import { getParam, isMobileDevice } from "../engine/engine_utils";
4
- import { setWorldPositionXYZ } from "../engine/engine_three_utils";
5
- import { FrameEvent } from "../engine/engine_setup";
6
- import { serializable } from "../engine/engine_serialization_decorator";
3
+ import { getParam, isMobileDevice } from "../engine/engine_utils.js";
4
+ import { setWorldPositionXYZ } from "../engine/engine_three_utils.js";
5
+ import { FrameEvent } from "../engine/engine_setup.js";
6
+ import { serializable } from "../engine/engine_serialization_decorator.js";
7
7
  import { Color, DirectionalLight, OrthographicCamera } from "three";
8
- import { WebXR, WebXREvent } from "./webxr/WebXR";
9
- import { WebARSessionRoot } from "./webxr/WebARSessionRoot";
10
- import { ILight } from "../engine/engine_types";
11
- import { Mathf } from "../engine/engine_math";
12
- import { isLocalNetwork } from "../engine/engine_networking_utils";
8
+ import { WebXR, WebXREvent } from "./webxr/WebXR.js";
9
+ import { WebARSessionRoot } from "./webxr/WebARSessionRoot.js";
10
+ import { ILight } from "../engine/engine_types.js";
11
+ import { Mathf } from "../engine/engine_math.js";
12
+ import { isLocalNetwork } from "../engine/engine_networking_utils.js";
13
13
 
14
14
  // https://threejs.org/examples/webgl_shadowmap_csm.html
15
15
 
src/engine-components/LODGroup.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import { Renderer } from "./Renderer";
4
- import { getParam } from "../engine/engine_utils";
5
- import { serializable } from "../engine/engine_serialization_decorator";
3
+ import { Renderer } from "./Renderer.js";
4
+ import { getParam } from "../engine/engine_utils.js";
5
+ import { serializable } from "../engine/engine_serialization_decorator.js";
6
6
  import { Vector3 } from "three";
7
- import { isDevEnvironment } from "../engine/debug";
8
- import { GuidsMap } from "../engine/engine_types";
7
+ import { isDevEnvironment } from "../engine/debug/index.js";
8
+ import { GuidsMap } from "../engine/engine_types.js";
9
9
 
10
10
  const debug = getParam("debugLODs");
11
11
  const noLods = getParam("noLODs");
src/engine-components/debug/LogStats.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour } from "../../engine-components/Component";
2
- import { FrameEvent } from "../../engine/engine_setup";
3
- import { getParam } from "../../engine/engine_utils";
1
+ import { Behaviour } from "../../engine-components/Component.js";
2
+ import { FrameEvent } from "../../engine/engine_setup.js";
3
+ import { getParam } from "../../engine/engine_utils.js";
4
4
 
5
5
  const debug = getParam("logstats");
6
6
 
src/engine-components/utils/LookAt.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { serializable } from "../../engine/engine_serialization";
2
- import { Behaviour } from "../Component";
1
+ import { serializable } from "../../engine/engine_serialization.js";
2
+ import { Behaviour } from "../Component.js";
3
3
  import { Matrix4, Object3D, Quaternion, Vector3 } from "three";
4
- import { getWorldPosition, getWorldQuaternion, setWorldQuaternion } from "../../engine/engine_three_utils";
4
+ import { getWorldPosition, getWorldQuaternion, setWorldQuaternion } from "../../engine/engine_three_utils.js";
5
5
 
6
- import { USDObject } from "../../engine-components/export/usdz/ThreeUSDZExporter";
7
- import { UsdzBehaviour } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
8
- import { ActionBuilder, BehaviorModel, TriggerBuilder, USDVec3 } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
6
+ import { USDObject } from "../../engine-components/export/usdz/ThreeUSDZExporter.js";
7
+ import { UsdzBehaviour } from "../../engine-components/export/usdz/extensions/behavior/Behaviour.js";
8
+ import { ActionBuilder, BehaviorModel, TriggerBuilder, USDVec3 } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
9
9
 
10
10
  export class LookAt extends Behaviour implements UsdzBehaviour {
11
11
 
src/engine-components/LookAtConstraint.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import { serializable } from "../engine/engine_serialization_decorator";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
4
  import { Object3D } from "three";
5
5
 
6
6
  export class LookAtConstraint extends Behaviour {
src/engine/extensions/NEEDLE_animator_controller_model.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Animator } from "../../engine-components/Animator";
1
+ import { Animator } from "../../engine-components/Animator.js";
2
2
  import { AnimationAction, AnimationClip, MathUtils, Object3D } from "three"
3
- import { Context } from "../engine_setup";
4
- import { InstantiateIdProvider } from "../../engine/engine_networking_instantiate";
3
+ import { Context } from "../engine_setup.js";
4
+ import { InstantiateIdProvider } from "../../engine/engine_networking_instantiate.js";
5
5
 
6
6
 
7
7
  export declare type AnimatorControllerModel = {
src/engine/extensions/NEEDLE_components.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
2
- import { NodeToObjectMap, ObjectToNodeMap, SerializationContext } from "../engine_serialization_core";
1
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
2
+ import { NodeToObjectMap, ObjectToNodeMap, SerializationContext } from "../engine_serialization_core.js";
3
3
  import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
4
- import { debugExtension } from "../engine_default_parameters";
5
- import { builtinComponentKeyName } from "../engine_constants";
6
- import { resolveReferences } from "./extension_utils";
7
- import { apply } from "../../engine-components/js-extensions/Object3D";
8
- import { getLoader } from "../engine_gltf";
4
+ import { debugExtension } from "../engine_default_parameters.js";
5
+ import { builtinComponentKeyName } from "../engine_constants.js";
6
+ import { resolveReferences } from "./extension_utils.js";
7
+ import { apply } from "../../engine-components/js-extensions/Object3D.js";
8
+ import { getLoader } from "../engine_gltf.js";
9
9
  import { Object3D } from "three";
10
10
 
11
11
  export const debug = debugExtension
src/engine/extensions/NEEDLE_gameobject_data.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Object3D } from "three";
2
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
2
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
3
 
4
4
  export const EXTENSION_NAME = "NEEDLE_gameobject_data";
5
5
 
src/engine/extensions/NEEDLE_lighting_settings.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { AmbientLight, Color, HemisphereLight, Object3D } from "three";
2
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
3
- import { SourceIdentifier } from "../engine_types";
4
- import { Behaviour, GameObject } from "../../engine-components/Component";
5
- import { AmbientMode, DefaultReflectionMode } from "../engine_scenelighting";
6
- import { LightmapType } from "./NEEDLE_lightmaps";
7
- import { getParam } from "../engine_utils";
8
- import { Context } from "../engine_setup";
2
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
+ import { SourceIdentifier } from "../engine_types.js";
4
+ import { Behaviour, GameObject } from "../../engine-components/Component.js";
5
+ import { AmbientMode, DefaultReflectionMode } from "../engine_scenelighting.js";
6
+ import { LightmapType } from "./NEEDLE_lightmaps.js";
7
+ import { getParam } from "../engine_utils.js";
8
+ import { Context } from "../engine_setup.js";
9
9
  import { LightProbe } from "three";
10
- import { ContextEvent, ContextRegistry } from "../engine_context_registry";
11
- import { Mathf } from "../engine_math";
10
+ import { ContextEvent, ContextRegistry } from "../engine_context_registry.js";
11
+ import { Mathf } from "../engine_math.js";
12
12
 
13
13
  export const EXTENSION_NAME = "NEEDLE_lighting_settings";
14
14
  const debug = getParam("debugenvlight");
src/engine/extensions/NEEDLE_lightmaps.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ILightDataRegistry } from "../engine_lightdata";
1
+ import { ILightDataRegistry } from "../engine_lightdata.js";
2
2
  import { FloatType, HalfFloatType, LinearEncoding, LinearSRGBColorSpace, SRGBColorSpace, sRGBEncoding, Texture } from "three";
3
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
4
- import { SourceIdentifier } from "../engine_types";
5
- import { resolveReferences } from "./extension_utils";
6
- import { getParam } from "../engine_utils";
3
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { SourceIdentifier } from "../engine_types.js";
5
+ import { resolveReferences } from "./extension_utils.js";
6
+ import { getParam } from "../engine_utils.js";
7
7
 
8
8
  // the lightmap extension is aimed to also export export skyboxes and custom reflection maps
9
9
  // should we rename it?
src/engine/extensions/NEEDLE_persistent_assets.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { resolveReferences } from "./extension_utils";
2
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
3
- import { IExtensionReferenceResolver } from "./extension_resolver";
4
- import { debugExtension } from "../engine_default_parameters";
5
- import { TypeStore } from "../engine_typestore";
1
+ import { resolveReferences } from "./extension_utils.js";
2
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
+ import { IExtensionReferenceResolver } from "./extension_resolver.js";
4
+ import { debugExtension } from "../engine_default_parameters.js";
5
+ import { TypeStore } from "../engine_typestore.js";
6
6
 
7
7
  export const EXTENSION_NAME = "NEEDLE_persistent_assets";
8
8
 
src/engine/extensions/NEEDLE_progressive.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Material, RawShaderMaterial, Texture, TextureLoader } from "three";
2
- import { GLTF, GLTFLoader, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
3
- import { SourceIdentifier } from "../engine_types";
4
- import { Context } from "../engine_setup";
5
- import { addDracoAndKTX2Loaders } from "../engine_loaders";
6
- import { delay, getParam, resolveUrl } from "../engine_utils";
2
+ import { GLTF, GLTFLoader, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
+ import { SourceIdentifier } from "../engine_types.js";
4
+ import { Context } from "../engine_setup.js";
5
+ import { addDracoAndKTX2Loaders } from "../engine_loaders.js";
6
+ import { delay, getParam, resolveUrl } from "../engine_utils.js";
7
7
 
8
8
  export const EXTENSION_NAME = "NEEDLE_progressive";
9
9
 
src/engine/extensions/NEEDLE_render_objects.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
- import { SourceIdentifier } from "../engine_types";
3
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
4
- import { IComponent as Component, IRenderer } from "../engine_types";
2
+ import { SourceIdentifier } from "../engine_types.js";
3
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { IComponent as Component, IRenderer } from "../engine_types.js";
5
5
 
6
6
  import {
7
7
  // stencil funcs
@@ -25,10 +25,10 @@
25
25
  StencilFunc,
26
26
  StencilOp as ThreeStencilOp,
27
27
  } from "three";
28
- import { getParam, isDebugMode } from "../engine_utils";
29
- import { showBalloonWarning } from "../debug";
30
- import { isUsingInstancing } from "../engine_gameobject";
31
- import { isLocalNetwork } from "../engine_networking_utils";
28
+ import { getParam } from "../engine_utils.js";
29
+ import { showBalloonWarning } from "../debug/index.js";
30
+ import { isUsingInstancing } from "../engine_gameobject.js";
31
+ import { isLocalNetwork } from "../engine_networking_utils.js";
32
32
 
33
33
  const debug = getParam("debugstencil");
34
34
 
src/engine/extensions/NEEDLE_techniques_webgl.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
2
- import { FindShaderTechniques, whiteDefaultTexture, ToUnityMatrixArray, SetUnitySphericalHarmonics } from '../engine_shaders';
1
+ import { GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
2
+ import { FindShaderTechniques, whiteDefaultTexture, ToUnityMatrixArray, SetUnitySphericalHarmonics } from '../engine_shaders.js';
3
3
  import { AlwaysDepth, BackSide, Camera, DoubleSide, EqualDepth, FrontSide, GLSL3, GreaterDepth, GreaterEqualDepth, IUniform, LessDepth, LessEqualDepth, LinearEncoding, LinearSRGBColorSpace, Material, Matrix4, NotEqualDepth, Object3D, RawShaderMaterial, Texture, Vector3, Vector4 } from 'three';
4
- import { Context } from '../engine_setup';
5
- import { getParam } from "../engine_utils";
6
- import * as SHADERDATA from "../shaders/shaderData"
7
- import { SourceIdentifier } from "../engine_types";
8
- import { ILight } from "../engine_types";
9
- import { getWorldPosition } from "../engine_three_utils";
4
+ import { Context } from '../engine_setup.js';
5
+ import { getParam } from "../engine_utils.js";
6
+ import * as SHADERDATA from "../shaders/shaderData.js"
7
+ import { SourceIdentifier } from "../engine_types.js";
8
+ import { ILight } from "../engine_types.js";
9
+ import { getWorldPosition } from "../engine_three_utils.js";
10
10
 
11
11
  const debug = getParam("debugcustomshader");
12
12
 
src/needle-engine.ts CHANGED
@@ -1,49 +1,50 @@
1
- import { makeErrorsVisibleForDevelopment } from "./engine/debug/debug_overlay";
2
- makeErrorsVisibleForDevelopment();
3
-
4
- import "./engine/engine_element";
5
- import "./engine/engine_setup";
6
- export * from "./engine/api";
7
- export * from "./engine-components/api";
8
- export * from "./engine-components-experimental/api";
9
-
10
- // make accessible for external javascript
11
- import { Context } from "./engine/engine_setup";
12
- const Needle = { Context: Context };
13
- if (globalThis["Needle"] !== undefined) {
14
- console.warn("Needle Engine is already imported");
15
- }
16
- globalThis["Needle"] = Needle;
17
- function registerGlobal(obj: object) {
18
- for (const key in obj) {
19
- Needle[key] = obj[key];
20
- }
21
- }
22
- import * as Component from "./engine-components/Component";
23
- registerGlobal(Component);
24
-
25
- import * as Components from "./engine-components/codegen/components";
26
- registerGlobal(Components);
27
-
28
-
29
- import { GameObject } from "./engine-components/Component";
30
- for (const method of Object.getOwnPropertyNames(GameObject)) {
31
- switch (method) {
32
- case "prototype":
33
- case "constructor":
34
- case "length":
35
- case "name":
36
- continue;
37
- default:
38
- Needle[method] = GameObject[method];
39
- break;
40
- }
41
- }
42
-
43
- // make three accessible
44
- import * as THREE from "three";
45
- if (!globalThis["THREE"]) {
46
- globalThis["THREE"] = THREE;
47
- }
48
- else console.warn("Threejs is already imported");
49
-
1
+ import { makeErrorsVisibleForDevelopment } from "./engine/debug/debug_overlay.js";
2
+ makeErrorsVisibleForDevelopment();
3
+
4
+ import "./engine/engine_element.js";
5
+ import "./engine/engine_setup.js";
6
+ export * from "./engine/api.js";
7
+ export * from "./engine-components/api.js";
8
+ export * from "./engine-components-experimental/api.js";
9
+ export * from "./engine-schemes/api.js";
10
+
11
+ // make accessible for external javascript
12
+ import { Context } from "./engine/engine_setup.js";
13
+ const Needle = { Context: Context };
14
+ if (globalThis["Needle"] !== undefined) {
15
+ console.warn("Needle Engine is already imported");
16
+ }
17
+ globalThis["Needle"] = Needle;
18
+ function registerGlobal(obj: object) {
19
+ for (const key in obj) {
20
+ Needle[key] = obj[key];
21
+ }
22
+ }
23
+ import * as Component from "./engine-components/Component.js";
24
+ registerGlobal(Component);
25
+
26
+ import * as Components from "./engine-components/codegen/components.js";
27
+ registerGlobal(Components);
28
+
29
+
30
+ import { GameObject } from "./engine-components/Component.js";
31
+ for (const method of Object.getOwnPropertyNames(GameObject)) {
32
+ switch (method) {
33
+ case "prototype":
34
+ case "constructor":
35
+ case "length":
36
+ case "name":
37
+ continue;
38
+ default:
39
+ Needle[method] = GameObject[method];
40
+ break;
41
+ }
42
+ }
43
+
44
+ // make three accessible
45
+ import * as THREE from "three";
46
+ if (!globalThis["THREE"]) {
47
+ globalThis["THREE"] = THREE;
48
+ }
49
+ else console.warn("Threejs is already imported");
50
+
src/engine-components/NestedGltf.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { getParam } from "../engine/engine_utils";
2
- import { Behaviour } from "../engine-components/Component";
3
- import { AssetReference, ProgressCallback } from "../engine/engine_addressables";
4
- import { serializable } from "../engine/engine_serialization_decorator";
5
- import { InstantiateIdProvider } from "../engine/engine_networking_instantiate";
6
- import { InstantiateOptions } from "../engine/engine_gameobject";
1
+ import { getParam } from "../engine/engine_utils.js";
2
+ import { Behaviour } from "../engine-components/Component.js";
3
+ import { AssetReference, ProgressCallback } from "../engine/engine_addressables.js";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
+ import { InstantiateIdProvider } from "../engine/engine_networking_instantiate.js";
6
+ import { InstantiateOptions } from "../engine/engine_gameobject.js";
7
7
 
8
8
  const debug = getParam("debugnestedgltf");
9
9
 
src/engine-components/Networking.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { serializable } from "../engine/engine_serialization";
2
- import { INetworkingWebsocketUrlProvider } from "../engine/engine_networking";
3
- import { isLocalNetwork } from "../engine/engine_networking_utils";
4
- import { getParam } from "../engine/engine_utils";
5
- import { Behaviour } from "./Component";
1
+ import { serializable } from "../engine/engine_serialization.js";
2
+ import { INetworkingWebsocketUrlProvider } from "../engine/engine_networking.js";
3
+ import { isLocalNetwork } from "../engine/engine_networking_utils.js";
4
+ import { getParam } from "../engine/engine_utils.js";
5
+ import { Behaviour } from "./Component.js";
6
6
 
7
7
  const debug = getParam("debugnet");
8
8
 
src/engine-components/js-extensions/Object3D.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { applyPrototypeExtensions, registerPrototypeExtensions } from "./ExtensionUtils";
1
+ import { applyPrototypeExtensions, registerPrototypeExtensions } from "./ExtensionUtils.js";
2
2
  import { Object3D } from "three";
3
- import { Constructor, ConstructorConcrete, IComponent } from "../../engine/engine_types"
4
- import { IComponent as Component } from "../../engine/engine_types";
5
- import { moveComponentInstance, addNewComponent, getComponent, getComponentInChildren, getComponentInParent, getComponents, getComponentsInChildren, getComponentsInParent, getOrAddComponent, removeComponent } from "../../engine/engine_components";
6
- import { isActiveSelf, setActive, destroy } from "../../engine/engine_gameobject";
3
+ import { Constructor, ConstructorConcrete, IComponent } from "../../engine/engine_types.js"
4
+ import { IComponent as Component } from "../../engine/engine_types.js";
5
+ import { moveComponentInstance, addNewComponent, getComponent, getComponentInChildren, getComponentInParent, getComponents, getComponentsInChildren, getComponentsInParent, getOrAddComponent, removeComponent } from "../../engine/engine_components.js";
6
+ import { isActiveSelf, setActive, destroy } from "../../engine/engine_gameobject.js";
7
7
 
8
8
  // used to decorate cloned object3D objects with the same added components defined above
9
9
  export function apply(object: Object3D) {
src/engine-components/OffsetConstraint.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import * as utils from "./../engine/engine_three_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import * as utils from "./../engine/engine_three_utils.js";
3
3
  import { Quaternion, Euler, Vector3, Plane } from "three";
4
- import { serializable } from "../engine/engine_serialization_decorator";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
5
 
6
6
  export class OffsetConstraint extends Behaviour {
7
7
 
src/engine-components/utils/OpenURL.ts CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
- import { IPointerClickHandler, PointerEventData } from "../ui";
3
- import { Behaviour } from "../Component";
4
- import { serializable } from "../../engine/engine_serialization";
5
- import { isDevEnvironment, showBalloonMessage } from "../../engine/debug";
6
- import { isSafari } from "../../engine/engine_utils";
7
- import { ObjectRaycaster, Raycaster } from "../ui/Raycaster";
8
- import { tryGetUIComponent } from "../ui/Utils";
2
+ import { IPointerClickHandler, PointerEventData } from "../ui/index.js";
3
+ import { Behaviour } from "../Component.js";
4
+ import { serializable } from "../../engine/engine_serialization.js";
5
+ import { isDevEnvironment, showBalloonMessage } from "../../engine/debug/index.js";
6
+ import { isSafari } from "../../engine/engine_utils.js";
7
+ import { ObjectRaycaster, Raycaster } from "../ui/Raycaster.js";
8
+ import { tryGetUIComponent } from "../ui/Utils.js";
9
9
 
10
10
  export enum OpenURLMode {
11
11
  NewTab = 0,
src/engine-components/OrbitControls.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { Camera } from "./Camera";
3
- import { LookAtConstraint } from "./LookAtConstraint";
4
- import { getWorldPosition, getWorldRotation, setWorldPosition, setWorldRotation, slerp } from "../engine/engine_three_utils";
5
- import { RaycastOptions } from "../engine/engine_physics";
6
- import { serializable } from "../engine/engine_serialization_decorator";
7
- import { getParam, isMobileDevice } from "../engine/engine_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { Camera } from "./Camera.js";
3
+ import { LookAtConstraint } from "./LookAtConstraint.js";
4
+ import { getWorldPosition, getWorldRotation, setWorldPosition, setWorldRotation, slerp } from "../engine/engine_three_utils.js";
5
+ import { RaycastOptions } from "../engine/engine_physics.js";
6
+ import { serializable } from "../engine/engine_serialization_decorator.js";
7
+ import { getParam, isMobileDevice } from "../engine/engine_utils.js";
8
8
 
9
9
  import { Camera as ThreeCamera, Box3, Object3D, PerspectiveCamera, Vector2, Vector3, Box3Helper, GridHelper } from "three";
10
- import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
11
- import { AfterHandleInputEvent, EventSystem, EventSystemEvents } from "./ui/EventSystem";
12
- import { ICameraController } from "../engine/engine_types";
13
- import { setCameraController } from "../engine/engine_camera";
14
- import { SyncedTransform } from "./SyncedTransform";
15
- import { tryGetUIComponent } from "./ui/Utils";
10
+ import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
11
+ import { AfterHandleInputEvent, EventSystem, EventSystemEvents } from "./ui/EventSystem.js";
12
+ import { ICameraController } from "../engine/engine_types.js";
13
+ import { setCameraController } from "../engine/engine_camera.js";
14
+ import { SyncedTransform } from "./SyncedTransform.js";
15
+ import { tryGetUIComponent } from "./ui/Utils.js";
16
16
 
17
17
  const freeCam = getParam("freecam");
18
18
  const debugCameraFit = getParam("debugcamerafit");
@@ -59,6 +59,9 @@
59
59
  debugLog: boolean = false;
60
60
  targetLerpSpeed = 5;
61
61
 
62
+ /** When enabled OrbitControls will automatically raycast find a look at target in start */
63
+ autoTarget: boolean = true;
64
+
62
65
  private _lookTargetPosition!: Vector3;
63
66
  private _controls: ThreeOrbitControls | null = null;
64
67
  private _cameraObject: Object3D | null = null;
@@ -84,18 +87,20 @@
84
87
  }
85
88
 
86
89
  start() {
87
- if (this._controls) {
88
- const camGo = GameObject.getComponent(this.gameObject, Camera);
89
- if (camGo && !this.setFromTargetPosition()) {
90
- if (this.debugLog)
91
- console.log("NO TARGET");
92
- const worldPosition = getWorldPosition(camGo.cam);
93
- const distanceToCenter = worldPosition.length();
94
- const forward = new Vector3(0, 0, -distanceToCenter).applyMatrix4(camGo.cam.matrixWorld);
95
- this.setTarget(forward, true);
90
+ if (this.autoTarget) {
91
+ if (this._controls) {
92
+ const camGo = GameObject.getComponent(this.gameObject, Camera);
93
+ if (camGo && !this.setFromTargetPosition()) {
94
+ if (this.debugLog)
95
+ console.log("NO TARGET");
96
+ const worldPosition = getWorldPosition(camGo.cam);
97
+ const distanceToCenter = worldPosition.length();
98
+ const forward = new Vector3(0, 0, -distanceToCenter).applyMatrix4(camGo.cam.matrixWorld);
99
+ this.setTarget(forward, true);
100
+ }
96
101
  }
102
+ this.startCoroutine(this.startRaycastDelayed());
97
103
  }
98
- this.startCoroutine(this.startRaycastDelayed());
99
104
 
100
105
  this._eventSystem = EventSystem.get(this.context) ?? undefined;
101
106
  if (this._eventSystem) {
@@ -199,7 +204,7 @@
199
204
  // we need to wait one frame (when starting the scene for the very first time)
200
205
  private * startRaycastDelayed() {
201
206
  yield;
202
- if (!this.setFromTargetPosition()) {
207
+ if (this.autoTarget && !this.setFromTargetPosition()) {
203
208
  const opts = new RaycastOptions();
204
209
  // center of the screen:
205
210
  opts.screenPoint = new Vector2(0, 0);
@@ -226,8 +231,6 @@
226
231
  }
227
232
  this._inputs = 0;
228
233
 
229
- // if (this.context.input.getPointerLongPress(0) && this.context.time.frameCount % 20 === 0) console.log("LP", this.context.alias);
230
-
231
234
  let focusAtPointer = (this.middleClickToFocus && this.context.input.getPointerClicked(1));
232
235
  focusAtPointer ||= (this.doubleClickToFocus && this.context.input.getPointerDoubleClicked(0) && this.context.time.time - this._enableTime > .3);
233
236
  if (focusAtPointer) {
@@ -262,7 +265,6 @@
262
265
 
263
266
  // lerp the look target
264
267
  if (this._lerpToTargetPosition) {
265
-
266
268
  this.lerpTarget(this._lookTargetPosition, step);
267
269
  if (this._lookTargetPosition.distanceTo(this._controls.target) < .00001) {
268
270
  this._lerpToTargetPosition = false;
@@ -272,7 +274,6 @@
272
274
 
273
275
  if (!freeCam && this.lookAtConstraint?.locked) this.setFromTargetPosition(0, this.lookAtConstraint01);
274
276
 
275
-
276
277
  if (this._controls) {
277
278
  if (this.debugLog)
278
279
  this._controls.domElement = this.context.renderer.domElement;
@@ -403,7 +404,7 @@
403
404
  box.getSize(size);
404
405
  box.setFromCenterAndSize(center, size);
405
406
  if (size.length() <= 0.0000000001) {
406
- if(debugCameraFit) console.warn("Camera fit size is zero", box, [...objects]);
407
+ if (debugCameraFit) console.warn("Camera fit size is zero", box, [...objects]);
407
408
  return;
408
409
  }
409
410
 
@@ -426,7 +427,8 @@
426
427
 
427
428
  controls.maxDistance = distance * 10;
428
429
  controls.minDistance = distance * 0.01;
429
- controls.target.copy(center);
430
+ this.setTarget(center, true);
431
+ this.autoTarget = false;
430
432
 
431
433
  camera.near = distance / 100;
432
434
  camera.far = distance * 100;
src/engine-components/ui/Outline.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { RGBAColor } from "../js-extensions";
2
- import { serializable } from "../../engine/engine_serialization";
3
- import { Behaviour } from "../Component";
1
+ import { RGBAColor } from "../js-extensions/index.js";
2
+ import { serializable } from "../../engine/engine_serialization.js";
3
+ import { Behaviour } from "../Component.js";
4
4
  import { Color, Vector2 } from "three"
5
5
 
6
6
  export class Outline extends Behaviour {
src/engine-components/ParticleSystem.ts CHANGED
@@ -1,24 +1,24 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import { MainModule, EmissionModule, ShapeModule, ParticleSystemShapeType, MinMaxCurve, MinMaxGradient, ColorOverLifetimeModule, SizeOverLifetimeModule, NoiseModule, ParticleSystemSimulationSpace, ParticleBurst, IParticleSystem, ParticleSystemRenderMode, TrailModule, VelocityOverLifetimeModule, TextureSheetAnimationModule, RotationOverLifetimeModule, LimitVelocityOverLifetimeModule, RotationBySpeedModule, InheritVelocityModule, SizeBySpeedModule, ColorBySpeedModule, ParticleSystemScalingMode } from "./ParticleSystemModules"
4
- import { getParam } from "../engine/engine_utils";
3
+ import { MainModule, EmissionModule, ShapeModule, ParticleSystemShapeType, MinMaxCurve, MinMaxGradient, ColorOverLifetimeModule, SizeOverLifetimeModule, NoiseModule, ParticleSystemSimulationSpace, ParticleBurst, IParticleSystem, ParticleSystemRenderMode, TrailModule, VelocityOverLifetimeModule, TextureSheetAnimationModule, RotationOverLifetimeModule, LimitVelocityOverLifetimeModule, RotationBySpeedModule, InheritVelocityModule, SizeBySpeedModule, ColorBySpeedModule, ParticleSystemScalingMode } from "./ParticleSystemModules.js"
4
+ import { getParam } from "../engine/engine_utils.js";
5
5
 
6
6
  // https://github.dev/creativelifeform/three-nebula
7
- // import System, { Emitter, Position, Life, SpriteRenderer, Particle, Body, MeshRenderer, } from 'three-nebula';
7
+ // import System, { Emitter, Position, Life, SpriteRenderer, Particle, Body, MeshRenderer, } from 'three-nebula.js';
8
8
 
9
- import { serializable } from "../engine/engine_serialization";
10
- import { RGBAColor } from "./js-extensions/RGBAColor";
9
+ import { serializable } from "../engine/engine_serialization.js";
10
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
11
11
  import { AxesHelper, BufferGeometry, Color, Material, Matrix4, Mesh, MeshStandardMaterial, Object3D, OneMinusDstAlphaFactor, PlaneGeometry, Quaternion, Sprite, SpriteMaterial, Vector3, Vector4 } from "three";
12
- import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldScale } from "../engine/engine_three_utils";
13
- import { assign } from "../engine/engine_serialization_core";
12
+ import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldScale } from "../engine/engine_three_utils.js";
13
+ import { assign } from "../engine/engine_serialization_core.js";
14
14
  import { BatchedParticleRenderer, Behavior, BillBoardSettings, BurstParameters, ColorGenerator, ConstantColor, ConstantValue, EmissionState, EmitSubParticleSystem, EmitterShape, FunctionColorGenerator, FunctionJSON, FunctionValueGenerator, IntervalValue, MeshSettings, Particle, ParticleEmitter, ParticleSystem as _ParticleSystem, ParticleSystemParameters, PointEmitter, RecordState, RenderMode, RotationGenerator, SizeOverLife, TrailBatch, TrailParticle, TrailSettings, ValueGenerator } from "three.quarks";
15
- import { createFlatTexture } from "../engine/engine_shaders";
16
- import { Mathf } from "../engine/engine_math";
17
- import { Context } from "../engine/engine_setup";
18
- import { ParticleSubEmitter } from "./ParticleSystemSubEmitter";
19
- import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive";
20
- import { Gizmos } from "../engine/engine_gizmos";
21
- import { isDevEnvironment, showBalloonWarning } from "../engine/debug";
15
+ import { createFlatTexture } from "../engine/engine_shaders.js";
16
+ import { Mathf } from "../engine/engine_math.js";
17
+ import { Context } from "../engine/engine_setup.js";
18
+ import { ParticleSubEmitter } from "./ParticleSystemSubEmitter.js";
19
+ import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive.js";
20
+ import { Gizmos } from "../engine/engine_gizmos.js";
21
+ import { isDevEnvironment, showBalloonWarning } from "../engine/debug/index.js";
22
22
 
23
23
  const debug = getParam("debugparticles");
24
24
  const suppressProgressiveLoading = getParam("noprogressive");
src/engine-components/ParticleSystemModules.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { Color, Matrix4, Object3D, PointLightShadow, Quaternion, Vector3, Vector2, Euler, Vector4, DirectionalLightHelper } from "three";
2
- import { Mathf } from "../engine/engine_math";
3
- import { serializable } from "../engine/engine_serialization";
4
- import { RGBAColor } from "./js-extensions/RGBAColor";
5
- import { AnimationCurve } from "./AnimationCurve";
6
- import { Vec2, Vec3 } from "../engine/engine_types";
7
- import { Context } from "../engine/engine_setup";
2
+ import { Mathf } from "../engine/engine_math.js";
3
+ import { serializable } from "../engine/engine_serialization.js";
4
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
5
+ import { AnimationCurve } from "./AnimationCurve.js";
6
+ import { Vec2, Vec3 } from "../engine/engine_types.js";
7
+ import { Context } from "../engine/engine_setup.js";
8
8
  import { EmitterShape, FrameOverLife, Particle, ShapeJSON } from "three.quarks";
9
9
  import { createNoise4D, NoiseFunction4D } from 'simplex-noise';
10
- import { Gizmos } from "../engine/engine_gizmos";
11
- import { getParam } from "../engine/engine_utils";
10
+ import { Gizmos } from "../engine/engine_gizmos.js";
11
+ import { getParam } from "../engine/engine_utils.js";
12
12
 
13
13
  const debug = getParam("debugparticles");
14
14
 
src/engine-components/ParticleSystemSubEmitter.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Behavior, Particle, EmissionState, ParticleSystem, ParticleEmitter } from "three.quarks";
2
2
  import { Vector3, Quaternion, Matrix4 } from "three";
3
- import { IParticleSystem } from "./ParticleSystemModules";
4
- import { CircularBuffer } from "../engine/engine_utils";
5
- import { $particleLife, SubEmitterType } from "./ParticleSystem";
3
+ import { IParticleSystem } from "./ParticleSystemModules.js";
4
+ import { CircularBuffer } from "../engine/engine_utils.js";
5
+ import { $particleLife, SubEmitterType } from "./ParticleSystem.js";
6
6
 
7
7
  const VECTOR_ONE = new Vector3(1, 1, 1);
8
8
  const VECTOR_Z = new Vector3(0, 0, 1);
src/engine-components/postprocessing/Effects/Pixelation.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { registerCustomEffectType } from "../VolumeProfile";
2
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
1
+ import { registerCustomEffectType } from "../VolumeProfile.js";
2
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
3
3
  import { PixelationEffect as PixelationEffectPP } from "postprocessing";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { serializable } from "../../../engine/engine_serialization";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { serializable } from "../../../engine/engine_serialization.js";
6
6
 
7
7
  export class PixelationEffect extends PostProcessingEffect {
8
8
  get typeName(): string {
src/engine-components/timeline/PlayableDirector.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { Animator } from '../Animator';
2
- import { Behaviour, GameObject } from '../Component';
1
+ import { Animator } from '../Animator.js';
2
+ import { Behaviour, GameObject } from '../Component.js';
3
3
  import * as THREE from 'three';
4
- import { AudioListener } from '../AudioListener';
5
- import { AudioSource } from '../AudioSource';
6
- import { SignalReceiver } from './SignalAsset';
7
- import * as Models from "./TimelineModels";
8
- import * as Tracks from "./TimelineTracks";
9
- import { deepClone, delay, getParam } from '../../engine/engine_utils';
10
- import { GuidsMap } from '../../engine/engine_types';
4
+ import { AudioListener } from '../AudioListener.js';
5
+ import { AudioSource } from '../AudioSource.js';
6
+ import { SignalReceiver } from './SignalAsset.js';
7
+ import * as Models from "./TimelineModels.js";
8
+ import * as Tracks from "./TimelineTracks.js";
9
+ import { deepClone, delay, getParam } from '../../engine/engine_utils.js';
10
+ import { GuidsMap } from '../../engine/engine_types.js';
11
11
  import { Object3D } from 'three';
12
- import { isLocalNetwork } from '../../engine/engine_networking_utils';
12
+ import { isLocalNetwork } from '../../engine/engine_networking_utils.js';
13
+ import { FrameEvent } from '../../engine/engine_context.js';
13
14
 
14
15
  const debug = getParam("debugtimeline");
15
16
 
@@ -181,7 +182,8 @@
181
182
  while (this._audioTracks.length > 0 && this._isPlaying && !AudioSource.userInteractionRegistered && this.waitForAudio)
182
183
  await delay(200);
183
184
  }
184
- this._internalUpdateRoutine = this.startCoroutine(this.internalUpdate());
185
+ this.invokeStateChangedMethodsOnTracks();
186
+ this._internalUpdateRoutine = this.startCoroutine(this.internalUpdate(), FrameEvent.OnBeforeRender);
185
187
  }
186
188
 
187
189
  pause() {
@@ -191,6 +193,7 @@
191
193
  this._isPaused = true;
192
194
  this.evaluate();
193
195
  this.invokePauseChangedMethodsOnTracks();
196
+ this.invokeStateChangedMethodsOnTracks();
194
197
  }
195
198
 
196
199
  stop() {
@@ -207,6 +210,7 @@
207
210
  this._isPlaying = false;
208
211
  this._isPaused = false;
209
212
  if (pauseChanged && !wasPlaying) this.invokePauseChangedMethodsOnTracks();
213
+ if(wasPlaying) this.invokeStateChangedMethodsOnTracks();
210
214
  if (this._internalUpdateRoutine)
211
215
  this.stopCoroutine(this._internalUpdateRoutine);
212
216
  this._internalUpdateRoutine = null;
@@ -285,6 +289,11 @@
285
289
  track.onPauseChanged?.call(track);
286
290
  }
287
291
  }
292
+ private invokeStateChangedMethodsOnTracks() {
293
+ for (const track of this.forEachTrack()) {
294
+ track.onStateChanged?.call(track, this._isPlaying);
295
+ }
296
+ }
288
297
 
289
298
  private *internalUpdate() {
290
299
  while (this._isPlaying && this.activeAndEnabled) {
@@ -379,11 +388,6 @@
379
388
  if (debug)
380
389
  console.log("Resolved binding", binding, "to", obj);
381
390
  track.outputs[i] = obj;
382
- if (obj instanceof Animator) {
383
- // TODO: should disable? animator but this is not the animator that is currently on the object? needs investigation
384
- // console.log("DISABLE ANIMATOR", obj, obj.name, binding, this._guidsMap);
385
- // obj.enabled = false;
386
- }
387
391
  }
388
392
  }
389
393
  else if (binding === null) {
@@ -433,7 +437,7 @@
433
437
  for (const clip of track.clips) {
434
438
  if (clip.end > this._duration) this._duration = clip.end;
435
439
  }
436
- for(const marker of track.markers){
440
+ for (const marker of track.markers) {
437
441
  if (marker.time > this._duration) this._duration = marker.time + .001;
438
442
  }
439
443
  }
@@ -495,6 +499,14 @@
495
499
  console.warn("Could not find animationClip for model", clipModel, track.name, this.name, this.playableAsset?.name);
496
500
  continue;
497
501
  }
502
+ // Try to share the mixer with the animator
503
+ if (binding instanceof Animator && binding.runtimeAnimatorController) {
504
+ if(!binding.__internalDidAwakeAndStart) binding.initializeRuntimeAnimatorController();
505
+ // Call bind once to ensure the animator is setup and has a mixer
506
+ if(!binding.runtimeAnimatorController.mixer) binding.runtimeAnimatorController.bind(binding);
507
+ handler.mixer = binding.runtimeAnimatorController.mixer;
508
+ }
509
+ // If we can not get the mixer from the animator then create a new one
498
510
  if (!handler.mixer)
499
511
  handler.mixer = new THREE.AnimationMixer(binding.gameObject);
500
512
  handler.clips.push(clip);
src/engine-components/PlayerColor.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { RoomEvents } from "../engine/engine_networking";
2
- import { Behaviour, GameObject } from "./Component";
1
+ import { RoomEvents } from "../engine/engine_networking.js";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
3
  import * as THREE from "three";
4
- import { AvatarMarker } from "./webxr/WebXRAvatar";
5
- import { WaitForSeconds } from "../engine/engine_coroutine";
4
+ import { AvatarMarker } from "./webxr/WebXRAvatar.js";
5
+ import { WaitForSeconds } from "../engine/engine_coroutine.js";
6
6
 
7
7
 
8
8
  export class PlayerColor extends Behaviour {
src/engine-components-experimental/networking/PlayerSync.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { Behaviour, Component, GameObject } from "../../engine-components/Component";
2
- import { AssetReference } from "../../engine/engine_addressables";
3
- import { serializable } from "../../engine/engine_serialization_decorator";
4
- import { syncField } from "../../engine/engine_networking_auto"
5
- import { RoomEvents } from "../../engine/engine_networking";
6
- import { syncDestroy } from "../../engine/engine_networking_instantiate";
7
- import { getParam } from "../../engine/engine_utils";
1
+ import { Behaviour, Component, GameObject } from "../../engine-components/Component.js";
2
+ import { AssetReference } from "../../engine/engine_addressables.js";
3
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
4
+ import { syncField } from "../../engine/engine_networking_auto.js"
5
+ import { RoomEvents } from "../../engine/engine_networking.js";
6
+ import { syncDestroy } from "../../engine/engine_networking_instantiate.js";
7
+ import { getParam } from "../../engine/engine_utils.js";
8
8
 
9
9
  import { Object3D } from "three";
10
- import { EventList } from "../../engine-components/EventList";
10
+ import { EventList } from "../../engine-components/EventList.js";
11
11
 
12
12
 
13
13
  const debug = getParam("debugplayersync");
src/engine-components/ui/PointerEvents.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Input } from "../../engine/engine_input";
1
+ import { Input } from "../../engine/engine_input.js";
2
2
 
3
3
  export interface IInputEventArgs {
4
4
  get used(): boolean;
src/engine-components/postprocessing/PostProcessingEffect.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { serializable } from "../../engine/engine_serialization";
1
+ import { serializable } from "../../engine/engine_serialization.js";
2
2
  import { Effect, Pass } from "postprocessing";
3
- import { VolumeParameter } from "./VolumeParameter";
4
- import { Component } from "../Component";
5
- import { ISerializable, SerializationContext } from "../../engine/engine_serialization_core";
6
- import { EditorModification, IEditorModification } from "../../engine/engine_editor-sync";
7
- import { getParam } from "../../engine/engine_utils";
3
+ import { VolumeParameter } from "./VolumeParameter.js";
4
+ import { Component } from "../Component.js";
5
+ import { ISerializable, SerializationContext } from "../../engine/engine_serialization_core.js";
6
+ import { EditorModification, IEditorModification } from "../../engine/engine_editor-sync.js";
7
+ import { getParam } from "../../engine/engine_utils.js";
8
8
 
9
9
  const debug = getParam("debugpost");
10
10
 
src/engine-components/postprocessing/PostProcessingHandler.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { HalfFloatType } from "three";
2
- import { Context } from "../../engine/engine_setup";
3
- import { getParam, isMobileDevice } from "../../engine/engine_utils";
2
+ import { Context } from "../../engine/engine_setup.js";
3
+ import { getParam, isMobileDevice } from "../../engine/engine_utils.js";
4
4
  import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, DepthDownsamplingPass, DepthOfFieldEffect, Effect, EffectComposer, EffectPass, HueSaturationEffect, NormalPass, Pass, PixelationEffect, RenderPass, SelectiveBloomEffect, SSAOEffect, VignetteEffect } from "postprocessing";
5
- import { showBalloonWarning } from "../../engine/debug/debug";
6
- import { Camera } from "../Camera";
7
- import { PostProcessingEffect } from "./PostProcessingEffect";
8
- import { Constructor } from "../../engine/engine_types";
5
+ import { showBalloonWarning } from "../../engine/debug/index.js";
6
+ import { Camera } from "../Camera.js";
7
+ import { PostProcessingEffect } from "./PostProcessingEffect.js";
8
+ import { Constructor } from "../../engine/engine_types.js";
9
9
 
10
10
  const debug = getParam("debugpost");
11
11
 
src/engine-components-experimental/Presentation.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Behaviour } from "../engine-components/Component";
2
- import { KeyCode } from "../engine/engine_input";
1
+ import { Behaviour } from "../engine-components/Component.js";
2
+ import { KeyCode } from "../engine/engine_input.js";
3
3
 
4
4
  export class PresentationMode extends Behaviour {
5
5
 
src/engine-components/export/usdz/utils/quicklook.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "../../../../engine/engine_setup";
1
+ import { Context } from "../../../../engine/engine_setup.js";
2
2
 
3
3
 
4
4
  export function ensureQuicklookLinkIsCreated(context: Context) : HTMLAnchorElement {
src/engine-components/ui/Raycaster.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { RaycastOptions } from "../../engine/engine_physics";
2
- import { Behaviour, Component } from "../Component";
3
- import { EventSystem } from "./EventSystem";
1
+ import { RaycastOptions } from "../../engine/engine_physics.js";
2
+ import { Behaviour, Component } from "../Component.js";
3
+ import { EventSystem } from "./EventSystem.js";
4
4
 
5
5
 
6
6
  export class Raycaster extends Behaviour {
src/engine-components/ui/RaycastUtils.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { foreachComponent } from "../../engine/engine_gameobject";
2
- import { objectSerializer } from "../../engine/engine_serialization_builtin_serializer";
3
- import { IComponent } from "../../engine/engine_types";
4
- import { $shadowDomOwner } from "./BaseUIComponent";
5
- import { ICanvasGroup, IGraphic } from "./Interfaces";
1
+ import { foreachComponent } from "../../engine/engine_gameobject.js";
2
+ import { objectSerializer } from "../../engine/engine_serialization_builtin_serializer.js";
3
+ import { IComponent } from "../../engine/engine_types.js";
4
+ import { $shadowDomOwner } from "./BaseUIComponent.js";
5
+ import { ICanvasGroup, IGraphic } from "./Interfaces.js";
6
6
  import { Object3D } from "three";
7
7
 
8
8
 
src/engine-components/ui/RectTransform.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as ThreeMeshUI from 'three-mesh-ui'
2
- import { BaseUIComponent } from "./BaseUIComponent";
3
- import { DocumentedOptions as ThreeMeshUIEveryOptions } from "three-mesh-ui/build/types/core/elements/MeshUIBaseElement";
4
- import { serializable } from "../../engine/engine_serialization_decorator";
2
+ import { BaseUIComponent } from "./BaseUIComponent.js";
3
+ import { DocumentedOptions as ThreeMeshUIEveryOptions } from "three-mesh-ui/build/types/core/elements/MeshUIBaseElement.js";
4
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
5
5
  import { Matrix4, Object3D, Quaternion, Vector2, Vector3 } from "three";
6
- import { getParam } from "../../engine/engine_utils";
7
- import { onChange } from "./Utils";
8
- import { foreachComponentEnumerator } from "../../engine/engine_gameobject";
9
- import { ICanvas, IRectTransform, IRectTransformChangedReceiver } from "./Interfaces";
10
- import { GameObject } from '../Component';
6
+ import { getParam } from "../../engine/engine_utils.js";
7
+ import { onChange } from "./Utils.js";
8
+ import { foreachComponentEnumerator } from "../../engine/engine_gameobject.js";
9
+ import { ICanvas, IRectTransform, IRectTransformChangedReceiver } from "./Interfaces.js";
10
+ import { GameObject } from '../Component.js';
11
11
 
12
12
  const debug = getParam("debugui");
13
13
  const debugLayout = getParam("debuguilayout");
src/engine-components/ReflectionProbe.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import { Box3, Color, EquirectangularReflectionMapping, LinearEncoding, LineBasicMaterial, Material, MeshStandardMaterial, Object3D, SrcAlphaFactor, SRGBColorSpace, sRGBEncoding, Texture, Vector3, WebGLCubeRenderTarget, WebGLRenderTarget } from "three";
3
- import { serializable } from "../engine/engine_serialization";
4
- import { Context } from "../engine/engine_setup";
5
- import { getWorldPosition, getWorldScale } from "../engine/engine_three_utils";
6
- import { IRenderer } from "../engine/engine_types";
7
- import { BoxHelperComponent } from "./BoxHelperComponent";
8
- import { getParam } from "../engine/engine_utils";
3
+ import { serializable } from "../engine/engine_serialization.js";
4
+ import { Context } from "../engine/engine_setup.js";
5
+ import { getWorldPosition, getWorldScale } from "../engine/engine_three_utils.js";
6
+ import { IRenderer } from "../engine/engine_types.js";
7
+ import { BoxHelperComponent } from "./BoxHelperComponent.js";
8
+ import { getParam } from "../engine/engine_utils.js";
9
9
 
10
10
  export const debug = getParam("debugreflectionprobe");
11
11
  const disable = getParam("noreflectionprobe");
src/engine-components/Renderer.ts CHANGED
@@ -1,22 +1,22 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import * as THREE from "three";
3
- // import { RendererCustomShader } from "./RendererCustomShader";
4
- import { RendererLightmap } from "./RendererLightmap";
5
- import { Context, FrameEvent } from "../engine/engine_setup";
6
- import { getParam } from "../engine/engine_utils";
7
- import { serializable } from "../engine/engine_serialization_decorator";
3
+ // import { RendererCustomShader } from "./RendererCustomShader.js";
4
+ import { RendererLightmap } from "./RendererLightmap.js";
5
+ import { Context, FrameEvent } from "../engine/engine_setup.js";
6
+ import { getParam } from "../engine/engine_utils.js";
7
+ import { serializable } from "../engine/engine_serialization_decorator.js";
8
8
  import { AxesHelper, Material, Matrix4, Mesh, Object3D, SkinnedMesh, Texture, Vector4 } from "three";
9
- import { NEEDLE_render_objects } from "../engine/extensions/NEEDLE_render_objects";
10
- import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive";
11
- import { NEED_UPDATE_INSTANCE_KEY } from "../engine/engine_instancing";
12
- import { IRenderer, ISharedMaterials } from "../engine/engine_types";
13
- import { ReflectionProbe } from "./ReflectionProbe";
14
- import { setCustomVisibility } from "../engine/js-extensions/Layers";
15
- import { isLocalNetwork } from "../engine/engine_networking_utils";
16
- import { showBalloonWarning } from "../engine/debug/debug";
9
+ import { NEEDLE_render_objects } from "../engine/extensions/NEEDLE_render_objects.js";
10
+ import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive.js";
11
+ import { NEED_UPDATE_INSTANCE_KEY } from "../engine/engine_instancing.js";
12
+ import { IRenderer, ISharedMaterials } from "../engine/engine_types.js";
13
+ import { ReflectionProbe } from "./ReflectionProbe.js";
14
+ import { setCustomVisibility } from "../engine/js-extensions/Layers.js";
15
+ import { isLocalNetwork } from "../engine/engine_networking_utils.js";
16
+ import { showBalloonWarning } from "../engine/debug/index.js";
17
17
 
18
18
  // for staying compatible with old code
19
- export { InstancingUtil } from "../engine/engine_instancing";
19
+ export { InstancingUtil } from "../engine/engine_instancing.js";
20
20
 
21
21
  const debugRenderer = getParam("debugrenderer");
22
22
  const suppressInstancing = getParam("noInstancing");
src/engine-components/RendererLightmap.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour, GameObject } from "./Component";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
2
  import { Material, Mesh, Shader, ShaderMaterial, Texture, Vector4 } from "three";
3
- import { Context, OnRenderCallback } from "../engine/engine_setup";
4
- import { getParam } from "../engine/engine_utils";
3
+ import { Context, OnRenderCallback } from "../engine/engine_setup.js";
4
+ import { getParam } from "../engine/engine_utils.js";
5
5
 
6
6
  const debug = getParam("debuglightmaps");
7
7
 
src/engine-components/js-extensions/RGBAColor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Mathf } from "../../engine/engine_math";
1
+ import { Mathf } from "../../engine/engine_math.js";
2
2
  import { Color } from "three";
3
3
 
4
4
  export class RGBAColor extends Color {
src/engine-components/RigidBody.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import * as THREE from 'three'
3
- import { getWorldPosition } from "../engine/engine_three_utils";
4
- import { serializable } from "../engine/engine_serialization_decorator";
5
- import { Watch } from "../engine/engine_utils";
3
+ import { getWorldPosition } from "../engine/engine_three_utils.js";
4
+ import { serializable } from "../engine/engine_serialization_decorator.js";
5
+ import { Watch } from "../engine/engine_utils.js";
6
6
  import { Matrix4, Object3D, Vector3 } from "three";
7
- import { IRigidbody } from "../engine/engine_types";
8
- import { CollisionDetectionMode, RigidbodyConstraints } from "../engine/engine_physics.types";
9
- import { validate } from "../engine/engine_util_decorator";
10
- import { Context, FrameEvent } from "../engine/engine_setup";
7
+ import { IRigidbody } from "../engine/engine_types.js";
8
+ import { CollisionDetectionMode, RigidbodyConstraints } from "../engine/engine_physics.types.js";
9
+ import { validate } from "../engine/engine_util_decorator.js";
10
+ import { Context, FrameEvent } from "../engine/engine_setup.js";
11
11
 
12
12
  class TransformWatch {
13
13
 
src/engine-components/SceneSwitcher.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { AssetReference } from "../engine/engine_addressables";
2
- import { InputEvents } from "../engine/engine_input";
3
- import { isLocalNetwork } from "../engine/engine_networking_utils";
4
- import { getParam, setParamWithoutReload } from "../engine/engine_utils";
5
- import { serializable } from "../engine/engine_serialization";
6
- import { Behaviour, GameObject } from "./Component";
7
- import { registerObservableAttribute } from "../engine/engine_element_extras";
1
+ import { AssetReference } from "../engine/engine_addressables.js";
2
+ import { InputEvents } from "../engine/engine_input.js";
3
+ import { isLocalNetwork } from "../engine/engine_networking_utils.js";
4
+ import { getParam, setParamWithoutReload } from "../engine/engine_utils.js";
5
+ import { serializable } from "../engine/engine_serialization.js";
6
+ import { Behaviour, GameObject } from "./Component.js";
7
+ import { registerObservableAttribute } from "../engine/engine_element_extras.js";
8
8
 
9
9
  const debug = getParam("debugsceneswitcher");
10
10
 
src/engine-schemes/schemes.ts CHANGED
@@ -1,19 +1,18 @@
1
1
 
2
2
  import * as flatbuffers from "flatbuffers"
3
- import { Transform } from "./transform";
4
- import { SyncedTransformModel } from "./synced-transform-model";
3
+ import { Transform } from "./transform.js";
4
+ import { SyncedTransformModel } from "./synced-transform-model.js";
5
5
 
6
6
  // registry
7
- const binaryIdentifierCasts : {[key:string] : (bin:flatbuffers.ByteBuffer) => object} = {};
7
+ export const binaryIdentifierCasts : {[key:string] : (bin:flatbuffers.ByteBuffer) => object} = {};
8
8
 
9
- export function registerType(identifier:string, cast: (bin:flatbuffers.ByteBuffer) => object) {
9
+ export function registerBinaryType(identifier:string, cast: (bin:flatbuffers.ByteBuffer) => object) {
10
10
  binaryIdentifierCasts[identifier] = cast;
11
11
  }
12
12
 
13
13
  // called by networking on receiving a new binary blob
14
14
  // it's just a little helper method so listeners dont have to cast to types every time
15
- export function tryCast(bin : flatbuffers.ByteBuffer) : object {
16
-
15
+ export function tryCastBinary(bin : flatbuffers.ByteBuffer) : object {
17
16
  const id = bin.getBufferIdentifier();
18
17
  const cast = binaryIdentifierCasts[id];
19
18
  const mod = cast(bin);
src/engine-components/ScreenCapture.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { VideoPlayer } from "./VideoPlayer";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { VideoPlayer } from "./VideoPlayer.js";
3
3
  import Peer, { MediaConnection } from "peerjs"
4
- import { Context } from "../engine/engine_setup";
5
- import { RoomEvents } from "../engine/engine_networking";
6
- import { UserJoinedOrLeftRoomModel } from "../engine/engine_networking";
7
- import { serializable } from "../engine/engine_serialization";
8
- import { IPointerClickHandler, PointerEventData } from "./ui/PointerEvents";
4
+ import { Context } from "../engine/engine_setup.js";
5
+ import { RoomEvents } from "../engine/engine_networking.js";
6
+ import { UserJoinedOrLeftRoomModel } from "../engine/engine_networking.js";
7
+ import { serializable } from "../engine/engine_serialization.js";
8
+ import { IPointerClickHandler, PointerEventData } from "./ui/PointerEvents.js";
9
9
  import { EventDispatcher } from "three";
10
- import { AudioSource } from "./AudioSource";
11
- import { getParam } from "../engine/engine_utils";
12
- import { IModel } from "../engine/engine_networking_types";
13
- import { showBalloonWarning } from "../engine/debug";
10
+ import { AudioSource } from "./AudioSource.js";
11
+ import { getParam } from "../engine/engine_utils.js";
12
+ import { IModel } from "../engine/engine_networking_types.js";
13
+ import { showBalloonWarning } from "../engine/debug/index.js";
14
14
 
15
15
  const debug = getParam("debugscreensharing");
16
16
 
src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { BlendFunction, DepthDownsamplingPass, Effect, NormalPass, SSAOEffect } from "postprocessing";
2
2
  import { Color, NeverDepth, PerspectiveCamera } from "three";
3
- import { serializable } from "../../../engine/engine_serialization";
4
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
5
- import { VolumeParameter } from "../VolumeParameter";
6
- import { registerCustomEffectType } from "../VolumeProfile";
3
+ import { serializable } from "../../../engine/engine_serialization.js";
4
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
5
+ import { VolumeParameter } from "../VolumeParameter.js";
6
+ import { registerCustomEffectType } from "../VolumeProfile.js";
7
7
 
8
8
 
9
9
  export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Color, NeverDepth, PerspectiveCamera } from "three";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { registerCustomEffectType } from "../VolumeProfile";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { registerCustomEffectType } from "../VolumeProfile.js";
6
6
  import { N8AOPostPass } from "n8ao";
7
- import { validate } from "../../../engine/engine_util_decorator";
7
+ import { validate } from "../../../engine/engine_util_decorator.js";
8
8
 
9
9
  // https://github.com/N8python/n8ao
10
10
 
src/engine-components/ShadowCatcher.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { RGBAColor } from "./js-extensions/RGBAColor";
3
- import { Renderer } from "./Renderer";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
3
+ import { Renderer } from "./Renderer.js";
4
4
  import { ShadowMaterial, AdditiveBlending, Material } from "three";
5
- import { serializable } from "../engine/engine_serialization_decorator";
5
+ import { serializable } from "../engine/engine_serialization_decorator.js";
6
6
 
7
7
  enum ShadowMode {
8
8
  ShadowMask = 0,
src/engine-components/timeline/SignalAsset.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { EventList } from "../EventList";
2
- import { Behaviour } from "../Component";
3
- import { serializable } from "../../engine/engine_serialization_decorator";
4
- import { getParam } from "../../engine/engine_utils";
1
+ import { EventList } from "../EventList.js";
2
+ import { Behaviour } from "../Component.js";
3
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
4
+ import { getParam } from "../../engine/engine_utils.js";
5
5
 
6
6
  const debug = getParam("debugsignals")
7
7
 
src/engine-components/Skybox.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { serializable } from "../engine/engine_serialization_decorator";
2
- import { Behaviour, GameObject } from "./Component";
1
+ import { serializable } from "../engine/engine_serialization_decorator.js";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
3
  import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js';
4
- import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader";
4
+ import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader.js";
5
5
  import { EquirectangularRefractionMapping, NeverDepth, SRGBColorSpace, sRGBEncoding, Texture, TextureLoader } from "three"
6
- import { syncField } from "../engine/engine_networking_auto";
7
- import { Camera } from "./Camera";
8
- import { addAttributeChangeCallback, getParam, removeAttributeChangeCallback } from "../engine/engine_utils";
9
- import { ContextRegistry } from "../engine/engine_context_registry";
10
- import { registerObservableAttribute } from "../engine/engine_element_extras";
11
- import { type IContext } from "../engine/engine_types";
12
- import { disposeObjectResources, setDisposable } from "../engine/engine_assetdatabase";
6
+ import { syncField } from "../engine/engine_networking_auto.js";
7
+ import { Camera } from "./Camera.js";
8
+ import { addAttributeChangeCallback, getParam, removeAttributeChangeCallback } from "../engine/engine_utils.js";
9
+ import { ContextRegistry } from "../engine/engine_context_registry.js";
10
+ import { registerObservableAttribute } from "../engine/engine_element_extras.js";
11
+ import { type IContext } from "../engine/engine_types.js";
12
+ import { disposeObjectResources, setDisposable } from "../engine/engine_assetdatabase.js";
13
13
 
14
14
  const debug = getParam("debugskybox");
15
15
 
src/engine-components/SmoothFollow.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Camera } from "./Camera";
2
- import { Behaviour, GameObject } from "./Component";
1
+ import { Camera } from "./Camera.js";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
3
  import * as THREE from "three";
4
- import { Mathf } from "../engine/engine_math";
5
- import { serializable } from "../engine/engine_serialization_decorator";
4
+ import { Mathf } from "../engine/engine_math.js";
5
+ import { serializable } from "../engine/engine_serialization_decorator.js";
6
6
  import { Object3D } from "three";
7
- import { getWorldPosition, getWorldQuaternion } from "../engine/engine_three_utils";
8
- import { Axes } from "../engine/engine_physics.types";
7
+ import { getWorldPosition, getWorldQuaternion } from "../engine/engine_three_utils.js";
8
+ import { Axes } from "../engine/engine_physics.types.js";
9
9
 
10
10
  export class SmoothFollow extends Behaviour {
11
11
 
src/engine-components/ui/SpatialHtml.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as THREE from 'three'
2
2
  import { HTMLMesh } from 'three/examples/jsm/interactive/HTMLMesh.js';
3
3
  import { InteractiveGroup } from 'three/examples/jsm/interactive/InteractiveGroup.js';
4
- import { getWorldEuler, getWorldRotation, setWorldRotationXYZ } from '../../engine/engine_three_utils';
5
- import { Behaviour } from '../Component';
4
+ import { getWorldEuler, getWorldRotation, setWorldRotationXYZ } from '../../engine/engine_three_utils.js';
5
+ import { Behaviour } from '../Component.js';
6
6
 
7
7
  export class SpatialHtml extends Behaviour {
8
8
 
src/engine-components/SpatialTrigger.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { BoxHelper, Layers } from "three";
2
- import { Behaviour, GameObject } from "./Component";
3
- import { BoxHelperComponent } from "./BoxHelperComponent"
4
- import { EventList } from "./EventList";
5
- import { serializable } from "../engine/engine_serialization_decorator";
6
- import { getParam } from "../engine/engine_utils";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
+ import { BoxHelperComponent } from "./BoxHelperComponent.js"
4
+ import { EventList } from "./EventList.js";
5
+ import { serializable } from "../engine/engine_serialization_decorator.js";
6
+ import { getParam } from "../engine/engine_utils.js";
7
7
 
8
8
  const debug = getParam("debugspatialtrigger");
9
9
 
src/engine-components/SpectatorCamera.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { Behaviour, Component, GameObject } from "./Component";
2
- import { Camera } from "./Camera";
1
+ import { Behaviour, Component, GameObject } from "./Component.js";
2
+ import { Camera } from "./Camera.js";
3
3
  import * as THREE from "three";
4
- import { OrbitControls } from "./OrbitControls";
5
- import { WebXR, WebXREvent } from "./webxr/WebXR";
6
- import { AvatarMarker } from "./webxr/WebXRAvatar";
7
- import { XRStateFlag } from "./XRFlag";
8
- import { SmoothFollow } from "./SmoothFollow";
4
+ import { OrbitControls } from "./OrbitControls.js";
5
+ import { WebXR, WebXREvent } from "./webxr/WebXR.js";
6
+ import { AvatarMarker } from "./webxr/WebXRAvatar.js";
7
+ import { XRStateFlag } from "./XRFlag.js";
8
+ import { SmoothFollow } from "./SmoothFollow.js";
9
9
  import { Object3D } from "three";
10
- import { InputEvents } from "../engine/engine_input";
11
- import { Context } from "../engine/engine_setup";
12
- import { getParam } from "../engine/engine_utils";
13
- import { PlayerView, ViewDevice } from "../engine/engine_playerview";
14
- import { RaycastOptions } from "../engine/engine_physics";
15
- import { RoomEvents } from "../engine/engine_networking";
16
- import { ICamera } from "../engine/engine_types";
17
- import { IModel } from "../engine/engine_networking_types";
18
- import { serializable } from "../engine/engine_serialization";
10
+ import { InputEvents } from "../engine/engine_input.js";
11
+ import { Context } from "../engine/engine_setup.js";
12
+ import { getParam } from "../engine/engine_utils.js";
13
+ import { PlayerView, ViewDevice } from "../engine/engine_playerview.js";
14
+ import { RaycastOptions } from "../engine/engine_physics.js";
15
+ import { RoomEvents } from "../engine/engine_networking.js";
16
+ import { ICamera } from "../engine/engine_types.js";
17
+ import { IModel } from "../engine/engine_networking_types.js";
18
+ import { serializable } from "../engine/engine_serialization.js";
19
19
 
20
20
 
21
21
  export enum SpectatorMode {
src/engine-components/SphereCollider.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { SphereCollider } from "./Collider";
1
+ import { SphereCollider } from "./Collider.js";
2
2
  export default SphereCollider;
src/engine-components/SpriteRenderer.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Behaviour } from "./Component";
1
+ import { Behaviour } from "./Component.js";
2
2
  import * as THREE from "three";
3
- import { serializable, serializeable } from "../engine/engine_serialization_decorator";
3
+ import { serializable, serializeable } from "../engine/engine_serialization_decorator.js";
4
4
  import { Color, Material, NearestFilter, Texture, Vector2, TextureFilter } from "three";
5
- import { RGBAColor } from "./js-extensions/RGBAColor";
6
- import { getParam } from "../engine/engine_utils";
5
+ import { RGBAColor } from "./js-extensions/RGBAColor.js";
6
+ import { getParam } from "../engine/engine_utils.js";
7
7
 
8
8
  const debug = getParam("debugspriterenderer");
9
9
  const showWireframe = getParam("wireframe");
src/engine-schemes/synced-camera-model.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as flatbuffers from 'flatbuffers';
4
4
 
5
- import { Vec3 } from './vec3';
5
+ import { Vec3 } from './vec3.js';
6
6
 
7
7
 
8
8
  export class SyncedCameraModel {
src/engine-schemes/synced-transform-model.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as flatbuffers from 'flatbuffers';
4
4
 
5
- import { Transform } from './transform';
5
+ import { Transform } from './transform.js';
6
6
 
7
7
 
8
8
  export class SyncedTransformModel {
src/engine-components/SyncedCamera.ts CHANGED
@@ -1,208 +1,208 @@
1
- import { NetworkConnection } from "../engine/engine_networking";
2
- import { Behaviour, GameObject } from "./Component";
3
- import { Camera } from "./Camera";
4
- import * as utils from "../engine/engine_three_utils"
5
- import { WebXR } from "./webxr/WebXR";
6
- import { Builder } from "flatbuffers";
7
- import { SyncedCameraModel } from "../engine-schemes/synced-camera-model";
8
- import { Vec3 } from "../engine-schemes/vec3";
9
- import { registerType } from "../engine-schemes/schemes";
10
- import { InstancingUtil } from "../engine/engine_instancing";
11
- import { serializable } from "../engine/engine_serialization_decorator";
12
- import { Object3D } from "three";
13
- import { AvatarMarker } from "./webxr/WebXRAvatar";
14
- import { AssetReference } from "../engine/engine_addressables";
15
- import { ViewDevice } from "../engine/engine_playerview";
16
- import { InstantiateOptions } from "../engine/engine_gameobject";
17
-
18
- const SyncedCameraModelIdentifier = "SCAM";
19
- registerType(SyncedCameraModelIdentifier, SyncedCameraModel.getRootAsSyncedCameraModel);
20
- const builder = new Builder();
21
-
22
- // enum CameraSyncEvent {
23
- // Update = "sync-update-camera",
24
- // }
25
-
26
- class CameraModel {
27
- userId: string;
28
- guid: string;
29
- // dontSave: boolean = true;
30
- // pos: { x: number, y: number, z: number } = { x: 0, y: 0, z: 0 };
31
- // rot: { x: number, y: number, z: number } = { x: 0, y: 0, z: 0 };
32
-
33
- constructor(connectionId: string, guid: string) {
34
- this.guid = guid;
35
- this.userId = connectionId;
36
- }
37
-
38
- send(cam: THREE.Camera | null | undefined, con: NetworkConnection) {
39
- if (cam) {
40
- builder.clear();
41
- const guid = builder.createString(this.guid);
42
- const userId = builder.createString(this.userId);
43
- SyncedCameraModel.startSyncedCameraModel(builder);
44
- SyncedCameraModel.addGuid(builder, guid);
45
- SyncedCameraModel.addUserId(builder, userId);
46
- const p = utils.getWorldPosition(cam);
47
- const r = utils.getWorldRotation(cam);
48
- SyncedCameraModel.addPos(builder, Vec3.createVec3(builder, p.x, p.y, p.z));
49
- SyncedCameraModel.addRot(builder, Vec3.createVec3(builder, r.x, r.y, r.z));
50
- const offset = SyncedCameraModel.endSyncedCameraModel(builder);
51
- builder.finish(offset, SyncedCameraModelIdentifier);
52
- con.sendBinary(builder.asUint8Array());
53
- }
54
- }
55
- }
56
-
57
- declare type UserCamInfo = {
58
- obj: THREE.Object3D,
59
- lastUpdate: number;
60
- userId: string;
61
- };
62
-
63
- export class SyncedCamera extends Behaviour {
64
-
65
- static instances: UserCamInfo[] = [];
66
-
67
- getCameraObject(userId: string): THREE.Object3D | null {
68
- const guid = this.userToCamMap[userId];
69
- if (!guid) return null;
70
- return this.remoteCams[guid].obj;
71
- }
72
-
73
- @serializable([Object3D, AssetReference])
74
- public cameraPrefab: THREE.Object3D | null | AssetReference = null;
75
-
76
- private _lastWorldPosition!: THREE.Vector3;
77
- private _lastWorldQuaternion!: THREE.Quaternion;
78
- private _model: CameraModel | null = null;
79
- private _needsUpdate: boolean = true;
80
- private _lastUpdateTime: number = 0;
81
-
82
- private remoteCams: { [id: string]: UserCamInfo } = {};
83
- private userToCamMap: { [id: string]: string } = {};
84
- private _camTimeoutInSeconds = 10;
85
- private _receiveCallback: Function | null = null;
86
-
87
- async awake() {
88
- this._lastWorldPosition = this.worldPosition.clone();
89
- this._lastWorldQuaternion = this.worldQuaternion.clone();
90
-
91
- if (this.cameraPrefab) {
92
-
93
- if ("uri" in this.cameraPrefab) {
94
- this.cameraPrefab = await this.cameraPrefab.instantiate(this.gameObject);
95
- }
96
-
97
- if (this.cameraPrefab && "isObject3D" in this.cameraPrefab) {
98
- this.cameraPrefab.visible = false;
99
- }
100
- }
101
-
102
- }
103
-
104
- onEnable(): void {
105
- this._receiveCallback = this.context.connection.beginListenBinary(SyncedCameraModelIdentifier, this.onReceivedRemoteCameraInfoBin.bind(this));
106
- }
107
-
108
- onDisable(): void {
109
- this.context.connection.stopListenBinary(SyncedCameraModelIdentifier, this._receiveCallback);
110
- }
111
-
112
- update(): void {
113
-
114
- for (const guid in this.remoteCams) {
115
- const cam = this.remoteCams[guid];
116
- const timeDiff = this.context.time.realtimeSinceStartup - cam.lastUpdate;
117
- if (!cam || (timeDiff) > this._camTimeoutInSeconds) {
118
- console.log("Remote cam timeout", cam, timeDiff);
119
- if (cam?.obj) {
120
- GameObject.destroy(cam.obj);
121
- }
122
- delete this.remoteCams[guid];
123
- if (cam)
124
- delete this.userToCamMap[cam.userId];
125
-
126
- SyncedCamera.instances.push(cam);
127
- this.context.players.removePlayerView(cam.userId, ViewDevice.Browser);
128
- continue;
129
- }
130
- }
131
-
132
- if (WebXR.IsInWebXR) return;
133
-
134
- const cam = this.context.mainCamera
135
- if (cam === null) {
136
- this.enabled = false;
137
- return;
138
- }
139
-
140
- if (!this.context.connection.isConnected || this.context.connection.connectionId === null) return;
141
-
142
- if (this._model === null) {
143
- this._model = new CameraModel(this.context.connection.connectionId, this.context.connection.connectionId + "_camera");
144
- }
145
-
146
- const wp = utils.getWorldPosition(cam);
147
- const wq = utils.getWorldQuaternion(cam);
148
- if (wp.distanceTo(this._lastWorldPosition) > 0.001 || wq.angleTo(this._lastWorldQuaternion) > 0.01) {
149
- this._needsUpdate = true;
150
- }
151
- this._lastWorldPosition.copy(wp);
152
- this._lastWorldQuaternion.copy(wq);
153
-
154
- if (!this._needsUpdate || this.context.time.frameCount % 2 !== 0) {
155
- if (this.context.time.realtimeSinceStartup - this._lastUpdateTime > this._camTimeoutInSeconds * .5) {
156
- // send update anyways to avoid timeout
157
- }
158
- else return;
159
- }
160
-
161
- this._lastUpdateTime = this.context.time.realtimeSinceStartup;
162
- this._needsUpdate = false;
163
- this._model.send(cam, this.context.connection);
164
- if (!this.context.isInXR)
165
- this.context.players.setPlayerView(this.context.connection.connectionId, cam, ViewDevice.Browser);
166
- }
167
-
168
- private onReceivedRemoteCameraInfoBin(model: SyncedCameraModel) {
169
- const guid = model.guid();
170
- if (!guid) return;
171
- const userId = model.userId();
172
- if (!userId) return;
173
- if (!this.context.connection.userIsInRoom(userId)) return;
174
- if (!this.cameraPrefab) return;
175
- let rc = this.remoteCams[guid];
176
- if (!rc) {
177
- if ("isObject3D" in this.cameraPrefab) {
178
- const opt = new InstantiateOptions();
179
- opt.context = this.context;
180
- const instance = GameObject.instantiate(this.cameraPrefab, opt) as GameObject;
181
- rc = this.remoteCams[guid] = { obj: instance, lastUpdate: this.context.time.realtimeSinceStartup, userId: userId };
182
- rc.obj.visible = true;
183
- this.gameObject.add(instance);
184
- this.userToCamMap[userId] = guid;
185
- SyncedCamera.instances.push(rc);
186
-
187
- const marker = GameObject.getOrAddComponent(instance, AvatarMarker);
188
- marker.connectionId = userId;
189
- marker.avatar = instance;
190
-
191
- }
192
- else {
193
- return;
194
- }
195
- // console.log(this.remoteCams);
196
- }
197
- const obj = rc.obj;
198
- this.context.players.setPlayerView(userId, obj, ViewDevice.Browser);
199
- rc.lastUpdate = this.context.time.realtimeSinceStartup;
200
- InstancingUtil.markDirty(obj);
201
- const pos = model.pos();
202
- if (pos)
203
- utils.setWorldPositionXYZ(obj, pos.x(), pos.y(), pos.z());
204
- const rot = model.rot();
205
- if (rot)
206
- utils.setWorldRotationXYZ(obj, rot.x(), rot.y(), rot.z());
207
- }
1
+ import { NetworkConnection } from "../engine/engine_networking.js";
2
+ import { Behaviour, GameObject } from "./Component.js";
3
+ import { Camera } from "./Camera.js";
4
+ import * as utils from "../engine/engine_three_utils.js"
5
+ import { WebXR } from "./webxr/WebXR.js";
6
+ import { Builder } from "flatbuffers";
7
+ import { SyncedCameraModel } from "../engine-schemes/synced-camera-model.js";
8
+ import { Vec3 } from "../engine-schemes/vec3.js";
9
+ import { registerBinaryType } from "../engine-schemes/schemes.js";
10
+ import { InstancingUtil } from "../engine/engine_instancing.js";
11
+ import { serializable } from "../engine/engine_serialization_decorator.js";
12
+ import { Object3D } from "three";
13
+ import { AvatarMarker } from "./webxr/WebXRAvatar.js";
14
+ import { AssetReference } from "../engine/engine_addressables.js";
15
+ import { ViewDevice } from "../engine/engine_playerview.js";
16
+ import { InstantiateOptions } from "../engine/engine_gameobject.js";
17
+
18
+ const SyncedCameraModelIdentifier = "SCAM";
19
+ registerBinaryType(SyncedCameraModelIdentifier, SyncedCameraModel.getRootAsSyncedCameraModel);
20
+ const builder = new Builder();
21
+
22
+ // enum CameraSyncEvent {
23
+ // Update = "sync-update-camera",
24
+ // }
25
+
26
+ class CameraModel {
27
+ userId: string;
28
+ guid: string;
29
+ // dontSave: boolean = true;
30
+ // pos: { x: number, y: number, z: number } = { x: 0, y: 0, z: 0 };
31
+ // rot: { x: number, y: number, z: number } = { x: 0, y: 0, z: 0 };
32
+
33
+ constructor(connectionId: string, guid: string) {
34
+ this.guid = guid;
35
+ this.userId = connectionId;
36
+ }
37
+
38
+ send(cam: THREE.Camera | null | undefined, con: NetworkConnection) {
39
+ if (cam) {
40
+ builder.clear();
41
+ const guid = builder.createString(this.guid);
42
+ const userId = builder.createString(this.userId);
43
+ SyncedCameraModel.startSyncedCameraModel(builder);
44
+ SyncedCameraModel.addGuid(builder, guid);
45
+ SyncedCameraModel.addUserId(builder, userId);
46
+ const p = utils.getWorldPosition(cam);
47
+ const r = utils.getWorldRotation(cam);
48
+ SyncedCameraModel.addPos(builder, Vec3.createVec3(builder, p.x, p.y, p.z));
49
+ SyncedCameraModel.addRot(builder, Vec3.createVec3(builder, r.x, r.y, r.z));
50
+ const offset = SyncedCameraModel.endSyncedCameraModel(builder);
51
+ builder.finish(offset, SyncedCameraModelIdentifier);
52
+ con.sendBinary(builder.asUint8Array());
53
+ }
54
+ }
55
+ }
56
+
57
+ declare type UserCamInfo = {
58
+ obj: THREE.Object3D,
59
+ lastUpdate: number;
60
+ userId: string;
61
+ };
62
+
63
+ export class SyncedCamera extends Behaviour {
64
+
65
+ static instances: UserCamInfo[] = [];
66
+
67
+ getCameraObject(userId: string): THREE.Object3D | null {
68
+ const guid = this.userToCamMap[userId];
69
+ if (!guid) return null;
70
+ return this.remoteCams[guid].obj;
71
+ }
72
+
73
+ @serializable([Object3D, AssetReference])
74
+ public cameraPrefab: THREE.Object3D | null | AssetReference = null;
75
+
76
+ private _lastWorldPosition!: THREE.Vector3;
77
+ private _lastWorldQuaternion!: THREE.Quaternion;
78
+ private _model: CameraModel | null = null;
79
+ private _needsUpdate: boolean = true;
80
+ private _lastUpdateTime: number = 0;
81
+
82
+ private remoteCams: { [id: string]: UserCamInfo } = {};
83
+ private userToCamMap: { [id: string]: string } = {};
84
+ private _camTimeoutInSeconds = 10;
85
+ private _receiveCallback: Function | null = null;
86
+
87
+ async awake() {
88
+ this._lastWorldPosition = this.worldPosition.clone();
89
+ this._lastWorldQuaternion = this.worldQuaternion.clone();
90
+
91
+ if (this.cameraPrefab) {
92
+
93
+ if ("uri" in this.cameraPrefab) {
94
+ this.cameraPrefab = await this.cameraPrefab.instantiate(this.gameObject);
95
+ }
96
+
97
+ if (this.cameraPrefab && "isObject3D" in this.cameraPrefab) {
98
+ this.cameraPrefab.visible = false;
99
+ }
100
+ }
101
+
102
+ }
103
+
104
+ onEnable(): void {
105
+ this._receiveCallback = this.context.connection.beginListenBinary(SyncedCameraModelIdentifier, this.onReceivedRemoteCameraInfoBin.bind(this));
106
+ }
107
+
108
+ onDisable(): void {
109
+ this.context.connection.stopListenBinary(SyncedCameraModelIdentifier, this._receiveCallback);
110
+ }
111
+
112
+ update(): void {
113
+
114
+ for (const guid in this.remoteCams) {
115
+ const cam = this.remoteCams[guid];
116
+ const timeDiff = this.context.time.realtimeSinceStartup - cam.lastUpdate;
117
+ if (!cam || (timeDiff) > this._camTimeoutInSeconds) {
118
+ console.log("Remote cam timeout", cam, timeDiff);
119
+ if (cam?.obj) {
120
+ GameObject.destroy(cam.obj);
121
+ }
122
+ delete this.remoteCams[guid];
123
+ if (cam)
124
+ delete this.userToCamMap[cam.userId];
125
+
126
+ SyncedCamera.instances.push(cam);
127
+ this.context.players.removePlayerView(cam.userId, ViewDevice.Browser);
128
+ continue;
129
+ }
130
+ }
131
+
132
+ if (WebXR.IsInWebXR) return;
133
+
134
+ const cam = this.context.mainCamera
135
+ if (cam === null) {
136
+ this.enabled = false;
137
+ return;
138
+ }
139
+
140
+ if (!this.context.connection.isConnected || this.context.connection.connectionId === null) return;
141
+
142
+ if (this._model === null) {
143
+ this._model = new CameraModel(this.context.connection.connectionId, this.context.connection.connectionId + "_camera");
144
+ }
145
+
146
+ const wp = utils.getWorldPosition(cam);
147
+ const wq = utils.getWorldQuaternion(cam);
148
+ if (wp.distanceTo(this._lastWorldPosition) > 0.001 || wq.angleTo(this._lastWorldQuaternion) > 0.01) {
149
+ this._needsUpdate = true;
150
+ }
151
+ this._lastWorldPosition.copy(wp);
152
+ this._lastWorldQuaternion.copy(wq);
153
+
154
+ if (!this._needsUpdate || this.context.time.frameCount % 2 !== 0) {
155
+ if (this.context.time.realtimeSinceStartup - this._lastUpdateTime > this._camTimeoutInSeconds * .5) {
156
+ // send update anyways to avoid timeout
157
+ }
158
+ else return;
159
+ }
160
+
161
+ this._lastUpdateTime = this.context.time.realtimeSinceStartup;
162
+ this._needsUpdate = false;
163
+ this._model.send(cam, this.context.connection);
164
+ if (!this.context.isInXR)
165
+ this.context.players.setPlayerView(this.context.connection.connectionId, cam, ViewDevice.Browser);
166
+ }
167
+
168
+ private onReceivedRemoteCameraInfoBin(model: SyncedCameraModel) {
169
+ const guid = model.guid();
170
+ if (!guid) return;
171
+ const userId = model.userId();
172
+ if (!userId) return;
173
+ if (!this.context.connection.userIsInRoom(userId)) return;
174
+ if (!this.cameraPrefab) return;
175
+ let rc = this.remoteCams[guid];
176
+ if (!rc) {
177
+ if ("isObject3D" in this.cameraPrefab) {
178
+ const opt = new InstantiateOptions();
179
+ opt.context = this.context;
180
+ const instance = GameObject.instantiate(this.cameraPrefab, opt) as GameObject;
181
+ rc = this.remoteCams[guid] = { obj: instance, lastUpdate: this.context.time.realtimeSinceStartup, userId: userId };
182
+ rc.obj.visible = true;
183
+ this.gameObject.add(instance);
184
+ this.userToCamMap[userId] = guid;
185
+ SyncedCamera.instances.push(rc);
186
+
187
+ const marker = GameObject.getOrAddComponent(instance, AvatarMarker);
188
+ marker.connectionId = userId;
189
+ marker.avatar = instance;
190
+
191
+ }
192
+ else {
193
+ return;
194
+ }
195
+ // console.log(this.remoteCams);
196
+ }
197
+ const obj = rc.obj;
198
+ this.context.players.setPlayerView(userId, obj, ViewDevice.Browser);
199
+ rc.lastUpdate = this.context.time.realtimeSinceStartup;
200
+ InstancingUtil.markDirty(obj);
201
+ const pos = model.pos();
202
+ if (pos)
203
+ utils.setWorldPositionXYZ(obj, pos.x(), pos.y(), pos.z());
204
+ const rot = model.rot();
205
+ if (rot)
206
+ utils.setWorldRotationXYZ(obj, rot.x(), rot.y(), rot.z());
207
+ }
208
208
  }
src/engine-components/SyncedRoom.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour } from "./Component";
2
- import * as utils from "../engine/engine_utils"
3
- import { serializable } from "../engine/engine_serialization_decorator";
4
- import { getParam } from "../engine/engine_utils";
1
+ import { Behaviour } from "./Component.js";
2
+ import * as utils from "../engine/engine_utils.js"
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
+ import { getParam } from "../engine/engine_utils.js";
5
5
 
6
6
  const viewParamName = "view";
7
7
  const debug = utils.getParam("debugsyncedroom");
src/engine-components/SyncedTransform.ts CHANGED
@@ -1,337 +1,337 @@
1
- import * as THREE from 'three'
2
- import { OwnershipModel, RoomEvents } from "../engine/engine_networking"
3
- import { Behaviour, GameObject } from "./Component";
4
- import { Rigidbody } from "./RigidBody";
5
- import * as utils from "../engine/engine_utils"
6
- import { sendDestroyed } from '../engine/engine_networking_instantiate';
7
- import { InstancingUtil } from "../engine/engine_instancing";
8
- import { SyncedTransformModel } from '../engine-schemes/synced-transform-model';
9
- import * as flatbuffers from "flatbuffers";
10
- import { Transform } from '../engine-schemes/transform';
11
- import { registerType } from '../engine-schemes/schemes';
12
- import { setWorldEuler } from '../engine/engine_three_utils';
13
-
14
- const debug = utils.getParam("debugsync");
15
- export const SyncedTransformIdentifier = "STRS";
16
- registerType(SyncedTransformIdentifier, SyncedTransformModel.getRootAsSyncedTransformModel);
17
-
18
- const builder = new flatbuffers.Builder();
19
-
20
- export function createTransformModel(guid: string, b: Behaviour, fast: boolean = true): Uint8Array {
21
- builder.clear();
22
- const guidObj = builder.createString(guid);
23
- SyncedTransformModel.startSyncedTransformModel(builder);
24
- SyncedTransformModel.addGuid(builder, guidObj);
25
- SyncedTransformModel.addFast(builder, fast);
26
- const p = b.worldPosition;
27
- const r = b.worldEuler;
28
- const s = b.gameObject.scale; // todo: world scale
29
- // console.log(p, r, s);
30
- SyncedTransformModel.addTransform(builder, Transform.createTransform(builder, p.x, p.y, p.z, r.x, r.y, r.z, s.x, s.y, s.z));
31
- const res = SyncedTransformModel.endSyncedTransformModel(builder);
32
- // SyncedTransformModel.finishSyncedTransformModelBuffer(builder, res);
33
- builder.finish(res, SyncedTransformIdentifier);
34
- return builder.asUint8Array();
35
- }
36
-
37
-
38
- export class SyncedTransform extends Behaviour {
39
-
40
- // public autoOwnership: boolean = true;
41
- public overridePhysics: boolean = true
42
- public interpolatePosition: boolean = true;
43
- public interpolateRotation: boolean = true;
44
- public fastMode: boolean = false;
45
- public syncDestroy: boolean = false;
46
-
47
- // private _state!: SyncedTransformModel;
48
- private _model: OwnershipModel | null = null;
49
- private _needsUpdate: boolean = true;
50
- private rb: Rigidbody | null = null;
51
- private _wasKinematic: boolean | undefined = false;
52
- private _receivedDataBefore: boolean = false;
53
-
54
- private _targetPosition!: THREE.Vector3;
55
- private _targetRotation!: THREE.Quaternion;
56
-
57
- private _receivedFastUpdate: boolean = false;
58
- private _shouldRequestOwnership: boolean = false;
59
-
60
- public requestOwnership() {
61
- if (debug)
62
- console.log("Request ownership");
63
- if (!this._model) {
64
- this._shouldRequestOwnership = true;
65
- this._needsUpdate = true;
66
- }
67
- else
68
- this._model.requestOwnership();
69
- }
70
-
71
- public hasOwnership(): boolean | undefined {
72
- return this._model?.hasOwnership ?? undefined;
73
- }
74
-
75
- public isOwned(): boolean | undefined {
76
- return this._model?.isOwned;
77
- }
78
-
79
- private joinedRoomCallback: any = null;
80
- private receivedDataCallback: any = null;
81
-
82
- awake() {
83
- if (debug)
84
- console.log("new instance", this.guid, this);
85
- this._receivedDataBefore = false;
86
- this._targetPosition = new THREE.Vector3();
87
- this._targetRotation = new THREE.Quaternion();
88
-
89
- // sync instantiate issue was because they shared the same last pos vector!
90
- this.lastWorldPos = new THREE.Vector3();
91
- this.lastWorldRotation = new THREE.Quaternion();
92
-
93
- this.rb = GameObject.getComponentInChildren(this.gameObject, Rigidbody);
94
- if (this.rb) {
95
- this._wasKinematic = this.rb.isKinematic;
96
- }
97
-
98
- this.receivedUpdate = true;
99
- // this._state = new TransformModel(this.guid, this);
100
- this._model = new OwnershipModel(this.context.connection, this.guid);
101
- if (this.context.connection.isConnected) {
102
- this.tryGetLastState();
103
- }
104
-
105
- this.joinedRoomCallback = this.tryGetLastState.bind(this);
106
- this.context.connection.beginListen(RoomEvents.JoinedRoom, this.joinedRoomCallback);
107
- this.receivedDataCallback = this.onReceivedData.bind(this);
108
- this.context.connection.beginListenBinary(SyncedTransformIdentifier, this.receivedDataCallback);
109
- }
110
-
111
- onDestroy(): void {
112
- // TODO: can we add a new component for this?! do we really need this?!
113
- if (this.syncDestroy)
114
- sendDestroyed(this.guid, this.context.connection);
115
- this._model = null;
116
- this.context.connection.stopListen(RoomEvents.JoinedRoom, this.joinedRoomCallback);
117
- this.context.connection.stopListenBinary(SyncedTransformIdentifier, this.receivedDataCallback);
118
- }
119
-
120
- private tryGetLastState() {
121
- const model = this.context.connection.tryGetState(this.guid) as unknown as SyncedTransformModel;
122
- if (model) this.onReceivedData(model);
123
- }
124
-
125
- private tempEuler: THREE.Euler = new THREE.Euler();
126
-
127
- private onReceivedData(data: SyncedTransformModel) {
128
- if (this.destroyed) return;
129
- if (typeof data.guid === "function" && data.guid() === this.guid) {
130
- if (debug)
131
- console.log("new data", this.context.connection.connectionId, this.context.time.frameCount, this.guid, data);
132
- this.receivedUpdate = true;
133
- this._receivedFastUpdate = data.fast();
134
- const transform = data.transform();
135
- if (transform) {
136
- InstancingUtil.markDirty(this.gameObject, true);
137
- const position = transform.position();
138
- if (position) {
139
- if (this.interpolatePosition)
140
- this._targetPosition?.set(position.x(), position.y(), position.z());
141
- if (!this.interpolatePosition || !this._receivedDataBefore)
142
- this.setWorldPosition(position.x(), position.y(), position.z());
143
- }
144
-
145
- const rotation = transform.rotation();
146
- if (rotation) {
147
- this.tempEuler.set(rotation.x(), rotation.y(), rotation.z());
148
- if (this.interpolateRotation) {
149
- this._targetRotation.setFromEuler(this.tempEuler);
150
- }
151
- if (!this.interpolateRotation || !this._receivedDataBefore)
152
- setWorldEuler(this.gameObject, this.tempEuler);
153
- }
154
- }
155
- this._receivedDataBefore = true;
156
-
157
- // if (this.rb && !this._model?.hasOwnership) {
158
- // this.rb.setBodyFromGameObject(data.velocity)
159
- // }
160
- }
161
- }
162
-
163
- onEnable(): void {
164
- this.lastWorldPos.copy(this.worldPosition);
165
- this.lastWorldRotation.copy(this.worldQuaternion);
166
- this._needsUpdate = true;
167
- // console.log("ENABLE", this.guid, this.gameObject.guid, this.lastWorldPos);
168
- if (this._model) {
169
- this._model.updateIsOwned();
170
- }
171
- }
172
-
173
- onDisable(): void {
174
- if (this._model)
175
- this._model.freeOwnership();
176
- }
177
-
178
-
179
- private receivedUpdate = false;
180
- private lastWorldPos!: THREE.Vector3;
181
- private lastWorldRotation!: THREE.Quaternion;
182
-
183
- onBeforeRender() {
184
- if (!this.activeAndEnabled || !this.context.connection.isConnected) return;
185
- // console.log("BEFORE RENDER", this.destroyed, this.guid, this._model?.isOwned, this.name, this.gameObject);
186
-
187
- if (!this.context.connection.isInRoom || !this._model) {
188
- if (debug)
189
- console.log("no model or room", this.name, this.guid, this.context.connection.isInRoom);
190
- return;
191
- }
192
-
193
- if (this._shouldRequestOwnership) {
194
- this._shouldRequestOwnership = false;
195
- this._model.requestOwnership();
196
- }
197
-
198
- let wp = this.worldPosition;
199
- let wr = this.worldQuaternion;
200
- if (this._model.isOwned && !this.receivedUpdate) {
201
- const worlddiff = wp.distanceTo(this.lastWorldPos);
202
- const worldRot = wr.angleTo(this.lastWorldRotation);
203
- const threshold = this._model.hasOwnership || this.fastMode ? .0001 : .001;
204
- if (worlddiff > threshold || worldRot > threshold) {
205
- // console.log(worlddiff, worldRot);
206
- if (!this._model.hasOwnership) {
207
-
208
- if (debug)
209
- console.log(this.guid, "reset because not owned but", this.gameObject.name, this.lastWorldPos);
210
-
211
- this.worldPosition = this.lastWorldPos;
212
- wp.copy(this.lastWorldPos);
213
-
214
- this.worldQuaternion = this.lastWorldRotation;
215
- wr.copy(this.lastWorldRotation);
216
-
217
- InstancingUtil.markDirty(this.gameObject, true);
218
- this._needsUpdate = false;
219
- }
220
- else {
221
- this._needsUpdate = true;
222
- }
223
- }
224
- }
225
- // else if (this._model.isOwned === false) {
226
- // if (!this._didRequestOwnershipOnce && this.autoOwnership) {
227
- // this._didRequestOwnershipOnce = true;
228
- // this._model.requestOwnershipIfNotOwned();
229
- // }
230
- // }
231
-
232
-
233
- if (this._model && !this._model.hasOwnership && this._model.isOwned) {
234
- if (this._receivedDataBefore) {
235
- const factor = this._receivedFastUpdate || this.fastMode ? .5 : .3;
236
- const t = factor;//Mathf.clamp01(this.context.time.deltaTime * factor);
237
- let requireMarkDirty = false;
238
- if (this.interpolatePosition && this._targetPosition) {
239
- const pos = this.worldPosition;
240
- pos.lerp(this._targetPosition, t);
241
- this.worldPosition = pos;
242
- requireMarkDirty = true;
243
- }
244
- if (this.interpolateRotation && this._targetRotation) {
245
- const rot = this.worldQuaternion;
246
- rot.slerp(this._targetRotation, t);
247
- this.worldQuaternion = rot;
248
- requireMarkDirty = true;
249
- }
250
- if (requireMarkDirty)
251
- InstancingUtil.markDirty(this.gameObject, true);
252
- }
253
- }
254
-
255
-
256
- this.receivedUpdate = false;
257
- this.lastWorldPos.copy(wp);
258
- this.lastWorldRotation.copy(wr);
259
-
260
-
261
- // if (this._model.isOwned === false && this.autoOwnership) {
262
- // this.requestOwnership();
263
- // }
264
-
265
- if (!this._model) return;
266
- // only run if we are the owner
267
- if (!this._model || this._model.hasOwnership === undefined || !this._model.hasOwnership) {
268
- if (this.rb) {
269
- this.rb.isKinematic = this._model.isOwned ?? false;
270
- this.rb.setVelocity(0, 0, 0);
271
- }
272
- return;
273
- }
274
-
275
- // local user is owner:
276
-
277
- if (this.rb) {
278
- if (this._wasKinematic !== undefined) {
279
- if (debug)
280
- console.log("reset kinematic", this.rb.name, this._wasKinematic);
281
- this.rb.isKinematic = this._wasKinematic;
282
- }
283
-
284
- // hacky reset if too far off
285
- if (this.gameObject.position.distanceTo(new THREE.Vector3(0, 0, 0)) > 1000) {
286
- if (debug)
287
- console.log("RESET", this.name)
288
- this.gameObject.position.set(0, 1, 0);
289
- this.rb.setVelocity(0, 0, 0);
290
- }
291
- }
292
-
293
- const updateInterval = 10;
294
- const fastUpdate = this.rb || this.fastMode;
295
- if (this._needsUpdate && (updateInterval <= 0 || updateInterval > 0 && this.context.time.frameCount % updateInterval === 0 || fastUpdate)) {
296
-
297
- if (debug)
298
- console.log("send update", this.context.connection.connectionId, this.guid, this.gameObject.name, this.gameObject.guid);
299
-
300
- if (this.overridePhysics && this.rb) {
301
- // this.rb.setBodyFromGameObject();
302
- }
303
-
304
- this._needsUpdate = false;
305
- const st = createTransformModel(this.guid, this, fastUpdate ? true : false);
306
- // this._state.update(this, this.rb);
307
- // this._state.fast = fastUpdate ? true : false;
308
- this.context.connection.sendBinary(st);
309
- }
310
- }
311
-
312
-
313
- // private lastPosition: THREE.Vector3 = new THREE.Vector3();
314
-
315
- // private async setPosition(pt: THREE.Vector3) {
316
-
317
- // if (this._model.isConnected && !this._model?.hasOwnership) {
318
- // await this._model?.requestOwnershipAsync();
319
- // }
320
-
321
- // if (pt.distanceTo(this.lastPosition) < .001) {
322
- // return;
323
- // }
324
- // this.lastPosition.copy(pt);
325
-
326
- // if(this.gameObject.parent) this.gameObject.parent.worldToLocal(pt);
327
- // // this.gameObject.position.copy(pt);
328
- // this.gameObject.position.set(pt.x, pt.y, pt.z);
329
- // this._target.set(pt.x, pt.y, pt.z);
330
- // this._needsUpdate = true;
331
- // if (this.rb) {
332
- // this.gameObject.position.set(pt.x, pt.y + .5, pt.z);
333
- // this.rb.setVelocity(0, 0, 0);
334
- // this.rb.setBodyFromGameObject();
335
- // }
336
- // }
1
+ import * as THREE from 'three'
2
+ import { OwnershipModel, RoomEvents } from "../engine/engine_networking.js"
3
+ import { Behaviour, GameObject } from "./Component.js";
4
+ import { Rigidbody } from "./RigidBody.js";
5
+ import * as utils from "../engine/engine_utils.js"
6
+ import { sendDestroyed } from '../engine/engine_networking_instantiate.js';
7
+ import { InstancingUtil } from "../engine/engine_instancing.js";
8
+ import { SyncedTransformModel } from '../engine-schemes/synced-transform-model.js';
9
+ import * as flatbuffers from "flatbuffers";
10
+ import { Transform } from '../engine-schemes/transform.js';
11
+ import { registerBinaryType } from '../engine-schemes/schemes.js';
12
+ import { setWorldEuler } from '../engine/engine_three_utils.js';
13
+
14
+ const debug = utils.getParam("debugsync");
15
+ export const SyncedTransformIdentifier = "STRS";
16
+ registerBinaryType(SyncedTransformIdentifier, SyncedTransformModel.getRootAsSyncedTransformModel);
17
+
18
+ const builder = new flatbuffers.Builder();
19
+
20
+ export function createTransformModel(guid: string, b: Behaviour, fast: boolean = true): Uint8Array {
21
+ builder.clear();
22
+ const guidObj = builder.createString(guid);
23
+ SyncedTransformModel.startSyncedTransformModel(builder);
24
+ SyncedTransformModel.addGuid(builder, guidObj);
25
+ SyncedTransformModel.addFast(builder, fast);
26
+ const p = b.worldPosition;
27
+ const r = b.worldEuler;
28
+ const s = b.gameObject.scale; // todo: world scale
29
+ // console.log(p, r, s);
30
+ SyncedTransformModel.addTransform(builder, Transform.createTransform(builder, p.x, p.y, p.z, r.x, r.y, r.z, s.x, s.y, s.z));
31
+ const res = SyncedTransformModel.endSyncedTransformModel(builder);
32
+ // SyncedTransformModel.finishSyncedTransformModelBuffer(builder, res);
33
+ builder.finish(res, SyncedTransformIdentifier);
34
+ return builder.asUint8Array();
35
+ }
36
+
37
+
38
+ export class SyncedTransform extends Behaviour {
39
+
40
+ // public autoOwnership: boolean = true;
41
+ public overridePhysics: boolean = true
42
+ public interpolatePosition: boolean = true;
43
+ public interpolateRotation: boolean = true;
44
+ public fastMode: boolean = false;
45
+ public syncDestroy: boolean = false;
46
+
47
+ // private _state!: SyncedTransformModel;
48
+ private _model: OwnershipModel | null = null;
49
+ private _needsUpdate: boolean = true;
50
+ private rb: Rigidbody | null = null;
51
+ private _wasKinematic: boolean | undefined = false;
52
+ private _receivedDataBefore: boolean = false;
53
+
54
+ private _targetPosition!: THREE.Vector3;
55
+ private _targetRotation!: THREE.Quaternion;
56
+
57
+ private _receivedFastUpdate: boolean = false;
58
+ private _shouldRequestOwnership: boolean = false;
59
+
60
+ public requestOwnership() {
61
+ if (debug)
62
+ console.log("Request ownership");
63
+ if (!this._model) {
64
+ this._shouldRequestOwnership = true;
65
+ this._needsUpdate = true;
66
+ }
67
+ else
68
+ this._model.requestOwnership();
69
+ }
70
+
71
+ public hasOwnership(): boolean | undefined {
72
+ return this._model?.hasOwnership ?? undefined;
73
+ }
74
+
75
+ public isOwned(): boolean | undefined {
76
+ return this._model?.isOwned;
77
+ }
78
+
79
+ private joinedRoomCallback: any = null;
80
+ private receivedDataCallback: any = null;
81
+
82
+ awake() {
83
+ if (debug)
84
+ console.log("new instance", this.guid, this);
85
+ this._receivedDataBefore = false;
86
+ this._targetPosition = new THREE.Vector3();
87
+ this._targetRotation = new THREE.Quaternion();
88
+
89
+ // sync instantiate issue was because they shared the same last pos vector!
90
+ this.lastWorldPos = new THREE.Vector3();
91
+ this.lastWorldRotation = new THREE.Quaternion();
92
+
93
+ this.rb = GameObject.getComponentInChildren(this.gameObject, Rigidbody);
94
+ if (this.rb) {
95
+ this._wasKinematic = this.rb.isKinematic;
96
+ }
97
+
98
+ this.receivedUpdate = true;
99
+ // this._state = new TransformModel(this.guid, this);
100
+ this._model = new OwnershipModel(this.context.connection, this.guid);
101
+ if (this.context.connection.isConnected) {
102
+ this.tryGetLastState();
103
+ }
104
+
105
+ this.joinedRoomCallback = this.tryGetLastState.bind(this);
106
+ this.context.connection.beginListen(RoomEvents.JoinedRoom, this.joinedRoomCallback);
107
+ this.receivedDataCallback = this.onReceivedData.bind(this);
108
+ this.context.connection.beginListenBinary(SyncedTransformIdentifier, this.receivedDataCallback);
109
+ }
110
+
111
+ onDestroy(): void {
112
+ // TODO: can we add a new component for this?! do we really need this?!
113
+ if (this.syncDestroy)
114
+ sendDestroyed(this.guid, this.context.connection);
115
+ this._model = null;
116
+ this.context.connection.stopListen(RoomEvents.JoinedRoom, this.joinedRoomCallback);
117
+ this.context.connection.stopListenBinary(SyncedTransformIdentifier, this.receivedDataCallback);
118
+ }
119
+
120
+ private tryGetLastState() {
121
+ const model = this.context.connection.tryGetState(this.guid) as unknown as SyncedTransformModel;
122
+ if (model) this.onReceivedData(model);
123
+ }
124
+
125
+ private tempEuler: THREE.Euler = new THREE.Euler();
126
+
127
+ private onReceivedData(data: SyncedTransformModel) {
128
+ if (this.destroyed) return;
129
+ if (typeof data.guid === "function" && data.guid() === this.guid) {
130
+ if (debug)
131
+ console.log("new data", this.context.connection.connectionId, this.context.time.frameCount, this.guid, data);
132
+ this.receivedUpdate = true;
133
+ this._receivedFastUpdate = data.fast();
134
+ const transform = data.transform();
135
+ if (transform) {
136
+ InstancingUtil.markDirty(this.gameObject, true);
137
+ const position = transform.position();
138
+ if (position) {
139
+ if (this.interpolatePosition)
140
+ this._targetPosition?.set(position.x(), position.y(), position.z());
141
+ if (!this.interpolatePosition || !this._receivedDataBefore)
142
+ this.setWorldPosition(position.x(), position.y(), position.z());
143
+ }
144
+
145
+ const rotation = transform.rotation();
146
+ if (rotation) {
147
+ this.tempEuler.set(rotation.x(), rotation.y(), rotation.z());
148
+ if (this.interpolateRotation) {
149
+ this._targetRotation.setFromEuler(this.tempEuler);
150
+ }
151
+ if (!this.interpolateRotation || !this._receivedDataBefore)
152
+ setWorldEuler(this.gameObject, this.tempEuler);
153
+ }
154
+ }
155
+ this._receivedDataBefore = true;
156
+
157
+ // if (this.rb && !this._model?.hasOwnership) {
158
+ // this.rb.setBodyFromGameObject(data.velocity)
159
+ // }
160
+ }
161
+ }
162
+
163
+ onEnable(): void {
164
+ this.lastWorldPos.copy(this.worldPosition);
165
+ this.lastWorldRotation.copy(this.worldQuaternion);
166
+ this._needsUpdate = true;
167
+ // console.log("ENABLE", this.guid, this.gameObject.guid, this.lastWorldPos);
168
+ if (this._model) {
169
+ this._model.updateIsOwned();
170
+ }
171
+ }
172
+
173
+ onDisable(): void {
174
+ if (this._model)
175
+ this._model.freeOwnership();
176
+ }
177
+
178
+
179
+ private receivedUpdate = false;
180
+ private lastWorldPos!: THREE.Vector3;
181
+ private lastWorldRotation!: THREE.Quaternion;
182
+
183
+ onBeforeRender() {
184
+ if (!this.activeAndEnabled || !this.context.connection.isConnected) return;
185
+ // console.log("BEFORE RENDER", this.destroyed, this.guid, this._model?.isOwned, this.name, this.gameObject);
186
+
187
+ if (!this.context.connection.isInRoom || !this._model) {
188
+ if (debug)
189
+ console.log("no model or room", this.name, this.guid, this.context.connection.isInRoom);
190
+ return;
191
+ }
192
+
193
+ if (this._shouldRequestOwnership) {
194
+ this._shouldRequestOwnership = false;
195
+ this._model.requestOwnership();
196
+ }
197
+
198
+ let wp = this.worldPosition;
199
+ let wr = this.worldQuaternion;
200
+ if (this._model.isOwned && !this.receivedUpdate) {
201
+ const worlddiff = wp.distanceTo(this.lastWorldPos);
202
+ const worldRot = wr.angleTo(this.lastWorldRotation);
203
+ const threshold = this._model.hasOwnership || this.fastMode ? .0001 : .001;
204
+ if (worlddiff > threshold || worldRot > threshold) {
205
+ // console.log(worlddiff, worldRot);
206
+ if (!this._model.hasOwnership) {
207
+
208
+ if (debug)
209
+ console.log(this.guid, "reset because not owned but", this.gameObject.name, this.lastWorldPos);
210
+
211
+ this.worldPosition = this.lastWorldPos;
212
+ wp.copy(this.lastWorldPos);
213
+
214
+ this.worldQuaternion = this.lastWorldRotation;
215
+ wr.copy(this.lastWorldRotation);
216
+
217
+ InstancingUtil.markDirty(this.gameObject, true);
218
+ this._needsUpdate = false;
219
+ }
220
+ else {
221
+ this._needsUpdate = true;
222
+ }
223
+ }
224
+ }
225
+ // else if (this._model.isOwned === false) {
226
+ // if (!this._didRequestOwnershipOnce && this.autoOwnership) {
227
+ // this._didRequestOwnershipOnce = true;
228
+ // this._model.requestOwnershipIfNotOwned();
229
+ // }
230
+ // }
231
+
232
+
233
+ if (this._model && !this._model.hasOwnership && this._model.isOwned) {
234
+ if (this._receivedDataBefore) {
235
+ const factor = this._receivedFastUpdate || this.fastMode ? .5 : .3;
236
+ const t = factor;//Mathf.clamp01(this.context.time.deltaTime * factor);
237
+ let requireMarkDirty = false;
238
+ if (this.interpolatePosition && this._targetPosition) {
239
+ const pos = this.worldPosition;
240
+ pos.lerp(this._targetPosition, t);
241
+ this.worldPosition = pos;
242
+ requireMarkDirty = true;
243
+ }
244
+ if (this.interpolateRotation && this._targetRotation) {
245
+ const rot = this.worldQuaternion;
246
+ rot.slerp(this._targetRotation, t);
247
+ this.worldQuaternion = rot;
248
+ requireMarkDirty = true;
249
+ }
250
+ if (requireMarkDirty)
251
+ InstancingUtil.markDirty(this.gameObject, true);
252
+ }
253
+ }
254
+
255
+
256
+ this.receivedUpdate = false;
257
+ this.lastWorldPos.copy(wp);
258
+ this.lastWorldRotation.copy(wr);
259
+
260
+
261
+ // if (this._model.isOwned === false && this.autoOwnership) {
262
+ // this.requestOwnership();
263
+ // }
264
+
265
+ if (!this._model) return;
266
+ // only run if we are the owner
267
+ if (!this._model || this._model.hasOwnership === undefined || !this._model.hasOwnership) {
268
+ if (this.rb) {
269
+ this.rb.isKinematic = this._model.isOwned ?? false;
270
+ this.rb.setVelocity(0, 0, 0);
271
+ }
272
+ return;
273
+ }
274
+
275
+ // local user is owner:
276
+
277
+ if (this.rb) {
278
+ if (this._wasKinematic !== undefined) {
279
+ if (debug)
280
+ console.log("reset kinematic", this.rb.name, this._wasKinematic);
281
+ this.rb.isKinematic = this._wasKinematic;
282
+ }
283
+
284
+ // hacky reset if too far off
285
+ if (this.gameObject.position.distanceTo(new THREE.Vector3(0, 0, 0)) > 1000) {
286
+ if (debug)
287
+ console.log("RESET", this.name)
288
+ this.gameObject.position.set(0, 1, 0);
289
+ this.rb.setVelocity(0, 0, 0);
290
+ }
291
+ }
292
+
293
+ const updateInterval = 10;
294
+ const fastUpdate = this.rb || this.fastMode;
295
+ if (this._needsUpdate && (updateInterval <= 0 || updateInterval > 0 && this.context.time.frameCount % updateInterval === 0 || fastUpdate)) {
296
+
297
+ if (debug)
298
+ console.log("send update", this.context.connection.connectionId, this.guid, this.gameObject.name, this.gameObject.guid);
299
+
300
+ if (this.overridePhysics && this.rb) {
301
+ // this.rb.setBodyFromGameObject();
302
+ }
303
+
304
+ this._needsUpdate = false;
305
+ const st = createTransformModel(this.guid, this, fastUpdate ? true : false);
306
+ // this._state.update(this, this.rb);
307
+ // this._state.fast = fastUpdate ? true : false;
308
+ this.context.connection.sendBinary(st);
309
+ }
310
+ }
311
+
312
+
313
+ // private lastPosition: THREE.Vector3 = new THREE.Vector3();
314
+
315
+ // private async setPosition(pt: THREE.Vector3) {
316
+
317
+ // if (this._model.isConnected && !this._model?.hasOwnership) {
318
+ // await this._model?.requestOwnershipAsync();
319
+ // }
320
+
321
+ // if (pt.distanceTo(this.lastPosition) < .001) {
322
+ // return;
323
+ // }
324
+ // this.lastPosition.copy(pt);
325
+
326
+ // if(this.gameObject.parent) this.gameObject.parent.worldToLocal(pt);
327
+ // // this.gameObject.position.copy(pt);
328
+ // this.gameObject.position.set(pt.x, pt.y, pt.z);
329
+ // this._target.set(pt.x, pt.y, pt.z);
330
+ // this._needsUpdate = true;
331
+ // if (this.rb) {
332
+ // this.gameObject.position.set(pt.x, pt.y + .5, pt.z);
333
+ // this.rb.setVelocity(0, 0, 0);
334
+ // this.rb.setBodyFromGameObject();
335
+ // }
336
+ // }
337
337
  }
src/engine/tests/test_utils.ts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- import * as utils from "../engine_utils";
3
- import { noVoip } from "../../engine-components/Voip";
2
+ import * as utils from "../engine_utils.js";
3
+ import { noVoip } from "../../engine-components/Voip.js";
4
4
 
5
5
 
6
6
  export function detect_run_tests(){
src/engine-components/TestRunner.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Behaviour } from "./Component";
2
- import * as tests from "../engine/tests/test_utils";
3
- import { createTransformModel, SyncedTransform, SyncedTransformIdentifier } from "./SyncedTransform";
1
+ import { Behaviour } from "./Component.js";
2
+ import * as tests from "../engine/tests/test_utils.js";
3
+ import { createTransformModel, SyncedTransform, SyncedTransformIdentifier } from "./SyncedTransform.js";
4
4
  import * as flatbuffers from 'flatbuffers';
5
- import { SyncedTransformModel } from "../engine-schemes/synced-transform-model";
6
- import { Rigidbody } from "./RigidBody";
5
+ import { SyncedTransformModel } from "../engine-schemes/synced-transform-model.js";
6
+ import { Rigidbody } from "./RigidBody.js";
7
7
  import { Vector3 } from "three";
8
- import { IModel } from "../engine/engine_networking_types";
8
+ import { IModel } from "../engine/engine_networking_types.js";
9
9
 
10
10
  export class TestRunner extends Behaviour {
11
11
  awake(): void {
src/engine-components/ui/Text.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { Graphic } from './Graphic';
1
+ import { Graphic } from './Graphic.js';
2
2
  import * as ThreeMeshUI from 'three-mesh-ui'
3
- import { DocumentedOptions as ThreeMeshUIEveryOptions } from "three-mesh-ui/build/types/core/elements/MeshUIBaseElement";
3
+ import { DocumentedOptions as ThreeMeshUIEveryOptions } from "three-mesh-ui/build/types/core/elements/MeshUIBaseElement.js";
4
4
  import { Color } from 'three';
5
- import { updateRenderSettings } from './Utils';
6
- import { Canvas } from './Canvas';
7
- import { serializable } from '../../engine/engine_serialization_decorator';
8
- import { getParam, resolveUrl } from '../../engine/engine_utils';
9
- import { ICanvas, IHasAlphaFactor } from './Interfaces';
5
+ import { updateRenderSettings } from './Utils.js';
6
+ import { Canvas } from './Canvas.js';
7
+ import { serializable } from '../../engine/engine_serialization_decorator.js';
8
+ import { getParam, resolveUrl } from '../../engine/engine_utils.js';
9
+ import { ICanvas, IHasAlphaFactor } from './Interfaces.js';
10
10
 
11
11
  const debug = getParam("debugtext");
12
12
 
src/engine-components/export/usdz/ThreeUSDZExporter.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Renderer } from '../../Renderer';
2
- import { GameObject } from '../../Component';
1
+ import { Renderer } from '../../Renderer.js';
2
+ import { GameObject } from '../../Component.js';
3
3
  import {
4
4
  PlaneGeometry,
5
5
  Texture,
src/engine-components/postprocessing/Effects/TiltShiftEffect.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { registerCustomEffectType } from "../VolumeProfile";
2
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
1
+ import { registerCustomEffectType } from "../VolumeProfile.js";
2
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
3
3
  import { KernelSize, TiltShiftEffect as TiltShift } from "postprocessing";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { serializable } from "../../../engine/engine_serialization";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { serializable } from "../../../engine/engine_serialization.js";
6
6
 
7
7
 
8
8
  export class TiltShiftEffect extends PostProcessingEffect {
src/engine-components/timeline/TimelineTracks.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { PlayableDirector } from "./PlayableDirector";
2
- import * as Models from "./TimelineModels";
1
+ import { PlayableDirector } from "./PlayableDirector.js";
2
+ import * as Models from "./TimelineModels.js";
3
3
  import * as THREE from 'three';
4
- import { GameObject } from "../Component";
5
- import { Context } from "../../engine/engine_setup";
6
- import { SignalReceiver } from "./SignalAsset";
4
+ import { GameObject } from "../Component.js";
5
+ import { Context } from "../../engine/engine_setup.js";
6
+ import { SignalReceiver } from "./SignalAsset.js";
7
7
  import { AnimationClip, Quaternion, Vector3 } from "three";
8
- import { getParam, resolveUrl } from "../../engine/engine_utils";
9
- import { AudioSource } from "../AudioSource";
10
- import { Animator } from "../Animator"
11
- import { setObjectAnimated } from "../AnimationUtils";
8
+ import { getParam, resolveUrl } from "../../engine/engine_utils.js";
9
+ import { AudioSource } from "../AudioSource.js";
10
+ import { Animator } from "../Animator.js"
11
+ import { setObjectAnimated } from "../AnimationUtils.js";
12
+ import { isDevEnvironment } from "../../engine/debug/index.js";
12
13
 
13
14
  const debug = getParam("debugtimeline");
14
15
 
@@ -44,6 +45,8 @@
44
45
  abstract evaluate(time: number);
45
46
  onMuteChanged?();
46
47
  onPauseChanged?();
48
+ /** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
49
+ onStateChanged?(isPlaying: boolean);
47
50
 
48
51
  getClipTime(time: number, model: Models.ClipModel) {
49
52
  return model.clipIn + (time - model.start) * model.timeScale;
@@ -133,6 +136,7 @@
133
136
  trackOffset?: Models.TrackOffset;
134
137
 
135
138
  target?: THREE.Object3D;
139
+ /** The AnimationMixer, should be shared with the animator if an animator is bound */
136
140
  mixer?: THREE.AnimationMixer;
137
141
  clips: Array<THREE.AnimationClip> = [];
138
142
  actions: Array<THREE.AnimationAction> = [];
@@ -142,22 +146,16 @@
142
146
  private _didBind: boolean = false;
143
147
  private _animator: Animator | null = null;
144
148
 
145
- onPauseChanged() {
149
+ // Using this callback instead of onEnable etc
150
+ // because we want to re-enable the animator when the director is at the end and wrap mode is set to none
151
+ // in which case the director is stopped (but not disabled)
152
+ // which means we want to notify the object that it's not animated anymore
153
+ // and the animator can then take over
154
+ onStateChanged() {
146
155
  if (this._animator)
147
- setObjectAnimated(this._animator.gameObject, this.director.isPaused);
156
+ setObjectAnimated(this._animator.gameObject, this, this.director.isPlaying);
148
157
  }
149
158
 
150
- onEnable() {
151
- if (this._animator)
152
- setObjectAnimated(this._animator.gameObject, true);
153
- }
154
-
155
- onDisable() {
156
- if (this._animator)
157
- setObjectAnimated(this._animator.gameObject, false);
158
- }
159
-
160
-
161
159
  createHooks(clipModel: Models.AnimationClipModel, clip) {
162
160
  if (clip.tracks?.length <= 0) {
163
161
  console.warn("No tracks in AnimationClip", clip);
@@ -233,6 +231,9 @@
233
231
  // We need to disable the animator component in case it also animates
234
232
  // which overrides the timeline
235
233
  this._animator = GameObject.getComponent(this.target, Animator) ?? null;
234
+ if (this._animator) {
235
+ setObjectAnimated(this._animator.gameObject, this, true);
236
+ }
236
237
  }
237
238
 
238
239
  // Clip Offsets
@@ -286,6 +287,13 @@
286
287
  evaluate(time: number) {
287
288
  if (this.track.muted) return;
288
289
  if (!this.mixer) return;
290
+ // Don't evaluate the timeline if the director is not playing animator
291
+ // consider the case where we want to blend into an Animator (e.g. last clip is faded out)
292
+ // and currently evaluate is being called when the director is stopped which happens for example
293
+ // if Wrap mode is set to None. I think it makes sense to NOT evaluate anymore when stopping (not sure why we did it in the first place)
294
+ // I won't change the root behaviour on the other tracks for now to avoid side-effects
295
+ if (!this.director.isPlaying) return;
296
+
289
297
  this.bind();
290
298
 
291
299
  // if (this._animator && this.director.isPlaying && this.director.weight > 0) this._animator.enabled = false;
@@ -298,6 +306,8 @@
298
306
  let blend: number = 0;
299
307
  let didPostExtrapolate = false;
300
308
  let didPreExtrapolate = false;
309
+ // The total weight is used to blend with the animator controller active states
310
+ let totalWeight = 0;
301
311
  for (let i = 0; i < this.clips.length; i++) {
302
312
  const model = this.models[i];
303
313
  const action = this.actions[i];
@@ -394,12 +404,15 @@
394
404
  if (model.reversed === true) action.time = action.getClip().duration - t;
395
405
  else action.time = t;
396
406
 
407
+
397
408
  action.timeScale = 0;
398
- const effectiveWeight = weight;
409
+ const effectiveWeight = Math.max(0, weight);
399
410
  action.weight = effectiveWeight;
400
- action.clampWhenFinished = true;
411
+ totalWeight += effectiveWeight;
412
+ action.clampWhenFinished = false;
401
413
  if (!action.isRunning())
402
414
  action.play();
415
+ // console.log(action.time, action.weight);
403
416
 
404
417
  if (this._useclipOffsets) {
405
418
  const totalPosition = activeClips == 0 ? this._totalOffsetPosition : this._totalOffsetPosition2;
@@ -454,8 +467,20 @@
454
467
  this._totalOffsetRotation.slerp(this._totalOffsetRotation2, blend);
455
468
  }
456
469
 
470
+ if (this["__mixerError"] === undefined && (debug || isDevEnvironment()) && this._animator?.runtimeAnimatorController?.mixer && this.mixer !== this._animator?.runtimeAnimatorController?.mixer) {
471
+ this["__mixerError"] = true;
472
+ console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!", this);
473
+ }
457
474
 
458
- this.mixer.update(time);
475
+ if (this._animator?.runtimeAnimatorController) {
476
+ // If the Timeline is running then the timeline track takes control over the animatorcontroller
477
+ // we calculate the weight left for the animatorcontroller actions
478
+ const weightLeft = Math.max(0, 1 - totalWeight);
479
+ this._animator?.runtimeAnimatorController?.update(weightLeft);
480
+ }
481
+ else {
482
+ this.mixer.update(time);
483
+ }
459
484
  }
460
485
 
461
486
  private createRotationInterpolant(_clip: AnimationClip, _clipModel: Models.AnimationClipModel, track: any) {
src/engine-components/postprocessing/Effects/Tonemapping.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ACESFilmicToneMapping, LinearToneMapping, NoToneMapping, ReinhardToneMapping } from "three";
2
- import { serializable } from "../../../engine/engine_serialization";
3
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
4
- import { VolumeParameter } from "../VolumeParameter";
5
- import { registerCustomEffectType } from "../VolumeProfile";
2
+ import { serializable } from "../../../engine/engine_serialization.js";
3
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { VolumeParameter } from "../VolumeParameter.js";
5
+ import { registerCustomEffectType } from "../VolumeProfile.js";
6
6
 
7
7
 
8
8
  export enum TonemappingMode {
src/engine-schemes/transform.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as flatbuffers from 'flatbuffers';
4
4
 
5
- import { Vec3 } from './vec3';
5
+ import { Vec3 } from './vec3.js';
6
6
 
7
7
 
8
8
  export class Transform {
src/engine-components/TransformGizmo.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { SyncedTransform } from "./SyncedTransform";
3
- import { serializable } from "../engine/engine_serialization_decorator";
4
- import * as params from "../engine/engine_default_parameters";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { SyncedTransform } from "./SyncedTransform.js";
3
+ import { serializable } from "../engine/engine_serialization_decorator.js";
4
+ import * as params from "../engine/engine_default_parameters.js";
5
5
  import { Mesh, MathUtils, EventListener } from "three";
6
- import { TransformControls } from "three/examples/jsm/controls/TransformControls";
7
- import { OrbitControls } from "./OrbitControls";
6
+ import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
7
+ import { OrbitControls } from "./OrbitControls.js";
8
8
 
9
9
  export class TransformGizmo extends Behaviour {
10
10
 
src/engine/extensions/usage_tracker.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
2
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
3
3
  import { Group, Mesh, Object3D, SkinnedMesh } from "three";
4
- import { getParam } from "../engine_utils";
4
+ import { getParam } from "../engine_utils.js";
5
5
 
6
6
 
7
7
  const $loadingId = Symbol("gltf-loader-internal-usage-tracker");
src/engine-components/export/usdz/USDZExporter.ts CHANGED
@@ -1,23 +1,23 @@
1
- import { delay, getParam, isiOS, isMobileDevice, isSafari } from "../../../engine/engine_utils";
1
+ import { delay, getParam, isiOS, isMobileDevice, isSafari } from "../../../engine/engine_utils.js";
2
2
  import { Object3D, Mesh, Matrix4 } from "three";
3
- import { USDZExporter as ThreeUSDZExporter } from "./ThreeUSDZExporter";
4
- import { AnimationExtension } from "./extensions/Animation"
5
- import { ensureQuicklookLinkIsCreated } from "./utils/quicklook";
6
- import { getFormattedDate } from "./utils/timeutils";
7
- import { registerAnimatorsImplictly } from "./utils/animationutils";
8
- import { IUSDExporterExtension } from "./Extension";
9
- import { Behaviour, GameObject } from "../../Component";
10
- import { WebXR } from "../../webxr/WebXR"
11
- import { serializable } from "../../../engine/engine_serialization";
12
- import { showBalloonMessage, showBalloonWarning } from "../../../engine/debug/debug";
13
- import { Context } from "../../../engine/engine_setup";
14
- import { WebARSessionRoot } from "../../webxr/WebARSessionRoot";
15
- import { hasProLicense } from "../../../engine/engine_license";
16
- import { BehaviorExtension } from "./extensions/behavior/Behaviour";
17
- import { AudioExtension } from "./extensions/behavior/AudioExtension";
18
- import { TextExtension } from "./extensions/USDZText";
19
- import { USDZUIExtension } from "./extensions/USDZUI";
20
- import { Renderer } from "../../Renderer"
3
+ import { USDZExporter as ThreeUSDZExporter } from "./ThreeUSDZExporter.js";
4
+ import { AnimationExtension } from "./extensions/Animation.js"
5
+ import { ensureQuicklookLinkIsCreated } from "./utils/quicklook.js";
6
+ import { getFormattedDate } from "./utils/timeutils.js";
7
+ import { registerAnimatorsImplictly } from "./utils/animationutils.js";
8
+ import { IUSDExporterExtension } from "./Extension.js";
9
+ import { Behaviour, GameObject } from "../../Component.js";
10
+ import { WebXR } from "../../webxr/WebXR.js"
11
+ import { serializable } from "../../../engine/engine_serialization.js";
12
+ import { showBalloonMessage, showBalloonWarning } from "../../../engine/debug/index.js";
13
+ import { Context } from "../../../engine/engine_setup.js";
14
+ import { WebARSessionRoot } from "../../webxr/WebARSessionRoot.js";
15
+ import { hasProLicense } from "../../../engine/engine_license.js";
16
+ import { BehaviorExtension } from "./extensions/behavior/Behaviour.js";
17
+ import { AudioExtension } from "./extensions/behavior/AudioExtension.js";
18
+ import { TextExtension } from "./extensions/USDZText.js";
19
+ import { USDZUIExtension } from "./extensions/USDZUI.js";
20
+ import { Renderer } from "../../Renderer.js"
21
21
 
22
22
  const debug = getParam("debugusdz");
23
23
 
src/engine-components/export/usdz/extensions/USDZText.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { IUSDExporterExtension } from "../Extension";
2
- import { IBehaviorElement } from "../extensions/behavior/BehavioursBuilder";
3
- import { USDDocument, USDObject, USDWriter, USDZExporterContext } from "../ThreeUSDZExporter";
4
- import { GameObject } from "../../../Component";
5
- import { Text } from "../../../ui/Text"
6
- import { RectTransform } from "../../../ui/RectTransform";
1
+ import { IUSDExporterExtension } from "../Extension.js";
2
+ import { IBehaviorElement } from "../extensions/behavior/BehavioursBuilder.js";
3
+ import { USDDocument, USDObject, USDWriter, USDZExporterContext } from "../ThreeUSDZExporter.js";
4
+ import { GameObject } from "../../../Component.js";
5
+ import { Text } from "../../../ui/Text.js"
6
+ import { RectTransform } from "../../../ui/RectTransform.js";
7
7
  import { Color, Material, Matrix4, MeshStandardMaterial, Object3D, Vector3 } from "three";
8
- import { TextAnchor } from "../../../ui/Text";
8
+ import { TextAnchor } from "../../../ui/Text.js";
9
9
 
10
10
 
11
11
  export enum TextWrapMode {
src/engine-components/export/usdz/extensions/USDZUI.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { IUSDExporterExtension } from "../Extension";
2
- import { USDObject, USDZExporterContext } from "../ThreeUSDZExporter";
3
- import { GameObject } from "../../../Component";
4
- import { Canvas } from "../../../ui/Canvas";
5
- import { CanvasGroup } from "../../../ui/CanvasGroup";
6
- import { $shadowDomOwner } from "../../../ui/BaseUIComponent";
7
- import { RectTransform } from "../../../ui/RectTransform";
1
+ import { IUSDExporterExtension } from "../Extension.js";
2
+ import { USDObject, USDZExporterContext } from "../ThreeUSDZExporter.js";
3
+ import { GameObject } from "../../../Component.js";
4
+ import { Canvas } from "../../../ui/Canvas.js";
5
+ import { CanvasGroup } from "../../../ui/CanvasGroup.js";
6
+ import { $shadowDomOwner } from "../../../ui/BaseUIComponent.js";
7
+ import { RectTransform } from "../../../ui/RectTransform.js";
8
8
  import { Color, Mesh, MeshBasicMaterial, Object3D } from "three";
9
- import { TextExtension } from "./USDZText";
10
- import { RenderMode } from "../../../ui/Canvas";
9
+ import { TextExtension } from "./USDZText.js";
10
+ import { RenderMode } from "../../../ui/Canvas.js";
11
11
 
12
12
  export class USDZUIExtension implements IUSDExporterExtension {
13
13
  get extensionName(): string {
src/engine-components/ui/Utils.ts CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { FrontSide, DoubleSide, Object3D } from "three"
3
- import { FrameEvent } from "../../engine/engine_setup";
4
- import { Behaviour } from "../Component";
5
- import { $shadowDomOwner, BaseUIComponent } from "./BaseUIComponent";
3
+ import { FrameEvent } from "../../engine/engine_setup.js";
4
+ import { Behaviour } from "../Component.js";
5
+ import { $shadowDomOwner, BaseUIComponent } from "./BaseUIComponent.js";
6
6
 
7
7
  export function tryGetUIComponent(obj: Object3D): BaseUIComponent | null {
8
8
  const owner = obj[$shadowDomOwner];
src/engine-components/js-extensions/Vector.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { applyPrototypeExtensions, registerPrototypeExtensions } from "./ExtensionUtils";
1
+ import { applyPrototypeExtensions, registerPrototypeExtensions } from "./ExtensionUtils.js";
2
2
  import { Vector3 } from "three";
3
- import { slerp } from "../../engine/engine_three_utils";
3
+ import { slerp } from "../../engine/engine_three_utils.js";
4
4
 
5
5
  export function apply(object: Vector3) {
6
6
  if (object && object.isVector3 === true) {
src/engine-components/VideoPlayer.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import { serializable } from "../engine/engine_serialization_decorator";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import { serializable } from "../engine/engine_serialization_decorator.js";
3
3
  import { Material, Mesh, Object3D, ShaderMaterial, SRGBColorSpace, sRGBEncoding, Texture, Vector2, Vector4, VideoTexture } from "three";
4
- import { awaitInput } from "../engine/engine_input_utils";
5
- import { getParam } from "../engine/engine_utils";
6
- import { Renderer } from "./Renderer";
7
- import { getWorldScale } from "../engine/engine_three_utils";
8
- import { ObjectUtils, PrimitiveType } from "../engine/engine_create_objects";
9
- import { Context } from "../engine/engine_setup";
10
- import { isDevEnvironment } from "../engine/debug";
4
+ import { awaitInput } from "../engine/engine_input_utils.js";
5
+ import { getParam } from "../engine/engine_utils.js";
6
+ import { Renderer } from "./Renderer.js";
7
+ import { getWorldScale } from "../engine/engine_three_utils.js";
8
+ import { ObjectUtils, PrimitiveType } from "../engine/engine_create_objects.js";
9
+ import { Context } from "../engine/engine_setup.js";
10
+ import { isDevEnvironment } from "../engine/debug/index.js";
11
11
 
12
12
  const debug = getParam("debugvideo");
13
13
 
src/engine-components/postprocessing/Effects/Vignette.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { serializable } from "../../../engine/engine_serialization";
2
- import { VolumeParameter } from "../VolumeParameter";
3
- import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
4
- import { registerCustomEffectType } from "../VolumeProfile";
1
+ import { serializable } from "../../../engine/engine_serialization.js";
2
+ import { VolumeParameter } from "../VolumeParameter.js";
3
+ import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect.js";
4
+ import { registerCustomEffectType } from "../VolumeProfile.js";
5
5
  import { VignetteEffect } from "postprocessing";
6
6
 
7
7
 
src/engine-components/Voip.ts CHANGED
@@ -1,12 +1,12 @@
1
1
 
2
- import { Behaviour } from "./Component";
2
+ import { Behaviour } from "./Component.js";
3
3
  import * as THREE from "three";
4
- import { RoomEvents } from "../engine/engine_networking"
4
+ import { RoomEvents } from "../engine/engine_networking.js"
5
5
  import Peer, { MediaConnection } from "peerjs"
6
- import { AudioSource } from "./AudioSource";
7
- import * as utils from "../engine/engine_utils"
6
+ import { AudioSource } from "./AudioSource.js";
7
+ import * as utils from "../engine/engine_utils.js"
8
8
  import { AudioAnalyser } from "three";
9
- import { SendQueue } from "../engine/engine_networking_types";
9
+ import { SendQueue } from "../engine/engine_networking_types.js";
10
10
 
11
11
  export const noVoip = "noVoip";
12
12
  const debug = utils.getParam("debugvoip");
src/engine-components/postprocessing/Volume.ts CHANGED
@@ -1,13 +1,12 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { serializeable } from "../../engine/engine_serialization_decorator";
3
- import { getParam } from "../../engine/engine_utils";
4
- import { VolumeProfile } from "./VolumeProfile";
5
- import { EditorModification, IEditorModification as IEditorModificationReceiver } from "../../engine/engine_editor-sync";
6
- import { PostProcessingHandler } from "./PostProcessingHandler";
7
- import { PostProcessingEffect } from "./PostProcessingEffect";
8
- import { VolumeParameter } from "./VolumeParameter";
9
- import { getEditorModificationCache } from "../../engine/engine_editor-sync";
10
- import { isDevEnvironment } from "../../engine/debug";
1
+ import { Behaviour } from "../Component.js";
2
+ import { serializeable } from "../../engine/engine_serialization_decorator.js";
3
+ import { getParam } from "../../engine/engine_utils.js";
4
+ import { VolumeProfile } from "./VolumeProfile.js";
5
+ import { EditorModification, IEditorModification as IEditorModificationReceiver } from "../../engine/engine_editor-sync.js";
6
+ import { PostProcessingHandler } from "./PostProcessingHandler.js";
7
+ import { PostProcessingEffect } from "./PostProcessingEffect.js";
8
+ import { VolumeParameter } from "./VolumeParameter.js";
9
+ import { isDevEnvironment } from "../../engine/debug/index.js";
11
10
  import { EffectComposer } from "postprocessing";
12
11
 
13
12
  const debug = getParam("debugpost");
src/engine-components/postprocessing/VolumeParameter.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { serializable } from "../../engine/engine_serialization";
1
+ import { serializable } from "../../engine/engine_serialization.js";
2
2
 
3
3
  export declare type VolumeParameterChangedEvent = (newValue: any, oldValue: any, parameter: VolumeParameter) => void;
4
4
  export declare type VolumeParameterValueProcessor = (value: any) => any;
src/engine-components/postprocessing/VolumeProfile.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { serializeable } from "../../engine/engine_serialization_decorator";
2
- import { getParam } from "../../engine/engine_utils";
3
- import { PostProcessingEffect } from "./PostProcessingEffect";
1
+ import { serializeable } from "../../engine/engine_serialization_decorator.js";
2
+ import { getParam } from "../../engine/engine_utils.js";
3
+ import { PostProcessingEffect } from "./PostProcessingEffect.js";
4
4
 
5
5
  const debug = getParam("debugpost");
6
6
 
src/engine-schemes/vr-user-state-buffer.ts CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  import * as flatbuffers from 'flatbuffers';
4
4
 
5
- import { Vec3 } from './vec3';
6
- import { Vec4 } from './vec4';
5
+ import { Vec3 } from './vec3.js';
6
+ import { Vec4 } from './vec4.js';
7
7
 
8
8
 
9
9
  export class VrUserStateBuffer {
src/engine-components/webxr/WebARCameraBackground.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Behaviour } from "../Component";
2
- import { serializable } from "../../engine/engine_serialization_decorator";
3
- import { RGBAColor } from "../js-extensions/RGBAColor"
4
- import { WebXR } from "./WebXR";
1
+ import { Behaviour } from "../Component.js";
2
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
3
+ import { RGBAColor } from "../js-extensions/RGBAColor.js"
4
+ import { WebXR } from "./WebXR.js";
5
5
  import {
6
6
  Scene,
7
7
  Texture,
src/engine-components/webxr/WebARSessionRoot.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Behaviour, GameObject } from "../Component";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
2
  import { Matrix4, Object3D } from "three";
3
- import { WebAR, WebXR } from "./WebXR";
4
- import { InstancingUtil } from "../../engine/engine_instancing";
5
- import { serializable } from "../../engine/engine_serialization_decorator";
3
+ import { WebAR, WebXR } from "./WebXR.js";
4
+ import { InstancingUtil } from "../../engine/engine_instancing.js";
5
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
6
6
 
7
7
  // https://github.com/takahirox/takahirox.github.io/blob/master/js.mmdeditor/examples/js/controls/DeviceOrientationControls.js
8
8
 
src/engine-components/webxr/WebXR.ts CHANGED
@@ -2,21 +2,21 @@
2
2
  import { ARButton } from '../../include/three/ARButton.js';
3
3
  import { VRButton } from '../../include/three/VRButton.js';
4
4
 
5
- import { AssetReference } from "../../engine/engine_addressables";
6
- import { serializable } from "../../engine/engine_serialization_decorator";
7
- import { XRSessionMode } from "../../engine/engine_setup";
8
- import { getWorldPosition, getWorldQuaternion, setWorldPosition, setWorldQuaternion } from "../../engine/engine_three_utils";
9
- import { INeedleEngineComponent } from "../../engine/engine_types";
10
- import { getParam, isMozillaXR, setOrAddParamsToUrl } from "../../engine/engine_utils";
5
+ import { AssetReference } from "../../engine/engine_addressables.js";
6
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
7
+ import { XRSessionMode } from "../../engine/engine_setup.js";
8
+ import { getWorldPosition, getWorldQuaternion, setWorldPosition, setWorldQuaternion } from "../../engine/engine_three_utils.js";
9
+ import { INeedleEngineComponent } from "../../engine/engine_types.js";
10
+ import { getParam, isMozillaXR, setOrAddParamsToUrl } from "../../engine/engine_utils.js";
11
11
 
12
- import { Behaviour, GameObject } from "../Component";
13
- import { noVoip } from "../Voip";
14
- import { WebARSessionRoot } from "./WebARSessionRoot";
15
- import { ControllerType, WebXRController } from "./WebXRController";
16
- import { XRRig } from "./WebXRRig";
17
- import { WebXRSync } from "./WebXRSync";
18
- import { XRFlag, XRState, XRStateFlag } from "../XRFlag";
19
- import { showBalloonWarning } from '../../engine/debug';
12
+ import { Behaviour, GameObject } from "../Component.js";
13
+ import { noVoip } from "../Voip.js";
14
+ import { WebARSessionRoot } from "./WebARSessionRoot.js";
15
+ import { ControllerType, WebXRController } from "./WebXRController.js";
16
+ import { XRRig } from "./WebXRRig.js";
17
+ import { WebXRSync } from "./WebXRSync.js";
18
+ import { XRFlag, XRState, XRStateFlag } from "../XRFlag.js";
19
+ import { showBalloonWarning } from '../../engine/debug/index.js';
20
20
 
21
21
  const debugWebXR = getParam("debugwebxr");
22
22
 
@@ -41,7 +41,7 @@
41
41
  detectARSupport().then(res => arSupported = res);
42
42
  detectVRSupport().then(res => vrSupported = res);
43
43
 
44
- // import TeleportVR from "teleportvr";
44
+ // import TeleportVR from "teleportvr.js";
45
45
 
46
46
  export enum WebXREvent {
47
47
  XRStarted = "xrStarted",
@@ -240,7 +240,7 @@
240
240
  const buttonsContainer = document.createElement('div');
241
241
  buttonsContainer.classList.add("webxr-buttons");
242
242
  buttonsContainer.style.cssText = `
243
- position: fixed;
243
+ position: absolute;
244
244
  bottom: 21px;
245
245
  left: 50%;
246
246
  transform: translate(-50%, 0%);
src/engine-components/webxr/WebXRAvatar.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { WebXR } from "./WebXR";
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { WebXR } from "./WebXR.js";
3
3
  import { Quaternion, Vector3 } from "three";
4
- import { AvatarLoader } from "../AvatarLoader";
5
- import { XRFlag, XRStateFlag } from "../XRFlag";
6
- import { Avatar_POI } from "../avatar/Avatar_Brain_LookAt";
7
- import { Context } from "../../engine/engine_setup";
8
- import { AssetReference } from "../../engine/engine_addressables";
4
+ import { AvatarLoader } from "../AvatarLoader.js";
5
+ import { XRFlag, XRStateFlag } from "../XRFlag.js";
6
+ import { Avatar_POI } from "../avatar/Avatar_Brain_LookAt.js";
7
+ import { Context } from "../../engine/engine_setup.js";
8
+ import { AssetReference } from "../../engine/engine_addressables.js";
9
9
  import { Object3D } from "three";
10
- import { VRUserState } from "./WebXRSync";
11
- import { getParam } from "../../engine/engine_utils";
12
- import { ViewDevice } from "../../engine/engine_playerview";
13
- import { InstancingUtil } from "../../engine/engine_instancing";
10
+ import { VRUserState } from "./WebXRSync.js";
11
+ import { getParam } from "../../engine/engine_utils.js";
12
+ import { ViewDevice } from "../../engine/engine_playerview.js";
13
+ import { InstancingUtil } from "../../engine/engine_instancing.js";
14
14
 
15
15
  export const debug = getParam("debugavatar");
16
16
 
src/engine-components/webxr/WebXRController.ts CHANGED
@@ -4,21 +4,21 @@
4
4
  import { XRControllerModel, XRControllerModelFactory } from 'three/examples/jsm/webxr/XRControllerModelFactory.js';
5
5
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
6
6
 
7
- import { InstancingUtil } from "../../engine/engine_instancing";
8
- import { Mathf } from "../../engine/engine_math";
9
- import { RaycastOptions } from "../../engine/engine_physics";
10
- import { getWorldPosition, getWorldQuaternion, setWorldPosition, setWorldQuaternion } from "../../engine/engine_three_utils";
11
- import { getParam, resolveUrl } from "../../engine/engine_utils";
12
- import { addDracoAndKTX2Loaders } from "../../engine/engine_loaders";
7
+ import { InstancingUtil } from "../../engine/engine_instancing.js";
8
+ import { Mathf } from "../../engine/engine_math.js";
9
+ import { RaycastOptions } from "../../engine/engine_physics.js";
10
+ import { getWorldPosition, getWorldQuaternion, setWorldPosition, setWorldQuaternion } from "../../engine/engine_three_utils.js";
11
+ import { getParam, resolveUrl } from "../../engine/engine_utils.js";
12
+ import { addDracoAndKTX2Loaders } from "../../engine/engine_loaders.js";
13
13
 
14
- import { Avatar_POI } from "../avatar/Avatar_Brain_LookAt";
15
- import { Behaviour, GameObject } from "../Component";
16
- import { Interactable, UsageMarker } from "../Interactable";
17
- import { Rigidbody } from "../RigidBody";
18
- import { SyncedTransform } from "../SyncedTransform";
19
- import { UIRaycastUtils } from "../ui/RaycastUtils";
20
- import { WebXR } from "./WebXR";
21
- import { XRRig } from "./WebXRRig";
14
+ import { Avatar_POI } from "../avatar/Avatar_Brain_LookAt.js";
15
+ import { Behaviour, GameObject } from "../Component.js";
16
+ import { Interactable, UsageMarker } from "../Interactable.js";
17
+ import { Rigidbody } from "../RigidBody.js";
18
+ import { SyncedTransform } from "../SyncedTransform.js";
19
+ import { UIRaycastUtils } from "../ui/RaycastUtils.js";
20
+ import { WebXR } from "./WebXR.js";
21
+ import { XRRig } from "./WebXRRig.js";
22
22
 
23
23
  const debug = getParam("debugwebxrcontroller");
24
24
 
src/engine-components/webxr/WebXRGrabRendering.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { getWorldPosition, setWorldPosition, setWorldPositionXYZ } from "../../engine/engine_three_utils";
2
- import { Behaviour, GameObject } from "../Component";
3
- import { AttachedObject, AttachedObjectEvents } from "./WebXRController";
1
+ import { getWorldPosition, setWorldPosition, setWorldPositionXYZ } from "../../engine/engine_three_utils.js";
2
+ import { Behaviour, GameObject } from "../Component.js";
3
+ import { AttachedObject, AttachedObjectEvents } from "./WebXRController.js";
4
4
  import { Object3D, Vector3 } from "three";
5
- import { PlayerColor } from "../PlayerColor";
6
- import { Context } from "../../engine/engine_setup";
7
- import { IModel, SendQueue } from "../../engine/engine_networking_types";
5
+ import { PlayerColor } from "../PlayerColor.js";
6
+ import { Context } from "../../engine/engine_setup.js";
7
+ import { IModel, SendQueue } from "../../engine/engine_networking_types.js";
8
8
 
9
9
  enum XRGrabEvent {
10
10
  StartOrUpdate = "xr-grab-visual-start-or-update",
src/engine-components/webxr/WebXRImageTracking.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { WebXR, WebXREvent } from "./WebXR";
2
- import { serializable } from "../../engine/engine_serialization";
3
- import { Behaviour, GameObject } from "../Component";
1
+ import { WebXR, WebXREvent } from "./WebXR.js";
2
+ import { serializable } from "../../engine/engine_serialization.js";
3
+ import { Behaviour, GameObject } from "../Component.js";
4
4
  import { Object3D, Quaternion, Vector3 } from "three";
5
- import { CircularBuffer, getParam } from "../../engine/engine_utils";
6
- import { AssetReference } from "../../engine/engine_addressables";
7
- import { showBalloonWarning } from "../../engine/debug";
5
+ import { CircularBuffer, getParam } from "../../engine/engine_utils.js";
6
+ import { AssetReference } from "../../engine/engine_addressables.js";
7
+ import { showBalloonWarning } from "../../engine/debug/index.js";
8
8
 
9
- import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter";
10
- import { USDZExporterContext, USDWriter, imageToCanvas } from "../../engine-components/export/usdz/ThreeUSDZExporter";
9
+ import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter.js";
10
+ import { USDZExporterContext, USDWriter, imageToCanvas } from "../../engine-components/export/usdz/ThreeUSDZExporter.js";
11
11
 
12
12
  // https://github.com/immersive-web/marker-tracking/blob/main/explainer.md
13
13
 
src/engine-components/webxr/WebXRPlaneTracking.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { BufferAttribute, BufferGeometry, Group, Mesh, Object3D, Vector3 } from "three";
2
- import { MeshCollider } from "../Collider";
3
- import { Behaviour, GameObject } from "../Component";
4
- import { WebXR, WebXREvent } from "./WebXR";
5
- import { serializable } from "../../engine/engine_serialization";
6
- import { Vec3 } from "../../engine/engine_types";
7
- import { disposeObjectResources } from "../../engine/engine_assetdatabase";
8
- import { getParam } from "../../engine/engine_utils";
2
+ import { MeshCollider } from "../Collider.js";
3
+ import { Behaviour, GameObject } from "../Component.js";
4
+ import { WebXR, WebXREvent } from "./WebXR.js";
5
+ import { serializable } from "../../engine/engine_serialization.js";
6
+ import { Vec3 } from "../../engine/engine_types.js";
7
+ import { disposeObjectResources } from "../../engine/engine_assetdatabase.js";
8
+ import { getParam } from "../../engine/engine_utils.js";
9
9
 
10
10
  const debug = getParam("debugplanetracking");
11
11
 
src/engine-components/webxr/WebXRRig.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Object3D } from "three";
2
- import { IGameObject } from "../../engine/engine_types";
3
- import { getParam } from "../../engine/engine_utils";
4
- import { Behaviour, GameObject } from "../Component";
5
- import { BoxGizmo } from "../Gizmos";
2
+ import { IGameObject } from "../../engine/engine_types.js";
3
+ import { getParam } from "../../engine/engine_utils.js";
4
+ import { Behaviour, GameObject } from "../Component.js";
5
+ import { BoxGizmo } from "../Gizmos.js";
6
6
 
7
7
  const debug = getParam("debugrig");
8
8
 
src/engine-components/webxr/WebXRSync.ts CHANGED
@@ -1,463 +1,463 @@
1
- import { Behaviour, GameObject } from "../Component";
2
- import { RoomEvents, OwnershipModel, NetworkConnection } from "../../engine/engine_networking";
3
- import { WebXR, WebXREvent } from "./WebXR";
4
- import { Group, Quaternion, Vector3, Vector4, WebXRManager } from "three";
5
- import { getParam } from "../../engine/engine_utils";
6
- import { Voip } from "../Voip";
7
- import { Builder, Long } from "flatbuffers";
8
- import { VrUserStateBuffer } from "../../engine-schemes/vr-user-state-buffer";
9
- import { Vec3 } from "../../engine-schemes/vec3";
10
- import { registerType } from "../../engine-schemes/schemes";
11
- import { Vec4 } from "../../engine-schemes/vec4";
12
- import { WebXRAvatar } from "./WebXRAvatar";
13
-
14
- // for debug GUI
15
- // import { GUI } from "three/examples/jsm/libs/lil-gui.module.min.js";
16
- // import { HTMLMesh } from 'three/examples/jsm/interactive/HTMLMesh.js';
17
- // import { InteractiveGroup } from 'three/examples/jsm/interactive/InteractiveGroup.js';
18
- // import { renderer, sceneData } from "../engine/engine_setup";
19
-
20
- const debugLogs = getParam("debugxr");
21
- const debugAvatar = getParam("debugavatar");
22
- // const debugAvatarVoip = getParam("debugavatarvoip");
23
-
24
- enum WebXRSyncEvent {
25
- WebXR_UserJoined = "webxr-user-joined",
26
- WebXR_UserLeft = "webxr-user-left",
27
- VRSessionStart = "vr-session-started",
28
- VRSessionEnd = "vr-session-ended",
29
- VRSessionUpdate = "vr-session-update",
30
- }
31
-
32
- enum XRMode {
33
- VR = "vr",
34
- AR = "ar",
35
- }
36
-
37
- const VRUserStateBufferIdentifier = "VRUS";
38
- registerType(VRUserStateBufferIdentifier, VrUserStateBuffer.getRootAsVrUserStateBuffer);
39
-
40
- function getTimeStampNow() {
41
- return new Date().getTime(); // avoid sending millis in flatbuffer
42
- }
43
-
44
- function flatbuffers_long_from_number(num: number): Long {
45
- let low = num & 0xffffffff
46
- let high = (num / Math.pow(2, 32)) & 0xfffff
47
- return Long.create(low, high);
48
- }
49
-
50
- export class VRUserState {
51
- public guid: string;
52
- public time!: number;
53
- public avatarId!: string;
54
- public position: Vector3 = new Vector3();
55
- public rotation: Vector4 = new Vector4();
56
- public scale: number = 1;
57
-
58
- public posLeftHand = new Vector3();
59
- public posRightHand = new Vector3();
60
-
61
- public rotLeftHand = new Quaternion();
62
- public rotRightHand = new Quaternion();
63
-
64
- public constructor(guid: string) {
65
- this.guid = guid;
66
- }
67
-
68
- private static invertRotation: Quaternion = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI);
69
-
70
- public update(rig: Group, pos: DOMPointReadOnly, rot: DOMPointReadOnly, webXR: WebXR, avatarId: string) {
71
- this.time = getTimeStampNow();
72
- this.avatarId = avatarId;
73
- this.position.set(pos.x, pos.y, pos.z);
74
- if (rig)
75
- this.position.applyMatrix4(rig.matrixWorld);
76
-
77
- let q0 = VRUserState.quat0;
78
- const q1 = VRUserState.quat1;
79
- q0.set(rot.x, rot.y, rot.z, rot.w);
80
- q0 = q0.multiplyQuaternions(q0, VRUserState.invertRotation);
81
-
82
- if (rig) {
83
- rig.getWorldQuaternion(q1);
84
- q0.multiplyQuaternions(q1, q0);
85
- }
86
-
87
- this.rotation.set(q0.x, q0.y, q0.z, q0.w);
88
- this.scale = rig.scale.x;
89
-
90
- // for controllers, it seems we need grip pose
91
- const ctrl0 = webXR.LeftController?.controllerGrip;
92
- if (ctrl0) {
93
- ctrl0.getWorldPosition(this.posLeftHand);
94
- ctrl0.getWorldQuaternion(this.rotLeftHand);
95
- }
96
- const ctrl1 = webXR.RightController?.controllerGrip;
97
- if (ctrl1) {
98
- ctrl1.getWorldPosition(this.posRightHand);
99
- ctrl1.getWorldQuaternion(this.rotRightHand);
100
- }
101
-
102
- // if this is a hand, we need to get the root bone of that / use that for position/rotation
103
- if (webXR.LeftController?.hand?.visible) {
104
- const wrist = webXR.LeftController.wrist;
105
- if (wrist) {
106
- wrist.getWorldPosition(this.posLeftHand);
107
- wrist.getWorldQuaternion(this.rotLeftHand);
108
- }
109
- }
110
-
111
- if (webXR.RightController?.hand?.visible) {
112
- const wrist = webXR.RightController.wrist;
113
- if (wrist) {
114
- wrist.getWorldPosition(this.posRightHand);
115
- wrist.getWorldQuaternion(this.rotRightHand);
116
- }
117
- }
118
- }
119
-
120
- private static quat0: Quaternion = new Quaternion();
121
- private static quat1: Quaternion = new Quaternion();
122
-
123
- public sendAsBuffer(builder: Builder, net: NetworkConnection) {
124
- builder.clear();
125
- const guid = builder.createString(this.guid);
126
- const id = builder.createString(this.avatarId);
127
- VrUserStateBuffer.startVrUserStateBuffer(builder);
128
- VrUserStateBuffer.addGuid(builder, guid);
129
- VrUserStateBuffer.addTime(builder, flatbuffers_long_from_number(this.time));
130
- VrUserStateBuffer.addAvatarId(builder, id);
131
- VrUserStateBuffer.addPosition(builder, Vec3.createVec3(builder, this.position.x, this.position.y, this.position.z));
132
- VrUserStateBuffer.addRotation(builder, Vec4.createVec4(builder, this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w));
133
- VrUserStateBuffer.addScale(builder, this.scale);
134
- VrUserStateBuffer.addPosLeftHand(builder, Vec3.createVec3(builder, this.posLeftHand.x, this.posLeftHand.y, this.posLeftHand.z));
135
- VrUserStateBuffer.addPosRightHand(builder, Vec3.createVec3(builder, this.posRightHand.x, this.posRightHand.y, this.posRightHand.z));
136
- VrUserStateBuffer.addRotLeftHand(builder, Vec4.createVec4(builder, this.rotLeftHand.x, this.rotLeftHand.y, this.rotLeftHand.z, this.rotLeftHand.w));
137
- VrUserStateBuffer.addRotRightHand(builder, Vec4.createVec4(builder, this.rotRightHand.x, this.rotRightHand.y, this.rotRightHand.z, this.rotRightHand.w));
138
- const res = VrUserStateBuffer.endVrUserStateBuffer(builder);
139
- builder.finish(res, VRUserStateBufferIdentifier);
140
- const arr = builder.asUint8Array();
141
- net.sendBinary(arr);
142
- }
143
-
144
- public setFromBuffer(guid: string, state: VrUserStateBuffer) {
145
- if (!guid) return;
146
- this.guid = guid;
147
- this.time = state.time().toFloat64();
148
- const id = state.avatarId();
149
- if (id)
150
- this.avatarId = id;
151
- const pos = state.position();
152
- if (pos)
153
- this.position.set(pos.x(), pos.y(), pos.z());
154
- // TODO: maybe just send one float more instead of converting back and forth
155
- const rot = state.rotation();
156
- if (rot)
157
- this.rotation.set(rot.x(), rot.y(), rot.z(), rot.w());
158
- const posLeftHand = state.posLeftHand();
159
- if (posLeftHand)
160
- this.posLeftHand.set(posLeftHand.x(), posLeftHand.y(), posLeftHand.z());
161
- const posRightHand = state.posRightHand();
162
- if (posRightHand)
163
- this.posRightHand.set(posRightHand.x(), posRightHand.y(), posRightHand.z());
164
- const rotLeftHand = state.rotLeftHand();
165
- if (rotLeftHand)
166
- this.rotLeftHand.set(rotLeftHand.x(), rotLeftHand.y(), rotLeftHand.z(), rotLeftHand.w());
167
- const rotRightHand = state.rotRightHand();
168
- if (rotRightHand)
169
- this.rotRightHand.set(rotRightHand.x(), rotRightHand.y(), rotRightHand.z(), rotRightHand.w());
170
- this.scale = state.scale();
171
- }
172
- }
173
-
174
- export class WebXRSync extends Behaviour {
175
-
176
- webXR: WebXR | null = null;
177
-
178
- // private allowCustomAvatars: boolean | null = true;
179
-
180
- private debugAvatarUser: WebXRAvatar | null = null;
181
- private voip: Voip | null = null;
182
-
183
- async awake() {
184
-
185
- if(!this.webXR) this.webXR = GameObject.getComponent(this.gameObject, WebXR);
186
- if(!this.webXR) this.webXR = GameObject.findObjectOfType(WebXR, this.context);
187
-
188
- if(!this.webXR)
189
- {
190
- console.log("Missing webxr component");
191
- this.webXR = GameObject.findObjectOfType(WebXR, this.context);
192
- if(!this.webXR) {
193
- console.error("Could not find webxr component");
194
- return;
195
- }
196
- }
197
-
198
- if (!this.voip) this.voip = GameObject.findObjectOfType(Voip, this.context);
199
-
200
- if (debugAvatar) {
201
- const debugGuid = "debug-avatar-" + debugAvatar;
202
- const newUser = new WebXRAvatar(this.context, debugGuid, this.webXR);
203
- // newUser.isLocalAvatar = true;
204
- this.debugAvatarUser = newUser;
205
- if (typeof debugAvatar === "string" && debugAvatar.length > 0) {
206
- if (await newUser.setAvatarOverride(debugAvatar)) {
207
- const debugState = new VRUserState(debugGuid);
208
- debugState.position.y += 1;
209
- const off = .5;
210
- debugState.posLeftHand.y += off;
211
- debugState.posLeftHand.x += off;
212
- debugState.posRightHand.y += off;
213
- debugState.posRightHand.x -= off;
214
- newUser.tryUpdate(debugState, 0);
215
- }
216
- else {
217
- newUser.destroy();
218
- }
219
- }
220
- }
221
- }
222
-
223
- onEnable() {
224
- // const debugUser = new WebXRAvatar(this.context, "sorry-no-guid", this.webXR!);
225
-
226
- if (!this.webXR) {
227
- this.webXR = GameObject.getComponent(this.gameObject, WebXR);
228
- if (!this.webXR) {
229
- console.warn("Missing webxr component on " + this.gameObject.name);
230
- return;
231
- }
232
- }
233
-
234
- this.eventSub_WebXRStartEvent = this.onXRSessionStart.bind(this);
235
- WebXR.addEventListener(WebXREvent.XRStarted, this.eventSub_WebXRStartEvent);
236
- this.eventSub_WebXRUpdateEvent = this.onXRSessionUpdate.bind(this);
237
- WebXR.addEventListener(WebXREvent.XRUpdate, this.eventSub_WebXRUpdateEvent);
238
- this.eventSub_WebXREndEvent = this.onXRSessionEnded.bind(this);
239
- WebXR.addEventListener(WebXREvent.XRStopped, this.eventSub_WebXREndEvent);
240
-
241
- this.eventSub_ConnectionEvent = this.onConnected.bind(this);
242
- this.context.connection.beginListen(RoomEvents.JoinedRoom, this.eventSub_ConnectionEvent);
243
- this.context.connection.beginListen(WebXRSyncEvent.WebXR_UserJoined, _evt => {
244
- console.log("webxr user joined evt");
245
- });
246
- this.context.connection.beginListen(WebXRSyncEvent.WebXR_UserLeft, evt => {
247
- const hasId = evt.id !== null && evt.id !== undefined;
248
- if (!hasId) return;
249
- console.log("webxr user left evt");
250
- if (hasId) {
251
- const avatar = this.avatars[evt.id];
252
- avatar?.destroy();
253
- this.avatars[evt.id] = undefined;
254
- }
255
- });
256
- this.context.connection.beginListenBinary(VRUserStateBufferIdentifier, (state: VrUserStateBuffer) => {
257
- // console.log("BUFFER", state);
258
- const guid = state.guid();
259
- if (!guid) return;
260
- const time = state.time().toFloat64();
261
- const temp = this.tempState;
262
- temp.setFromBuffer(guid, state);
263
- // console.log(temp);
264
- const user = this.onTryGetAvatar(guid, time);
265
- user?.tryUpdate(temp, time);
266
- });
267
- this.context.connection.beginListen(WebXRSyncEvent.VRSessionUpdate, (state: VRUserState) => {
268
- const guid = state.guid;
269
- const time = state.time;
270
- const user = this.onTryGetAvatar(guid, time);
271
- user?.tryUpdate(state, time);
272
- });
273
- }
274
-
275
- private tempState: VRUserState = new VRUserState("");
276
-
277
- private onTryGetAvatar(guid: string, time: number) {
278
- if (guid === this.context.connection.connectionId) return null; // ignore self in case we receive that also!
279
- const timeDiff = new Date().getTime() - time;
280
- if (timeDiff > 5000) {
281
- if (debugLogs)
282
- console.log("old data", timeDiff, guid)
283
- return null;
284
- }
285
- let user = this.avatars[guid];
286
- if (user === undefined) {
287
- try {
288
- console.log("create new avatar");
289
- const newUser = new WebXRAvatar(this.context, guid, this.webXR!);
290
- user = newUser;
291
- this.avatars[guid] = newUser;
292
- } catch (err) {
293
- this.avatars[guid] = null;
294
- console.error(err);
295
- }
296
- }
297
- return user;
298
- }
299
-
300
- onDisable() {
301
- if (this.eventSub_ConnectionEvent)
302
- this.context.connection.stopListen(RoomEvents.JoinedRoom, this.eventSub_ConnectionEvent);
303
- WebXR.removeEventListener(WebXREvent.XRStarted, this.eventSub_WebXRStartEvent);
304
- WebXR.removeEventListener(WebXREvent.XRUpdate, this.eventSub_WebXRUpdateEvent);
305
- WebXR.removeEventListener(WebXREvent.XRStopped, this.eventSub_WebXREndEvent);
306
- }
307
-
308
- update(): void {
309
-
310
- const now = getTimeStampNow();
311
-
312
- if (this.debugAvatarUser) {
313
- this.debugAvatarUser.lastUpdate = now;
314
- }
315
-
316
- this.detectPotentiallyDisconnectedAvatarsAndRemove();
317
-
318
- for (const key in this.avatars) {
319
- const avatar = this.avatars[key];
320
- if (!avatar) continue;
321
- avatar.update();
322
- }
323
- }
324
-
325
-
326
- private _removeAvatarsList: string[] = [];
327
- private detectPotentiallyDisconnectedAvatarsAndRemove() {
328
- const utcnow = getTimeStampNow();
329
- for (const key in this.avatars) {
330
- const avatar = this.avatars[key];
331
- if (!avatar) {
332
- this._removeAvatarsList.push(key);
333
- continue;
334
- }
335
- if (utcnow - avatar.lastUpdate > 10_000) {
336
- console.log("avatar timed out (didnt receive any updates in a while) - destroying it now");
337
- avatar.destroy();
338
- this.avatars[key] = undefined;
339
- }
340
- }
341
- for (const rem of this._removeAvatarsList) {
342
- delete this.avatars[rem];
343
- }
344
- this._removeAvatarsList.length = 0;
345
- }
346
-
347
- private buildLocalAvatar() {
348
- if (this.localAvatar) return;
349
- const connectionId = this.context.connection?.connectionId ?? this.k_LocalAvatarNoNetworkingGuid;
350
- this.localAvatar = new WebXRAvatar(this.context, connectionId, this.webXR!);
351
- this.localAvatar.isLocalAvatar = true;
352
- this.localAvatar.setAvatarOverride(this.getAvatarId());
353
- this.avatars[this.localAvatar.guid] = this.localAvatar;
354
- }
355
-
356
-
357
- private eventSub_ConnectionEvent: Function | null = null;
358
- private eventSub_WebXRStartEvent: Function | null = null;
359
- private eventSub_WebXREndEvent: Function | null = null;
360
- private eventSub_WebXRUpdateEvent: Function | null = null;
361
- private avatars: { [key: string]: WebXRAvatar | undefined | null } = {}
362
- private localAvatar: WebXRAvatar | null = null;
363
- private k_LocalAvatarNoNetworkingGuid = "local";
364
-
365
- private onConnected() {
366
- // this event gets fired when we have joined a room and are ready to update
367
- if (debugLogs)
368
- console.log("Hey you are connected as " + this.context.connection.connectionId);
369
-
370
- if (this.localAvatar?.guid === this.k_LocalAvatarNoNetworkingGuid) {
371
- if (this.localAvatar) {
372
- this.localAvatar?.destroy();
373
- this.avatars[this.localAvatar.guid] = undefined;
374
- }
375
- this.localAvatar = null;
376
- this.xrState = null;
377
- this.ownership?.freeOwnership();
378
- this.ownership = null;
379
- }
380
- }
381
-
382
- private onXRSessionStart(_evt: { session: XRSession }) {
383
- console.log("XR session started");
384
- this.context.connection.send(WebXRSyncEvent.WebXR_UserJoined, { id: this.context.connection.connectionId, mode: XRMode.VR });
385
-
386
- if (this.localAvatar) {
387
- this.localAvatar?.destroy();
388
- this.avatars[this.localAvatar.guid] = undefined;
389
- this.localAvatar = null;
390
- }
391
- this.xrState = null;
392
- this.ownership?.freeOwnership();
393
- this.ownership = null;
394
-
395
- if (this.avatars) {
396
- for (const key in this.avatars) {
397
- this.avatars[key]?.updateFlags();
398
- }
399
- }
400
- }
401
-
402
- private onXRSessionEnded(_evt: { session: XRSession }) {
403
- console.log("XR session ended");
404
- this.context.connection.send(WebXRSyncEvent.WebXR_UserLeft, { id: this.context.connection.connectionId, mode: XRMode.VR });
405
- if(this.localAvatar){
406
- this.localAvatar?.destroy();
407
- this.avatars[this.localAvatar.guid] = undefined;
408
- this.localAvatar = null;
409
- }
410
- }
411
-
412
- private ownership: OwnershipModel | null = null;
413
- private xrState: VRUserState | null = null;
414
- private builder: Builder = new Builder(1024);
415
-
416
- private onXRSessionUpdate(evt: { rig: Group, frame: XRFrame, xr: WebXRManager, input: XRInputSource[] }) {
417
-
418
- this.xrState ??= new VRUserState(this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid);
419
- this.ownership ??= new OwnershipModel(this.context.connection, this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid);
420
- this.ownership.guid = this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid;
421
- this.buildLocalAvatar();
422
-
423
-
424
- const { frame, xr, rig } = evt;
425
- const pose = frame.getViewerPose(xr.getReferenceSpace()!);
426
- if (!pose) return; // e.g. if user is not wearing headset
427
- const transform: XRRigidTransform = pose?.transform;
428
- const pos = transform.position;
429
- const rot = transform.orientation;
430
- this.xrState.update(rig, pos, rot, this.webXR!, this.getAvatarId());
431
-
432
- if (this.localAvatar) {
433
- if (this.context.connection.connectionId) {
434
- this.localAvatar.guid = this.context.connection.connectionId;
435
- }
436
- this.localAvatar.tryUpdate(this.xrState, 0);
437
- }
438
-
439
- if (this.ownership && !this.ownership.hasOwnership && this.context.connection.isConnected) {
440
- if (this.context.time.frameCount % 120 === 0)
441
- this.ownership.requestOwnership();
442
- if (!this.ownership.hasOwnership) {
443
- // console.log("NO OWNERSHIP", this.ownership.guid);
444
- return;
445
- }
446
- }
447
-
448
- if (!this.context.connection.isConnected || !this.context.connection.connectionId) {
449
- return;
450
- }
451
-
452
- this.xrState.sendAsBuffer(this.builder, this.context.connection);
453
-
454
- // this.context.connection.send(WebXRSyncEvent.VRSessionUpdate, this.xrState);
455
-
456
- }
457
-
458
- private getAvatarId() {
459
- const urlAvatar = getParam("avatar") as string;
460
- const avatarId = urlAvatar ?? null;
461
- return avatarId;
462
- }
463
- }
1
+ import { Behaviour, GameObject } from "../Component.js";
2
+ import { RoomEvents, OwnershipModel, NetworkConnection } from "../../engine/engine_networking.js";
3
+ import { WebXR, WebXREvent } from "./WebXR.js";
4
+ import { Group, Quaternion, Vector3, Vector4, WebXRManager } from "three";
5
+ import { getParam } from "../../engine/engine_utils.js";
6
+ import { Voip } from "../Voip.js";
7
+ import { Builder, Long } from "flatbuffers";
8
+ import { VrUserStateBuffer } from "../../engine-schemes/vr-user-state-buffer.js";
9
+ import { Vec3 } from "../../engine-schemes/vec3.js";
10
+ import { registerBinaryType } from "../../engine-schemes/schemes.js";
11
+ import { Vec4 } from "../../engine-schemes/vec4.js";
12
+ import { WebXRAvatar } from "./WebXRAvatar.js";
13
+
14
+ // for debug GUI
15
+ // import { GUI } from "three/examples/jsm/libs/lil-gui.module.min.js";
16
+ // import { HTMLMesh } from 'three/examples/jsm/interactive/HTMLMesh.js';
17
+ // import { InteractiveGroup } from 'three/examples/jsm/interactive/InteractiveGroup.js';
18
+ // import { renderer, sceneData } from "../engine/engine_setup.js";
19
+
20
+ const debugLogs = getParam("debugxr");
21
+ const debugAvatar = getParam("debugavatar");
22
+ // const debugAvatarVoip = getParam("debugavatarvoip");
23
+
24
+ enum WebXRSyncEvent {
25
+ WebXR_UserJoined = "webxr-user-joined",
26
+ WebXR_UserLeft = "webxr-user-left",
27
+ VRSessionStart = "vr-session-started",
28
+ VRSessionEnd = "vr-session-ended",
29
+ VRSessionUpdate = "vr-session-update",
30
+ }
31
+
32
+ enum XRMode {
33
+ VR = "vr",
34
+ AR = "ar",
35
+ }
36
+
37
+ const VRUserStateBufferIdentifier = "VRUS";
38
+ registerBinaryType(VRUserStateBufferIdentifier, VrUserStateBuffer.getRootAsVrUserStateBuffer);
39
+
40
+ function getTimeStampNow() {
41
+ return new Date().getTime(); // avoid sending millis in flatbuffer
42
+ }
43
+
44
+ function flatbuffers_long_from_number(num: number): Long {
45
+ let low = num & 0xffffffff
46
+ let high = (num / Math.pow(2, 32)) & 0xfffff
47
+ return Long.create(low, high);
48
+ }
49
+
50
+ export class VRUserState {
51
+ public guid: string;
52
+ public time!: number;
53
+ public avatarId!: string;
54
+ public position: Vector3 = new Vector3();
55
+ public rotation: Vector4 = new Vector4();
56
+ public scale: number = 1;
57
+
58
+ public posLeftHand = new Vector3();
59
+ public posRightHand = new Vector3();
60
+
61
+ public rotLeftHand = new Quaternion();
62
+ public rotRightHand = new Quaternion();
63
+
64
+ public constructor(guid: string) {
65
+ this.guid = guid;
66
+ }
67
+
68
+ private static invertRotation: Quaternion = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI);
69
+
70
+ public update(rig: Group, pos: DOMPointReadOnly, rot: DOMPointReadOnly, webXR: WebXR, avatarId: string) {
71
+ this.time = getTimeStampNow();
72
+ this.avatarId = avatarId;
73
+ this.position.set(pos.x, pos.y, pos.z);
74
+ if (rig)
75
+ this.position.applyMatrix4(rig.matrixWorld);
76
+
77
+ let q0 = VRUserState.quat0;
78
+ const q1 = VRUserState.quat1;
79
+ q0.set(rot.x, rot.y, rot.z, rot.w);
80
+ q0 = q0.multiplyQuaternions(q0, VRUserState.invertRotation);
81
+
82
+ if (rig) {
83
+ rig.getWorldQuaternion(q1);
84
+ q0.multiplyQuaternions(q1, q0);
85
+ }
86
+
87
+ this.rotation.set(q0.x, q0.y, q0.z, q0.w);
88
+ this.scale = rig.scale.x;
89
+
90
+ // for controllers, it seems we need grip pose
91
+ const ctrl0 = webXR.LeftController?.controllerGrip;
92
+ if (ctrl0) {
93
+ ctrl0.getWorldPosition(this.posLeftHand);
94
+ ctrl0.getWorldQuaternion(this.rotLeftHand);
95
+ }
96
+ const ctrl1 = webXR.RightController?.controllerGrip;
97
+ if (ctrl1) {
98
+ ctrl1.getWorldPosition(this.posRightHand);
99
+ ctrl1.getWorldQuaternion(this.rotRightHand);
100
+ }
101
+
102
+ // if this is a hand, we need to get the root bone of that / use that for position/rotation
103
+ if (webXR.LeftController?.hand?.visible) {
104
+ const wrist = webXR.LeftController.wrist;
105
+ if (wrist) {
106
+ wrist.getWorldPosition(this.posLeftHand);
107
+ wrist.getWorldQuaternion(this.rotLeftHand);
108
+ }
109
+ }
110
+
111
+ if (webXR.RightController?.hand?.visible) {
112
+ const wrist = webXR.RightController.wrist;
113
+ if (wrist) {
114
+ wrist.getWorldPosition(this.posRightHand);
115
+ wrist.getWorldQuaternion(this.rotRightHand);
116
+ }
117
+ }
118
+ }
119
+
120
+ private static quat0: Quaternion = new Quaternion();
121
+ private static quat1: Quaternion = new Quaternion();
122
+
123
+ public sendAsBuffer(builder: Builder, net: NetworkConnection) {
124
+ builder.clear();
125
+ const guid = builder.createString(this.guid);
126
+ const id = builder.createString(this.avatarId);
127
+ VrUserStateBuffer.startVrUserStateBuffer(builder);
128
+ VrUserStateBuffer.addGuid(builder, guid);
129
+ VrUserStateBuffer.addTime(builder, flatbuffers_long_from_number(this.time));
130
+ VrUserStateBuffer.addAvatarId(builder, id);
131
+ VrUserStateBuffer.addPosition(builder, Vec3.createVec3(builder, this.position.x, this.position.y, this.position.z));
132
+ VrUserStateBuffer.addRotation(builder, Vec4.createVec4(builder, this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w));
133
+ VrUserStateBuffer.addScale(builder, this.scale);
134
+ VrUserStateBuffer.addPosLeftHand(builder, Vec3.createVec3(builder, this.posLeftHand.x, this.posLeftHand.y, this.posLeftHand.z));
135
+ VrUserStateBuffer.addPosRightHand(builder, Vec3.createVec3(builder, this.posRightHand.x, this.posRightHand.y, this.posRightHand.z));
136
+ VrUserStateBuffer.addRotLeftHand(builder, Vec4.createVec4(builder, this.rotLeftHand.x, this.rotLeftHand.y, this.rotLeftHand.z, this.rotLeftHand.w));
137
+ VrUserStateBuffer.addRotRightHand(builder, Vec4.createVec4(builder, this.rotRightHand.x, this.rotRightHand.y, this.rotRightHand.z, this.rotRightHand.w));
138
+ const res = VrUserStateBuffer.endVrUserStateBuffer(builder);
139
+ builder.finish(res, VRUserStateBufferIdentifier);
140
+ const arr = builder.asUint8Array();
141
+ net.sendBinary(arr);
142
+ }
143
+
144
+ public setFromBuffer(guid: string, state: VrUserStateBuffer) {
145
+ if (!guid) return;
146
+ this.guid = guid;
147
+ this.time = state.time().toFloat64();
148
+ const id = state.avatarId();
149
+ if (id)
150
+ this.avatarId = id;
151
+ const pos = state.position();
152
+ if (pos)
153
+ this.position.set(pos.x(), pos.y(), pos.z());
154
+ // TODO: maybe just send one float more instead of converting back and forth
155
+ const rot = state.rotation();
156
+ if (rot)
157
+ this.rotation.set(rot.x(), rot.y(), rot.z(), rot.w());
158
+ const posLeftHand = state.posLeftHand();
159
+ if (posLeftHand)
160
+ this.posLeftHand.set(posLeftHand.x(), posLeftHand.y(), posLeftHand.z());
161
+ const posRightHand = state.posRightHand();
162
+ if (posRightHand)
163
+ this.posRightHand.set(posRightHand.x(), posRightHand.y(), posRightHand.z());
164
+ const rotLeftHand = state.rotLeftHand();
165
+ if (rotLeftHand)
166
+ this.rotLeftHand.set(rotLeftHand.x(), rotLeftHand.y(), rotLeftHand.z(), rotLeftHand.w());
167
+ const rotRightHand = state.rotRightHand();
168
+ if (rotRightHand)
169
+ this.rotRightHand.set(rotRightHand.x(), rotRightHand.y(), rotRightHand.z(), rotRightHand.w());
170
+ this.scale = state.scale();
171
+ }
172
+ }
173
+
174
+ export class WebXRSync extends Behaviour {
175
+
176
+ webXR: WebXR | null = null;
177
+
178
+ // private allowCustomAvatars: boolean | null = true;
179
+
180
+ private debugAvatarUser: WebXRAvatar | null = null;
181
+ private voip: Voip | null = null;
182
+
183
+ async awake() {
184
+
185
+ if(!this.webXR) this.webXR = GameObject.getComponent(this.gameObject, WebXR);
186
+ if(!this.webXR) this.webXR = GameObject.findObjectOfType(WebXR, this.context);
187
+
188
+ if(!this.webXR)
189
+ {
190
+ console.log("Missing webxr component");
191
+ this.webXR = GameObject.findObjectOfType(WebXR, this.context);
192
+ if(!this.webXR) {
193
+ console.error("Could not find webxr component");
194
+ return;
195
+ }
196
+ }
197
+
198
+ if (!this.voip) this.voip = GameObject.findObjectOfType(Voip, this.context);
199
+
200
+ if (debugAvatar) {
201
+ const debugGuid = "debug-avatar-" + debugAvatar;
202
+ const newUser = new WebXRAvatar(this.context, debugGuid, this.webXR);
203
+ // newUser.isLocalAvatar = true;
204
+ this.debugAvatarUser = newUser;
205
+ if (typeof debugAvatar === "string" && debugAvatar.length > 0) {
206
+ if (await newUser.setAvatarOverride(debugAvatar)) {
207
+ const debugState = new VRUserState(debugGuid);
208
+ debugState.position.y += 1;
209
+ const off = .5;
210
+ debugState.posLeftHand.y += off;
211
+ debugState.posLeftHand.x += off;
212
+ debugState.posRightHand.y += off;
213
+ debugState.posRightHand.x -= off;
214
+ newUser.tryUpdate(debugState, 0);
215
+ }
216
+ else {
217
+ newUser.destroy();
218
+ }
219
+ }
220
+ }
221
+ }
222
+
223
+ onEnable() {
224
+ // const debugUser = new WebXRAvatar(this.context, "sorry-no-guid", this.webXR!);
225
+
226
+ if (!this.webXR) {
227
+ this.webXR = GameObject.getComponent(this.gameObject, WebXR);
228
+ if (!this.webXR) {
229
+ console.warn("Missing webxr component on " + this.gameObject.name);
230
+ return;
231
+ }
232
+ }
233
+
234
+ this.eventSub_WebXRStartEvent = this.onXRSessionStart.bind(this);
235
+ WebXR.addEventListener(WebXREvent.XRStarted, this.eventSub_WebXRStartEvent);
236
+ this.eventSub_WebXRUpdateEvent = this.onXRSessionUpdate.bind(this);
237
+ WebXR.addEventListener(WebXREvent.XRUpdate, this.eventSub_WebXRUpdateEvent);
238
+ this.eventSub_WebXREndEvent = this.onXRSessionEnded.bind(this);
239
+ WebXR.addEventListener(WebXREvent.XRStopped, this.eventSub_WebXREndEvent);
240
+
241
+ this.eventSub_ConnectionEvent = this.onConnected.bind(this);
242
+ this.context.connection.beginListen(RoomEvents.JoinedRoom, this.eventSub_ConnectionEvent);
243
+ this.context.connection.beginListen(WebXRSyncEvent.WebXR_UserJoined, _evt => {
244
+ console.log("webxr user joined evt");
245
+ });
246
+ this.context.connection.beginListen(WebXRSyncEvent.WebXR_UserLeft, evt => {
247
+ const hasId = evt.id !== null && evt.id !== undefined;
248
+ if (!hasId) return;
249
+ console.log("webxr user left evt");
250
+ if (hasId) {
251
+ const avatar = this.avatars[evt.id];
252
+ avatar?.destroy();
253
+ this.avatars[evt.id] = undefined;
254
+ }
255
+ });
256
+ this.context.connection.beginListenBinary(VRUserStateBufferIdentifier, (state: VrUserStateBuffer) => {
257
+ // console.log("BUFFER", state);
258
+ const guid = state.guid();
259
+ if (!guid) return;
260
+ const time = state.time().toFloat64();
261
+ const temp = this.tempState;
262
+ temp.setFromBuffer(guid, state);
263
+ // console.log(temp);
264
+ const user = this.onTryGetAvatar(guid, time);
265
+ user?.tryUpdate(temp, time);
266
+ });
267
+ this.context.connection.beginListen(WebXRSyncEvent.VRSessionUpdate, (state: VRUserState) => {
268
+ const guid = state.guid;
269
+ const time = state.time;
270
+ const user = this.onTryGetAvatar(guid, time);
271
+ user?.tryUpdate(state, time);
272
+ });
273
+ }
274
+
275
+ private tempState: VRUserState = new VRUserState("");
276
+
277
+ private onTryGetAvatar(guid: string, time: number) {
278
+ if (guid === this.context.connection.connectionId) return null; // ignore self in case we receive that also!
279
+ const timeDiff = new Date().getTime() - time;
280
+ if (timeDiff > 5000) {
281
+ if (debugLogs)
282
+ console.log("old data", timeDiff, guid)
283
+ return null;
284
+ }
285
+ let user = this.avatars[guid];
286
+ if (user === undefined) {
287
+ try {
288
+ console.log("create new avatar");
289
+ const newUser = new WebXRAvatar(this.context, guid, this.webXR!);
290
+ user = newUser;
291
+ this.avatars[guid] = newUser;
292
+ } catch (err) {
293
+ this.avatars[guid] = null;
294
+ console.error(err);
295
+ }
296
+ }
297
+ return user;
298
+ }
299
+
300
+ onDisable() {
301
+ if (this.eventSub_ConnectionEvent)
302
+ this.context.connection.stopListen(RoomEvents.JoinedRoom, this.eventSub_ConnectionEvent);
303
+ WebXR.removeEventListener(WebXREvent.XRStarted, this.eventSub_WebXRStartEvent);
304
+ WebXR.removeEventListener(WebXREvent.XRUpdate, this.eventSub_WebXRUpdateEvent);
305
+ WebXR.removeEventListener(WebXREvent.XRStopped, this.eventSub_WebXREndEvent);
306
+ }
307
+
308
+ update(): void {
309
+
310
+ const now = getTimeStampNow();
311
+
312
+ if (this.debugAvatarUser) {
313
+ this.debugAvatarUser.lastUpdate = now;
314
+ }
315
+
316
+ this.detectPotentiallyDisconnectedAvatarsAndRemove();
317
+
318
+ for (const key in this.avatars) {
319
+ const avatar = this.avatars[key];
320
+ if (!avatar) continue;
321
+ avatar.update();
322
+ }
323
+ }
324
+
325
+
326
+ private _removeAvatarsList: string[] = [];
327
+ private detectPotentiallyDisconnectedAvatarsAndRemove() {
328
+ const utcnow = getTimeStampNow();
329
+ for (const key in this.avatars) {
330
+ const avatar = this.avatars[key];
331
+ if (!avatar) {
332
+ this._removeAvatarsList.push(key);
333
+ continue;
334
+ }
335
+ if (utcnow - avatar.lastUpdate > 10_000) {
336
+ console.log("avatar timed out (didnt receive any updates in a while) - destroying it now");
337
+ avatar.destroy();
338
+ this.avatars[key] = undefined;
339
+ }
340
+ }
341
+ for (const rem of this._removeAvatarsList) {
342
+ delete this.avatars[rem];
343
+ }
344
+ this._removeAvatarsList.length = 0;
345
+ }
346
+
347
+ private buildLocalAvatar() {
348
+ if (this.localAvatar) return;
349
+ const connectionId = this.context.connection?.connectionId ?? this.k_LocalAvatarNoNetworkingGuid;
350
+ this.localAvatar = new WebXRAvatar(this.context, connectionId, this.webXR!);
351
+ this.localAvatar.isLocalAvatar = true;
352
+ this.localAvatar.setAvatarOverride(this.getAvatarId());
353
+ this.avatars[this.localAvatar.guid] = this.localAvatar;
354
+ }
355
+
356
+
357
+ private eventSub_ConnectionEvent: Function | null = null;
358
+ private eventSub_WebXRStartEvent: Function | null = null;
359
+ private eventSub_WebXREndEvent: Function | null = null;
360
+ private eventSub_WebXRUpdateEvent: Function | null = null;
361
+ private avatars: { [key: string]: WebXRAvatar | undefined | null } = {}
362
+ private localAvatar: WebXRAvatar | null = null;
363
+ private k_LocalAvatarNoNetworkingGuid = "local";
364
+
365
+ private onConnected() {
366
+ // this event gets fired when we have joined a room and are ready to update
367
+ if (debugLogs)
368
+ console.log("Hey you are connected as " + this.context.connection.connectionId);
369
+
370
+ if (this.localAvatar?.guid === this.k_LocalAvatarNoNetworkingGuid) {
371
+ if (this.localAvatar) {
372
+ this.localAvatar?.destroy();
373
+ this.avatars[this.localAvatar.guid] = undefined;
374
+ }
375
+ this.localAvatar = null;
376
+ this.xrState = null;
377
+ this.ownership?.freeOwnership();
378
+ this.ownership = null;
379
+ }
380
+ }
381
+
382
+ private onXRSessionStart(_evt: { session: XRSession }) {
383
+ console.log("XR session started");
384
+ this.context.connection.send(WebXRSyncEvent.WebXR_UserJoined, { id: this.context.connection.connectionId, mode: XRMode.VR });
385
+
386
+ if (this.localAvatar) {
387
+ this.localAvatar?.destroy();
388
+ this.avatars[this.localAvatar.guid] = undefined;
389
+ this.localAvatar = null;
390
+ }
391
+ this.xrState = null;
392
+ this.ownership?.freeOwnership();
393
+ this.ownership = null;
394
+
395
+ if (this.avatars) {
396
+ for (const key in this.avatars) {
397
+ this.avatars[key]?.updateFlags();
398
+ }
399
+ }
400
+ }
401
+
402
+ private onXRSessionEnded(_evt: { session: XRSession }) {
403
+ console.log("XR session ended");
404
+ this.context.connection.send(WebXRSyncEvent.WebXR_UserLeft, { id: this.context.connection.connectionId, mode: XRMode.VR });
405
+ if(this.localAvatar){
406
+ this.localAvatar?.destroy();
407
+ this.avatars[this.localAvatar.guid] = undefined;
408
+ this.localAvatar = null;
409
+ }
410
+ }
411
+
412
+ private ownership: OwnershipModel | null = null;
413
+ private xrState: VRUserState | null = null;
414
+ private builder: Builder = new Builder(1024);
415
+
416
+ private onXRSessionUpdate(evt: { rig: Group, frame: XRFrame, xr: WebXRManager, input: XRInputSource[] }) {
417
+
418
+ this.xrState ??= new VRUserState(this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid);
419
+ this.ownership ??= new OwnershipModel(this.context.connection, this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid);
420
+ this.ownership.guid = this.context.connection.connectionId ?? this.k_LocalAvatarNoNetworkingGuid;
421
+ this.buildLocalAvatar();
422
+
423
+
424
+ const { frame, xr, rig } = evt;
425
+ const pose = frame.getViewerPose(xr.getReferenceSpace()!);
426
+ if (!pose) return; // e.g. if user is not wearing headset
427
+ const transform: XRRigidTransform = pose?.transform;
428
+ const pos = transform.position;
429
+ const rot = transform.orientation;
430
+ this.xrState.update(rig, pos, rot, this.webXR!, this.getAvatarId());
431
+
432
+ if (this.localAvatar) {
433
+ if (this.context.connection.connectionId) {
434
+ this.localAvatar.guid = this.context.connection.connectionId;
435
+ }
436
+ this.localAvatar.tryUpdate(this.xrState, 0);
437
+ }
438
+
439
+ if (this.ownership && !this.ownership.hasOwnership && this.context.connection.isConnected) {
440
+ if (this.context.time.frameCount % 120 === 0)
441
+ this.ownership.requestOwnership();
442
+ if (!this.ownership.hasOwnership) {
443
+ // console.log("NO OWNERSHIP", this.ownership.guid);
444
+ return;
445
+ }
446
+ }
447
+
448
+ if (!this.context.connection.isConnected || !this.context.connection.connectionId) {
449
+ return;
450
+ }
451
+
452
+ this.xrState.sendAsBuffer(this.builder, this.context.connection);
453
+
454
+ // this.context.connection.send(WebXRSyncEvent.VRSessionUpdate, this.xrState);
455
+
456
+ }
457
+
458
+ private getAvatarId() {
459
+ const urlAvatar = getParam("avatar") as string;
460
+ const avatarId = urlAvatar ?? null;
461
+ return avatarId;
462
+ }
463
+ }
src/engine-components/XRFlag.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Behaviour, GameObject } from "./Component";
2
- import * as utils from "../engine/engine_utils";
1
+ import { Behaviour, GameObject } from "./Component.js";
2
+ import * as utils from "../engine/engine_utils.js";
3
3
 
4
4
 
5
5
  const debug = utils.getParam("debugflags");
src/engine-schemes/api.ts ADDED
@@ -0,0 +1,1 @@
1
+ export * from "./schemes.js";
src/engine/codegen/register_types.ts ADDED
@@ -0,0 +1,437 @@
1
+ import { TypeStore } from "./../engine_typestore.js"
2
+
3
+ // Import types
4
+ import { __Ignore } from "../../engine-components/codegen/components.js";
5
+ import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
6
+ import { ActionCollection } from "../../engine-components/export/usdz/extensions/behavior/Actions.js";
7
+ import { ActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
8
+ import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint.js";
9
+ import { Animation } from "../../engine-components/Animation.js";
10
+ import { AnimationCurve } from "../../engine-components/AnimationCurve.js";
11
+ import { AnimationExtension } from "../../engine-components/export/usdz/extensions/Animation.js";
12
+ import { AnimationTrackHandler } from "../../engine-components/timeline/TimelineTracks.js";
13
+ import { Animator } from "../../engine-components/Animator.js";
14
+ import { AnimatorController } from "../../engine-components/AnimatorController.js";
15
+ import { Antialiasing } from "../../engine-components/postprocessing/Effects/Antialiasing.js";
16
+ import { AttachedObject } from "../../engine-components/webxr/WebXRController.js";
17
+ import { AudioExtension } from "../../engine-components/export/usdz/extensions/behavior/AudioExtension.js";
18
+ import { AudioListener } from "../../engine-components/AudioListener.js";
19
+ import { AudioSource } from "../../engine-components/AudioSource.js";
20
+ import { AudioTrackHandler } from "../../engine-components/timeline/TimelineTracks.js";
21
+ import { Avatar_Brain_LookAt } from "../../engine-components/avatar/Avatar_Brain_LookAt.js";
22
+ import { Avatar_MouthShapes } from "../../engine-components/avatar/Avatar_MouthShapes.js";
23
+ import { Avatar_MustacheShake } from "../../engine-components/avatar/Avatar_MustacheShake.js";
24
+ import { Avatar_POI } from "../../engine-components/avatar/Avatar_Brain_LookAt.js";
25
+ import { AvatarBlink_Simple } from "../../engine-components/avatar/AvatarBlink_Simple.js";
26
+ import { AvatarEyeLook_Rotation } from "../../engine-components/avatar/AvatarEyeLook_Rotation.js";
27
+ import { AvatarLoader } from "../../engine-components/AvatarLoader.js";
28
+ import { AvatarMarker } from "../../engine-components/webxr/WebXRAvatar.js";
29
+ import { AvatarModel } from "../../engine-components/AvatarLoader.js";
30
+ import { AxesHelper } from "../../engine-components/AxesHelper.js";
31
+ import { BaseUIComponent } from "../../engine-components/ui/BaseUIComponent.js";
32
+ import { BasicIKConstraint } from "../../engine-components/BasicIKConstraint.js";
33
+ import { BehaviorExtension } from "../../engine-components/export/usdz/extensions/behavior/Behaviour.js";
34
+ import { BehaviorModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
35
+ import { Behaviour } from "../../engine-components/Component.js";
36
+ import { Bloom } from "../../engine-components/postprocessing/Effects/Bloom.js";
37
+ import { BoxCollider } from "../../engine-components/Collider.js";
38
+ import { BoxGizmo } from "../../engine-components/Gizmos.js";
39
+ import { BoxHelperComponent } from "../../engine-components/BoxHelperComponent.js";
40
+ import { Button } from "../../engine-components/ui/Button.js";
41
+ import { CallInfo } from "../../engine-components/EventList.js";
42
+ import { Camera } from "../../engine-components/Camera.js";
43
+ import { Canvas } from "../../engine-components/ui/Canvas.js";
44
+ import { CanvasGroup } from "../../engine-components/ui/CanvasGroup.js";
45
+ import { CapsuleCollider } from "../../engine-components/Collider.js";
46
+ import { ChangeMaterialOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
47
+ import { ChangeTransformOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
48
+ import { CharacterController } from "../../engine-components/CharacterController.js";
49
+ import { CharacterControllerInput } from "../../engine-components/CharacterController.js";
50
+ import { ChromaticAberration } from "../../engine-components/postprocessing/Effects/ChromaticAberration.js";
51
+ import { Collider } from "../../engine-components/Collider.js";
52
+ import { ColorAdjustments } from "../../engine-components/postprocessing/Effects/ColorAdjustments.js";
53
+ import { ColorBySpeedModule } from "../../engine-components/ParticleSystemModules.js";
54
+ import { ColorOverLifetimeModule } from "../../engine-components/ParticleSystemModules.js";
55
+ import { Component } from "../../engine-components/Component.js";
56
+ import { ControlTrackHandler } from "../../engine-components/timeline/TimelineTracks.js";
57
+ import { CustomBranding } from "../../engine-components/export/usdz/USDZExporter.js";
58
+ import { Deletable } from "../../engine-components/DeleteBox.js";
59
+ import { DeleteBox } from "../../engine-components/DeleteBox.js";
60
+ import { DepthOfField } from "../../engine-components/postprocessing/Effects/DepthOfField.js";
61
+ import { DeviceFlag } from "../../engine-components/DeviceFlag.js";
62
+ import { DocumentExtension } from "../../engine-components/export/usdz/extensions/DocumentExtension.js";
63
+ import { DragControls } from "../../engine-components/DragControls.js";
64
+ import { DropListener } from "../../engine-components/DropListener.js";
65
+ import { Duplicatable } from "../../engine-components/Duplicatable.js";
66
+ import { EmissionModule } from "../../engine-components/ParticleSystemModules.js";
67
+ import { EmphasizeOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
68
+ import { EventList } from "../../engine-components/EventList.js";
69
+ import { EventListEvent } from "../../engine-components/EventList.js";
70
+ import { EventSystem } from "../../engine-components/ui/EventSystem.js";
71
+ import { EventTrigger } from "../../engine-components/EventTrigger.js";
72
+ import { FieldWithDefault } from "../../engine-components/Renderer.js";
73
+ import { FixedJoint } from "../../engine-components/Joints.js";
74
+ import { FlyControls } from "../../engine-components/FlyControls.js";
75
+ import { Fog } from "../../engine-components/Fog.js";
76
+ import { GltfExport } from "../../engine-components/export/gltf/GltfExport.js";
77
+ import { GltfExportBox } from "../../engine-components/export/gltf/GltfExport.js";
78
+ import { Gradient } from "../../engine-components/ParticleSystemModules.js";
79
+ import { Graphic } from "../../engine-components/ui/Graphic.js";
80
+ import { GraphicRaycaster } from "../../engine-components/ui/Raycaster.js";
81
+ import { GridHelper } from "../../engine-components/GridHelper.js";
82
+ import { GridLayoutGroup } from "../../engine-components/ui/Layout.js";
83
+ import { GroundProjectedEnv } from "../../engine-components/GroundProjection.js";
84
+ import { GroupActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
85
+ import { HideOnStart } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
86
+ import { HingeJoint } from "../../engine-components/Joints.js";
87
+ import { HorizontalLayoutGroup } from "../../engine-components/ui/Layout.js";
88
+ import { Image } from "../../engine-components/ui/Image.js";
89
+ import { InheritVelocityModule } from "../../engine-components/ParticleSystemModules.js";
90
+ import { InputField } from "../../engine-components/ui/InputField.js";
91
+ import { Interactable } from "../../engine-components/Interactable.js";
92
+ import { Light } from "../../engine-components/Light.js";
93
+ import { LimitVelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules.js";
94
+ import { LODGroup } from "../../engine-components/LODGroup.js";
95
+ import { LODModel } from "../../engine-components/LODGroup.js";
96
+ import { LogStats } from "../../engine-components/debug/LogStats.js";
97
+ import { LookAt } from "../../engine-components/utils/LookAt.js";
98
+ import { LookAtConstraint } from "../../engine-components/LookAtConstraint.js";
99
+ import { MainModule } from "../../engine-components/ParticleSystemModules.js";
100
+ import { MaskableGraphic } from "../../engine-components/ui/Graphic.js";
101
+ import { MeshCollider } from "../../engine-components/Collider.js";
102
+ import { MeshRenderer } from "../../engine-components/Renderer.js";
103
+ import { MinMaxCurve } from "../../engine-components/ParticleSystemModules.js";
104
+ import { MinMaxGradient } from "../../engine-components/ParticleSystemModules.js";
105
+ import { NestedGltf } from "../../engine-components/NestedGltf.js";
106
+ import { Networking } from "../../engine-components/Networking.js";
107
+ import { NoiseModule } from "../../engine-components/ParticleSystemModules.js";
108
+ import { ObjectRaycaster } from "../../engine-components/ui/Raycaster.js";
109
+ import { OffsetConstraint } from "../../engine-components/OffsetConstraint.js";
110
+ import { OpenURL } from "../../engine-components/utils/OpenURL.js";
111
+ import { OrbitControls } from "../../engine-components/OrbitControls.js";
112
+ import { Outline } from "../../engine-components/ui/Outline.js";
113
+ import { Padding } from "../../engine-components/ui/Layout.js";
114
+ import { ParticleBurst } from "../../engine-components/ParticleSystemModules.js";
115
+ import { ParticleSubEmitter } from "../../engine-components/ParticleSystemSubEmitter.js";
116
+ import { ParticleSystem } from "../../engine-components/ParticleSystem.js";
117
+ import { ParticleSystemRenderer } from "../../engine-components/ParticleSystem.js";
118
+ import { PixelationEffect } from "../../engine-components/postprocessing/Effects/Pixelation.js";
119
+ import { PlayableDirector } from "../../engine-components/timeline/PlayableDirector.js";
120
+ import { PlayAnimationOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
121
+ import { PlayAudioOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
122
+ import { PlayerColor } from "../../engine-components/PlayerColor.js";
123
+ import { PlayerState } from "../../engine-components-experimental/networking/PlayerSync.js";
124
+ import { PlayerSync } from "../../engine-components-experimental/networking/PlayerSync.js";
125
+ import { PointerEventData } from "../../engine-components/ui/PointerEvents.js";
126
+ import { PostProcessingHandler } from "../../engine-components/postprocessing/PostProcessingHandler.js";
127
+ import { PreliminaryAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
128
+ import { PreliminaryTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
129
+ import { PresentationMode } from "../../engine-components-experimental/Presentation.js";
130
+ import { RawImage } from "../../engine-components/ui/Image.js";
131
+ import { Raycaster } from "../../engine-components/ui/Raycaster.js";
132
+ import { Rect } from "../../engine-components/ui/RectTransform.js";
133
+ import { RectTransform } from "../../engine-components/ui/RectTransform.js";
134
+ import { ReflectionProbe } from "../../engine-components/ReflectionProbe.js";
135
+ import { RegisteredAnimationInfo } from "../../engine-components/export/usdz/extensions/Animation.js";
136
+ import { RemoteSkybox } from "../../engine-components/Skybox.js";
137
+ import { Renderer } from "../../engine-components/Renderer.js";
138
+ import { RendererLightmap } from "../../engine-components/RendererLightmap.js";
139
+ import { RGBAColor } from "../../engine-components/js-extensions/RGBAColor.js";
140
+ import { Rigidbody } from "../../engine-components/RigidBody.js";
141
+ import { RotationBySpeedModule } from "../../engine-components/ParticleSystemModules.js";
142
+ import { RotationOverLifetimeModule } from "../../engine-components/ParticleSystemModules.js";
143
+ import { SceneSwitcher } from "../../engine-components/SceneSwitcher.js";
144
+ import { ScreenCapture } from "../../engine-components/ScreenCapture.js";
145
+ import { ScreenSpaceAmbientOcclusion } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js";
146
+ import { ScreenSpaceAmbientOcclusionN8 } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js";
147
+ import { SetActiveOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
148
+ import { ShadowCatcher } from "../../engine-components/ShadowCatcher.js";
149
+ import { ShapeModule } from "../../engine-components/ParticleSystemModules.js";
150
+ import { SignalAsset } from "../../engine-components/timeline/SignalAsset.js";
151
+ import { SignalReceiver } from "../../engine-components/timeline/SignalAsset.js";
152
+ import { SignalReceiverEvent } from "../../engine-components/timeline/SignalAsset.js";
153
+ import { SignalTrackHandler } from "../../engine-components/timeline/TimelineTracks.js";
154
+ import { Size } from "../../engine-components/ui/RectTransform.js";
155
+ import { SizeBySpeedModule } from "../../engine-components/ParticleSystemModules.js";
156
+ import { SizeOverLifetimeModule } from "../../engine-components/ParticleSystemModules.js";
157
+ import { SkinnedMeshRenderer } from "../../engine-components/Renderer.js";
158
+ import { SmoothFollow } from "../../engine-components/SmoothFollow.js";
159
+ import { SpatialHtml } from "../../engine-components/ui/SpatialHtml.js";
160
+ import { SpatialTrigger } from "../../engine-components/SpatialTrigger.js";
161
+ import { SpatialTriggerReceiver } from "../../engine-components/SpatialTrigger.js";
162
+ import { SpectatorCamera } from "../../engine-components/SpectatorCamera.js";
163
+ import { SphereCollider } from "../../engine-components/Collider.js";
164
+ import { Sprite } from "../../engine-components/SpriteRenderer.js";
165
+ import { SpriteData } from "../../engine-components/SpriteRenderer.js";
166
+ import { SpriteRenderer } from "../../engine-components/SpriteRenderer.js";
167
+ import { SpriteSheet } from "../../engine-components/SpriteRenderer.js";
168
+ import { SubEmitterSystem } from "../../engine-components/ParticleSystem.js";
169
+ import { SyncedCamera } from "../../engine-components/SyncedCamera.js";
170
+ import { SyncedRoom } from "../../engine-components/SyncedRoom.js";
171
+ import { SyncedTransform } from "../../engine-components/SyncedTransform.js";
172
+ import { TapGestureTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
173
+ import { TeleportTarget } from "../../engine-components/webxr/WebXRController.js";
174
+ import { TestRunner } from "../../engine-components/TestRunner.js";
175
+ import { TestSimulateUserData } from "../../engine-components/TestRunner.js";
176
+ import { Text } from "../../engine-components/ui/Text.js";
177
+ import { TextBuilder } from "../../engine-components/export/usdz/extensions/USDZText.js";
178
+ import { TextExtension } from "../../engine-components/export/usdz/extensions/USDZText.js";
179
+ import { TextureSheetAnimationModule } from "../../engine-components/ParticleSystemModules.js";
180
+ import { TiltShiftEffect } from "../../engine-components/postprocessing/Effects/TiltShiftEffect.js";
181
+ import { ToneMapping } from "../../engine-components/postprocessing/Effects/Tonemapping.js";
182
+ import { TrailModule } from "../../engine-components/ParticleSystemModules.js";
183
+ import { TransformData } from "../../engine-components/export/usdz/extensions/Animation.js";
184
+ import { TransformGizmo } from "../../engine-components/TransformGizmo.js";
185
+ import { TriggerBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
186
+ import { TriggerModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
187
+ import { UIRaycastUtils } from "../../engine-components/ui/RaycastUtils.js";
188
+ import { UIRootComponent } from "../../engine-components/ui/BaseUIComponent.js";
189
+ import { UsageMarker } from "../../engine-components/Interactable.js";
190
+ import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter.js";
191
+ import { USDZText } from "../../engine-components/export/usdz/extensions/USDZText.js";
192
+ import { USDZUIExtension } from "../../engine-components/export/usdz/extensions/USDZUI.js";
193
+ import { VariantAction } from "../../engine-components/export/usdz/extensions/behavior/Actions.js";
194
+ import { VelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules.js";
195
+ import { VerticalLayoutGroup } from "../../engine-components/ui/Layout.js";
196
+ import { VideoPlayer } from "../../engine-components/VideoPlayer.js";
197
+ import { Vignette } from "../../engine-components/postprocessing/Effects/Vignette.js";
198
+ import { VisibilityAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents.js";
199
+ import { Voip } from "../../engine-components/Voip.js";
200
+ import { Volume } from "../../engine-components/postprocessing/Volume.js";
201
+ import { VolumeParameter } from "../../engine-components/postprocessing/VolumeParameter.js";
202
+ import { VolumeProfile } from "../../engine-components/postprocessing/VolumeProfile.js";
203
+ import { VRUserState } from "../../engine-components/webxr/WebXRSync.js";
204
+ import { WebAR } from "../../engine-components/webxr/WebXR.js";
205
+ import { WebARCameraBackground } from "../../engine-components/webxr/WebARCameraBackground.js";
206
+ import { WebARSessionRoot } from "../../engine-components/webxr/WebARSessionRoot.js";
207
+ import { WebXR } from "../../engine-components/webxr/WebXR.js";
208
+ import { WebXRAvatar } from "../../engine-components/webxr/WebXRAvatar.js";
209
+ import { WebXRController } from "../../engine-components/webxr/WebXRController.js";
210
+ import { WebXRImageTracking } from "../../engine-components/webxr/WebXRImageTracking.js";
211
+ import { WebXRImageTrackingModel } from "../../engine-components/webxr/WebXRImageTracking.js";
212
+ import { WebXRPlaneTracking } from "../../engine-components/webxr/WebXRPlaneTracking.js";
213
+ import { WebXRSync } from "../../engine-components/webxr/WebXRSync.js";
214
+ import { WebXRTrackedImage } from "../../engine-components/webxr/WebXRImageTracking.js";
215
+ import { XRFlag } from "../../engine-components/XRFlag.js";
216
+ import { XRGrabModel } from "../../engine-components/webxr/WebXRGrabRendering.js";
217
+ import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering.js";
218
+ import { XRRig } from "../../engine-components/webxr/WebXRRig.js";
219
+ import { XRState } from "../../engine-components/XRFlag.js";
220
+
221
+ // Register types
222
+ TypeStore.add("__Ignore", __Ignore);
223
+ TypeStore.add("ActionBuilder", ActionBuilder);
224
+ TypeStore.add("ActionCollection", ActionCollection);
225
+ TypeStore.add("ActionModel", ActionModel);
226
+ TypeStore.add("AlignmentConstraint", AlignmentConstraint);
227
+ TypeStore.add("Animation", Animation);
228
+ TypeStore.add("AnimationCurve", AnimationCurve);
229
+ TypeStore.add("AnimationExtension", AnimationExtension);
230
+ TypeStore.add("AnimationTrackHandler", AnimationTrackHandler);
231
+ TypeStore.add("Animator", Animator);
232
+ TypeStore.add("AnimatorController", AnimatorController);
233
+ TypeStore.add("Antialiasing", Antialiasing);
234
+ TypeStore.add("AttachedObject", AttachedObject);
235
+ TypeStore.add("AudioExtension", AudioExtension);
236
+ TypeStore.add("AudioListener", AudioListener);
237
+ TypeStore.add("AudioSource", AudioSource);
238
+ TypeStore.add("AudioTrackHandler", AudioTrackHandler);
239
+ TypeStore.add("Avatar_Brain_LookAt", Avatar_Brain_LookAt);
240
+ TypeStore.add("Avatar_MouthShapes", Avatar_MouthShapes);
241
+ TypeStore.add("Avatar_MustacheShake", Avatar_MustacheShake);
242
+ TypeStore.add("Avatar_POI", Avatar_POI);
243
+ TypeStore.add("AvatarBlink_Simple", AvatarBlink_Simple);
244
+ TypeStore.add("AvatarEyeLook_Rotation", AvatarEyeLook_Rotation);
245
+ TypeStore.add("AvatarLoader", AvatarLoader);
246
+ TypeStore.add("AvatarMarker", AvatarMarker);
247
+ TypeStore.add("AvatarModel", AvatarModel);
248
+ TypeStore.add("AxesHelper", AxesHelper);
249
+ TypeStore.add("BaseUIComponent", BaseUIComponent);
250
+ TypeStore.add("BasicIKConstraint", BasicIKConstraint);
251
+ TypeStore.add("BehaviorExtension", BehaviorExtension);
252
+ TypeStore.add("BehaviorModel", BehaviorModel);
253
+ TypeStore.add("Behaviour", Behaviour);
254
+ TypeStore.add("Bloom", Bloom);
255
+ TypeStore.add("BoxCollider", BoxCollider);
256
+ TypeStore.add("BoxGizmo", BoxGizmo);
257
+ TypeStore.add("BoxHelperComponent", BoxHelperComponent);
258
+ TypeStore.add("Button", Button);
259
+ TypeStore.add("CallInfo", CallInfo);
260
+ TypeStore.add("Camera", Camera);
261
+ TypeStore.add("Canvas", Canvas);
262
+ TypeStore.add("CanvasGroup", CanvasGroup);
263
+ TypeStore.add("CapsuleCollider", CapsuleCollider);
264
+ TypeStore.add("ChangeMaterialOnClick", ChangeMaterialOnClick);
265
+ TypeStore.add("ChangeTransformOnClick", ChangeTransformOnClick);
266
+ TypeStore.add("CharacterController", CharacterController);
267
+ TypeStore.add("CharacterControllerInput", CharacterControllerInput);
268
+ TypeStore.add("ChromaticAberration", ChromaticAberration);
269
+ TypeStore.add("Collider", Collider);
270
+ TypeStore.add("ColorAdjustments", ColorAdjustments);
271
+ TypeStore.add("ColorBySpeedModule", ColorBySpeedModule);
272
+ TypeStore.add("ColorOverLifetimeModule", ColorOverLifetimeModule);
273
+ TypeStore.add("Component", Component);
274
+ TypeStore.add("ControlTrackHandler", ControlTrackHandler);
275
+ TypeStore.add("CustomBranding", CustomBranding);
276
+ TypeStore.add("Deletable", Deletable);
277
+ TypeStore.add("DeleteBox", DeleteBox);
278
+ TypeStore.add("DepthOfField", DepthOfField);
279
+ TypeStore.add("DeviceFlag", DeviceFlag);
280
+ TypeStore.add("DocumentExtension", DocumentExtension);
281
+ TypeStore.add("DragControls", DragControls);
282
+ TypeStore.add("DropListener", DropListener);
283
+ TypeStore.add("Duplicatable", Duplicatable);
284
+ TypeStore.add("EmissionModule", EmissionModule);
285
+ TypeStore.add("EmphasizeOnClick", EmphasizeOnClick);
286
+ TypeStore.add("EventList", EventList);
287
+ TypeStore.add("EventListEvent", EventListEvent);
288
+ TypeStore.add("EventSystem", EventSystem);
289
+ TypeStore.add("EventTrigger", EventTrigger);
290
+ TypeStore.add("FieldWithDefault", FieldWithDefault);
291
+ TypeStore.add("FixedJoint", FixedJoint);
292
+ TypeStore.add("FlyControls", FlyControls);
293
+ TypeStore.add("Fog", Fog);
294
+ TypeStore.add("GltfExport", GltfExport);
295
+ TypeStore.add("GltfExportBox", GltfExportBox);
296
+ TypeStore.add("Gradient", Gradient);
297
+ TypeStore.add("Graphic", Graphic);
298
+ TypeStore.add("GraphicRaycaster", GraphicRaycaster);
299
+ TypeStore.add("GridHelper", GridHelper);
300
+ TypeStore.add("GridLayoutGroup", GridLayoutGroup);
301
+ TypeStore.add("GroundProjectedEnv", GroundProjectedEnv);
302
+ TypeStore.add("GroupActionModel", GroupActionModel);
303
+ TypeStore.add("HideOnStart", HideOnStart);
304
+ TypeStore.add("HingeJoint", HingeJoint);
305
+ TypeStore.add("HorizontalLayoutGroup", HorizontalLayoutGroup);
306
+ TypeStore.add("Image", Image);
307
+ TypeStore.add("InheritVelocityModule", InheritVelocityModule);
308
+ TypeStore.add("InputField", InputField);
309
+ TypeStore.add("Interactable", Interactable);
310
+ TypeStore.add("Light", Light);
311
+ TypeStore.add("LimitVelocityOverLifetimeModule", LimitVelocityOverLifetimeModule);
312
+ TypeStore.add("LODGroup", LODGroup);
313
+ TypeStore.add("LODModel", LODModel);
314
+ TypeStore.add("LogStats", LogStats);
315
+ TypeStore.add("LookAt", LookAt);
316
+ TypeStore.add("LookAtConstraint", LookAtConstraint);
317
+ TypeStore.add("MainModule", MainModule);
318
+ TypeStore.add("MaskableGraphic", MaskableGraphic);
319
+ TypeStore.add("MeshCollider", MeshCollider);
320
+ TypeStore.add("MeshRenderer", MeshRenderer);
321
+ TypeStore.add("MinMaxCurve", MinMaxCurve);
322
+ TypeStore.add("MinMaxGradient", MinMaxGradient);
323
+ TypeStore.add("NestedGltf", NestedGltf);
324
+ TypeStore.add("Networking", Networking);
325
+ TypeStore.add("NoiseModule", NoiseModule);
326
+ TypeStore.add("ObjectRaycaster", ObjectRaycaster);
327
+ TypeStore.add("OffsetConstraint", OffsetConstraint);
328
+ TypeStore.add("OpenURL", OpenURL);
329
+ TypeStore.add("OrbitControls", OrbitControls);
330
+ TypeStore.add("Outline", Outline);
331
+ TypeStore.add("Padding", Padding);
332
+ TypeStore.add("ParticleBurst", ParticleBurst);
333
+ TypeStore.add("ParticleSubEmitter", ParticleSubEmitter);
334
+ TypeStore.add("ParticleSystem", ParticleSystem);
335
+ TypeStore.add("ParticleSystemRenderer", ParticleSystemRenderer);
336
+ TypeStore.add("PixelationEffect", PixelationEffect);
337
+ TypeStore.add("PlayableDirector", PlayableDirector);
338
+ TypeStore.add("PlayAnimationOnClick", PlayAnimationOnClick);
339
+ TypeStore.add("PlayAudioOnClick", PlayAudioOnClick);
340
+ TypeStore.add("PlayerColor", PlayerColor);
341
+ TypeStore.add("PlayerState", PlayerState);
342
+ TypeStore.add("PlayerSync", PlayerSync);
343
+ TypeStore.add("PointerEventData", PointerEventData);
344
+ TypeStore.add("PostProcessingHandler", PostProcessingHandler);
345
+ TypeStore.add("PreliminaryAction", PreliminaryAction);
346
+ TypeStore.add("PreliminaryTrigger", PreliminaryTrigger);
347
+ TypeStore.add("PresentationMode", PresentationMode);
348
+ TypeStore.add("RawImage", RawImage);
349
+ TypeStore.add("Raycaster", Raycaster);
350
+ TypeStore.add("Rect", Rect);
351
+ TypeStore.add("RectTransform", RectTransform);
352
+ TypeStore.add("ReflectionProbe", ReflectionProbe);
353
+ TypeStore.add("RegisteredAnimationInfo", RegisteredAnimationInfo);
354
+ TypeStore.add("RemoteSkybox", RemoteSkybox);
355
+ TypeStore.add("Renderer", Renderer);
356
+ TypeStore.add("RendererLightmap", RendererLightmap);
357
+ TypeStore.add("RGBAColor", RGBAColor);
358
+ TypeStore.add("Rigidbody", Rigidbody);
359
+ TypeStore.add("RotationBySpeedModule", RotationBySpeedModule);
360
+ TypeStore.add("RotationOverLifetimeModule", RotationOverLifetimeModule);
361
+ TypeStore.add("SceneSwitcher", SceneSwitcher);
362
+ TypeStore.add("ScreenCapture", ScreenCapture);
363
+ TypeStore.add("ScreenSpaceAmbientOcclusion", ScreenSpaceAmbientOcclusion);
364
+ TypeStore.add("ScreenSpaceAmbientOcclusionN8", ScreenSpaceAmbientOcclusionN8);
365
+ TypeStore.add("SetActiveOnClick", SetActiveOnClick);
366
+ TypeStore.add("ShadowCatcher", ShadowCatcher);
367
+ TypeStore.add("ShapeModule", ShapeModule);
368
+ TypeStore.add("SignalAsset", SignalAsset);
369
+ TypeStore.add("SignalReceiver", SignalReceiver);
370
+ TypeStore.add("SignalReceiverEvent", SignalReceiverEvent);
371
+ TypeStore.add("SignalTrackHandler", SignalTrackHandler);
372
+ TypeStore.add("Size", Size);
373
+ TypeStore.add("SizeBySpeedModule", SizeBySpeedModule);
374
+ TypeStore.add("SizeOverLifetimeModule", SizeOverLifetimeModule);
375
+ TypeStore.add("SkinnedMeshRenderer", SkinnedMeshRenderer);
376
+ TypeStore.add("SmoothFollow", SmoothFollow);
377
+ TypeStore.add("SpatialHtml", SpatialHtml);
378
+ TypeStore.add("SpatialTrigger", SpatialTrigger);
379
+ TypeStore.add("SpatialTriggerReceiver", SpatialTriggerReceiver);
380
+ TypeStore.add("SpectatorCamera", SpectatorCamera);
381
+ TypeStore.add("SphereCollider", SphereCollider);
382
+ TypeStore.add("Sprite", Sprite);
383
+ TypeStore.add("SpriteData", SpriteData);
384
+ TypeStore.add("SpriteRenderer", SpriteRenderer);
385
+ TypeStore.add("SpriteSheet", SpriteSheet);
386
+ TypeStore.add("SubEmitterSystem", SubEmitterSystem);
387
+ TypeStore.add("SyncedCamera", SyncedCamera);
388
+ TypeStore.add("SyncedRoom", SyncedRoom);
389
+ TypeStore.add("SyncedTransform", SyncedTransform);
390
+ TypeStore.add("TapGestureTrigger", TapGestureTrigger);
391
+ TypeStore.add("TeleportTarget", TeleportTarget);
392
+ TypeStore.add("TestRunner", TestRunner);
393
+ TypeStore.add("TestSimulateUserData", TestSimulateUserData);
394
+ TypeStore.add("Text", Text);
395
+ TypeStore.add("TextBuilder", TextBuilder);
396
+ TypeStore.add("TextExtension", TextExtension);
397
+ TypeStore.add("TextureSheetAnimationModule", TextureSheetAnimationModule);
398
+ TypeStore.add("TiltShiftEffect", TiltShiftEffect);
399
+ TypeStore.add("ToneMapping", ToneMapping);
400
+ TypeStore.add("TrailModule", TrailModule);
401
+ TypeStore.add("TransformData", TransformData);
402
+ TypeStore.add("TransformGizmo", TransformGizmo);
403
+ TypeStore.add("TriggerBuilder", TriggerBuilder);
404
+ TypeStore.add("TriggerModel", TriggerModel);
405
+ TypeStore.add("UIRaycastUtils", UIRaycastUtils);
406
+ TypeStore.add("UIRootComponent", UIRootComponent);
407
+ TypeStore.add("UsageMarker", UsageMarker);
408
+ TypeStore.add("USDZExporter", USDZExporter);
409
+ TypeStore.add("USDZText", USDZText);
410
+ TypeStore.add("USDZUIExtension", USDZUIExtension);
411
+ TypeStore.add("VariantAction", VariantAction);
412
+ TypeStore.add("VelocityOverLifetimeModule", VelocityOverLifetimeModule);
413
+ TypeStore.add("VerticalLayoutGroup", VerticalLayoutGroup);
414
+ TypeStore.add("VideoPlayer", VideoPlayer);
415
+ TypeStore.add("Vignette", Vignette);
416
+ TypeStore.add("VisibilityAction", VisibilityAction);
417
+ TypeStore.add("Voip", Voip);
418
+ TypeStore.add("Volume", Volume);
419
+ TypeStore.add("VolumeParameter", VolumeParameter);
420
+ TypeStore.add("VolumeProfile", VolumeProfile);
421
+ TypeStore.add("VRUserState", VRUserState);
422
+ TypeStore.add("WebAR", WebAR);
423
+ TypeStore.add("WebARCameraBackground", WebARCameraBackground);
424
+ TypeStore.add("WebARSessionRoot", WebARSessionRoot);
425
+ TypeStore.add("WebXR", WebXR);
426
+ TypeStore.add("WebXRAvatar", WebXRAvatar);
427
+ TypeStore.add("WebXRController", WebXRController);
428
+ TypeStore.add("WebXRImageTracking", WebXRImageTracking);
429
+ TypeStore.add("WebXRImageTrackingModel", WebXRImageTrackingModel);
430
+ TypeStore.add("WebXRPlaneTracking", WebXRPlaneTracking);
431
+ TypeStore.add("WebXRSync", WebXRSync);
432
+ TypeStore.add("WebXRTrackedImage", WebXRTrackedImage);
433
+ TypeStore.add("XRFlag", XRFlag);
434
+ TypeStore.add("XRGrabModel", XRGrabModel);
435
+ TypeStore.add("XRGrabRendering", XRGrabRendering);
436
+ TypeStore.add("XRRig", XRRig);
437
+ TypeStore.add("XRState", XRState);