@needle-tools/engine 3.32.18-alpha.1 → 3.32.20-alpha

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 (36) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/needle-engine.js +1692 -1687
  3. package/dist/needle-engine.light.js +1626 -1621
  4. package/dist/needle-engine.light.min.js +88 -86
  5. package/dist/needle-engine.light.umd.cjs +101 -99
  6. package/dist/needle-engine.min.js +87 -85
  7. package/dist/needle-engine.umd.cjs +98 -96
  8. package/lib/engine/engine_components.d.ts +3 -3
  9. package/lib/engine/engine_components.js +17 -8
  10. package/lib/engine/engine_components.js.map +1 -1
  11. package/lib/engine/engine_context.d.ts +2 -1
  12. package/lib/engine/engine_context.js +4 -3
  13. package/lib/engine/engine_context.js.map +1 -1
  14. package/lib/engine/engine_input.js +11 -11
  15. package/lib/engine/engine_input.js.map +1 -1
  16. package/lib/engine/engine_scenelighting.js +2 -0
  17. package/lib/engine/engine_scenelighting.js.map +1 -1
  18. package/lib/engine/xr/NeedleXRSession.d.ts +1 -0
  19. package/lib/engine/xr/NeedleXRSession.js +3 -3
  20. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  21. package/lib/engine-components/Camera.d.ts +1 -0
  22. package/lib/engine-components/Camera.js +8 -2
  23. package/lib/engine-components/Camera.js.map +1 -1
  24. package/lib/engine-components/ui/CanvasGroup.js +1 -0
  25. package/lib/engine-components/ui/CanvasGroup.js.map +1 -1
  26. package/lib/engine-components/webxr/WebXRButtons.js +2 -2
  27. package/lib/engine-components/webxr/WebXRButtons.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/engine/engine_components.ts +16 -8
  30. package/src/engine/engine_context.ts +4 -3
  31. package/src/engine/engine_input.ts +12 -11
  32. package/src/engine/engine_scenelighting.ts +1 -0
  33. package/src/engine/xr/NeedleXRSession.ts +3 -2
  34. package/src/engine-components/Camera.ts +6 -2
  35. package/src/engine-components/ui/CanvasGroup.ts +1 -0
  36. package/src/engine-components/webxr/WebXRButtons.ts +2 -2
@@ -118,6 +118,7 @@ export class Camera extends Behaviour implements ICamera {
118
118
  this.cullingMask = (1 << val | 0) >>> 0;
119
119
  }
120
120
 
121
+ /** Modify the background blurriness */
121
122
  @serializable()
122
123
  public set backgroundBlurriness(val: number | undefined) {
123
124
  if (val === this._backgroundBlurriness) return;
@@ -130,7 +131,7 @@ export class Camera extends Behaviour implements ICamera {
130
131
  public get backgroundBlurriness(): number | undefined {
131
132
  return this._backgroundBlurriness;
132
133
  }
133
- private _backgroundBlurriness?: number;
134
+ private _backgroundBlurriness?: number = 0;
134
135
 
135
136
  @serializable()
136
137
  public set backgroundIntensity(val: number | undefined) {
@@ -144,7 +145,7 @@ export class Camera extends Behaviour implements ICamera {
144
145
  public get backgroundIntensity(): number | undefined {
145
146
  return this._backgroundIntensity;
146
147
  }
147
- private _backgroundIntensity?: number;
148
+ private _backgroundIntensity?: number = 1;
148
149
 
149
150
  @serializable()
150
151
  public set environmentIntensity(val: number | undefined) {
@@ -347,10 +348,13 @@ export class Camera extends Behaviour implements ICamera {
347
348
  }
348
349
  this.enableSkybox();
349
350
 
351
+ // set background blurriness and intensity
350
352
  if (this._backgroundBlurriness !== undefined)
351
353
  this.context.scene.backgroundBlurriness = this._backgroundBlurriness;
354
+ else if (debug) console.warn(`Camera \"${this.name}\" has no background blurriness`)
352
355
  if (this._backgroundIntensity !== undefined)
353
356
  this.context.scene.backgroundIntensity = this._backgroundIntensity;
357
+ else if (debug) console.warn(`Camera \"${this.name}\" has no background intensity`)
354
358
 
355
359
  break;
356
360
  case ClearFlags.SolidColor:
@@ -41,6 +41,7 @@ export class CanvasGroup extends Behaviour implements ICanvasGroup {
41
41
 
42
42
  private _buffer: Graphic[] = [];
43
43
  private applyChangesNow() {
44
+ this._buffer.length = 0;
44
45
  for (const ch of GameObject.getComponentsInChildren(this.gameObject, BaseUIComponent, this._buffer)) {
45
46
  const hasAlphaFactor = ch as any as IHasAlphaFactor;
46
47
  if (hasAlphaFactor.setAlphaFactor)
@@ -297,11 +297,11 @@ export class NeedleWebXRHtmlElement extends HTMLElement {
297
297
  }
298
298
 
299
299
  private updateSessionSupported(button: HTMLButtonElement, mode: XRSessionMode) {
300
- if (!navigator.xr) {
300
+ if (!("xr" in navigator)) {
301
301
  button.style.display = "none";
302
302
  return;
303
303
  }
304
- navigator.xr.isSessionSupported(mode).then(supported => {
304
+ NeedleXRSession.isSessionSupported(mode).then(supported => {
305
305
  button.style.display = !supported ? "none" : "";
306
306
  if (isDevEnvironment() && !supported) console.warn(mode + " is not supported on this device - make sure your server runs using HTTPS and you have a device connected that supports " + mode);
307
307
  });