@needle-tools/engine 3.6.0-alpha → 3.6.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ 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.6.0-alpha.2] - 2023-05-27
8
+ - Fix: error in vite plugin when `meta.json` was missing
9
+ - Fix: three.js OrbitControls causing look direction to not work anymore due to forcing an update in the constructor
10
+
7
11
  ## [3.6.0-alpha] - 2023-05-27
8
12
  - Add: Changing `src` attribute now does scene cleanup and loads new files
9
13
  - Add: `skybox-image` and `environment-image` attributes, allow changing both at runtime
@@ -28364,12 +28364,12 @@ function jB(i, A) {
28364
28364
  return !0;
28365
28365
  }
28366
28366
  (0, eval)(`
28367
- if(!globalThis[""null""])
28368
- globalThis[""null""] = "0.0.0";
28367
+ if(!globalThis["NEEDLE_ENGINE_VERSION"])
28368
+ globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";
28369
28369
  if(!globalThis[""undefined""])
28370
28370
  globalThis[""undefined""] = "unknown";
28371
28371
  `);
28372
- const oV = "null", HCA = "undefined", On = "needle_isActiveInHierarchy", fB = "builtin_components", Lu = "needle_editor_guid", CV = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
28372
+ const oV = NEEDLE_ENGINE_VERSION, HCA = "undefined", On = "needle_isActiveInHierarchy", fB = "builtin_components", Lu = "needle_editor_guid", CV = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
28373
28373
  function sV(i) {
28374
28374
  return typeof i == "string" && CV.test(i);
28375
28375
  }
@@ -38619,7 +38619,7 @@ class we {
38619
38619
  return I = C, !0;
38620
38620
  I = C;
38621
38621
  }
38622
- }), I ? this.setCurrentCamera(I) : (wi.dispatchCallback(ao.MissingCamera, this), !this.mainCamera && !this.isManagedExternally && console.warn("Missing camera in main scene", this));
38622
+ }), I ? this.setCurrentCamera(I) : !wi.dispatchCallback(ao.MissingCamera, this) && !this.mainCamera && !this.isManagedExternally && console.warn("Missing camera in main scene", this);
38623
38623
  }
38624
38624
  if (we.Current = this, vD(this), !this.isManagedExternally && this.composer && this.mainCamera) {
38625
38625
  const I = new Sf(this.scene, this.mainCamera);
@@ -61873,6 +61873,9 @@ class ca extends mA {
61873
61873
  r(this, "_camera", null);
61874
61874
  r(this, "_syncedTransform");
61875
61875
  r(this, "targetElement", null);
61876
+ r(this, "onControlsChangeStarted", () => {
61877
+ this._syncedTransform && this._syncedTransform.requestOwnership();
61878
+ });
61876
61879
  r(this, "_shouldDisable", !1);
61877
61880
  r(this, "_haveAttachedKeyboardEvents", !1);
61878
61881
  }
@@ -61914,17 +61917,14 @@ class ca extends mA {
61914
61917
  const t = e == null ? void 0 : e.cam;
61915
61918
  if (t && RK(t, this, !0), !this._controls) {
61916
61919
  console.assert(t != null, "Missing camera", this), t && (this._cameraObject = t);
61917
- const g = this.targetElement ?? this.context.domElement;
61918
- this._controls = new hX(t, g), fS === void 0 && (fS = { ...this._controls.keys });
61920
+ const g = this.targetElement ?? this.context.domElement, I = t == null ? void 0 : t.quaternion.clone();
61921
+ this._controls = new hX(t, g), t == null || t.quaternion.copy(I), fS === void 0 && (fS = { ...this._controls.keys });
61919
61922
  }
61920
- this._controls && (ou && (this.enablePan = !0, this.enableZoom = !0, this.middleClickToFocus = !0, kQ() && (this.doubleClickToFocus = !0)), this._controls.enableDamping = this.enableDamping, this._controls.keys = this.enableKeys ? fS : EeA, this._controls.autoRotate = this.autoRotate, this._controls.autoRotateSpeed = this.autoRotateSpeed, this._controls.enableZoom = this.enableZoom, this._controls.addEventListener("start", this.onControlsChangeStarted.bind(this)), (t == null ? void 0 : t.type) === "PerspectiveCamera" ? ou || (this._controls.minDistance = this.minZoom, this._controls.maxDistance = this.maxZoom) : ou || (this._controls.minZoom = this.minZoom, this._controls.maxZoom = this.maxZoom), this._controls.dampingFactor = this.dampingFactor, this._controls.enablePan = this.enablePan, this._startedListeningToKeyEvents || (this._startedListeningToKeyEvents = !0, this._controls.listenToKeyEvents(window.document.body))), this._syncedTransform = eA.getComponent(this.gameObject, Dr) ?? void 0;
61923
+ this._controls && (ou && (this.enablePan = !0, this.enableZoom = !0, this.middleClickToFocus = !0, kQ() && (this.doubleClickToFocus = !0)), this._controls.enableDamping = this.enableDamping, this._controls.keys = this.enableKeys ? fS : EeA, this._controls.autoRotate = this.autoRotate, this._controls.autoRotateSpeed = this.autoRotateSpeed, this._controls.enableZoom = this.enableZoom, this._controls.addEventListener("start", this.onControlsChangeStarted), (t == null ? void 0 : t.type) === "PerspectiveCamera" ? ou || (this._controls.minDistance = this.minZoom, this._controls.maxDistance = this.maxZoom) : ou || (this._controls.minZoom = this.minZoom, this._controls.maxZoom = this.maxZoom), this._controls.dampingFactor = this.dampingFactor, this._controls.enablePan = this.enablePan, this._startedListeningToKeyEvents || (this._startedListeningToKeyEvents = !0, this._controls.listenToKeyEvents(window.document.body))), this._syncedTransform = eA.getComponent(this.gameObject, Dr) ?? void 0;
61921
61924
  }
61922
61925
  onDisable() {
61923
61926
  var e;
61924
- (e = this._camera) != null && e.cam && RK(this._camera.cam, this, !1), this._controls && (this._controls.enabled = !1, this._controls.autoRotate = !1);
61925
- }
61926
- onControlsChangeStarted() {
61927
- this._syncedTransform && this._syncedTransform.requestOwnership();
61927
+ (e = this._camera) != null && e.cam && RK(this._camera.cam, this, !1), this._controls && (this._controls.enabled = !1, this._controls.autoRotate = !1, this._controls.removeEventListener("start", this.onControlsChangeStarted));
61928
61928
  }
61929
61929
  afterHandleInput(e) {
61930
61930
  e.detail.args.pointerId === 0 && (e.detail.args.isDown ? this._controls && this._eventSystem && (this._shouldDisable = this._eventSystem.hasActiveUI) : (!e.detail.args.isPressed || e.detail.args.isUp) && (this._shouldDisable = !1));
@@ -62141,7 +62141,7 @@ const Ec = (Su = class extends mA {
62141
62141
  return o.sub(C), o.normalize(), t ? (t.set(C, o), t) : new Ps(C.clone(), o.clone());
62142
62142
  }
62143
62143
  awake() {
62144
- this.sourceId || console.warn("Camera has no source - the camera should be exported inside a gltf", this.name), FK && window.addEventListener("pointerdown", (A) => {
62144
+ FK && window.addEventListener("pointerdown", (A) => {
62145
62145
  const e = A.clientX, t = A.clientY;
62146
62146
  console.log("touch", e.toFixed(2), t.toFixed(2));
62147
62147
  const g = this.screenPointToRay(e, t), I = "#" + Math.floor(Math.random() * 16777215).toString(16);