@needle-tools/engine 2.63.0-pre → 2.63.1-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.63.0-pre",
3
+ "version": "2.63.1-pre",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "module": "dist/needle-engine.js",
@@ -0,0 +1,4 @@
1
+
2
+ //@ts-ignore
3
+ import _logo from "./logo.svg"
4
+ export const logoSVG = _logo;
@@ -0,0 +1 @@
1
+ {}
@@ -2,6 +2,7 @@ import { showBalloonWarning } from "./api";
2
2
  import { Mathf } from "./engine_math";
3
3
  import { LoadingProgressArgs } from "./engine_setup";
4
4
  import { getParam } from "./engine_utils";
5
+ import { logoSVG } from "./assets"
5
6
 
6
7
  const debug = getParam("debugloadingbar");
7
8
  const debugRendering = getParam("debugloadingbarrendering");
@@ -194,7 +195,6 @@ export class EngineLoadingView implements ILoadingViewHandler {
194
195
  this._loadingElement.appendChild(loadingBarContainer);
195
196
 
196
197
  const needleLogo = document.createElement("img");
197
- loadingBarContainer.appendChild(needleLogo);
198
198
  const logoSize = 64;
199
199
  needleLogo.style.width = `${logoSize}px`;
200
200
  needleLogo.style.height = `${logoSize}px`;
@@ -204,13 +204,8 @@ export class EngineLoadingView implements ILoadingViewHandler {
204
204
  needleLogo.addEventListener("click", () => window.open("https://needle.tools", "_blank"));
205
205
  needleLogo.style.cursor = "pointer";
206
206
  needleLogo.style.pointerEvents = "all";
207
- try {
208
- //@ts-ignore
209
- import("./assets/logo.svg").then(res => {
210
- needleLogo.src = res.default;
211
- })
212
- }
213
- catch { }
207
+ needleLogo.src = logoSVG;
208
+ loadingBarContainer.appendChild(needleLogo);
214
209
 
215
210
  this._loadingBar = document.createElement("div");
216
211
  loadingBarContainer.appendChild(this._loadingBar);
@@ -1,18 +1,37 @@
1
1
  import { getParam } from "./engine_utils";
2
2
  import { ContextEvent, ContextRegistry } from "./engine_context_registry";
3
3
  import { IContext } from "./engine_types";
4
+ import { logoSVG } from "./assets";
4
5
 
5
6
  const debug = getParam("debuglicense");
6
7
 
8
+
9
+ // import licenseInformation from "./codegen/license.json";
10
+ let licenseInformation: any = null;
11
+ let licenseImportPromise: Promise<any> | null = null;
12
+ try {
13
+ licenseImportPromise = import("./codegen/license.json");
14
+ licenseImportPromise.then(res => {
15
+ licenseInformation = res.default;
16
+ licenseImportPromise = null;
17
+ if (debug) console.log("License imported via dynamic import", licenseInformation)
18
+ }).catch(err => { if (debug) console.error("Error on dynamic license import", err) });
19
+ }
20
+ catch (err) {
21
+ if (debug)
22
+ console.log("Importing license failed", err)
23
+ }
24
+
25
+
7
26
  ContextRegistry.registerCallback(ContextEvent.ContextCreated, evt => {
8
27
  showLicenseInfo(evt.context);
9
28
  });
10
29
 
11
30
  async function showLicenseInfo(ctx: IContext) {
12
31
  try {
13
- const res = await import(/* @vite-ignore */ "./codegen/license");
32
+ // if(licenseImportPromise) await licenseImportPromise;
14
33
  //@ts-ignore
15
- if (!res || res.hasLicense !== true || debug) return onNonCommercialVersionDetected(ctx);
34
+ if (!licenseInformation || licenseInformation.hasLicense !== true || debug) return onNonCommercialVersionDetected(ctx);
16
35
  }
17
36
  catch (err) {
18
37
  if (debug) console.log("License check failed", err)
@@ -50,16 +69,10 @@ function insertNonCommercialUseHint(ctx: IContext) {
50
69
 
51
70
  logNonCommercialUse();
52
71
 
53
- //@ts-ignore
54
- import("./assets/logo.svg").then(res => {
55
- const svgContent = res.default;
56
- let svg = `<img class="logo" src="${svgContent}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`;
57
- svg = "<a href=\"https://needle.tools\" target=\"_blank\">" + svg + "</a>";
58
- licenseText = svg; //licenseText.replace("🌵", svg);
59
- licenseElement.innerHTML = licenseText;
60
- }).catch(err => {
61
- if (debug) console.log("Failed to load logo", err);
62
- });
72
+ let svg = `<img class="logo" src="${logoSVG}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`;
73
+ svg = "<a href=\"https://needle.tools\" target=\"_blank\">" + svg + "</a>";
74
+ licenseText = svg; //licenseText.replace("🌵", svg);
75
+ licenseElement.innerHTML = licenseText;
63
76
 
64
77
  const removeDelay = licenseDuration + licenseDelay;
65
78
  setTimeout(() => {
@@ -559,6 +559,14 @@ class Component implements IComponent, EventTarget {
559
559
  public get forward(): THREE.Vector3 {
560
560
  return Component._forward.set(0, 0, -1).applyQuaternion(this.worldQuaternion);
561
561
  }
562
+ private static _right: THREE.Vector3 = new THREE.Vector3();
563
+ public get right(): THREE.Vector3 {
564
+ return Component._right.set(1, 0, 0).applyQuaternion(this.worldQuaternion);
565
+ }
566
+ private static _up: THREE.Vector3 = new THREE.Vector3();
567
+ public get up(): THREE.Vector3 {
568
+ return Component._up.set(0, 1, 0).applyQuaternion(this.worldQuaternion);
569
+ }
562
570
 
563
571
 
564
572
 
@@ -1 +0,0 @@
1
- export const hasLicense: false;
@@ -1,2 +0,0 @@
1
- export const hasLicense = false;
2
- //# sourceMappingURL=license.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"license.js","sourceRoot":"","sources":["../../../../engine/codegen/license.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC"}
@@ -1 +0,0 @@
1
- export const hasLicense = false;