@needle-tools/engine 2.65.2-pre → 2.67.0-pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/needle-engine.js +34490 -26304
  3. package/dist/needle-engine.umd.cjs +748 -303
  4. package/lib/engine/api.d.ts +4 -0
  5. package/lib/engine/api.js +10 -0
  6. package/lib/engine/api.js.map +1 -1
  7. package/lib/engine/codegen/register_types.js +23 -7
  8. package/lib/engine/codegen/register_types.js.map +1 -1
  9. package/lib/engine/debug/debug_overlay.js +11 -2
  10. package/lib/engine/debug/debug_overlay.js.map +1 -1
  11. package/lib/engine/engine_addressables.js +4 -4
  12. package/lib/engine/engine_addressables.js.map +1 -1
  13. package/lib/engine/engine_assetdatabase.d.ts +17 -51
  14. package/lib/engine/engine_assetdatabase.js +252 -126
  15. package/lib/engine/engine_assetdatabase.js.map +1 -1
  16. package/lib/engine/engine_components.js +13 -1
  17. package/lib/engine/engine_components.js.map +1 -1
  18. package/lib/engine/engine_components_internal.d.ts +8 -0
  19. package/lib/engine/engine_components_internal.js +29 -0
  20. package/lib/engine/engine_components_internal.js.map +1 -0
  21. package/lib/engine/engine_constants.d.ts +1 -0
  22. package/lib/engine/engine_constants.js +1 -0
  23. package/lib/engine/engine_constants.js.map +1 -1
  24. package/lib/engine/engine_context_registry.d.ts +2 -0
  25. package/lib/engine/engine_context_registry.js +6 -0
  26. package/lib/engine/engine_context_registry.js.map +1 -1
  27. package/lib/engine/engine_editor-sync.d.ts +9 -0
  28. package/lib/engine/engine_editor-sync.js +8 -0
  29. package/lib/engine/engine_editor-sync.js.map +1 -0
  30. package/lib/engine/engine_element.d.ts +1 -0
  31. package/lib/engine/engine_element.js +4 -1
  32. package/lib/engine/engine_element.js.map +1 -1
  33. package/lib/engine/engine_element_loading.d.ts +3 -2
  34. package/lib/engine/engine_element_loading.js +19 -15
  35. package/lib/engine/engine_element_loading.js.map +1 -1
  36. package/lib/engine/engine_gameobject.js +21 -23
  37. package/lib/engine/engine_gameobject.js.map +1 -1
  38. package/lib/engine/engine_gizmos.js +3 -1
  39. package/lib/engine/engine_gizmos.js.map +1 -1
  40. package/lib/engine/engine_gltf_builtin_components.d.ts +2 -3
  41. package/lib/engine/engine_gltf_builtin_components.js +23 -6
  42. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  43. package/lib/engine/engine_networking.d.ts +3 -1
  44. package/lib/engine/engine_networking.js +10 -8
  45. package/lib/engine/engine_networking.js.map +1 -1
  46. package/lib/engine/engine_networking_auto.d.ts +1 -0
  47. package/lib/engine/engine_networking_auto.js +42 -9
  48. package/lib/engine/engine_networking_auto.js.map +1 -1
  49. package/lib/engine/engine_patcher.d.ts +8 -0
  50. package/lib/engine/engine_patcher.js +98 -0
  51. package/lib/engine/engine_patcher.js.map +1 -0
  52. package/lib/engine/engine_physics.d.ts +34 -2
  53. package/lib/engine/engine_physics.js +110 -11
  54. package/lib/engine/engine_physics.js.map +1 -1
  55. package/lib/engine/engine_scenetools.js +0 -1
  56. package/lib/engine/engine_scenetools.js.map +1 -1
  57. package/lib/engine/engine_serialization_core.js +4 -0
  58. package/lib/engine/engine_serialization_core.js.map +1 -1
  59. package/lib/engine/engine_setup.d.ts +1 -1
  60. package/lib/engine/engine_setup.js +12 -5
  61. package/lib/engine/engine_setup.js.map +1 -1
  62. package/lib/engine/engine_texture.d.ts +6 -1
  63. package/lib/engine/engine_texture.js +39 -1
  64. package/lib/engine/engine_texture.js.map +1 -1
  65. package/lib/engine/engine_types.d.ts +4 -0
  66. package/lib/engine/engine_types.js.map +1 -1
  67. package/lib/engine/engine_utils.js +3 -2
  68. package/lib/engine/engine_utils.js.map +1 -1
  69. package/lib/engine/extensions/NEEDLE_progressive.d.ts +0 -1
  70. package/lib/engine/extensions/NEEDLE_progressive.js +24 -26
  71. package/lib/engine/extensions/NEEDLE_progressive.js.map +1 -1
  72. package/lib/engine/extensions/NEEDLE_render_objects.js +9 -0
  73. package/lib/engine/extensions/NEEDLE_render_objects.js.map +1 -1
  74. package/lib/engine/extensions/extensions.d.ts +4 -1
  75. package/lib/engine/extensions/extensions.js +16 -0
  76. package/lib/engine/extensions/extensions.js.map +1 -1
  77. package/lib/engine/extensions/usage_tracker.d.ts +12 -0
  78. package/lib/engine/extensions/usage_tracker.js +59 -0
  79. package/lib/engine/extensions/usage_tracker.js.map +1 -0
  80. package/lib/engine-components/Animator.js +0 -1
  81. package/lib/engine-components/Animator.js.map +1 -1
  82. package/lib/engine-components/AnimatorController.js +4 -0
  83. package/lib/engine-components/AnimatorController.js.map +1 -1
  84. package/lib/engine-components/AudioSource.js +2 -1
  85. package/lib/engine-components/AudioSource.js.map +1 -1
  86. package/lib/engine-components/Camera.d.ts +6 -0
  87. package/lib/engine-components/Camera.js +70 -31
  88. package/lib/engine-components/Camera.js.map +1 -1
  89. package/lib/engine-components/CharacterController.d.ts +1 -0
  90. package/lib/engine-components/CharacterController.js +14 -9
  91. package/lib/engine-components/CharacterController.js.map +1 -1
  92. package/lib/engine-components/Collider.js +14 -1
  93. package/lib/engine-components/Collider.js.map +1 -1
  94. package/lib/engine-components/Component.d.ts +52 -0
  95. package/lib/engine-components/Component.js +55 -14
  96. package/lib/engine-components/Component.js.map +1 -1
  97. package/lib/engine-components/Networking.js +19 -0
  98. package/lib/engine-components/Networking.js.map +1 -1
  99. package/lib/engine-components/OrbitControls.d.ts +2 -0
  100. package/lib/engine-components/OrbitControls.js +9 -0
  101. package/lib/engine-components/OrbitControls.js.map +1 -1
  102. package/lib/engine-components/ParticleSystem.d.ts +5 -1
  103. package/lib/engine-components/ParticleSystem.js +52 -7
  104. package/lib/engine-components/ParticleSystem.js.map +1 -1
  105. package/lib/engine-components/ParticleSystemModules.d.ts +2 -0
  106. package/lib/engine-components/ParticleSystemModules.js +26 -0
  107. package/lib/engine-components/ParticleSystemModules.js.map +1 -1
  108. package/lib/engine-components/ParticleSystemSubEmitter.js +5 -2
  109. package/lib/engine-components/ParticleSystemSubEmitter.js.map +1 -1
  110. package/lib/engine-components/ReflectionProbe.js +18 -6
  111. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  112. package/lib/engine-components/Renderer.d.ts +1 -1
  113. package/lib/engine-components/Renderer.js +33 -11
  114. package/lib/engine-components/Renderer.js.map +1 -1
  115. package/lib/engine-components/ScreenCapture.js +3 -3
  116. package/lib/engine-components/ScreenCapture.js.map +1 -1
  117. package/lib/engine-components/Skybox.js +2 -0
  118. package/lib/engine-components/Skybox.js.map +1 -1
  119. package/lib/engine-components/SmoothFollow.js +1 -2
  120. package/lib/engine-components/SmoothFollow.js.map +1 -1
  121. package/lib/engine-components/SpectatorCamera.js +3 -3
  122. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  123. package/lib/engine-components/SyncedCamera.js +1 -1
  124. package/lib/engine-components/SyncedCamera.js.map +1 -1
  125. package/lib/engine-components/SyncedTransform.js +2 -2
  126. package/lib/engine-components/SyncedTransform.js.map +1 -1
  127. package/lib/engine-components/TestRunner.js +1 -1
  128. package/lib/engine-components/TestRunner.js.map +1 -1
  129. package/lib/engine-components/WebARCameraBackground.d.ts +19 -0
  130. package/lib/engine-components/WebARCameraBackground.js +185 -0
  131. package/lib/engine-components/WebARCameraBackground.js.map +1 -0
  132. package/lib/engine-components/WebARSessionRoot.js +3 -2
  133. package/lib/engine-components/WebARSessionRoot.js.map +1 -1
  134. package/lib/engine-components/WebXR.d.ts +4 -0
  135. package/lib/engine-components/WebXR.js +11 -8
  136. package/lib/engine-components/WebXR.js.map +1 -1
  137. package/lib/engine-components/WebXRAvatar.js +1 -0
  138. package/lib/engine-components/WebXRAvatar.js.map +1 -1
  139. package/lib/engine-components/WebXRGrabRendering.js +2 -2
  140. package/lib/engine-components/WebXRGrabRendering.js.map +1 -1
  141. package/lib/engine-components/WebXRSync.js +2 -2
  142. package/lib/engine-components/WebXRSync.js.map +1 -1
  143. package/lib/engine-components/codegen/components.d.ts +14 -6
  144. package/lib/engine-components/codegen/components.js +14 -6
  145. package/lib/engine-components/codegen/components.js.map +1 -1
  146. package/lib/engine-components/js-extensions/Object3D.js +4 -1
  147. package/lib/engine-components/js-extensions/Object3D.js.map +1 -1
  148. package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +13 -0
  149. package/lib/engine-components/postprocessing/Effects/Antialiasing.js +46 -0
  150. package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -0
  151. package/lib/engine-components/postprocessing/Effects/Bloom.d.ts +12 -0
  152. package/lib/engine-components/postprocessing/Effects/Bloom.js +76 -0
  153. package/lib/engine-components/postprocessing/Effects/Bloom.js.map +1 -0
  154. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +8 -0
  155. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +39 -0
  156. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -0
  157. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +12 -0
  158. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +96 -0
  159. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -0
  160. package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +21 -0
  161. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +87 -0
  162. package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -0
  163. package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +7 -0
  164. package/lib/engine-components/postprocessing/Effects/Pixelation.js +30 -0
  165. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -0
  166. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +11 -0
  167. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +70 -0
  168. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -0
  169. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +16 -0
  170. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +52 -0
  171. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -0
  172. package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +11 -0
  173. package/lib/engine-components/postprocessing/Effects/Vignette.js +57 -0
  174. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -0
  175. package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +29 -0
  176. package/lib/engine-components/postprocessing/PostProcessingEffect.js +89 -0
  177. package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -0
  178. package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +13 -0
  179. package/lib/engine-components/postprocessing/PostProcessingHandler.js +119 -0
  180. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -0
  181. package/lib/engine-components/postprocessing/Volume.d.ts +23 -0
  182. package/lib/engine-components/postprocessing/Volume.js +176 -0
  183. package/lib/engine-components/postprocessing/Volume.js.map +1 -0
  184. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +21 -0
  185. package/lib/engine-components/postprocessing/VolumeParameter.js +75 -0
  186. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -0
  187. package/lib/engine-components/postprocessing/VolumeProfile.d.ts +7 -0
  188. package/lib/engine-components/postprocessing/VolumeProfile.js +42 -0
  189. package/lib/engine-components/postprocessing/VolumeProfile.js.map +1 -0
  190. package/lib/engine-components/timeline/TimelineTracks.js +14 -15
  191. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  192. package/lib/engine-components/ui/Text.js +28 -170
  193. package/lib/engine-components/ui/Text.js.map +1 -1
  194. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +18 -0
  195. package/lib/engine-components-experimental/networking/PlayerSync.js +62 -8
  196. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  197. package/lib/include/three/ARButton.d.ts +1 -1
  198. package/lib/include/three/ARButton.js +11 -19
  199. package/lib/include/three/ARButton.js.map +1 -1
  200. package/lib/include/three/VRButton.js +1 -4
  201. package/lib/include/three/VRButton.js.map +1 -1
  202. package/package.json +3 -2
  203. package/plugins/vite/drop-client.js +77 -0
  204. package/plugins/vite/drop.js +81 -0
  205. package/plugins/vite/editor-connection.js +121 -0
  206. package/plugins/vite/index.js +9 -4
  207. package/plugins/vite/meta.js +3 -0
  208. package/plugins/vite/poster-client.js +6 -4
  209. package/src/engine/api.ts +30 -1
  210. package/src/engine/codegen/register_types.js +25 -9
  211. package/src/engine/debug/debug_overlay.ts +11 -2
  212. package/src/engine/engine_addressables.ts +4 -4
  213. package/src/engine/engine_assetdatabase.ts +291 -184
  214. package/src/engine/engine_components.ts +20 -1
  215. package/src/engine/engine_components_internal.ts +30 -0
  216. package/src/engine/engine_constants.ts +4 -1
  217. package/src/engine/engine_context_registry.ts +7 -0
  218. package/src/engine/engine_editor-sync.ts +21 -0
  219. package/src/engine/engine_element.ts +8 -1
  220. package/src/engine/engine_element_loading.ts +19 -15
  221. package/src/engine/engine_gameobject.ts +579 -583
  222. package/src/engine/engine_gizmos.ts +3 -2
  223. package/src/engine/engine_gltf_builtin_components.ts +30 -15
  224. package/src/engine/engine_networking.ts +10 -8
  225. package/src/engine/engine_networking_auto.ts +48 -11
  226. package/src/engine/engine_patcher.ts +113 -0
  227. package/src/engine/engine_physics.ts +128 -12
  228. package/src/engine/engine_scenetools.ts +0 -1
  229. package/src/engine/engine_serialization_core.ts +6 -0
  230. package/src/engine/engine_setup.ts +15 -5
  231. package/src/engine/engine_texture.ts +54 -5
  232. package/src/engine/engine_types.ts +6 -1
  233. package/src/engine/engine_utils.ts +6 -5
  234. package/src/engine/extensions/NEEDLE_progressive.ts +32 -32
  235. package/src/engine/extensions/NEEDLE_render_objects.ts +10 -1
  236. package/src/engine/extensions/extensions.ts +22 -1
  237. package/src/engine/extensions/usage_tracker.ts +91 -0
  238. package/src/engine-components/Animator.ts +0 -1
  239. package/src/engine-components/AnimatorController.ts +2 -0
  240. package/src/engine-components/AudioSource.ts +1 -1
  241. package/src/engine-components/Camera.ts +77 -37
  242. package/src/engine-components/CharacterController.ts +12 -9
  243. package/src/engine-components/Collider.ts +16 -2
  244. package/src/engine-components/Component.ts +74 -30
  245. package/src/engine-components/Networking.ts +9 -1
  246. package/src/engine-components/OrbitControls.ts +11 -2
  247. package/src/engine-components/ParticleSystem.ts +54 -10
  248. package/src/engine-components/ParticleSystemModules.ts +28 -1
  249. package/src/engine-components/ParticleSystemSubEmitter.ts +5 -3
  250. package/src/engine-components/ReflectionProbe.ts +17 -7
  251. package/src/engine-components/Renderer.ts +36 -16
  252. package/src/engine-components/ScreenCapture.ts +3 -3
  253. package/src/engine-components/Skybox.ts +2 -0
  254. package/src/engine-components/SmoothFollow.ts +4 -4
  255. package/src/engine-components/SpectatorCamera.ts +3 -3
  256. package/src/engine-components/SyncedCamera.ts +1 -1
  257. package/src/engine-components/SyncedTransform.ts +2 -2
  258. package/src/engine-components/TestRunner.ts +1 -1
  259. package/src/engine-components/WebARCameraBackground.ts +215 -0
  260. package/src/engine-components/WebARSessionRoot.ts +3 -2
  261. package/src/engine-components/WebXR.ts +12 -8
  262. package/src/engine-components/WebXRAvatar.ts +1 -1
  263. package/src/engine-components/WebXRGrabRendering.ts +2 -2
  264. package/src/engine-components/WebXRSync.ts +2 -2
  265. package/src/engine-components/codegen/components.ts +14 -6
  266. package/src/engine-components/js-extensions/Object3D.ts +6 -1
  267. package/src/engine-components/postprocessing/Effects/Antialiasing.ts +52 -0
  268. package/src/engine-components/postprocessing/Effects/Bloom.ts +75 -0
  269. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +36 -0
  270. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +114 -0
  271. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +90 -0
  272. package/src/engine-components/postprocessing/Effects/Pixelation.ts +28 -0
  273. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +71 -0
  274. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +55 -0
  275. package/src/engine-components/postprocessing/Effects/Vignette.ts +55 -0
  276. package/src/engine-components/postprocessing/PostProcessingEffect.ts +112 -0
  277. package/src/engine-components/postprocessing/PostProcessingHandler.ts +148 -0
  278. package/src/engine-components/postprocessing/Volume.ts +194 -0
  279. package/src/engine-components/postprocessing/VolumeParameter.ts +85 -0
  280. package/src/engine-components/postprocessing/VolumeProfile.ts +40 -0
  281. package/src/engine-components/timeline/TimelineTracks.ts +16 -17
  282. package/src/engine-components/ui/Text.ts +37 -174
  283. package/src/engine-components-experimental/networking/PlayerSync.ts +69 -8
  284. package/src/include/three/ARButton.js +13 -24
  285. package/src/include/three/VRButton.js +1 -7
  286. package/lib/engine-components/Volume.d.ts +0 -34
  287. package/lib/engine-components/Volume.js +0 -140
  288. package/lib/engine-components/Volume.js.map +0 -1
  289. package/src/engine-components/Volume.ts +0 -141
@@ -23,6 +23,9 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
23
23
 
24
24
  guid: string | undefined;
25
25
 
26
+ // Added to the threejs Object3D prototype
27
+ abstract destroy();
28
+
26
29
  // The actual implementation / prototype of threejs is modified in js-extensions/Object3D
27
30
  abstract get transform(): THREE.Object3D;
28
31
 
@@ -33,15 +36,21 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
33
36
  public static setActive(go: THREE.Object3D, active: boolean, processStart: boolean = true) {
34
37
  if (!go) return;
35
38
  setActive(go, active);
39
+
40
+ // TODO: do we still need this?:
36
41
  main.updateIsActive(go);
37
42
  if (active && processStart)
38
43
  main.processStart(Context.Current, go);
39
44
  }
40
45
 
46
+ /** If the object is active (same as go.visible) */
41
47
  public static isActiveSelf(go: THREE.Object3D): boolean {
42
48
  return isActiveSelf(go);
43
49
  }
44
50
 
51
+ /** If the object is active in the hierarchy (e.g. if any parent is invisible or not in the scene it will be false)
52
+ * @param go object to check
53
+ */
45
54
  public static isActiveInHierarchy(go: THREE.Object3D): boolean {
46
55
  return isActiveInHierarchy(go);
47
56
  }
@@ -52,19 +61,35 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
52
61
 
53
62
  public static isUsingInstancing(instance: THREE.Object3D): boolean { return isUsingInstancing(instance); }
54
63
 
64
+ /** Run a callback for all components of the provided type on the provided object and its children (if recursive is true)
65
+ * @param instance object to run the method on
66
+ * @param cb callback to run on each component
67
+ * @param recursive if true, the method will be run on all children as well
68
+ */
55
69
  public static foreachComponent(instance: THREE.Object3D, cb: (comp: Component) => any, recursive: boolean = true): any {
56
70
  return foreachComponent(instance, cb as (comp: IComponent) => any, recursive);
57
71
  }
58
72
 
73
+ /** Creates a new instance of the provided object. The new instance will be created on all connected clients
74
+ * @param instance object to instantiate
75
+ * @param opts options for the instantiation
76
+ */
59
77
  public static instantiateSynced(instance: GameObject | Object3D | null, opts: InstantiateOptions): GameObject | null {
60
78
  if (!instance) return null;
61
79
  return syncInstantiate(instance as any, opts) as GameObject | null;
62
80
  }
63
81
 
82
+ /** Creates a new instance of the provided object (like cloning it including all components and children)
83
+ * @param instance object to instantiate
84
+ * @param opts options for the instantiation (e.g. with what parent, position, etc.)
85
+ */
64
86
  public static instantiate(instance: GameObject | Object3D | null, opts: InstantiateOptions | null = null): GameObject | null {
65
87
  return instantiate(instance, opts) as GameObject | null;
66
88
  }
67
89
 
90
+ /** Destroys a object on all connected clients (if you are in a networked session)
91
+ * @param instance object to destroy
92
+ */
68
93
  public static destroySynced(instance: THREE.Object3D | Component, context?: Context, recursive: boolean = true) {
69
94
  if (!instance) return;
70
95
  const go = instance as GameObject;
@@ -72,6 +97,10 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
72
97
  syncDestroy(go as any, context.connection, recursive);
73
98
  }
74
99
 
100
+ /** Destroys a object
101
+ * @param instance object to destroy
102
+ * @param recursive if true, all children will be destroyed as well
103
+ */
75
104
  public static destroy(instance: THREE.Object3D | Component, recursive: boolean = true, isRoot: boolean = true) {
76
105
  return destroy(instance, recursive, isRoot);
77
106
  }
@@ -94,7 +123,7 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
94
123
  if (context) {
95
124
  GameObject.foreachComponent(instance, (comp: Component) => {
96
125
  main.addScriptToArrays(comp, context!);
97
- if(comp.__internalDidAwakeAndStart) return;
126
+ if (comp.__internalDidAwakeAndStart) return;
98
127
  if (context!.new_script_start.includes(comp) === false) {
99
128
  context!.new_script_start.push(comp as Behaviour);
100
129
  }
@@ -118,24 +147,31 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
118
147
  }, true);
119
148
  }
120
149
 
150
+ /** Invokes a method on all components including children (if a method with that name exists) */
121
151
  public static invokeOnChildren(go: THREE.Object3D | null | undefined, functionName: string, ...args: any) {
122
152
  this.invoke(go, functionName, true, args);
123
153
  }
124
154
 
155
+ /** Invokes a method on all components that have a method matching the provided name
156
+ * @param go object to invoke the method on all components
157
+ * @param functionName name of the method to invoke
158
+ */
125
159
  public static invoke(go: THREE.Object3D | null | undefined, functionName: string, children: boolean = false, ...args: any) {
126
160
  if (!go) return;
127
-
128
- // console.log(go);
129
161
  this.foreachComponent(go, c => {
130
162
  const fn = c[functionName];
131
163
  if (fn && typeof fn === "function") {
132
- const bound = fn.bind(c);
133
- // console.log(c, bound)
134
- bound(...args)
164
+ fn?.call(c, ...args)
135
165
  }
136
166
  }, children);
137
167
  }
138
168
 
169
+ /**
170
+ * Adds a new component to the provided object
171
+ * @param go object to add the component to
172
+ * @param type type of the component to add
173
+ * @param callAwake if true, the component will be added and awake will be called immediately
174
+ */
139
175
  public static addNewComponent<T>(go: GameObject | THREE.Object3D, type: ConstructorConcrete<T>, callAwake: boolean = true): T {
140
176
  const instance = new type();
141
177
  //@ts-ignore
@@ -143,13 +179,31 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
143
179
  return instance
144
180
  }
145
181
 
182
+ /**
183
+ * Moves a component to a new object
184
+ * BEWARE: this does MOVE a component. If you want to add a new component use `addNewComponent`
185
+ * @param go component to move the component to
186
+ * @param instance component to move to the GO
187
+ */
146
188
  public static addComponent(go: GameObject, instance: Component): void {
189
+ return this.moveComponent(go, instance);
190
+ }
191
+
192
+ /**
193
+ * Moves a component to a new object
194
+ * @param go component to move the component to
195
+ * @param instance component to move to the GO
196
+ */
197
+ public static moveComponent(go: GameObject, instance: Component): void {
147
198
  if (instance.gameObject == null) {
148
199
  throw new Error("Did you mean to create a new component? Use addNewComponent");
149
200
  }
150
201
  moveComponentInstance(go, instance as any);
151
202
  }
152
203
 
204
+ /** Removes a component from its object
205
+ * @param instance component to remove
206
+ */
153
207
  public static removeComponent(instance: Component): Component {
154
208
  removeComponent(instance.gameObject, instance as any);
155
209
  return instance;
@@ -159,6 +213,7 @@ abstract class GameObject extends THREE.Object3D implements THREE.Object3D, IGam
159
213
  return getOrAddComponent<any>(go, typeName);
160
214
  }
161
215
 
216
+ /** Gets a component on the provided object */
162
217
  public static getComponent<T>(go: GameObject | THREE.Object3D | null, typeName: Constructor<T> | null): T | null {
163
218
  if (go === null) return null;
164
219
  // if names are minified we could also use the type store and work with strings everywhere
@@ -339,7 +394,7 @@ class Component implements IComponent, EventTarget {
339
394
  onCollisionEnter?(col: Collision);
340
395
  onCollisionExit?(col: Collision);
341
396
  onCollisionStay?(col: Collision);
342
-
397
+
343
398
  onTriggerEnter?(col: ICollider);
344
399
  onTriggerStay?(col: ICollider);
345
400
  onTriggerExit?(col: ICollider);
@@ -361,34 +416,33 @@ class Component implements IComponent, EventTarget {
361
416
  this.__internalDestroy();
362
417
  }
363
418
 
364
-
365
-
419
+
420
+
366
421
  /** @internal */
367
422
  protected __didAwake: boolean = false;
368
-
423
+
369
424
  /** @internal */
370
425
  private __didStart: boolean = false;
371
-
426
+
372
427
  /** @internal */
373
428
  protected __didEnable: boolean = false;
374
-
429
+
375
430
  /** @internal */
376
431
  protected __isEnabled: boolean | undefined = undefined;
377
-
432
+
378
433
  /** @internal */
379
434
  private __destroyed: boolean = false;
380
-
435
+
381
436
  /** @internal */
382
437
  get __internalDidAwakeAndStart() { return this.__didAwake && this.__didStart; }
383
438
 
384
-
439
+
385
440
  /** @internal */
386
441
  constructor() {
387
- // super();
388
442
  this.__internalNewInstanceCreated();
389
443
  }
390
444
 
391
-
445
+
392
446
  /** @internal */
393
447
  __internalNewInstanceCreated() {
394
448
  this.__didAwake = false;
@@ -396,21 +450,17 @@ class Component implements IComponent, EventTarget {
396
450
  this.__didEnable = false;
397
451
  this.__isEnabled = undefined;
398
452
  this.__destroyed = false;
399
- // this.__internalResetsCachedPhysicsData();
400
453
  }
401
454
 
402
-
455
+
403
456
  /** @internal */
404
457
  __internalAwake() {
405
458
  if (this.__didAwake) return;
406
- // console.log("__internalAwake");
407
459
  this.__didAwake = true;
408
- // this.gameObject.test();
409
-
410
460
  this.awake();
411
461
  }
412
462
 
413
-
463
+
414
464
  /** @internal */
415
465
  __internalStart() {
416
466
  if (this.__didStart) return;
@@ -418,14 +468,13 @@ class Component implements IComponent, EventTarget {
418
468
  if (this.start) this.start();
419
469
  }
420
470
 
421
-
471
+
422
472
  /** @internal */
423
473
  __internalEnable(): boolean {
424
474
  if (this.__didEnable) return false;
425
475
  // console.trace("INTERNAL ENABLE");
426
476
  this.__didEnable = true;
427
477
  this.onEnable();
428
- // if we do this after processing the callback
429
478
  this.__isEnabled = true;
430
479
  return true;
431
480
  }
@@ -434,10 +483,7 @@ class Component implements IComponent, EventTarget {
434
483
  __internalDisable() {
435
484
  if (!this.__didEnable) return;
436
485
  this.__didEnable = false;
437
- // this._collisionExitRoutine = undefined;
438
486
  this.onDisable();
439
- // this._collisions?.clear();
440
- // if we do this after processing the callback
441
487
  this.__isEnabled = false;
442
488
  }
443
489
 
@@ -446,11 +492,9 @@ class Component implements IComponent, EventTarget {
446
492
  if (this.__destroyed) return;
447
493
  this.__destroyed = true;
448
494
  this.destroy?.call(this);
449
- // console.log("destroy", this);
450
495
  destroyComponentInstance(this as any);
451
496
  }
452
497
 
453
- // isActiveAndEnabled: boolean = false;
454
498
 
455
499
  get enabled(): boolean {
456
500
  return this.__isEnabled ?? true; // if it has no enabled field it is always enabled
@@ -1,17 +1,25 @@
1
+ import { serializable } from "../engine/engine_serialization";
1
2
  import { INetworkingWebsocketUrlProvider } from "../engine/engine_networking";
2
3
  import { isLocalNetwork } from "../engine/engine_networking_utils";
3
4
  import { getParam } from "../engine/engine_utils";
4
5
  import { Behaviour } from "./Component";
5
6
 
7
+ const debug = getParam("debugnet");
8
+
6
9
  export class Networking extends Behaviour implements INetworkingWebsocketUrlProvider {
7
10
 
11
+ @serializable()
8
12
  url: string | null = null;
13
+ @serializable()
9
14
  urlParameterName: string | null = null;
10
15
 
11
16
  // used when local host is detected
17
+ @serializable()
12
18
  localhost: string | null = null;
13
19
 
14
- awake(){
20
+ awake() {
21
+ if (debug)
22
+ console.log(this);
15
23
  this.context.connection.registerProvider(this);
16
24
  }
17
25
 
@@ -11,6 +11,7 @@ import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls
11
11
  import { EventSystem, EventSystemEvents } from "./ui/EventSystem";
12
12
  import { ICameraController } from "../engine/engine_types";
13
13
  import { setCameraController } from "../engine/engine_camera";
14
+ import { SyncedTransform } from "./SyncedTransform";
14
15
 
15
16
  const freeCam = getParam("freecam");
16
17
 
@@ -70,7 +71,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
70
71
 
71
72
  private _eventSystem?: EventSystem;
72
73
  private _afterHandleInputFn?: any;
73
- private _camera : Camera | null = null;
74
+ private _camera: Camera | null = null;
75
+ private _syncedTransform?: SyncedTransform;
74
76
 
75
77
  targetElement: HTMLElement | null = null;
76
78
 
@@ -133,6 +135,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
133
135
  this._controls.autoRotate = this.autoRotate;
134
136
  this._controls.autoRotateSpeed = this.autoRotateSpeed;
135
137
  this._controls.enableZoom = this.enableZoom;
138
+ this._controls.addEventListener("start", this.onControlsChangeStarted.bind(this));
136
139
  if (cam?.type === "PerspectiveCamera") {
137
140
  if (freeCam) {
138
141
  // dont set limits
@@ -158,7 +161,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
158
161
  this._controls.listenToKeyEvents(window.document.body);
159
162
  }
160
163
  }
161
-
164
+ this._syncedTransform = GameObject.getComponent(this.gameObject, SyncedTransform) ?? undefined;
162
165
  }
163
166
 
164
167
  onDisable() {
@@ -172,6 +175,12 @@ export class OrbitControls extends Behaviour implements ICameraController {
172
175
  }
173
176
  }
174
177
 
178
+ private onControlsChangeStarted() {
179
+ if(this._syncedTransform) {
180
+ this._syncedTransform.requestOwnership();
181
+ }
182
+ }
183
+
175
184
  private _shouldDisable: boolean = false;
176
185
  private afterHandleInput() {
177
186
  if (this._controls && this._eventSystem) {
@@ -17,7 +17,8 @@ import { Mathf } from "../engine/engine_math";
17
17
  import { Context } from "../engine/engine_setup";
18
18
  import { ParticleSubEmitter } from "./ParticleSystemSubEmitter";
19
19
  import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive";
20
- import { Gizmos, isDevEnvironment } from "../engine/api";
20
+ import { Gizmos } from "../engine/engine_gizmos";
21
+ import { isDevEnvironment } from "../engine/debug";
21
22
 
22
23
  const debug = getParam("debugparticles");
23
24
  const suppressProgressiveLoading = getParam("noprogressive");
@@ -330,7 +331,7 @@ class SizeBehaviour extends ParticleSystemBaseBehaviour {
330
331
  }
331
332
  }
332
333
 
333
- const $particleLife = Symbol("particleLife");
334
+ export const $particleLife = Symbol("particleLife");
334
335
  const $trailLifetime = Symbol("trailLifetime");
335
336
  const $trailStartLength = Symbol("trailStartLength");
336
337
 
@@ -340,7 +341,6 @@ class TrailBehaviour extends ParticleSystemBaseBehaviour {
340
341
  initialize(particle: Particle) {
341
342
  if (particle instanceof TrailParticle) {
342
343
  particle[$particleLife] = particle.life;
343
- particle[$trailLifetime] = particle.life;
344
344
  if (this.system.trails.enabled && this.system.trails.dieWithParticles === false) {
345
345
  particle[$trailLifetime] = this.system.trails.lifetime.evaluate(Math.random(), Math.random());
346
346
  particle.life += particle[$trailLifetime];
@@ -418,7 +418,7 @@ class VelocityBehaviour extends ParticleSystemBaseBehaviour {
418
418
  if (gravityFactor !== 0) {
419
419
  // gravityFactor *= -1;
420
420
  temp3.copy(this._gravityDirection).multiplyScalar(gravityFactor);
421
- if(debug) Gizmos.DrawDirection(particle.position, temp3, 0x0000ff, 0, false, 10);
421
+ if (debug) Gizmos.DrawDirection(particle.position, temp3, 0x0000ff, 0, false, 10);
422
422
  baseVelocity.add(temp3);
423
423
  }
424
424
  particle.velocity.copy(baseVelocity);
@@ -747,6 +747,7 @@ export class ParticleSystem extends Behaviour implements IParticleSystem {
747
747
  private _time: number = 0;
748
748
  private _isPlaying: boolean = true;
749
749
  private _isUsedAsSubsystem: boolean = false;
750
+ private _didPreWarm: boolean = false;
750
751
 
751
752
  /** called from deserialization */
752
753
  private set bursts(arr: ParticleBurst[]) {
@@ -779,7 +780,8 @@ export class ParticleSystem extends Behaviour implements IParticleSystem {
779
780
  }
780
781
  private _subEmitterSystems?: SubEmitterSystem[];
781
782
 
782
- onAfterDeserialize(_){
783
+ onAfterDeserialize(_) {
784
+ // doing this here to get a chance to resolve the subemitter guid
783
785
  if (this._subEmitterSystems && Array.isArray(this._subEmitterSystems)) {
784
786
  for (const sub of this._subEmitterSystems) {
785
787
  sub._deserialize(this.context, this.gameObject);
@@ -788,7 +790,6 @@ export class ParticleSystem extends Behaviour implements IParticleSystem {
788
790
  }
789
791
 
790
792
  awake(): void {
791
-
792
793
  this._renderer = this.gameObject.getComponent(ParticleSystemRenderer) as ParticleSystemRenderer;
793
794
 
794
795
  this._container = new Object3D();
@@ -837,16 +838,49 @@ export class ParticleSystem extends Behaviour implements IParticleSystem {
837
838
  onEnable() {
838
839
  if (this.inheritVelocity)
839
840
  this.inheritVelocity.system = this;
841
+ if (this._batchSystem)
842
+ this._batchSystem.visible = true;
840
843
  this.play();
841
844
  }
842
845
 
843
846
  onDisable() {
847
+ if (this._batchSystem)
848
+ this._batchSystem.visible = false;
844
849
  }
845
850
 
846
851
  onBeforeRender() {
852
+ if (this._didPreWarm === false && this.main?.prewarm === true) {
853
+ this._didPreWarm = true;
854
+ this.preWarm();
855
+ }
847
856
  this.onUpdate();
848
- const dt = this.deltaTime;
857
+ this.onSimulate(this.deltaTime);
858
+ }
859
+
860
+ private preWarm() {
861
+ if (!this.emission?.enabled) return;
862
+ const emission = this.emission.rateOverTime.getMax();
863
+ if (emission <= 0) return;
864
+ const dt = 1 / 60;
865
+ const duration = this.main.duration;
866
+ const lifetime = this.main.startLifetime.getMax();
867
+ const maxDurationToPrewarm = 1000;
868
+ const timeToSimulate = Math.min(duration, lifetime, maxDurationToPrewarm);
869
+ const framesToSimulate = Math.ceil(timeToSimulate / dt);
870
+ const startTime = Date.now();
871
+ if (debug)
872
+ console.log(`Particles ${this.name} - Prewarm for ${framesToSimulate} frames (${timeToSimulate} sec). Duration: ${duration}, Lifetime: ${lifetime}`);
873
+ for (let i = 0; i < framesToSimulate; i++) {
874
+ if (this.currentParticles >= this.maxParticles) break;
875
+ if (Date.now() - startTime > 2) {
876
+ console.warn(`Particles ${this.name} - Prewarm took too long. Aborting.`);
877
+ }
878
+ this.onUpdate();
879
+ this.onSimulate(dt);
880
+ }
881
+ }
849
882
 
883
+ private onSimulate(dt: number) {
850
884
  if (this._batchSystem) {
851
885
  // Updating layers on batches
852
886
  // TODO: figure out a better way to do this
@@ -942,10 +976,20 @@ export class SubEmitterSystem {
942
976
  properties?: number;
943
977
  type?: SubEmitterType;
944
978
 
945
- _deserialize(context: Context, _gameObject: GameObject) {
979
+ _deserialize(_context: Context, gameObject: GameObject) {
946
980
  const ps = this.particleSystem;
947
- if (ps && !(ps instanceof ParticleSystem) && typeof ps["guid"] === "string") {
948
- this.particleSystem = GameObject.findByGuid(ps["guid"], context.scene) as ParticleSystem;
981
+ if (ps instanceof ParticleSystem) return;
982
+
983
+ let guid = "";
984
+
985
+ if (ps && typeof ps["guid"] === "string") {
986
+ guid = ps["guid"];
987
+ // subemitter MUST be a child of the particle system
988
+ this.particleSystem = GameObject.findByGuid(guid, gameObject) as ParticleSystem;
989
+ }
990
+
991
+ if (debug && !(this.particleSystem instanceof ParticleSystem)) {
992
+ console.warn("Could not find particle system for sub emitter", guid, gameObject, this);
949
993
  }
950
994
  }
951
995
  }
@@ -199,6 +199,33 @@ export class MinMaxCurve {
199
199
  }
200
200
  return 0;
201
201
  }
202
+
203
+ getMax(): number {
204
+ switch (this.mode) {
205
+ case ParticleSystemCurveMode.Constant:
206
+ return this.constant;
207
+ case ParticleSystemCurveMode.Curve:
208
+ return this.getMaxFromCurve(this.curve!) * this.curveMultiplier!;
209
+ case ParticleSystemCurveMode.TwoCurves:
210
+ return Math.max(this.getMaxFromCurve(this.curveMin), this.getMaxFromCurve(this.curveMax)) * this.curveMultiplier!;
211
+ case ParticleSystemCurveMode.TwoConstants:
212
+ return Math.max(this.constantMin, this.constantMax);
213
+ default:
214
+ return 0;
215
+ }
216
+ }
217
+
218
+ private getMaxFromCurve(curve?: AnimationCurve) {
219
+ if (!curve) return 0;
220
+ let maxNumber = Number.MIN_VALUE;
221
+ for (let i = 0; i < curve!.keys.length; i++) {
222
+ const key = curve!.keys[i];
223
+ if (key.value > maxNumber) {
224
+ maxNumber = key.value;
225
+ }
226
+ }
227
+ return maxNumber;
228
+ }
202
229
  }
203
230
 
204
231
  export class MinMaxGradient {
@@ -571,7 +598,7 @@ export class ShapeModule implements EmitterShape {
571
598
  if (this.enabled) {
572
599
  switch (this.shapeType) {
573
600
  case ParticleSystemShapeType.Box:
574
- if(debug) Gizmos.DrawBox(this.position, this.scale, 0xdddddd, 1);
601
+ if (debug) Gizmos.DrawBox(this.position, this.scale, 0xdddddd, 1);
575
602
  this._vector.x = Math.random() * this.scale.x - this.scale.x / 2;
576
603
  this._vector.y = Math.random() * this.scale.y - this.scale.y / 2;
577
604
  this._vector.z = Math.random() * this.scale.z - this.scale.z / 2;
@@ -2,7 +2,7 @@ import { Behavior, Particle, EmissionState, ParticleSystem, ParticleEmitter } fr
2
2
  import { Vector3, Quaternion, Matrix4 } from "three";
3
3
  import { IParticleSystem } from "./ParticleSystemModules";
4
4
  import { CircularBuffer } from "../engine/engine_utils";
5
- import { SubEmitterType } from "./ParticleSystem";
5
+ import { $particleLife, SubEmitterType } from "./ParticleSystem";
6
6
 
7
7
  const VECTOR_ONE = new Vector3(1, 1, 1);
8
8
  const VECTOR_Z = new Vector3(0, 0, 1);
@@ -73,13 +73,15 @@ export class ParticleSubEmitter implements Behavior {
73
73
  if (!this.subParticleSystem || !particle.emissionState)
74
74
  return;
75
75
 
76
- if(this.emitterProbability && Math.random() > this.emitterProbability)
76
+ if (this.emitterProbability && Math.random() > this.emitterProbability)
77
77
  return;
78
78
 
79
79
  const delta = this.system.deltaTime;
80
80
 
81
81
  if (this.emitterType === SubEmitterType.Death) {
82
- const willDie = particle.age + delta * 1.2 >= particle.life;
82
+ let lifeTime = particle.life;
83
+ if (particle[$particleLife] !== undefined) lifeTime = particle[$particleLife];
84
+ const willDie = particle.age + delta * 1.2 >= lifeTime;
83
85
  if (!willDie) return;
84
86
  // Just emit all for now, we should probably add a way to get the amount from the subsystem emission module
85
87
  const maxAmount = this.subSystem.main.maxParticles - this.subSystem.currentParticles;
@@ -1,5 +1,5 @@
1
1
  import { Behaviour } from "./Component";
2
- import { Box3, Color, EquirectangularReflectionMapping, LineBasicMaterial, Material, MeshStandardMaterial, Object3D, sRGBEncoding, Texture, Vector3, WebGLCubeRenderTarget, WebGLRenderTarget } from "three";
2
+ import { Box3, Color, EquirectangularReflectionMapping, LinearEncoding, LineBasicMaterial, Material, MeshStandardMaterial, Object3D, SrcAlphaFactor, sRGBEncoding, Texture, Vector3, WebGLCubeRenderTarget, WebGLRenderTarget } from "three";
3
3
  import { serializable } from "../engine/engine_serialization";
4
4
  import { Context } from "../engine/engine_setup";
5
5
  import { getWorldPosition, getWorldScale } from "../engine/engine_three_utils";
@@ -47,7 +47,16 @@ export class ReflectionProbe extends Behaviour {
47
47
 
48
48
  private _texture!: Texture;
49
49
  set texture(tex: Texture) {
50
+ if (tex && !(tex instanceof Texture)) {
51
+ console.error("ReflectionProbe.texture must be a Texture", tex);
52
+ return;
53
+ }
50
54
  this._texture = tex;
55
+ if (tex) {
56
+ tex.mapping = EquirectangularReflectionMapping;
57
+ tex.encoding = sRGBEncoding;
58
+ tex.needsUpdate = true;
59
+ }
51
60
  }
52
61
  get texture(): Texture {
53
62
  return this._texture;
@@ -81,8 +90,6 @@ export class ReflectionProbe extends Behaviour {
81
90
  if (this.texture) {
82
91
  this.texture.mapping = EquirectangularReflectionMapping;
83
92
  this.texture.encoding = sRGBEncoding;
84
- // this.texture.rotation = Math.PI;
85
- // this.texture.flipY = true;
86
93
  this.texture.needsUpdate = true;
87
94
  }
88
95
  }
@@ -106,6 +113,7 @@ export class ReflectionProbe extends Behaviour {
106
113
 
107
114
  onSet(_rend: IRenderer) {
108
115
  if (disable) return;
116
+ if (!this.enabled) return;
109
117
  if (_rend.sharedMaterials?.length <= 0) return;
110
118
  if (!this.texture) return;
111
119
 
@@ -129,8 +137,10 @@ export class ReflectionProbe extends Behaviour {
129
137
  let cached = rendererCache[i];
130
138
 
131
139
  // make sure we have the currently assigned material cached (and an up to date clone of that)
132
- if (!cached || cached.material !== material || cached.material.version !== material.version) {
140
+ if (!cached || cached.material !== material || cached.copy.version !== material.version) {
141
+ if(debug) console.log("Cloning material", material.name, material.version);
133
142
  const clone = material.clone();
143
+ clone.version = material.version;
134
144
 
135
145
  if (cached) {
136
146
  cached.copy = clone;
@@ -147,9 +157,6 @@ export class ReflectionProbe extends Behaviour {
147
157
  clone[$reflectionProbeKey] = this;
148
158
  clone[$originalMaterial] = material;
149
159
 
150
- // make sure the reflection probe is assigned
151
- clone["envMap"] = this.texture;
152
-
153
160
  if (debug)
154
161
  console.log("Set reflection", _rend.name, _rend.guid);
155
162
  }
@@ -157,6 +164,9 @@ export class ReflectionProbe extends Behaviour {
157
164
  /** this is the material that we copied and that has the reflection probe */
158
165
  const copy = cached?.copy;
159
166
 
167
+ // make sure the reflection probe is assigned
168
+ copy["envMap"] = this.texture;
169
+
160
170
  _rend.sharedMaterials[i] = copy;
161
171
  }
162
172
  }