@needle-tools/engine 5.1.14 → 5.1.16
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 +8 -0
- package/dist/gltf-progressive-4EjGCbsd.umd.cjs +10 -0
- package/dist/{gltf-progressive-DaeP5KBr.js → gltf-progressive-BidVoP6g.js} +205 -198
- package/dist/gltf-progressive-JsCmImqa.min.js +10 -0
- package/dist/{needle-engine.bundle-y1_E7Ovt.umd.cjs → needle-engine.bundle-CFnhozXr.umd.cjs} +141 -141
- package/dist/{needle-engine.bundle-BEa7CABw.js → needle-engine.bundle-Ccvgzl3v.js} +6552 -6534
- package/dist/{needle-engine.bundle-mkmiuKZB.min.js → needle-engine.bundle-DBXustN8.min.js} +143 -143
- package/dist/needle-engine.d.ts +29 -27
- package/dist/needle-engine.js +8 -8
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug_overlay.js +5 -8
- package/lib/engine/debug/debug_overlay.js.map +1 -1
- package/lib/engine/engine_context.js +3 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.js +3 -1
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +87 -77
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_loaders.gltf.d.ts +3 -1
- package/lib/engine/engine_loaders.gltf.js +6 -1
- package/lib/engine/engine_loaders.gltf.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +2 -0
- package/lib/engine/engine_physics.js +23 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_utils.js +2 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine-components/Skybox.js +11 -7
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/web/Clickthrough.d.ts +1 -0
- package/lib/engine-components/web/Clickthrough.js +7 -2
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +1 -2
- package/lib/engine-components-experimental/networking/PlayerSync.js +10 -13
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/package.json +2 -2
- package/plugins/common/license.js +4 -4
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +1 -1
- package/src/engine/debug/debug_overlay.ts +6 -9
- package/src/engine/engine_context.ts +3 -0
- package/src/engine/engine_context_registry.ts +4 -2
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +83 -74
- package/src/engine/engine_loaders.gltf.ts +8 -2
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_physics.ts +22 -1
- package/src/engine/engine_utils.ts +2 -0
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/Skybox.ts +12 -9
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/web/Clickthrough.ts +8 -2
- package/src/engine-components-experimental/networking/PlayerSync.ts +11 -15
- package/dist/gltf-progressive-BnLTsXZw.umd.cjs +0 -10
- package/dist/gltf-progressive-D6RT9IkB.min.js +0 -10
|
@@ -41,19 +41,19 @@ function setLicenseTimeout(ctx: IContext, callback: () => void, delay: number) {
|
|
|
41
41
|
|
|
42
42
|
const debug = getParam("__debuglic__");
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const _$qssKJZ: ((result: boolean) => void)[] = [];
|
|
45
45
|
|
|
46
46
|
// DO NOT EDIT MANUALLY
|
|
47
|
-
let
|
|
47
|
+
let _$awngvTM: string = "";
|
|
48
48
|
// eslint-disable-next-line prefer-const
|
|
49
|
-
let
|
|
49
|
+
let _SWHZG: string = "";
|
|
50
50
|
|
|
51
51
|
if (debug) {
|
|
52
|
-
console.log("License Type: " +
|
|
53
|
-
if (
|
|
54
|
-
console.log("License JWT: " +
|
|
52
|
+
console.log("License Type: " + _$awngvTM);
|
|
53
|
+
if (_SWHZG) {
|
|
54
|
+
console.log("License JWT: " + _SWHZG);
|
|
55
55
|
try {
|
|
56
|
-
const payload = JSON.parse(atob(
|
|
56
|
+
const payload = JSON.parse(atob(_SWHZG.split(".")[1].replace(/-/g, '+').replace(/_/g, '/')));
|
|
57
57
|
console.log("License JWT payload:", payload);
|
|
58
58
|
}
|
|
59
59
|
catch { console.log("License JWT payload: (failed to decode)"); }
|
|
@@ -64,8 +64,8 @@ if (debug) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/** @internal */
|
|
67
|
-
export function _$
|
|
68
|
-
switch (
|
|
67
|
+
export function _$RTXoT() {
|
|
68
|
+
switch (_$awngvTM) {
|
|
69
69
|
case "pro":
|
|
70
70
|
case "enterprise":
|
|
71
71
|
return true;
|
|
@@ -74,8 +74,8 @@ export function _$xBhfh() {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/** @internal */
|
|
77
|
-
export function
|
|
78
|
-
switch (
|
|
77
|
+
export function __IBw() {
|
|
78
|
+
switch (_$awngvTM) {
|
|
79
79
|
case "indie":
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
@@ -83,8 +83,8 @@ export function __YFTdTh() {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/** @internal */
|
|
86
|
-
export function
|
|
87
|
-
switch (
|
|
86
|
+
export function __LoXXadh() {
|
|
87
|
+
switch (_$awngvTM) {
|
|
88
88
|
case "edu":
|
|
89
89
|
return true;
|
|
90
90
|
}
|
|
@@ -92,26 +92,26 @@ export function _$qEBaEKr() {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/** @internal */
|
|
95
|
-
export function
|
|
96
|
-
return _$
|
|
95
|
+
export function __zggva() {
|
|
96
|
+
return _$RTXoT() || __IBw() || __LoXXadh();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
/** @internal */
|
|
101
|
-
export function
|
|
102
|
-
if (_$
|
|
101
|
+
export function $ETZ(cb: (result: boolean) => void) {
|
|
102
|
+
if (_$RTXoT() || __IBw() || __LoXXadh()) {
|
|
103
103
|
cb(true);
|
|
104
104
|
return () => {};
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
_$qssKJZ.push(cb);
|
|
107
107
|
return () => {
|
|
108
|
-
const index =
|
|
109
|
-
if (index >= 0)
|
|
108
|
+
const index = _$qssKJZ.indexOf(cb);
|
|
109
|
+
if (index >= 0) _$qssKJZ.splice(index, 1);
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function
|
|
114
|
-
for (const cb of
|
|
113
|
+
function lzUeRV(result: boolean) {
|
|
114
|
+
for (const cb of _$qssKJZ) {
|
|
115
115
|
try {
|
|
116
116
|
cb(result);
|
|
117
117
|
}
|
|
@@ -126,7 +126,7 @@ function $rpNGR(result: boolean) {
|
|
|
126
126
|
|
|
127
127
|
// ECDSA P-256 public key for verifying license JWTs (verification-only, safe to ship)
|
|
128
128
|
/* eslint-disable no-secrets/no-secrets -- public key, not a secret */
|
|
129
|
-
const $
|
|
129
|
+
const _$FKtdh = {
|
|
130
130
|
kty: "EC",
|
|
131
131
|
crv: "P-256",
|
|
132
132
|
x: "A34nyKMjhQYVgzeE4tyLUYdx34TAKogDa7v7PRaO9Lg",
|
|
@@ -150,7 +150,7 @@ function base64urlDecode(str: string): Uint8Array {
|
|
|
150
150
|
* Verify a JWT license token and return the `type` claim if valid.
|
|
151
151
|
* Returns null if the JWT is missing, malformed, or has an invalid signature.
|
|
152
152
|
*/
|
|
153
|
-
async function
|
|
153
|
+
async function _sTpzyYzi(jwt: string): Promise<string | null> {
|
|
154
154
|
if (!jwt) return null;
|
|
155
155
|
try {
|
|
156
156
|
const parts = jwt.split(".");
|
|
@@ -160,7 +160,7 @@ async function Twm(jwt: string): Promise<string | null> {
|
|
|
160
160
|
|
|
161
161
|
const key = await crypto.subtle.importKey(
|
|
162
162
|
"jwk",
|
|
163
|
-
$
|
|
163
|
+
_$FKtdh,
|
|
164
164
|
{ name: "ECDSA", namedCurve: "P-256" },
|
|
165
165
|
false,
|
|
166
166
|
["verify"]
|
|
@@ -220,24 +220,24 @@ async function Twm(jwt: string): Promise<string | null> {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
/** Verify the injected JWT and update the license type if valid.
|
|
223
|
-
* The engine ONLY trusts the JWT — the plain
|
|
223
|
+
* The engine ONLY trusts the JWT — the plain _$awngvTM string is ignored. */
|
|
224
224
|
let _jwtVerificationPromise: Promise<void> | undefined = undefined;
|
|
225
|
-
async function
|
|
226
|
-
// NOTE: do NOT add an `if (!
|
|
225
|
+
async function _zNSpaav(): Promise<void> {
|
|
226
|
+
// NOTE: do NOT add an `if (!_SWHZG) return` guard here.
|
|
227
227
|
// esbuild (Vite dependency pre-bundling) would see the variable as constant ""
|
|
228
228
|
// and tree-shake the entire JWT verification code path.
|
|
229
|
-
const jwt =
|
|
229
|
+
const jwt = _SWHZG;
|
|
230
230
|
// Clear after reading — this reassignment also prevents esbuild from
|
|
231
231
|
// constant-folding the variable (it now has multiple assignment sites).
|
|
232
|
-
|
|
233
|
-
const verifiedType = await
|
|
232
|
+
_SWHZG = "";
|
|
233
|
+
const verifiedType = await _sTpzyYzi(jwt);
|
|
234
234
|
if (verifiedType) {
|
|
235
|
-
|
|
235
|
+
_$awngvTM = verifiedType;
|
|
236
236
|
if (debug) console.log("License type set from verified JWT: " + verifiedType);
|
|
237
|
-
|
|
237
|
+
lzUeRV(__zggva());
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
240
|
-
|
|
240
|
+
_$awngvTM = "basic";
|
|
241
241
|
if (debug && jwt) console.warn("JWT verification failed — license reset to basic");
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -360,7 +360,7 @@ export namespace Telemetry {
|
|
|
360
360
|
// NOTE: this does NOT affect license enforcement — the /check call, the "forbidden"
|
|
361
361
|
// overlay and the watermark/logo run on separate, ungated code paths.
|
|
362
362
|
const attribute = domElement?.getAttribute("no-telemetry");
|
|
363
|
-
if (_$
|
|
363
|
+
if (_$RTXoT() && (attribute === "" || attribute === "true" || attribute === "1")) {
|
|
364
364
|
if (debug) console.debug("Telemetry is disabled via no-telemetry attribute");
|
|
365
365
|
return false;
|
|
366
366
|
}
|
|
@@ -564,19 +564,28 @@ export namespace Telemetry {
|
|
|
564
564
|
if (_contextLossMonitored.has(canvas)) return;
|
|
565
565
|
_contextLossMonitored.add(canvas);
|
|
566
566
|
let lostAt = 0;
|
|
567
|
-
|
|
567
|
+
const onContextLost = () => {
|
|
568
568
|
lostAt = performance.now();
|
|
569
569
|
sendEvent(context, "engine", {
|
|
570
570
|
action: "context_lost",
|
|
571
571
|
since_navigation_ms: Math.round(performance.now()),
|
|
572
572
|
during_xr: context?.isInXR === true,
|
|
573
573
|
});
|
|
574
|
-
}
|
|
575
|
-
|
|
574
|
+
};
|
|
575
|
+
const onContextRestored = () => {
|
|
576
576
|
sendEvent(context, "engine", {
|
|
577
577
|
action: "context_restored",
|
|
578
578
|
downtime_ms: lostAt ? Math.round(performance.now() - lostAt) : undefined,
|
|
579
579
|
});
|
|
580
|
+
};
|
|
581
|
+
canvas.addEventListener("webglcontextlost", onContextLost);
|
|
582
|
+
canvas.addEventListener("webglcontextrestored", onContextRestored);
|
|
583
|
+
const unregisterDestroyed = ContextRegistry.registerCallback(ContextEvent.ContextDestroyed, evt => {
|
|
584
|
+
if (evt.context !== context) return;
|
|
585
|
+
canvas.removeEventListener("webglcontextlost", onContextLost);
|
|
586
|
+
canvas.removeEventListener("webglcontextrestored", onContextRestored);
|
|
587
|
+
_contextLossMonitored.delete(canvas);
|
|
588
|
+
unregisterDestroyed();
|
|
580
589
|
});
|
|
581
590
|
}
|
|
582
591
|
|
|
@@ -688,18 +697,18 @@ export namespace Telemetry {
|
|
|
688
697
|
}
|
|
689
698
|
|
|
690
699
|
|
|
691
|
-
export function
|
|
700
|
+
export function __RzSXX() {
|
|
692
701
|
|
|
693
|
-
if(
|
|
702
|
+
if(_$awngvTM === "") _$awngvTM = "basic";
|
|
694
703
|
|
|
695
704
|
// Start JWT verification — must be here (not top-level) to avoid tree-shaking
|
|
696
|
-
_jwtVerificationPromise =
|
|
705
|
+
_jwtVerificationPromise = _zNSpaav();
|
|
697
706
|
|
|
698
707
|
Telemetry.init();
|
|
699
708
|
ContextRegistry.registerCallback(ContextEvent.ContextRegistered, evt => {
|
|
700
|
-
_$
|
|
701
|
-
|
|
702
|
-
setLicenseTimeout(evt.context, () =>
|
|
709
|
+
_$TLdIKj(evt.context);
|
|
710
|
+
__BLGKU(evt.context);
|
|
711
|
+
setLicenseTimeout(evt.context, () => _hfNcxBI(evt.context), 2000);
|
|
703
712
|
});
|
|
704
713
|
// ContextCreated fires after the renderer exists, so the canvas is available for context-loss monitoring
|
|
705
714
|
ContextRegistry.registerCallback(ContextEvent.ContextCreated, evt => {
|
|
@@ -708,17 +717,17 @@ export function $tbhNjEbR() {
|
|
|
708
717
|
});
|
|
709
718
|
}
|
|
710
719
|
|
|
711
|
-
export let
|
|
720
|
+
export let __hMqJV: Promise<void> | undefined = undefined;
|
|
712
721
|
let applicationIsForbidden = false;
|
|
713
722
|
let applicationForbiddenText = "";
|
|
714
|
-
async function $
|
|
723
|
+
async function $PhL() {
|
|
715
724
|
// Only perform the runtime license check once
|
|
716
|
-
if (
|
|
725
|
+
if (__hMqJV) return __hMqJV;
|
|
717
726
|
// Wait for JWT verification to complete first (if running)
|
|
718
727
|
if (_jwtVerificationPromise) {
|
|
719
728
|
await _jwtVerificationPromise;
|
|
720
729
|
}
|
|
721
|
-
if (
|
|
730
|
+
if (_$awngvTM === "basic") {
|
|
722
731
|
try {
|
|
723
732
|
const licenseUrl = "https://needle.tools/api/v1/needle-engine/check?location=" + encodeURIComponent(window.location.href) + "&version=" + VERSION + "&generator=" + encodeURIComponent(GENERATOR);
|
|
724
733
|
const res = await fetch(licenseUrl, {
|
|
@@ -730,29 +739,29 @@ async function $TPLZ() {
|
|
|
730
739
|
if (res?.status === 200) {
|
|
731
740
|
applicationIsForbidden = false;
|
|
732
741
|
if (debug) console.log("License check succeeded");
|
|
733
|
-
|
|
734
|
-
|
|
742
|
+
_$awngvTM = "pro";
|
|
743
|
+
lzUeRV(true);
|
|
735
744
|
}
|
|
736
745
|
else if (res?.status === 403) {
|
|
737
|
-
|
|
746
|
+
lzUeRV(false);
|
|
738
747
|
applicationIsForbidden = true;
|
|
739
748
|
applicationForbiddenText = await res.text();
|
|
740
749
|
}
|
|
741
750
|
else {
|
|
742
|
-
|
|
751
|
+
lzUeRV(false);
|
|
743
752
|
if (debug) console.log("License check failed with status " + res?.status);
|
|
744
753
|
}
|
|
745
754
|
}
|
|
746
755
|
catch (err) {
|
|
747
|
-
|
|
756
|
+
lzUeRV(false);
|
|
748
757
|
if (debug) console.error("License check failed", err);
|
|
749
758
|
}
|
|
750
759
|
}
|
|
751
|
-
else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" +
|
|
760
|
+
else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" + _$awngvTM + "\"");
|
|
752
761
|
}
|
|
753
|
-
|
|
762
|
+
__hMqJV = $PhL();
|
|
754
763
|
|
|
755
|
-
async function
|
|
764
|
+
async function __BLGKU(ctx: IContext) {
|
|
756
765
|
function createForbiddenElement() {
|
|
757
766
|
const div = document.createElement("div");
|
|
758
767
|
div.className = "needle-forbidden";
|
|
@@ -817,40 +826,40 @@ async function $DAPYU(ctx: IContext) {
|
|
|
817
826
|
}, 500)
|
|
818
827
|
}
|
|
819
828
|
|
|
820
|
-
async function _$
|
|
829
|
+
async function _$TLdIKj(ctx: IContext) {
|
|
821
830
|
try {
|
|
822
|
-
if (!_$
|
|
823
|
-
return
|
|
831
|
+
if (!_$RTXoT() && !__IBw()) {
|
|
832
|
+
return __AnJSYFKu(ctx);
|
|
824
833
|
}
|
|
825
834
|
}
|
|
826
835
|
catch (err) {
|
|
827
836
|
if (debug) console.log("License check failed", err)
|
|
828
|
-
return
|
|
837
|
+
return __AnJSYFKu(ctx)
|
|
829
838
|
}
|
|
830
|
-
if (debug)
|
|
839
|
+
if (debug) __AnJSYFKu(ctx)
|
|
831
840
|
}
|
|
832
841
|
|
|
833
842
|
|
|
834
843
|
|
|
835
|
-
async function
|
|
844
|
+
async function __AnJSYFKu(ctx: IContext) {
|
|
836
845
|
|
|
837
846
|
// if the engine loads faster than the license check, we need to capture the ready event here
|
|
838
847
|
let isReady = false;
|
|
839
848
|
ctx.domElement.addEventListener("ready", () => isReady = true);
|
|
840
849
|
|
|
841
|
-
await
|
|
850
|
+
await __hMqJV?.catch(() => { });
|
|
842
851
|
|
|
843
852
|
|
|
844
|
-
if (_$
|
|
845
|
-
if (
|
|
853
|
+
if (_$RTXoT() || __IBw()) return;
|
|
854
|
+
if (__zggva() === false) BqLEwlz();
|
|
846
855
|
|
|
847
856
|
// check if the engine is already ready (meaning has finished loading)
|
|
848
857
|
if (isReady) {
|
|
849
|
-
|
|
858
|
+
_hpQzUS(ctx);
|
|
850
859
|
}
|
|
851
860
|
else {
|
|
852
861
|
ctx.domElement.addEventListener("ready", () => {
|
|
853
|
-
|
|
862
|
+
_hpQzUS(ctx);
|
|
854
863
|
});
|
|
855
864
|
}
|
|
856
865
|
}
|
|
@@ -858,7 +867,7 @@ async function $BkPUwzsT(ctx: IContext) {
|
|
|
858
867
|
// const licenseElementIdentifier = "needle-license-element";
|
|
859
868
|
// const licenseDuration = 10000;
|
|
860
869
|
// const licenseDelay = 1200;
|
|
861
|
-
function
|
|
870
|
+
function _hpQzUS(ctx: IContext) {
|
|
862
871
|
|
|
863
872
|
const style = `
|
|
864
873
|
position: relative;
|
|
@@ -871,7 +880,7 @@ function __vrAZI(ctx: IContext) {
|
|
|
871
880
|
padding: 10px;
|
|
872
881
|
padding-left: 30px;
|
|
873
882
|
`;
|
|
874
|
-
if (
|
|
883
|
+
if (_$awngvTM === "edu") {
|
|
875
884
|
if (navigator.webdriver) {
|
|
876
885
|
console.log("This project is supported by Needle for Education – https://needle.tools");
|
|
877
886
|
}
|
|
@@ -928,7 +937,7 @@ function __vrAZI(ctx: IContext) {
|
|
|
928
937
|
}
|
|
929
938
|
}, 1000);
|
|
930
939
|
|
|
931
|
-
if (
|
|
940
|
+
if (__LoXXadh()) {
|
|
932
941
|
const removeDelay = 20_000;
|
|
933
942
|
setLicenseTimeout(ctx, () => {
|
|
934
943
|
clearInterval(interval);
|
|
@@ -937,7 +946,7 @@ function __vrAZI(ctx: IContext) {
|
|
|
937
946
|
const intervalInMinutes = 5;
|
|
938
947
|
setLicenseTimeout(ctx, () => {
|
|
939
948
|
if (ctx.domElement.parentNode)
|
|
940
|
-
|
|
949
|
+
_hpQzUS(ctx);
|
|
941
950
|
}, 1000 * 60 * intervalInMinutes)
|
|
942
951
|
}, removeDelay);
|
|
943
952
|
}
|
|
@@ -948,7 +957,7 @@ function __vrAZI(ctx: IContext) {
|
|
|
948
957
|
const base64Logo = "data:image/webp;base64,UklGRrABAABXRUJQVlA4WAoAAAAQAAAAHwAAHwAAQUxQSKEAAAARN6CmbSM4WR7vdARON11EBDq3fLiNbVtVzpMCPlKAEzsx0Y/x+Ovuv4dn0EFE/ydAvz6YggXzgh5sVgXM/zOC/4sii7qgGvB5N7hmuQYwkvazWAu1JPW41FXSHq6pnaQWvqYH18Fc0j1hO/BFTtIeSBlJi5w6qIIO7IOrwhFsB2Yxukif0FTRLpXswHR8MxbslKe9VZsn/Ub5C7YFOpqSTABWUDgg6AAAAFAGAJ0BKiAAIAA+7VyoTqmkpCI3+qgBMB2JbACdMt69DwMIQBLhkTO6XwY00UEDK6cNIDnuNibPf0EgAP7Y1myuiQHLDsF/0h5unrGh6WAbv7aegg2ZMd3uRKfT/3SJztcaujYfTvMXspfCTmYcoO6a+vhC3ss4M8uM58t4siiu59I4aOl59e9Sr6xoxYlHf2v+NnBNpJYeJf8jABQAId/PXuBkLEFkiCucgSGEcfhvajql/j3reCGl0M5/9gQWy7ayNPs+wlvIxFnNfSlfuND4CZOCyxOHhRqOmHN4ULHo3tCSrUNvgAA=";
|
|
949
958
|
|
|
950
959
|
let lastLogTime = 0;
|
|
951
|
-
async function
|
|
960
|
+
async function BqLEwlz(_logo?: string) {
|
|
952
961
|
const now = Date.now();
|
|
953
962
|
if (now - lastLogTime < 2000) return;
|
|
954
963
|
lastLogTime = now;
|
|
@@ -981,7 +990,7 @@ async function EyGW(_logo?: string) {
|
|
|
981
990
|
}
|
|
982
991
|
|
|
983
992
|
|
|
984
|
-
async function
|
|
993
|
+
async function _hfNcxBI(context: IContext) {
|
|
985
994
|
// isAllowed() now also covers cross-origin-isolated pages (where beacons can't be sent)
|
|
986
995
|
// and Do Not Track / GPC.
|
|
987
996
|
if (!Telemetry.isAllowed(context)) {
|
|
@@ -995,7 +1004,7 @@ async function _qzMSGyVj(context: IContext) {
|
|
|
995
1004
|
|
|
996
1005
|
// current url without query parameters
|
|
997
1006
|
const currentUrl = window.location.href.split("?")[0];
|
|
998
|
-
const license =
|
|
1007
|
+
const license = _$awngvTM;
|
|
999
1008
|
|
|
1000
1009
|
const beaconData = {
|
|
1001
1010
|
license,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { addDracoAndKTX2Loaders as addDracoAndKTX2LoadersGLTFProgressive, configureLoader, createLoaders, setDracoDecoderLocation, setKTX2TranscoderLocation } from '@needle-tools/gltf-progressive';
|
|
2
|
+
import { addDracoAndKTX2Loaders as addDracoAndKTX2LoadersGLTFProgressive, configureLoader, createLoaders, disposeLoaders, setDracoDecoderLocation, setKTX2TranscoderLocation } from '@needle-tools/gltf-progressive';
|
|
3
3
|
import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
|
|
4
4
|
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
5
5
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
|
|
6
6
|
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
7
7
|
|
|
8
|
-
import { Context } from "./engine_setup.js"
|
|
8
|
+
import type { Context } from "./engine_setup.js"
|
|
9
9
|
import { getParam } from "./engine_utils.js";
|
|
10
10
|
|
|
11
11
|
const debug = getParam("debugdecoders");
|
|
@@ -20,6 +20,12 @@ function ensureLoaders() {
|
|
|
20
20
|
return loaders;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** Release shared decoder workers after the last engine context is destroyed. */
|
|
24
|
+
export function disposeGLTFLoaders() {
|
|
25
|
+
disposeLoaders();
|
|
26
|
+
loaders = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
export function setDracoDecoderPath(path: string | undefined) {
|
|
24
30
|
if (path !== undefined && typeof path === "string") {
|
|
25
31
|
setDracoDecoderLocation(path);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileLoader } from "three";
|
|
2
2
|
|
|
3
3
|
import { showBalloonWarning } from "./debug/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { __zggva } from "./engine_license.js";
|
|
5
5
|
import { delay } from "./engine_utils.js";
|
|
6
6
|
import { md5AsBytes, md5Hex, sha256Base64 } from "./engine_utils_hash.js";
|
|
7
7
|
|
|
@@ -45,7 +45,7 @@ export namespace BlobStorage {
|
|
|
45
45
|
*/
|
|
46
46
|
export function canUpload(info: { filesize: number }) {
|
|
47
47
|
const sizeInMB = info.filesize / 1024 / 1024;
|
|
48
|
-
if (
|
|
48
|
+
if (__zggva()) {
|
|
49
49
|
return sizeInMB < maxSizeInMB;
|
|
50
50
|
}
|
|
51
51
|
return sizeInMB < maxFreeSizeInMB;
|
|
@@ -100,7 +100,7 @@ export namespace BlobStorage {
|
|
|
100
100
|
console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max allowed size is ${maxSizeInMB}MB`);
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
|
-
else if (!
|
|
103
|
+
else if (!__zggva() && filesizeInMB > maxFreeSizeInMB) {
|
|
104
104
|
if (opts?.silent !== true) showBalloonWarning(`File is too large for uploading. Please get a <a href=\"https://needle.tools/pricing\" target=\"_blank\">commercial license</a> to upload files larger than 5MB`);
|
|
105
105
|
console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max size is 5MB for non-commercial users. Please get a commercial license at https://needle.tools/pricing for larger files (up to 50MB)`);
|
|
106
106
|
return null;
|
|
@@ -175,6 +175,11 @@ export class SphereIntersection implements Intersection {
|
|
|
175
175
|
*/
|
|
176
176
|
export class Physics {
|
|
177
177
|
|
|
178
|
+
/** Release the shared BVH worker pool after the last engine context is destroyed. */
|
|
179
|
+
static disposeMeshBVHWorkers() {
|
|
180
|
+
NEMeshBVH.disposeWorkers();
|
|
181
|
+
}
|
|
182
|
+
|
|
178
183
|
private static _raycasting: number = 0;
|
|
179
184
|
/**
|
|
180
185
|
* Returns true if raycasting is currently in progress
|
|
@@ -738,7 +743,13 @@ namespace NEMeshBVH {
|
|
|
738
743
|
})
|
|
739
744
|
.finally(() => {
|
|
740
745
|
if (debugPhysics) console.log(">>>>> worker done", name, { hasBoundsTre: geom.boundsTree != undefined });
|
|
741
|
-
|
|
746
|
+
if (retiredWorkers.has(workerInstance)) {
|
|
747
|
+
retiredWorkers.delete(workerInstance);
|
|
748
|
+
workerInstance.dispose();
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
availableWorkers.push(workerInstance);
|
|
752
|
+
}
|
|
742
753
|
copy.dispose();
|
|
743
754
|
performance.mark("bvh.create.end");
|
|
744
755
|
performance.measure("bvh.create (worker)", "bvh.create.start", "bvh.create.end");
|
|
@@ -859,6 +870,16 @@ namespace NEMeshBVH {
|
|
|
859
870
|
const canUseWorkerSymbol = Symbol("Needle:MeshBVH-CanUseWorker");
|
|
860
871
|
const workerInstances: GenerateMeshBVHWorker[] = [];
|
|
861
872
|
const availableWorkers: GenerateMeshBVHWorker[] = [];
|
|
873
|
+
const retiredWorkers = new Set<GenerateMeshBVHWorker>();
|
|
874
|
+
|
|
875
|
+
export function disposeWorkers() {
|
|
876
|
+
for (const worker of workerInstances) {
|
|
877
|
+
if (worker.running) retiredWorkers.add(worker);
|
|
878
|
+
else worker.dispose();
|
|
879
|
+
}
|
|
880
|
+
workerInstances.length = 0;
|
|
881
|
+
availableWorkers.length = 0;
|
|
882
|
+
}
|
|
862
883
|
|
|
863
884
|
function internalSetupWorker() {
|
|
864
885
|
didSetupWorker = true;
|
|
@@ -916,6 +916,8 @@ export function removeAttributeChangeCallback(domElement: HTMLElement, name: str
|
|
|
916
916
|
arr!.splice(index, 1);
|
|
917
917
|
if (arr!.length <= 0) {
|
|
918
918
|
listeners.delete(name);
|
|
919
|
+
}
|
|
920
|
+
if (listeners.size === 0) {
|
|
919
921
|
const entry = mutationObserverMap.get(domElement);
|
|
920
922
|
entry?.observer.disconnect();
|
|
921
923
|
mutationObserverMap.delete(domElement);
|
|
@@ -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 {
|
|
7
|
+
import { __zggva } 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 =
|
|
138
|
+
const canUseCustomLogo = __zggva();
|
|
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 {
|
|
5
|
+
import { __zggva } 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 &&
|
|
324
|
+
if (!this._showNeedleLogo && __zggva()) {
|
|
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 {
|
|
3
|
+
import { __zggva, $ETZ, 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";
|
|
@@ -801,8 +801,8 @@ export class NeedleMenuElement extends HTMLElementBase {
|
|
|
801
801
|
// calling this method immediately will cause an issue with vite bundling tho
|
|
802
802
|
this._licenseFrame = window.requestAnimationFrame(() => {
|
|
803
803
|
this._licenseFrame = undefined;
|
|
804
|
-
this._unsubscribeLicense =
|
|
805
|
-
if (res == true &&
|
|
804
|
+
this._unsubscribeLicense = $ETZ(res => {
|
|
805
|
+
if (res == true && __zggva() && !debugNonCommercial) {
|
|
806
806
|
let visible = this._userRequestedLogoVisible;
|
|
807
807
|
if (visible === undefined) visible = false;
|
|
808
808
|
this.___onSetLogoVisible(visible);
|
|
@@ -854,7 +854,7 @@ export class NeedleMenuElement extends HTMLElementBase {
|
|
|
854
854
|
// ensure the menu is not hidden or removed
|
|
855
855
|
const requiredParent = this?.parentNode;
|
|
856
856
|
if (this.style.display != "flex" || this.style.visibility != "visible" || this.style.opacity != "1" || requiredParent != this._domElement?.shadowRoot) {
|
|
857
|
-
if (!
|
|
857
|
+
if (!__zggva()) {
|
|
858
858
|
const change = changeEventCounter++;
|
|
859
859
|
// if a user doesn't have a local pro license *but* for development the menu is hidden then we show a warning
|
|
860
860
|
if (isLocalNetwork() && this._userRequestedMenuVisible === false) {
|
|
@@ -950,7 +950,7 @@ export class NeedleMenuElement extends HTMLElementBase {
|
|
|
950
950
|
showNeedleLogo(visible: boolean) {
|
|
951
951
|
this._userRequestedLogoVisible = visible;
|
|
952
952
|
if (!visible) {
|
|
953
|
-
if (!
|
|
953
|
+
if (!__zggva() || debugNonCommercial) {
|
|
954
954
|
console.warn("[Needle Engine] You need a commercial license to hide the Needle Engine logo in production.");
|
|
955
955
|
const localNetwork = isLocalNetwork()
|
|
956
956
|
if (!localNetwork) return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { needleLogoOnlySVG } from "../assets/index.js"
|
|
2
2
|
import { isDevEnvironment, showBalloonWarning } from "../debug/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { __zggva, _$RTXoT, __hMqJV } 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";
|
|
@@ -217,7 +217,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
|
|
220
|
-
const hasLicense = _$
|
|
220
|
+
const hasLicense = _$RTXoT();
|
|
221
221
|
if (!existing) {
|
|
222
222
|
this._loadingElement.style.position = "absolute";
|
|
223
223
|
this._loadingElement.style.width = "100%";
|
|
@@ -385,7 +385,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
|
|
|
385
385
|
|
|
386
386
|
// private async handleRuntimeLicense(loadingElement: HTMLElement) {
|
|
387
387
|
// // First check if we have a commercial license
|
|
388
|
-
// let commercialLicense =
|
|
388
|
+
// let commercialLicense = __zggva();
|
|
389
389
|
// // if it's the case then we don't need to perform a runtime check
|
|
390
390
|
// if (commercialLicense) return;
|
|
391
391
|
|
|
@@ -405,10 +405,10 @@ export class EngineLoadingView implements ILoadingViewHandler {
|
|
|
405
405
|
// loadingElement.appendChild(nonCommercialContainer);
|
|
406
406
|
|
|
407
407
|
// // Use the runtime license check
|
|
408
|
-
// if (!isDevEnvironment() &&
|
|
408
|
+
// if (!isDevEnvironment() && __hMqJV) {
|
|
409
409
|
// if (debugLicense) console.log("Waiting for runtime license check");
|
|
410
|
-
// await
|
|
411
|
-
// commercialLicense =
|
|
410
|
+
// await __hMqJV;
|
|
411
|
+
// commercialLicense = __zggva();
|
|
412
412
|
// }
|
|
413
413
|
// if (commercialLicense) return;
|
|
414
414
|
// 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 {
|
|
6
|
+
import { __zggva, Telemetry } 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";
|
|
@@ -583,7 +583,7 @@ export class NeedleEngineWebComponent extends HTMLElementBase implements INeedle
|
|
|
583
583
|
|
|
584
584
|
|
|
585
585
|
// Loading start events
|
|
586
|
-
const allowOverridingDefaultLoading =
|
|
586
|
+
const allowOverridingDefaultLoading = __zggva();
|
|
587
587
|
// default loading can be overriden by calling preventDefault in the onload start event
|
|
588
588
|
this.ensureLoadStartIsRegistered();
|
|
589
589
|
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 {
|
|
6
|
+
import { __zggva } 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 (
|
|
218
|
+
if (__zggva()) {
|
|
219
219
|
const htmlComponent = document.querySelector("needle-engine");
|
|
220
220
|
if (htmlComponent) {
|
|
221
221
|
const licenseLogo = htmlComponent.getAttribute("logo-src");
|