@needle-tools/engine 5.1.0-beta.1 → 5.1.0-beta.2

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 (65) hide show
  1. package/components.needle.json +1 -1
  2. package/dist/{materialx-jkHmVPez.js → materialx-BCzyAHFr.js} +1 -1
  3. package/dist/{materialx-B47Bz-xs.umd.cjs → materialx-BdEC3ugB.umd.cjs} +1 -1
  4. package/dist/{materialx-B85WjP7E.min.js → materialx-DnlAB5wd.min.js} +1 -1
  5. package/dist/{needle-engine.bundle-CWiO9cA8.umd.cjs → needle-engine.bundle-BcPtAnC9.umd.cjs} +98 -98
  6. package/dist/{needle-engine.bundle-DxJaiP7e.min.js → needle-engine.bundle-D0UTRn3W.min.js} +112 -112
  7. package/dist/{needle-engine.bundle-CFo3xWPu.js → needle-engine.bundle-H5HXbUCS.js} +2604 -2607
  8. package/dist/needle-engine.d.ts +8 -8
  9. package/dist/needle-engine.js +87 -87
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/dist/{vendor-1UvpPPSB.umd.cjs → vendor-CsClD1Nd.umd.cjs} +1 -1
  13. package/dist/{vendor-BQ2Vuntm.min.js → vendor-DQu6PDTB.min.js} +19 -19
  14. package/dist/{vendor-BslSKZPo.js → vendor-J7NvM88N.js} +342 -342
  15. package/lib/engine/api.d.ts +1 -1
  16. package/lib/engine/api.js +1 -1
  17. package/lib/engine/api.js.map +1 -1
  18. package/lib/engine/engine_init.js +2 -2
  19. package/lib/engine/engine_init.js.map +1 -1
  20. package/lib/engine/engine_license.d.ts +7 -7
  21. package/lib/engine/engine_license.js +72 -72
  22. package/lib/engine/engine_license.js.map +1 -1
  23. package/lib/engine/engine_networking_blob.js +3 -3
  24. package/lib/engine/engine_networking_blob.js.map +1 -1
  25. package/lib/engine/engine_utils_qrcode.js +2 -2
  26. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  27. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  28. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  29. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +2 -2
  30. package/lib/engine/webcomponents/needle menu/needle-menu.js +9 -9
  31. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  32. package/lib/engine/webcomponents/needle-engine.js +2 -2
  33. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  34. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  35. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  36. package/lib/engine/xr/TempXRContext.js +2 -2
  37. package/lib/engine/xr/TempXRContext.js.map +1 -1
  38. package/lib/engine-components/NeedleMenu.d.ts +1 -1
  39. package/lib/engine-components/NeedleMenu.js +1 -1
  40. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  41. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +9 -5
  42. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  43. package/lib/engine-components/particlesystem/ParticleSystem.js +4 -0
  44. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  45. package/lib/engine-components/webxr/WebXRImageTracking.js +3 -0
  46. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  47. package/package.json +2 -2
  48. package/plugins/common/license.js +4 -4
  49. package/plugins/vite/build-pipeline.js +33 -2
  50. package/plugins/vite/license.js +4 -4
  51. package/src/engine/api.ts +1 -1
  52. package/src/engine/engine_init.ts +2 -2
  53. package/src/engine/engine_license.ts +69 -69
  54. package/src/engine/engine_networking_blob.ts +3 -3
  55. package/src/engine/engine_utils_qrcode.ts +2 -2
  56. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  57. package/src/engine/webcomponents/needle menu/needle-menu.ts +10 -10
  58. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  59. package/src/engine/webcomponents/needle-engine.ts +2 -2
  60. package/src/engine/xr/TempXRContext.ts +2 -2
  61. package/src/engine-components/NeedleMenu.ts +2 -2
  62. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  63. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +12 -5
  64. package/src/engine-components/particlesystem/ParticleSystem.ts +4 -0
  65. package/src/engine-components/webxr/WebXRImageTracking.ts +1 -0
@@ -4,7 +4,7 @@ import { Quaternion, Vector2, Vector3, Vector4 } from "three";
4
4
 
5
5
  import { needleLogoOnlySVG } from "./assets/index.js";
6
6
  import { isDevEnvironment } from "./debug/debug.js";
7
- import { __Aale } from "./engine_license.js";
7
+ import { $cgOiWi } from "./engine_license.js";
8
8
  import { InternalAttributeUtils } from "./engine_utils_attributes.js";
9
9
  import type { NeedleEngineWebComponent } from "./webcomponents/needle-engine.js";
10
10
 
@@ -135,7 +135,7 @@ async function internalRenderQRCodeOverlays(canvas: HTMLCanvasElement, args: { s
135
135
  console.debug("[QR Code] No web component found")
136
136
  }
137
137
 
138
- const canUseCustomLogo = __Aale();
138
+ const canUseCustomLogo = $cgOiWi();
139
139
 
140
140
  // Query logo src from needle-engine attribute.
141
141
  // For any supported attribute it's possible to use "falsey" values (e.g. "0" or "false" to disable the logo in the QR code)
@@ -2,7 +2,7 @@ import { Mesh, Object3D, TextureLoader, Vector4 } from "three";
2
2
  import ThreeMeshUI from "three-mesh-ui";
3
3
 
4
4
  import { addNewComponent } from "../../engine_components.js";
5
- import { $KhjWEFh } from "../../engine_license.js";
5
+ import { $cgOiWi } from "../../engine_license.js";
6
6
  import { OneEuroFilterXYZ } from "../../engine_math.js";
7
7
  import type { Context } from "../../engine_setup.js";
8
8
  import { lookAtObject } from "../../engine_three_utils.js";
@@ -321,7 +321,7 @@ export class NeedleSpatialMenu {
321
321
  }
322
322
  if (this.menu) {
323
323
  const index = this.menu.children.indexOf(this._poweredByNeedleElement as any);
324
- if (!this._showNeedleLogo && $KhjWEFh()) {
324
+ if (!this._showNeedleLogo && $cgOiWi()) {
325
325
  if (index >= 0) {
326
326
  this._poweredByNeedleElement.removeFromParent();
327
327
  this.markDirty();
@@ -1,6 +1,6 @@
1
1
  import { showBalloonMessage } from "../../debug/debug.js";
2
2
  import type { Context } from "../../engine_context.js";
3
- import { __Aale, ytUNHgWl, Telemetry } from "../../engine_license.js";
3
+ import { $cgOiWi, $ziNBzS, Telemetry } from "../../engine_license.js";
4
4
  import { isLocalNetwork } from "../../engine_networking_utils.js";
5
5
  import { HTMLElementBase } from "../../engine_ssr.js";
6
6
  import { DeviceUtilities, getParam } from "../../engine_utils.js";
@@ -208,14 +208,14 @@ export class NeedleMenu {
208
208
  }
209
209
 
210
210
  /**
211
- * Call to show or hide the menu.
212
- * NOTE: Hiding the menu is a PRO feature and requires a needle engine license. Hiding the menu will not work in production without a license.
211
+ * Call to show or hide the menu.
212
+ * NOTE: Hiding the menu requires a commercial license. Hiding the menu will not work in production without a license.
213
213
  */
214
214
  setVisible(visible: boolean) {
215
215
  this._menu.setVisible(visible);
216
216
  }
217
217
 
218
- /** When set to false, the Needle Engine logo will be hidden. Hiding the logo requires a needle engine license */
218
+ /** When set to false, the Needle Engine logo will be hidden. Hiding the logo requires a commercial license */
219
219
  showNeedleLogo(visible: boolean) {
220
220
  this._menu.showNeedleLogo(visible);
221
221
  this._spatialMenu?.showNeedleLogo(visible);
@@ -778,8 +778,8 @@ export class NeedleMenuElement extends HTMLElementBase {
778
778
  try {
779
779
  // if the user has a license then we CAN hide the needle logo
780
780
  // calling this method immediately will cause an issue with vite bundling tho
781
- window.requestAnimationFrame(() => ytUNHgWl(res => {
782
- if (res == true && __Aale() && !debugNonCommercial) {
781
+ window.requestAnimationFrame(() => $ziNBzS(res => {
782
+ if (res == true && $cgOiWi() && !debugNonCommercial) {
783
783
  let visible = this._userRequestedLogoVisible;
784
784
  if (visible === undefined) visible = false;
785
785
  this.___onSetLogoVisible(visible);
@@ -830,7 +830,7 @@ export class NeedleMenuElement extends HTMLElementBase {
830
830
  // ensure the menu is not hidden or removed
831
831
  const requiredParent = this?.parentNode;
832
832
  if (this.style.display != "flex" || this.style.visibility != "visible" || this.style.opacity != "1" || requiredParent != this._domElement?.shadowRoot) {
833
- if (!__Aale()) {
833
+ if (!$cgOiWi()) {
834
834
  const change = changeEventCounter++;
835
835
  // if a user doesn't have a local pro license *but* for development the menu is hidden then we show a warning
836
836
  if (isLocalNetwork() && this._userRequestedMenuVisible === false) {
@@ -841,7 +841,7 @@ export class NeedleMenuElement extends HTMLElementBase {
841
841
  }
842
842
  // warn only once
843
843
  if (change === 1) {
844
- console.warn(`Needle Menu Warning: You need a PRO license to hide the Needle Engine menu → The menu will be visible in your deployed website if you don't have a PRO license. See https://needle.tools/pricing for details.`);
844
+ console.warn(`Needle Menu Warning: You need a commercial license to hide the Needle Engine menu → The menu will be visible in your deployed website without one. See https://needle.tools/pricing for details.`);
845
845
  }
846
846
  }
847
847
  else {
@@ -918,8 +918,8 @@ export class NeedleMenuElement extends HTMLElementBase {
918
918
  showNeedleLogo(visible: boolean) {
919
919
  this._userRequestedLogoVisible = visible;
920
920
  if (!visible) {
921
- if (!__Aale() || debugNonCommercial) {
922
- console.warn("[Needle Engine] You need a PRO license to hide the Needle Engine logo in production.");
921
+ if (!$cgOiWi() || debugNonCommercial) {
922
+ console.warn("[Needle Engine] You need a commercial license to hide the Needle Engine logo in production.");
923
923
  const localNetwork = isLocalNetwork()
924
924
  if (!localNetwork) return;
925
925
  }
@@ -1,6 +1,6 @@
1
1
  import { needleLogoOnlySVG } from "../assets/index.js"
2
2
  import { isDevEnvironment, showBalloonWarning } from "../debug/index.js";
3
- import { __Aale, $KhjWEFh, _AaROCyv } from "../engine_license.js";
3
+ import { $cgOiWi, _$jDMeEQ, __EJdGb } from "../engine_license.js";
4
4
  import { Mathf } from "../engine_math.js";
5
5
  import { LoadingProgressArgs } from "../engine_setup.js";
6
6
  import { getParam } from "../engine_utils.js";
@@ -205,7 +205,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
205
205
  }
206
206
 
207
207
 
208
- const hasLicense = $KhjWEFh();
208
+ const hasLicense = _$jDMeEQ();
209
209
  if (!existing) {
210
210
  this._loadingElement.style.position = "absolute";
211
211
  this._loadingElement.style.width = "100%";
@@ -373,7 +373,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
373
373
 
374
374
  // private async handleRuntimeLicense(loadingElement: HTMLElement) {
375
375
  // // First check if we have a commercial license
376
- // let commercialLicense = __Aale();
376
+ // let commercialLicense = $cgOiWi();
377
377
  // // if it's the case then we don't need to perform a runtime check
378
378
  // if (commercialLicense) return;
379
379
 
@@ -393,10 +393,10 @@ export class EngineLoadingView implements ILoadingViewHandler {
393
393
  // loadingElement.appendChild(nonCommercialContainer);
394
394
 
395
395
  // // Use the runtime license check
396
- // if (!isDevEnvironment() && _AaROCyv) {
396
+ // if (!isDevEnvironment() && __EJdGb) {
397
397
  // if (debugLicense) console.log("Waiting for runtime license check");
398
- // await _AaROCyv;
399
- // commercialLicense = __Aale();
398
+ // await __EJdGb;
399
+ // commercialLicense = $cgOiWi();
400
400
  // }
401
401
  // if (commercialLicense) return;
402
402
  // nonCommercialContainer.style.transition = "opacity .5s ease-in-out";
@@ -3,7 +3,7 @@ import type { Texture } from "three";
3
3
  import { isDevEnvironment, showBalloonWarning } from "../debug/index.js";
4
4
  import { PUBLIC_KEY, VERSION } from "../engine_constants.js";
5
5
  import { ContextEvent, ContextRegistry } from "../engine_context_registry.js";
6
- import { __Aale } from "../engine_license.js";
6
+ import { $cgOiWi } from "../engine_license.js";
7
7
  import { onStart } from "../engine_lifecycle_api.js";
8
8
  import { setDracoDecoderPath, setDracoDecoderType, setKtx2TranscoderPath } from "../engine_loaders.gltf.js";
9
9
  import { Context, ContextCreateArgs } from "../engine_setup.js";
@@ -579,7 +579,7 @@ export class NeedleEngineWebComponent extends HTMLElementBase implements INeedle
579
579
 
580
580
 
581
581
  // Loading start events
582
- const allowOverridingDefaultLoading = __Aale();
582
+ const allowOverridingDefaultLoading = $cgOiWi();
583
583
  // default loading can be overriden by calling preventDefault in the onload start event
584
584
  this.ensureLoadStartIsRegistered();
585
585
  let useDefaultLoading = this.dispatchEvent(new CustomEvent("loadstart", {
@@ -3,7 +3,7 @@ import { ArrayCamera, AxesHelper, Camera, Color, DirectionalLight, Fog, GridHelp
3
3
  import { needleLogoOnlySVG } from "../assets/index.js";
4
4
  import { isDevEnvironment } from "../debug/index.js";
5
5
  import { ObjectUtils, PrimitiveType } from "../engine_create_objects.js";
6
- import { __Aale } from "../engine_license.js";
6
+ import { $cgOiWi } from "../engine_license.js";
7
7
  import { Mathf } from "../engine_math.js";
8
8
  import { delay, DeviceUtilities } from "../engine_utils.js";
9
9
 
@@ -215,7 +215,7 @@ export class TemporaryXRContext {
215
215
  this._scene.background = new Color(0x000000);
216
216
 
217
217
  let logoSrc = needleLogoOnlySVG;
218
- if (__Aale()) {
218
+ if ($cgOiWi()) {
219
219
  const htmlComponent = document.querySelector("needle-engine");
220
220
  if (htmlComponent) {
221
221
  const licenseLogo = htmlComponent.getAttribute("logo-src");
@@ -49,8 +49,8 @@ export class NeedleMenu extends Behaviour {
49
49
  @serializable()
50
50
  position: "top" | "bottom" = "bottom";
51
51
 
52
- /**
53
- * Controls the visibility of the Needle logo in the menu (requires PRO license)
52
+ /**
53
+ * Controls the visibility of the Needle logo in the menu (requires a commercial license)
54
54
  */
55
55
  @serializable()
56
56
  showNeedleLogo: boolean = false;
@@ -3,7 +3,7 @@ import { Euler, Material, Matrix4, Mesh, Object3D, Quaternion, Vector3 } from "t
3
3
 
4
4
  import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../../../engine/debug/index.js";
5
5
  import { findObjectOfType } from "../../../engine/engine_components.js";
6
- import { $KhjWEFh } from "../../../engine/engine_license.js";
6
+ import { _$jDMeEQ } from "../../../engine/engine_license.js";
7
7
  import { serializable } from "../../../engine/engine_serialization.js";
8
8
  import { getFormattedDate, Progress } from "../../../engine/engine_time_utils.js";
9
9
  import { DeviceUtilities, getParam } from "../../../engine/engine_utils.js";
@@ -277,7 +277,7 @@ export class USDZExporter extends Behaviour {
277
277
  let name = this.exportFileName ?? this.objectToExport?.name ?? this.name;
278
278
  name += "-" + getFormattedDate(); // seems iOS caches the file in some cases, this ensures we always have a fresh file
279
279
 
280
- if (!$KhjWEFh()) {
280
+ if (!_$jDMeEQ()) {
281
281
  if (name !== "") name += "-";
282
282
  name += "MadeWithNeedle";
283
283
  }
@@ -682,7 +682,7 @@ export class USDZExporter extends Behaviour {
682
682
  if (debug)
683
683
  showBalloonMessage("Quicklook url: " + callToActionURL);
684
684
  if (callToActionURL) {
685
- if (!$KhjWEFh()) {
685
+ if (!_$jDMeEQ()) {
686
686
  console.warn("Quicklook closed: custom redirects require a Needle Engine Pro license: https://needle.tools/pricing", callToActionURL)
687
687
  }
688
688
  else {
@@ -697,7 +697,7 @@ export class USDZExporter extends Behaviour {
697
697
  private buildQuicklookOverlay(): CustomBranding {
698
698
  const obj: CustomBranding = {};
699
699
  if (this.customBranding) Object.assign(obj, this.customBranding);
700
- if (!$KhjWEFh()) {
700
+ if (!_$jDMeEQ()) {
701
701
  console.log("Custom Quicklook banner text requires pro license: https://needle.tools/pricing");
702
702
  obj.callToAction = "Close";
703
703
  obj.checkoutTitle = "🌵 Made with Needle";
@@ -11,6 +11,7 @@ import { Animation } from "../../../../Animation.js";
11
11
  import { Animator } from "../../../../Animator.js";
12
12
  import { AudioSource } from "../../../../AudioSource.js";
13
13
  import { Behaviour, GameObject } from "../../../../Component.js";
14
+ import type { ComponentInit } from "../../../../../engine/engine_types.js";
14
15
  import { Rigidbody } from "../../../../RigidBody.js";
15
16
  import type { IPointerClickHandler, PointerEventData } from "../../../../ui/PointerEvents.js";
16
17
  import { makeNameSafeForUSD, USDDocument, USDObject, USDZExporterContext } from "../../ThreeUSDZExporter.js";
@@ -811,13 +812,16 @@ export class PlayAudioOnClick extends Behaviour implements IPointerClickHandler,
811
812
 
812
813
  ensureAudioSource() {
813
814
  if (!this.target) {
814
- const newAudioSource = this.gameObject.addComponent(AudioSource);
815
+ const initializeAudioSource: ComponentInit<AudioSource> = {
816
+ spatialBlend: 1,
817
+ volume: 1,
818
+ loop: false,
819
+ clip: this.clip,
820
+ preload: true,
821
+ };
822
+ const newAudioSource = this.gameObject.addComponent(AudioSource, initializeAudioSource);
815
823
  if (newAudioSource) {
816
824
  this.target = newAudioSource;
817
- newAudioSource.spatialBlend = 1;
818
- newAudioSource.volume = 1;
819
- newAudioSource.loop = false;
820
- newAudioSource.preload = true;
821
825
  }
822
826
  }
823
827
  }
@@ -828,6 +832,9 @@ export class PlayAudioOnClick extends Behaviour implements IPointerClickHandler,
828
832
  label: "Play audio: " + (this.clip || this.target?.clip || "unknown clip"),
829
833
  hidden: false,
830
834
  })
835
+
836
+ this.ensureAudioSource();
837
+
831
838
  }
832
839
  onDisable(): void {
833
840
  this.context.accessibility.updateElement(this, {
@@ -593,6 +593,10 @@ class ColorBehaviour extends ParticleSystemBaseBehaviour {
593
593
  col.copy(this.system.main.startColor.evaluate(Math.random()));
594
594
  if (materialColor?.color) {
595
595
  tempColor.copy(materialColor.color);
596
+ // THREE.Color has no alpha — the material's color alpha is stored in
597
+ // material.opacity. Without this, a particle material's alpha/opacity
598
+ // was ignored (reported externally). multiply() propagates alpha.
599
+ tempColor.alpha = materialColor.opacity ?? 1;
596
600
  col.multiply(tempColor)
597
601
  }
598
602
  col.convertLinearToSRGB();
@@ -567,6 +567,7 @@ export class WebXRImageTracking extends Behaviour {
567
567
  * });
568
568
  * ```
569
569
  */
570
+ @serializable(EventList)
570
571
  imageTracked: EventList<WebXRImageTrackingEvent> = new EventList();
571
572
 
572
573
  /** @inheritdoc */