@needle-tools/engine 2.52.0-pre → 2.54.2-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 (220) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/needle-engine.d.ts +3018 -2680
  3. package/dist/needle-engine.js +439 -439
  4. package/dist/needle-engine.js.map +4 -4
  5. package/dist/needle-engine.min.js +41 -41
  6. package/dist/needle-engine.min.js.map +4 -4
  7. package/dist/needle-engine.tsbuildinfo +1 -0
  8. package/lib/engine/codegen/register_types.d.ts +1 -0
  9. package/lib/engine/codegen/register_types.js +346 -0
  10. package/lib/engine/codegen/register_types.js.map +1 -0
  11. package/lib/engine/debug/debug.d.ts +1 -0
  12. package/lib/engine/debug/debug.js +4 -0
  13. package/lib/engine/debug/debug.js.map +1 -1
  14. package/lib/engine/debug/debug_console.js +2 -1
  15. package/lib/engine/debug/debug_console.js.map +1 -1
  16. package/lib/engine/debug/debug_overlay.js +3 -1
  17. package/lib/engine/debug/debug_overlay.js.map +1 -1
  18. package/lib/engine/engine_components.js +2 -2
  19. package/lib/engine/engine_components.js.map +1 -1
  20. package/lib/engine/engine_default_parameters.d.ts +2 -2
  21. package/lib/engine/engine_element.js +4 -2
  22. package/lib/engine/engine_element.js.map +1 -1
  23. package/lib/engine/engine_element_loading.d.ts +1 -0
  24. package/lib/engine/engine_element_loading.js +17 -6
  25. package/lib/engine/engine_element_loading.js.map +1 -1
  26. package/lib/engine/engine_element_overlay.js +4 -2
  27. package/lib/engine/engine_element_overlay.js.map +1 -1
  28. package/lib/engine/engine_fileloader.d.ts +3 -0
  29. package/lib/engine/engine_fileloader.js +8 -0
  30. package/lib/engine/engine_fileloader.js.map +1 -0
  31. package/lib/engine/engine_generic_utils.d.ts +1 -0
  32. package/lib/engine/engine_generic_utils.js +14 -0
  33. package/lib/engine/engine_generic_utils.js.map +1 -0
  34. package/lib/engine/engine_input.js +4 -0
  35. package/lib/engine/engine_input.js.map +1 -1
  36. package/lib/engine/engine_networking_instantiate.d.ts +1 -1
  37. package/lib/engine/engine_networking_instantiate.js +3 -0
  38. package/lib/engine/engine_networking_instantiate.js.map +1 -1
  39. package/lib/engine/engine_networking_websocket.d.ts +1 -0
  40. package/lib/engine/engine_networking_websocket.js +1 -1
  41. package/lib/engine/engine_networking_websocket.js.map +1 -1
  42. package/lib/engine/engine_serialization_builtin_serializer.d.ts +6 -0
  43. package/lib/engine/engine_serialization_builtin_serializer.js +35 -7
  44. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  45. package/lib/engine/engine_serialization_core.d.ts +1 -0
  46. package/lib/engine/engine_serialization_core.js +6 -0
  47. package/lib/engine/engine_serialization_core.js.map +1 -1
  48. package/lib/engine/engine_setup.js +2 -2
  49. package/lib/engine/engine_setup.js.map +1 -1
  50. package/lib/engine/engine_texture.d.ts +3 -0
  51. package/lib/engine/engine_texture.js +4 -0
  52. package/lib/engine/engine_texture.js.map +1 -0
  53. package/lib/engine/engine_utils.d.ts +1 -1
  54. package/lib/engine/engine_utils.js +3 -0
  55. package/lib/engine/engine_utils.js.map +1 -1
  56. package/lib/engine/extensions/NEEDLE_components.d.ts +1 -1
  57. package/lib/engine/extensions/NEEDLE_progressive.d.ts +40 -0
  58. package/lib/engine/extensions/NEEDLE_progressive.js +322 -0
  59. package/lib/engine/extensions/NEEDLE_progressive.js.map +1 -0
  60. package/lib/engine/extensions/extensions.js +2 -2
  61. package/lib/engine/extensions/extensions.js.map +1 -1
  62. package/lib/engine-components/Camera.js +17 -2
  63. package/lib/engine-components/Camera.js.map +1 -1
  64. package/lib/engine-components/GroundProjection.d.ts +2 -1
  65. package/lib/engine-components/GroundProjection.js +19 -12
  66. package/lib/engine-components/GroundProjection.js.map +1 -1
  67. package/lib/engine-components/Light.js +1 -0
  68. package/lib/engine-components/Light.js.map +1 -1
  69. package/lib/engine-components/OrbitControls.js +6 -2
  70. package/lib/engine-components/OrbitControls.js.map +1 -1
  71. package/lib/engine-components/ParticleSystemModules.d.ts +1 -1
  72. package/lib/engine-components/ParticleSystemModules.js +48 -44
  73. package/lib/engine-components/ParticleSystemModules.js.map +1 -1
  74. package/lib/engine-components/ReflectionProbe.d.ts +1 -1
  75. package/lib/engine-components/Renderer.d.ts +1 -1
  76. package/lib/engine-components/Renderer.js +4 -9
  77. package/lib/engine-components/Renderer.js.map +1 -1
  78. package/lib/engine-components/Voip.js +13 -4
  79. package/lib/engine-components/Voip.js.map +1 -1
  80. package/lib/engine-components/Volume.js +8 -1
  81. package/lib/engine-components/Volume.js.map +1 -1
  82. package/lib/engine-components/WebXR.d.ts +2 -2
  83. package/lib/engine-components/WebXRAvatar.d.ts +1 -1
  84. package/lib/engine-components/codegen/components.d.ts +99 -95
  85. package/lib/engine-components/codegen/components.js +99 -95
  86. package/lib/engine-components/codegen/components.js.map +1 -1
  87. package/lib/engine-components/export/{GltfExport.d.ts → gltf/GltfExport.d.ts} +2 -2
  88. package/lib/engine-components/export/{GltfExport.js → gltf/GltfExport.js} +7 -7
  89. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -0
  90. package/lib/engine-components/export/usdz/Extension.d.ts +9 -0
  91. package/lib/engine-components/export/usdz/Extension.js +2 -0
  92. package/lib/engine-components/export/usdz/Extension.js.map +1 -0
  93. package/lib/engine-components/export/usdz/USDZExporter.d.ts +26 -0
  94. package/lib/engine-components/export/usdz/USDZExporter.js +209 -0
  95. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -0
  96. package/lib/engine-components/export/usdz/extensions/Animation.d.ts +44 -0
  97. package/lib/engine-components/export/usdz/extensions/Animation.js +264 -0
  98. package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -0
  99. package/lib/engine-components/export/usdz/types.d.ts +34 -0
  100. package/lib/engine-components/export/usdz/types.js +2 -0
  101. package/lib/engine-components/export/usdz/types.js.map +1 -0
  102. package/lib/engine-components/export/usdz/utils/animationutils.d.ts +3 -0
  103. package/lib/engine-components/export/usdz/utils/animationutils.js +46 -0
  104. package/lib/engine-components/export/usdz/utils/animationutils.js.map +1 -0
  105. package/lib/engine-components/export/usdz/utils/quicklook.d.ts +2 -0
  106. package/lib/engine-components/export/usdz/utils/quicklook.js +36 -0
  107. package/lib/engine-components/export/usdz/utils/quicklook.js.map +1 -0
  108. package/lib/engine-components/export/usdz/utils/timeutils.d.ts +1 -0
  109. package/lib/engine-components/export/usdz/utils/timeutils.js +15 -0
  110. package/lib/engine-components/export/usdz/utils/timeutils.js.map +1 -0
  111. package/lib/engine-components/ui/Button.js +30 -0
  112. package/lib/engine-components/ui/Button.js.map +1 -1
  113. package/lib/engine-components/ui/Graphic.d.ts +2 -0
  114. package/lib/engine-components/ui/Graphic.js +15 -0
  115. package/lib/engine-components/ui/Graphic.js.map +1 -1
  116. package/lib/engine-components/ui/InputField.d.ts +2 -0
  117. package/lib/engine-components/ui/InputField.js +23 -1
  118. package/lib/engine-components/ui/InputField.js.map +1 -1
  119. package/lib/engine-components/ui/Utils.d.ts +4 -1
  120. package/lib/engine-components/ui/Utils.js +15 -12
  121. package/lib/engine-components/ui/Utils.js.map +1 -1
  122. package/lib/engine-components-experimental/Presentation.d.ts +6 -0
  123. package/lib/engine-components-experimental/Presentation.js +11 -0
  124. package/lib/engine-components-experimental/Presentation.js.map +1 -0
  125. package/lib/engine-components-experimental/annotation/LineDrawer.d.ts +18 -0
  126. package/lib/engine-components-experimental/annotation/LineDrawer.js +175 -0
  127. package/lib/engine-components-experimental/annotation/LineDrawer.js.map +1 -0
  128. package/lib/engine-components-experimental/annotation/LinesManager.d.ts +54 -0
  129. package/lib/engine-components-experimental/annotation/LinesManager.js +155 -0
  130. package/lib/engine-components-experimental/annotation/LinesManager.js.map +1 -0
  131. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +26 -0
  132. package/lib/engine-components-experimental/networking/PlayerSync.js +121 -0
  133. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -0
  134. package/lib/engine-schemes/vec2.d.ts +10 -0
  135. package/lib/engine-schemes/vec2.js +26 -0
  136. package/lib/engine-schemes/vec2.js.map +1 -0
  137. package/lib/include/three/ARButton.d.ts +3 -0
  138. package/lib/include/three/ARButton.js +158 -0
  139. package/lib/include/three/ARButton.js.map +1 -0
  140. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.d.ts +6 -0
  141. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js +46 -0
  142. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js.map +1 -0
  143. package/lib/include/three/VRButton.d.ts +5 -0
  144. package/lib/include/three/VRButton.js +122 -0
  145. package/lib/include/three/VRButton.js.map +1 -0
  146. package/lib/tsconfig.tsbuildinfo +1 -0
  147. package/package.json +2 -2
  148. package/src/engine/codegen/register_types.js +212 -204
  149. package/src/engine/debug/debug.ts +5 -0
  150. package/src/engine/debug/debug_console.ts +3 -2
  151. package/src/engine/debug/debug_overlay.ts +3 -1
  152. package/src/engine/engine_components.ts +2 -2
  153. package/src/engine/engine_element.ts +4 -2
  154. package/src/engine/engine_element_loading.ts +13 -6
  155. package/src/engine/engine_element_overlay.ts +4 -2
  156. package/src/engine/engine_input.ts +4 -0
  157. package/src/engine/engine_networking_instantiate.ts +4 -1
  158. package/src/engine/engine_networking_websocket.ts +3 -1
  159. package/src/engine/engine_serialization_builtin_serializer.ts +39 -8
  160. package/src/engine/engine_serialization_core.ts +7 -1
  161. package/src/engine/engine_setup.ts +2 -2
  162. package/src/engine/engine_texture.ts +6 -0
  163. package/src/engine/engine_utils.ts +3 -1
  164. package/src/engine/extensions/NEEDLE_progressive.ts +357 -0
  165. package/src/engine/extensions/extensions.ts +2 -2
  166. package/src/engine-components/Camera.ts +17 -3
  167. package/src/engine-components/GroundProjection.ts +18 -12
  168. package/src/engine-components/Light.ts +3 -1
  169. package/src/engine-components/OrbitControls.ts +7 -3
  170. package/src/engine-components/ParticleSystemModules.ts +50 -47
  171. package/src/engine-components/Renderer.ts +6 -10
  172. package/src/engine-components/Voip.ts +14 -4
  173. package/src/engine-components/Volume.ts +8 -1
  174. package/src/engine-components/WebXR.ts +2 -2
  175. package/src/engine-components/codegen/components.ts +99 -95
  176. package/src/engine-components/export/{GltfExport.ts → gltf/GltfExport.ts} +7 -7
  177. package/src/engine-components/export/usdz/Extension.ts +12 -0
  178. package/src/engine-components/export/usdz/USDZExporter.ts +233 -0
  179. package/src/engine-components/export/usdz/extensions/Animation.ts +306 -0
  180. package/src/engine-components/export/usdz/types.ts +39 -0
  181. package/src/engine-components/export/usdz/utils/animationutils.ts +60 -0
  182. package/src/engine-components/export/usdz/utils/quicklook.ts +43 -0
  183. package/src/engine-components/export/usdz/utils/timeutils.ts +20 -0
  184. package/src/engine-components/ui/Button.ts +8 -8
  185. package/src/engine-components/ui/Graphic.ts +15 -1
  186. package/src/engine-components/ui/InputField.ts +25 -2
  187. package/src/engine-components/ui/Utils.ts +17 -14
  188. package/src/engine-components-experimental/annotation/LineDrawer.ts +10 -7
  189. package/src/engine-components-experimental/annotation/LinesManager.ts +6 -6
  190. package/src/engine-components-experimental/networking/PlayerSync.ts +1 -1
  191. package/lib/engine/engine_caching.d.ts +0 -0
  192. package/lib/engine/engine_caching.js +0 -2
  193. package/lib/engine/engine_caching.js.map +0 -1
  194. package/lib/engine/extensions/NEEDLE_deferred_texture.d.ts +0 -18
  195. package/lib/engine/extensions/NEEDLE_deferred_texture.js +0 -194
  196. package/lib/engine/extensions/NEEDLE_deferred_texture.js.map +0 -1
  197. package/lib/engine/tests/simulate_avatars.d.ts +0 -0
  198. package/lib/engine/tests/simulate_avatars.js +0 -3
  199. package/lib/engine/tests/simulate_avatars.js.map +0 -1
  200. package/lib/engine-components/NavMesh.d.ts +0 -0
  201. package/lib/engine-components/NavMesh.js +0 -101
  202. package/lib/engine-components/NavMesh.js.map +0 -1
  203. package/lib/engine-components/ParticleSystemBehaviours.d.ts +0 -0
  204. package/lib/engine-components/ParticleSystemBehaviours.js +0 -2
  205. package/lib/engine-components/ParticleSystemBehaviours.js.map +0 -1
  206. package/lib/engine-components/SpringJoint.d.ts +0 -0
  207. package/lib/engine-components/SpringJoint.js +0 -43
  208. package/lib/engine-components/SpringJoint.js.map +0 -1
  209. package/lib/engine-components/export/GltfExport.js.map +0 -1
  210. package/lib/engine-components/ui/CanvasScaler.d.ts +0 -0
  211. package/lib/engine-components/ui/CanvasScaler.js +0 -17
  212. package/lib/engine-components/ui/CanvasScaler.js.map +0 -1
  213. package/src/engine/dist/engine_three_utils.js +0 -279
  214. package/src/engine/engine_caching.ts +0 -0
  215. package/src/engine/extensions/NEEDLE_deferred_texture.ts +0 -217
  216. package/src/engine/tests/simulate_avatars.ts +0 -2
  217. package/src/engine-components/NavMesh.ts +0 -117
  218. package/src/engine-components/ParticleSystemBehaviours.ts +0 -0
  219. package/src/engine-components/SpringJoint.ts +0 -45
  220. package/src/engine-components/ui/CanvasScaler.ts +0 -21
@@ -12,7 +12,7 @@ import { SourceIdentifier } from "../engine_types";
12
12
  import { Context } from "../engine_setup";
13
13
  import { NEEDLE_lighting_settings } from "./NEEDLE_lighting_settings";
14
14
  import { NEEDLE_render_objects } from "./NEEDLE_render_objects";
15
- import { NEEDLE_deferred_texture } from "./NEEDLE_deferred_texture";
15
+ import { NEEDLE_progressive } from "./NEEDLE_progressive";
16
16
 
17
17
  export function registerComponentExtension(loader: GLTFLoader): NEEDLE_components {
18
18
  const ext = new NEEDLE_components();
@@ -40,7 +40,7 @@ export function registerExtensions(loader: GLTFLoader, context: Context, sourceI
40
40
  loader.register(p => new NEEDLE_lighting_settings(p, sourceId, context));
41
41
  loader.register(p => new NEEDLE_techniques_webgl(p, sourceId));
42
42
  loader.register(p => new NEEDLE_render_objects(p, sourceId));
43
- loader.register(p => new NEEDLE_deferred_texture(p, sourceId, context));
43
+ loader.register(p => new NEEDLE_progressive(p, sourceId, context));
44
44
  loader.register(p => new EXT_texture_exr(p));
45
45
 
46
46
  const setPointerResolverFunction = loader["setAnimationPointerResolver"];
@@ -9,6 +9,7 @@ import { XRSessionMode } from "../engine/engine_setup";
9
9
  import { ICamera } from "../engine/engine_types"
10
10
  import { showBalloonMessage } from "../engine/debug/debug";
11
11
  import { getWorldPosition } from "../engine/engine_three_utils";
12
+ import { Gizmos } from "../engine/engine_gizmos";
12
13
 
13
14
  export enum ClearFlags {
14
15
  Skybox = 1,
@@ -17,6 +18,7 @@ export enum ClearFlags {
17
18
  }
18
19
 
19
20
  const debug = getParam("debugcam");
21
+ const debugscreenpointtoray = getParam("debugscreenpointtoray");
20
22
 
21
23
  export class Camera extends Behaviour implements ICamera {
22
24
 
@@ -157,14 +159,15 @@ export class Camera extends Behaviour implements ICamera {
157
159
  private static _origin: THREE.Vector3 = new THREE.Vector3();
158
160
  private static _direction: THREE.Vector3 = new THREE.Vector3();
159
161
  public screenPointToRay(x: number, y: number, ray?: Ray): Ray {
162
+ let cam = this.cam;
160
163
  const origin = Camera._origin;
161
164
  origin.set(x, y, -1);
162
165
  this.context.input.convertScreenspaceToRaycastSpace(origin);
166
+ if(debugscreenpointtoray) console.log("screenPointToRay", x.toFixed(2), y.toFixed(2), "now:", origin.x.toFixed(2), origin.y.toFixed(2), "isInXR:" + this.context.isInXR);
163
167
  origin.z = -1;
164
- origin.unproject(this.cam);
165
-
168
+ origin.unproject(cam);
166
169
  const dir = Camera._direction.set(origin.x, origin.y, origin.z);
167
- const camPosition = getWorldPosition(this.cam);
170
+ const camPosition = getWorldPosition(cam);
168
171
  dir.sub(camPosition);
169
172
  dir.normalize();
170
173
  if (ray) {
@@ -180,6 +183,17 @@ export class Camera extends Behaviour implements ICamera {
180
183
  if (!this.sourceId) {
181
184
  console.warn("Camera has no source - the camera should be exported inside a gltf", this.name);
182
185
  }
186
+
187
+ if(debugscreenpointtoray){
188
+ window.addEventListener("pointerdown", evt => {
189
+ const px = evt.clientX;
190
+ const py = evt.clientY;
191
+ console.log("touch", px.toFixed(2), py.toFixed(2))
192
+ const ray = this.screenPointToRay(px, py);
193
+ const randomHex = "#" + Math.floor(Math.random()*16777215).toString(16);
194
+ Gizmos.DrawRay(ray.origin, ray.direction, randomHex, 10);
195
+ });
196
+ }
183
197
  }
184
198
 
185
199
  onEnable(): void {
@@ -7,6 +7,9 @@ import { Texture } from "three";
7
7
 
8
8
  export class GroundProjectedEnv extends Behaviour {
9
9
 
10
+ @serializable()
11
+ applyOnAwake: boolean = false;
12
+
10
13
  @serializable()
11
14
  set scale(val: number) {
12
15
  this._scale = val;
@@ -40,14 +43,23 @@ export class GroundProjectedEnv extends Behaviour {
40
43
  private _watcher?: Watch;
41
44
 
42
45
 
43
- onEnable() {
44
- // TODO: if we do this in the first frame we can not disable it again. Something buggy with the watch?!
45
- if (this.context.time.frameCount > 0)
46
+ awake() {
47
+ if (this.applyOnAwake)
46
48
  this.updateAndCreate();
47
49
  }
48
50
 
49
- start() {
50
- this.updateAndCreate();
51
+ onEnable() {
52
+ // TODO: if we do this in the first frame we can not disable it again. Something buggy with the watch?!
53
+ if (this.context.time.frameCount > 0) {
54
+ if (this.applyOnAwake)
55
+ this.updateAndCreate();
56
+ }
57
+ if (!this._watcher) {
58
+ this._watcher = new Watch(this.context.scene, "environment");
59
+ this._watcher.subscribeWrite(_ => {
60
+ this.updateProjection();
61
+ });
62
+ }
51
63
  }
52
64
 
53
65
  onDisable() {
@@ -57,13 +69,7 @@ export class GroundProjectedEnv extends Behaviour {
57
69
 
58
70
  private updateAndCreate() {
59
71
  this.updateProjection();
60
- if (!this._watcher) {
61
- this._watcher = new Watch(this.context.scene, "environment");
62
- this._watcher.subscribeWrite(_ => {
63
- this.updateProjection();
64
- });
65
- }
66
- this._watcher.apply();
72
+ this._watcher?.apply();
67
73
  }
68
74
 
69
75
  updateProjection() {
@@ -292,6 +292,7 @@ export class Light extends Behaviour implements ILight {
292
292
 
293
293
  if (lightAlreadyCreated && !this.light) {
294
294
  this.light = this.gameObject as unknown as THREE.Light;
295
+ this._intensity = this.light.intensity;
295
296
 
296
297
  switch (this.type) {
297
298
  case LightType.Directional:
@@ -346,7 +347,8 @@ export class Light extends Behaviour implements ILight {
346
347
  if (this.light) {
347
348
  if (this._intensity >= 0)
348
349
  this.light.intensity = this._intensity;
349
- else this._intensity = this.light.intensity;
350
+ else
351
+ this._intensity = this.light.intensity;
350
352
 
351
353
  if (this.shadows !== LightShadows.None) {
352
354
  this.light.castShadow = true;
@@ -11,6 +11,9 @@ import { getParam, isMobileDevice } from "../engine/engine_utils";
11
11
 
12
12
  const freeCam = getParam("freecam");
13
13
 
14
+ const disabledKeys = { LEFT: "", UP: "", RIGHT: "", BOTTOM: "" };
15
+ let defaultKeys: any = undefined;
16
+
14
17
  export class OrbitControls extends Behaviour {
15
18
  public get controls() {
16
19
  return this._controls;
@@ -73,6 +76,7 @@ export class OrbitControls extends Behaviour {
73
76
  if (cam)
74
77
  this._cameraObject = cam;
75
78
  this._controls = new ThreeOrbitControls(cam!, this.context.renderer.domElement);
79
+ if (defaultKeys === undefined) defaultKeys = { ...this._controls.keys };
76
80
  }
77
81
 
78
82
  if (this._controls) {
@@ -80,12 +84,11 @@ export class OrbitControls extends Behaviour {
80
84
  this.enablePan = true;
81
85
  this.enableZoom = true;
82
86
  this.middleClickToFocus = true;
83
- if(isMobileDevice()) this.doubleClickToFocus = true;
87
+ if (isMobileDevice()) this.doubleClickToFocus = true;
84
88
  }
85
89
 
86
90
  this._controls.enableDamping = this.enableDamping;
87
- //@ts-ignore (not in types)
88
- this._controls.enableKeys = this.enableKeys;
91
+ this._controls.keys = this.enableKeys ? defaultKeys : disabledKeys;
89
92
  this._controls.autoRotate = this.autoRotate;
90
93
  this._controls.autoRotateSpeed = this.autoRotateSpeed;
91
94
  this._controls.enableZoom = this.enableZoom;
@@ -164,6 +167,7 @@ export class OrbitControls extends Behaviour {
164
167
  this._inputs += 1;
165
168
  }
166
169
  if (this._inputs > 0) {
170
+ this.autoRotate = false;
167
171
  this._controls.autoRotate = false;
168
172
  this._lerpCameraToTarget = false;
169
173
  this._lerpToTargetPosition = false;
@@ -517,9 +517,9 @@ export class ShapeModule implements EmitterShape {
517
517
  private readonly _worldSpaceMatrixInverse: Matrix4 = new Matrix4();
518
518
 
519
519
 
520
- constructor() {
521
- // console.log(this);
522
- }
520
+ // constructor() {
521
+ // console.log(this);
522
+ // }
523
523
 
524
524
  update(system: IParticleSystem, _context: Context, simulationSpace: ParticleSystemSimulationSpace, obj: Object3D) {
525
525
  this.system = system;
@@ -534,6 +534,16 @@ export class ShapeModule implements EmitterShape {
534
534
  }
535
535
  }
536
536
 
537
+ private updateRotation() {
538
+ const isRotated = this.rotation.x !== 0 || this.rotation.y !== 0 || this.rotation.z !== 0;
539
+ if (isRotated) {
540
+ this._rotation.x = Mathf.toRadians(this.rotation.x);
541
+ this._rotation.y = -Mathf.toRadians(this.rotation.y);
542
+ this._rotation.z = -Mathf.toRadians(this.rotation.z);
543
+ }
544
+ return isRotated;
545
+ }
546
+
537
547
  /** nebula implementations: */
538
548
 
539
549
  /** initializer implementation */
@@ -544,61 +554,52 @@ export class ShapeModule implements EmitterShape {
544
554
  return this._vector;
545
555
  }
546
556
  getPosition(): void {
547
- if (!this.enabled) {
548
- this._vector.set(0, 0, 0);
549
- return;
550
- }
557
+ this._vector.set(0, 0, 0);
551
558
  const pos = this._temp.copy(this.position);
552
559
  const isWorldSpace = this._space === ParticleSystemSimulationSpace.World;
553
560
  if (isWorldSpace) {
554
561
  pos.applyQuaternion(this.system.worldQuaternion);
555
562
  }
556
-
557
- const isRotated = this.rotation.x !== 0 || this.rotation.y !== 0 || this.rotation.z !== 0;
558
- if (isRotated) {
559
- this._rotation.x = Mathf.toRadians(this.rotation.x);
560
- this._rotation.y = -Mathf.toRadians(this.rotation.y);
561
- this._rotation.z = -Mathf.toRadians(this.rotation.z);
562
- }
563
-
564
563
  let radius = this.radius;
565
564
  if (isWorldSpace) radius *= this.system.worldScale.x;
566
- switch (this.shapeType) {
567
- case ParticleSystemShapeType.Box:
568
- this._vector.x = Math.random() * this.scale.x - this.scale.x / 2;
569
- this._vector.y = Math.random() * this.scale.y - this.scale.y / 2;
570
- this._vector.z = Math.random() * this.scale.z - this.scale.z / 2;
571
- this._vector.add(pos);
572
- break;
573
- case ParticleSystemShapeType.Cone:
574
- this.randomConePoint(this.position, this.angle, radius, this.radiusThickness, this.arc, this.arcMode, this._vector);
575
- break;
576
- case ParticleSystemShapeType.Sphere:
577
- this.randomSpherePoint(this.position, radius, this.radiusThickness, this.arc, this._vector);
578
- this._vector.x *= this.scale.x;
579
- this._vector.y *= this.scale.y;
580
- this._vector.z *= this.scale.z;
581
- break;
582
- case ParticleSystemShapeType.Circle:
583
- this.randomSpherePoint(this.position, radius, this.radiusThickness, this.arc, this._vector);
584
- this._vector.x *= this.scale.x;
585
- this._vector.y *= this.scale.y;
586
- this._vector.z *= 0;
587
- break;
588
- default:
589
- this._vector.set(0, 0, 0);
590
- break;
591
- // case ParticleSystemShapeType.Hemisphere:
592
- // randomSpherePoint(this.position.x, this.position.y, this.position.z, this.radius, this.radiusThickness, 180, this._vector);
593
- // break;
594
- }
565
+ if (this.enabled) {
566
+ switch (this.shapeType) {
567
+ case ParticleSystemShapeType.Box:
568
+ this._vector.x = Math.random() * this.scale.x - this.scale.x / 2;
569
+ this._vector.y = Math.random() * this.scale.y - this.scale.y / 2;
570
+ this._vector.z = Math.random() * this.scale.z - this.scale.z / 2;
571
+ this._vector.add(pos);
572
+ break;
573
+ case ParticleSystemShapeType.Cone:
574
+ this.randomConePoint(this.position, this.angle, radius, this.radiusThickness, this.arc, this.arcMode, this._vector);
575
+ break;
576
+ case ParticleSystemShapeType.Sphere:
577
+ this.randomSpherePoint(this.position, radius, this.radiusThickness, this.arc, this._vector);
578
+ this._vector.x *= this.scale.x;
579
+ this._vector.y *= this.scale.y;
580
+ this._vector.z *= this.scale.z;
581
+ break;
582
+ case ParticleSystemShapeType.Circle:
583
+ this.randomSpherePoint(this.position, radius, this.radiusThickness, this.arc, this._vector);
584
+ this._vector.x *= this.scale.x;
585
+ this._vector.y *= this.scale.y;
586
+ this._vector.z *= 0;
587
+ break;
588
+ default:
589
+ this._vector.set(0, 0, 0);
590
+ break;
591
+ // case ParticleSystemShapeType.Hemisphere:
592
+ // randomSpherePoint(this.position.x, this.position.y, this.position.z, this.radius, this.radiusThickness, 180, this._vector);
593
+ // break;
594
+ }
595
595
 
596
- this.randomizePosition(this._vector, this.randomPositionAmount);
596
+ this.randomizePosition(this._vector, this.randomPositionAmount);
597
+ }
597
598
 
598
- if (isRotated)
599
+ if (this.updateRotation())
599
600
  this._vector.applyEuler(this._rotation);
600
601
 
601
- if (this._space === ParticleSystemSimulationSpace.World) {
602
+ if (isWorldSpace) {
602
603
  this._vector.add(this.system.worldPos);
603
604
  }
604
605
  }
@@ -634,6 +635,8 @@ export class ShapeModule implements EmitterShape {
634
635
  if (this._space === ParticleSystemSimulationSpace.World) {
635
636
  this._dir.applyMatrix4(this._worldSpaceMatrixInverse);
636
637
  }
638
+ if (this.updateRotation())
639
+ this._dir.applyEuler(this._rotation);
637
640
  this._dir.normalize();
638
641
  this.spherizeDirection(this._dir, this.sphericalDirectionAmount);
639
642
  this.randomizeDirection(this._dir, this.randomDirectionAmount);
@@ -7,7 +7,7 @@ import { getParam } from "../engine/engine_utils";
7
7
  import { serializable } from "../engine/engine_serialization_decorator";
8
8
  import { AxesHelper, Material, Mesh, Object3D, SkinnedMesh, Texture, Vector4 } from "three";
9
9
  import { NEEDLE_render_objects } from "../engine/extensions/NEEDLE_render_objects";
10
- import { NEEDLE_deferred_texture } from "../engine/extensions/NEEDLE_deferred_texture";
10
+ import { NEEDLE_progressive } from "../engine/extensions/NEEDLE_progressive";
11
11
  import { NEED_UPDATE_INSTANCE_KEY } from "../engine/engine_instancing";
12
12
  import { IRenderer, ISharedMaterials } from "../engine/engine_types";
13
13
  import { debug, ReflectionProbe } from "./ReflectionProbe";
@@ -463,14 +463,10 @@ export class Renderer extends Behaviour implements IRenderer {
463
463
  if (!suppressProgressiveLoading && material._didRequestTextureLOD === undefined && this.allowProgressiveLoading) {
464
464
  material._didRequestTextureLOD = 0;
465
465
  if (debugProgressiveLoading) {
466
- console.log("Load material LOD (with delay)", material.name);
467
- setTimeout(() => {
468
- NEEDLE_deferred_texture.assignTextureLOD(this.context, this.sourceId, material);
469
- }, 2000);
470
- }
471
- else {
472
- NEEDLE_deferred_texture.assignTextureLOD(this.context, this.sourceId, material);
466
+ console.log("Load material LOD", material.name);
473
467
  }
468
+ NEEDLE_progressive.assignTextureLOD(this.context, this.sourceId, material);
469
+
474
470
  }
475
471
 
476
472
  if (material.envMapIntensity !== undefined) {
@@ -549,10 +545,10 @@ export class Renderer extends Behaviour implements IRenderer {
549
545
  // update the reflection probe right before rendering
550
546
  // if we do it immediately the reflection probe might not be enabled yet
551
547
  // (since this method is called from onEnable)
552
- this.startCoroutine(this._updateReflectionProbe(), FrameEvent.OnBeforeRender);
548
+ this.startCoroutine(this._updateReflectionProbe(), FrameEvent.LateUpdate);
553
549
  }
554
550
  }
555
- private *_updateReflectionProbe(){
551
+ private *_updateReflectionProbe() {
556
552
  const obj = this.probeAnchor || this.gameObject;
557
553
  const isAnchor = this.probeAnchor ? true : false;
558
554
  this._reflectionProbe = ReflectionProbe.get(obj, this.context, isAnchor);
@@ -307,6 +307,11 @@ export class Voip extends Behaviour {
307
307
  return;
308
308
  }
309
309
 
310
+ if (utils.isiOS() && utils.isSafari()) {
311
+ console.log("VOIP is currently not supported on Safari iOS")
312
+ return;
313
+ }
314
+
310
315
  this.peer = new Peer();
311
316
  navigator["getUserMedia"] = (navigator["getUserMedia"] || navigator["webkitGetUserMedia"] || navigator["mozGetUserMedia"] || navigator["msGetUserMedia"]);
312
317
 
@@ -360,10 +365,15 @@ export class Voip extends Behaviour {
360
365
  onDisable(): void {
361
366
  console.log("TODO: close all");
362
367
  for (const key in this.currentIncomingCalls) {
363
- const call = this.currentIncomingCalls[key];
364
- call?.close();
365
- const con = this.connections[key];
366
- con?.close();
368
+ try {
369
+ const call = this.currentIncomingCalls[key];
370
+ call?.close();
371
+ const con = this.connections[key];
372
+ con?.close();
373
+ }
374
+ catch (err) {
375
+ console.error(err);
376
+ }
367
377
  }
368
378
  }
369
379
 
@@ -93,7 +93,14 @@ export class VolumeProfile {
93
93
  // three.js range goes from 0..inf
94
94
  if (debug)
95
95
  console.log(colorAdjustments.postExposure);
96
- const exposure = Math.pow(2, colorAdjustments.postExposure?.value ?? 0);
96
+ let exposure = 1;
97
+ // convert to linear
98
+ if (colorAdjustments.postExposure)
99
+ exposure = Math.pow(2, colorAdjustments.postExposure.value);
100
+ // ACES applies a factor of roughly 1.666 ( /= .6 )
101
+ if (context.renderer.toneMapping === ACESFilmicToneMapping) {
102
+ // exposure /= Math.PI / 2;
103
+ }
97
104
  const useExposure = colorAdjustments.postExposure?.overrideState && !remove;
98
105
  context.renderer.toneMappingExposure = useExposure ? exposure : 1;
99
106
  if (!context.renderer.toneMapping)
@@ -86,7 +86,7 @@ export class WebXR extends Behaviour {
86
86
  return listener;
87
87
  }
88
88
 
89
- public static createVRButton(webXR: WebXR, opts?: CreateButtonOptions): HTMLButtonElement {
89
+ public static createVRButton(webXR: WebXR, opts?: CreateButtonOptions): HTMLButtonElement | HTMLAnchorElement {
90
90
  if (!WebXR.XRSupported) {
91
91
  console.warn("WebXR is not supported on this device");
92
92
  }
@@ -102,7 +102,7 @@ export class WebXR extends Behaviour {
102
102
  return vrButton;
103
103
  }
104
104
 
105
- public static createARButton(webXR: WebXR, opts?: CreateButtonOptions): HTMLButtonElement {
105
+ public static createARButton(webXR: WebXR, opts?: CreateButtonOptions): HTMLButtonElement | HTMLAnchorElement {
106
106
  webXR.__internalAwake();
107
107
  const domOverlayRoot = webXR.webAR?.getAROverlayContainer();
108
108
  const features: any = {};