@needle-tools/engine 3.16.2 → 3.16.3

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.16.3] - 2023-09-15
8
+ - Add: logo now respects prefer-reduced-motion, reduce and is immediately added instead of after 1s
9
+ - Fix: use default background color if GLB without camera and skybox is loaded
10
+ - Fix: ensure custom KTX2 loader is correctly initialized
11
+ - Fix: revert RectTransform change that broke hotspot rendering
12
+ - Change: adjust default backgroundBlurriness to match Blender defaults
13
+
7
14
  ## [3.16.2] - 2023-09-15
8
15
  - Add: mesh collider handling for invalid mesh data (non-indexed geometry)
9
16
 
@@ -41819,35 +41819,37 @@ async function N5(i) {
41819
41819
  }
41820
41820
  is && cS(i);
41821
41821
  }
41822
- const IT = "needle-license-element", gG = 1e4, IG = 200;
41822
+ const IT = "needle-license-element", gG = 1e4, IG = 1200;
41823
41823
  async function cS(i) {
41824
41824
  await (jn == null ? void 0 : jn.catch(() => {
41825
41825
  })), !mQ() && (K5(), i.domElement.addEventListener("ready", () => {
41826
- setTimeout(() => {
41827
- oT(i);
41828
- }, 1e3);
41826
+ oT(i);
41829
41827
  }));
41830
41828
  }
41831
41829
  function oT(i) {
41832
- const A = J5(), e = q5(), t = setInterval(() => {
41830
+ const A = J5(), e = q5(), t = () => {
41833
41831
  if (!A)
41834
41832
  return;
41835
- const s = i.domElement.shadowRoot || i.domElement;
41836
- A.parentNode !== s && (s.appendChild(A), e && s.appendChild(e));
41837
- }, 100), g = `<img class="logo" src="${iT}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`, I = document.createElement("div");
41838
- I.innerHTML = g, I.classList.add("logo"), A.appendChild(I);
41839
- const o = document.createElement("div");
41840
- if (o.classList.add("text"), A.appendChild(o), A.title = "Needle Engine", mQ() || (A.title += " No active license found - Non Commercial Use"), A.addEventListener("click", () => {
41833
+ const C = i.domElement.shadowRoot || i.domElement;
41834
+ A.parentNode !== C && (C.appendChild(A), e && C.appendChild(e));
41835
+ };
41836
+ t();
41837
+ const g = setInterval(() => {
41838
+ t();
41839
+ }, 1e3), I = `<img class="logo" src="${iT}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`, o = document.createElement("div");
41840
+ o.innerHTML = I, o.classList.add("logo"), A.appendChild(o);
41841
+ const s = document.createElement("div");
41842
+ if (s.classList.add("text"), A.appendChild(s), A.title = "Needle Engine", mQ() || (A.title += " No active license found - Non Commercial Use"), A.addEventListener("click", () => {
41841
41843
  globalThis.open("https://needle.tools", "_blank");
41842
41844
  }), gT()) {
41843
- const s = gG + IG;
41845
+ const C = gG + IG;
41844
41846
  setTimeout(() => {
41845
- clearInterval(t), A == null || A.remove(), e == null || e.remove();
41846
- const C = 5;
41847
+ clearInterval(g), A == null || A.remove(), e == null || e.remove();
41848
+ const n = 5;
41847
41849
  setTimeout(() => {
41848
41850
  i.domElement.parentNode && oT(i);
41849
- }, 1e3 * 60 * C);
41850
- }, s);
41851
+ }, 1e3 * 60 * n);
41852
+ }, C);
41851
41853
  }
41852
41854
  }
41853
41855
  let TK = 0;
@@ -41985,6 +41987,24 @@ function q5() {
41985
41987
  transform: scale(1.02) !important;
41986
41988
  cursor: pointer !important;
41987
41989
  }
41990
+
41991
+ @media (prefers-reduced-motion: reduce) {
41992
+ ${A} .text {
41993
+ animation: none !important;
41994
+ transition: none !important;
41995
+ /* animation end state */
41996
+ opacity: 1;
41997
+ }
41998
+
41999
+ ${A} .logo {
42000
+ animation: none !important;
42001
+ transition: none !important;
42002
+ /* animation end state */
42003
+ opacity: 1;
42004
+ pointer-events: all;
42005
+ transform: scale(1)
42006
+ }
42007
+ }
41988
42008
  `, i;
41989
42009
  }
41990
42010
  async function v5() {
@@ -42973,7 +42993,7 @@ function ZK(i) {
42973
42993
  i !== void 0 && typeof i == "string" && (vn || (vn = new gs()), CQ && console.log("Setting ktx2 transcoder path to", i), vn.setTranscoderPath(i));
42974
42994
  }
42975
42995
  function dl(i, A) {
42976
- es || (es = new yM(), es.setDecoderPath(WK), es.setDecoderConfig({ type: "js" }), CQ && console.log("Setting draco decoder path to", WK)), vn || (vn = new gs(), vn.setTranscoderPath(VK), CQ && console.log("Setting ktx2 transcoder path to", VK), A.renderer && vn.detectSupport(A.renderer)), wS || (wS = j5, CQ && console.log("Using the default meshopt decoder")), i.setDRACOLoader(es), i.setKTX2Loader(vn), i.setMeshoptDecoder(wS);
42996
+ es || (es = new yM(), es.setDecoderPath(WK), es.setDecoderConfig({ type: "js" }), CQ && console.log("Setting draco decoder path to", WK)), vn || (vn = new gs(), vn.setTranscoderPath(VK), CQ && console.log("Setting ktx2 transcoder path to", VK)), wS || (wS = j5, CQ && console.log("Using the default meshopt decoder")), A.renderer ? vn.detectSupport(A.renderer) : console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"), i.setDRACOLoader(es), i.setKTX2Loader(vn), i.setMeshoptDecoder(wS);
42977
42997
  }
42978
42998
  function Z5(i, A = 1e-4) {
42979
42999
  A = Math.max(A, Number.EPSILON);
@@ -64549,7 +64569,7 @@ class wH {
64549
64569
  }
64550
64570
  const Po = new y(), jE = new NA(), cu = new mA(), yH = class extends Os {
64551
64571
  constructor() {
64552
- super();
64572
+ super(...arguments);
64553
64573
  r(this, "_anchoredPosition");
64554
64574
  r(this, "sizeDelta", new tA(100, 100));
64555
64575
  r(this, "pivot", new tA(0.5, 0.5));
@@ -64571,7 +64591,6 @@ const Po = new y(), jE = new NA(), cu = new mA(), yH = class extends Os {
64571
64591
  r(this, "_lastAnchoring");
64572
64592
  r(this, "_createdBlocks", []);
64573
64593
  r(this, "_createdTextBlocks", []);
64574
- this.lastMatrix = new NA(), this.rectBlock = new FA();
64575
64594
  }
64576
64595
  get parent() {
64577
64596
  return this._parentRectTransform;
@@ -64614,7 +64633,7 @@ const Po = new y(), jE = new NA(), cu = new mA(), yH = class extends Os {
64614
64633
  return this.sizeDelta.y;
64615
64634
  }
64616
64635
  awake() {
64617
- super.awake(), this._anchoredPosition || (this._anchoredPosition = new tA()), this.rectBlock.name = this.name, this._initialPosition = this.gameObject.position.clone(), this._initialPosition.z = 0, _B(this, "_anchoredPosition", () => {
64636
+ super.awake(), this._anchoredPosition || (this._anchoredPosition = new tA()), this.lastMatrix = new NA(), this.rectBlock = new FA(), this.rectBlock.name = this.name, this._initialPosition = this.gameObject.position.clone(), this._initialPosition.z = 0, _B(this, "_anchoredPosition", () => {
64618
64637
  this.markDirty();
64619
64638
  }), _B(this, "sizeDelta", () => {
64620
64639
  this.markDirty();
@@ -88977,7 +88996,7 @@ _t.registerCallback(Zg.MissingCamera, (i) => {
88977
88996
  const A = i.context.scene, e = new FA();
88978
88997
  e.name = "Default Fallback Camera", A.add(e);
88979
88998
  const t = new Wt();
88980
- t.sourceId = ((o = (I = i.files) == null ? void 0 : I[0]) == null ? void 0 : o.src) ?? "unknown", t.clearFlags = 1, t.backgroundColor = new Mt(0.5, 0.5, 0.5, 1), t.fieldOfView = 35, t.backgroundBlurriness = 0.125;
88999
+ t.sourceId = ((o = (I = i.files) == null ? void 0 : I[0]) == null ? void 0 : o.src) ?? "unknown", i.context.lightmaps.tryGetSkybox(t.sourceId) ? t.clearFlags = 1 : t.clearFlags = 2, t.backgroundColor = new Mt(0.5, 0.5, 0.5, 1), t.fieldOfView = 35, t.backgroundBlurriness = 0.2;
88981
89000
  const g = WQ(e, t, !0);
88982
89001
  return e.position.x = 0, e.position.y = 1, e.position.z = 2, F_(i.context, g), g;
88983
89002
  });
@@ -41819,35 +41819,37 @@ async function cq(n) {
41819
41819
  }
41820
41820
  Qo && Kx(n);
41821
41821
  }
41822
- const MF = "needle-license-element", UC = 1e4, NC = 200;
41822
+ const MF = "needle-license-element", UC = 1e4, NC = 1200;
41823
41823
  async function Kx(n) {
41824
41824
  await (Il == null ? void 0 : Il.catch(() => {
41825
41825
  })), !of() && (lq(), n.domElement.addEventListener("ready", () => {
41826
- setTimeout(() => {
41827
- TF(n);
41828
- }, 1e3);
41826
+ TF(n);
41829
41827
  }));
41830
41828
  }
41831
41829
  function TF(n) {
41832
- const e = hq(), t = uq(), i = setInterval(() => {
41830
+ const e = hq(), t = uq(), i = () => {
41833
41831
  if (!e)
41834
41832
  return;
41835
- const a = n.domElement.shadowRoot || n.domElement;
41836
- e.parentNode !== a && (a.appendChild(e), t && a.appendChild(t));
41837
- }, 100), s = `<img class="logo" src="${CF}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`, r = document.createElement("div");
41838
- r.innerHTML = s, r.classList.add("logo"), e.appendChild(r);
41839
- const o = document.createElement("div");
41840
- if (o.classList.add("text"), e.appendChild(o), e.title = "Needle Engine", of() || (e.title += " No active license found - Non Commercial Use"), e.addEventListener("click", () => {
41833
+ const c = n.domElement.shadowRoot || n.domElement;
41834
+ e.parentNode !== c && (c.appendChild(e), t && c.appendChild(t));
41835
+ };
41836
+ i();
41837
+ const s = setInterval(() => {
41838
+ i();
41839
+ }, 1e3), r = `<img class="logo" src="${CF}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`, o = document.createElement("div");
41840
+ o.innerHTML = r, o.classList.add("logo"), e.appendChild(o);
41841
+ const a = document.createElement("div");
41842
+ if (a.classList.add("text"), e.appendChild(a), e.title = "Needle Engine", of() || (e.title += " No active license found - Non Commercial Use"), e.addEventListener("click", () => {
41841
41843
  globalThis.open("https://needle.tools", "_blank");
41842
41844
  }), EF()) {
41843
- const a = UC + NC;
41845
+ const c = UC + NC;
41844
41846
  setTimeout(() => {
41845
- clearInterval(i), e == null || e.remove(), t == null || t.remove();
41846
- const c = 5;
41847
+ clearInterval(s), e == null || e.remove(), t == null || t.remove();
41848
+ const l = 5;
41847
41849
  setTimeout(() => {
41848
41850
  n.domElement.parentNode && TF(n);
41849
- }, 1e3 * 60 * c);
41850
- }, a);
41851
+ }, 1e3 * 60 * l);
41852
+ }, c);
41851
41853
  }
41852
41854
  }
41853
41855
  let tB = 0;
@@ -41985,6 +41987,24 @@ function uq() {
41985
41987
  transform: scale(1.02) !important;
41986
41988
  cursor: pointer !important;
41987
41989
  }
41990
+
41991
+ @media (prefers-reduced-motion: reduce) {
41992
+ ${e} .text {
41993
+ animation: none !important;
41994
+ transition: none !important;
41995
+ /* animation end state */
41996
+ opacity: 1;
41997
+ }
41998
+
41999
+ ${e} .logo {
42000
+ animation: none !important;
42001
+ transition: none !important;
42002
+ /* animation end state */
42003
+ opacity: 1;
42004
+ pointer-events: all;
42005
+ transform: scale(1)
42006
+ }
42007
+ }
41988
42008
  `, n;
41989
42009
  }
41990
42010
  async function dq() {
@@ -42973,7 +42993,7 @@ function uB(n) {
42973
42993
  n !== void 0 && typeof n == "string" && (vl || (vl = new Wo()), Nd && console.log("Setting ktx2 transcoder path to", n), vl.setTranscoderPath(n));
42974
42994
  }
42975
42995
  function Lm(n, e) {
42976
- Ho || (Ho = new lM(), Ho.setDecoderPath(aB), Ho.setDecoderConfig({ type: "js" }), Nd && console.log("Setting draco decoder path to", aB)), vl || (vl = new Wo(), vl.setTranscoderPath(cB), Nd && console.log("Setting ktx2 transcoder path to", cB), e.renderer && vl.detectSupport(e.renderer)), sw || (sw = Cq, Nd && console.log("Using the default meshopt decoder")), n.setDRACOLoader(Ho), n.setKTX2Loader(vl), n.setMeshoptDecoder(sw);
42996
+ Ho || (Ho = new lM(), Ho.setDecoderPath(aB), Ho.setDecoderConfig({ type: "js" }), Nd && console.log("Setting draco decoder path to", aB)), vl || (vl = new Wo(), vl.setTranscoderPath(cB), Nd && console.log("Setting ktx2 transcoder path to", cB)), sw || (sw = Cq, Nd && console.log("Using the default meshopt decoder")), e.renderer ? vl.detectSupport(e.renderer) : console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"), n.setDRACOLoader(Ho), n.setKTX2Loader(vl), n.setMeshoptDecoder(sw);
42977
42997
  }
42978
42998
  function Eq(n, e = 1e-4) {
42979
42999
  e = Math.max(e, Number.EPSILON);
@@ -64549,7 +64569,7 @@ class WN {
64549
64569
  }
64550
64570
  const ko = new S(), bp = new Re(), Bv = new Se(), jN = class extends Da {
64551
64571
  constructor() {
64552
- super();
64572
+ super(...arguments);
64553
64573
  u(this, "_anchoredPosition");
64554
64574
  u(this, "sizeDelta", new te(100, 100));
64555
64575
  u(this, "pivot", new te(0.5, 0.5));
@@ -64571,7 +64591,6 @@ const ko = new S(), bp = new Re(), Bv = new Se(), jN = class extends Da {
64571
64591
  u(this, "_lastAnchoring");
64572
64592
  u(this, "_createdBlocks", []);
64573
64593
  u(this, "_createdTextBlocks", []);
64574
- this.lastMatrix = new Re(), this.rectBlock = new Te();
64575
64594
  }
64576
64595
  get parent() {
64577
64596
  return this._parentRectTransform;
@@ -64614,7 +64633,7 @@ const ko = new S(), bp = new Re(), Bv = new Se(), jN = class extends Da {
64614
64633
  return this.sizeDelta.y;
64615
64634
  }
64616
64635
  awake() {
64617
- super.awake(), this._anchoredPosition || (this._anchoredPosition = new te()), this.rectBlock.name = this.name, this._initialPosition = this.gameObject.position.clone(), this._initialPosition.z = 0, yd(this, "_anchoredPosition", () => {
64636
+ super.awake(), this._anchoredPosition || (this._anchoredPosition = new te()), this.lastMatrix = new Re(), this.rectBlock = new Te(), this.rectBlock.name = this.name, this._initialPosition = this.gameObject.position.clone(), this._initialPosition.z = 0, yd(this, "_anchoredPosition", () => {
64618
64637
  this.markDirty();
64619
64638
  }), yd(this, "sizeDelta", () => {
64620
64639
  this.markDirty();
@@ -86436,7 +86455,7 @@ Qi.registerCallback(ir.MissingCamera, (n) => {
86436
86455
  const e = n.context.scene, t = new Te();
86437
86456
  t.name = "Default Fallback Camera", e.add(t);
86438
86457
  const i = new zi();
86439
- i.sourceId = ((o = (r = n.files) == null ? void 0 : r[0]) == null ? void 0 : o.src) ?? "unknown", i.clearFlags = 1, i.backgroundColor = new Si(0.5, 0.5, 0.5, 1), i.fieldOfView = 35, i.backgroundBlurriness = 0.125;
86458
+ i.sourceId = ((o = (r = n.files) == null ? void 0 : r[0]) == null ? void 0 : o.src) ?? "unknown", n.context.lightmaps.tryGetSkybox(i.sourceId) ? i.clearFlags = 1 : i.clearFlags = 2, i.backgroundColor = new Si(0.5, 0.5, 0.5, 1), i.fieldOfView = 35, i.backgroundBlurriness = 0.2;
86440
86459
  const s = _f(t, i, !0);
86441
86460
  return t.position.x = 0, t.position.y = 1, t.position.z = 2, az(n.context, s), s;
86442
86461
  });