@needle-tools/engine 4.16.5 → 4.17.0-next.52e0e32
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 +4 -0
- package/dist/gltf-progressive-BJ9OrddA.js +28272 -0
- package/dist/gltf-progressive-Ck_bXBr_.umd.cjs +4022 -0
- package/dist/gltf-progressive-CqZYu6Hx.min.js +4022 -0
- package/dist/loader.worker-CCrD-Ycm.js +3 -0
- package/dist/{materialx-Dk-cjpFv.umd.cjs → materialx-C3cdjbh7.umd.cjs} +1 -1
- package/dist/{materialx-BgYphGV9.js → materialx-DQ6OMWe8.js} +6 -7
- package/dist/{materialx-bmTetdSz.min.js → materialx-DwkZECrV.min.js} +1 -1
- package/dist/{needle-engine.bundle-D7PAIzue.umd.cjs → needle-engine.bundle-BVYLwU3k.umd.cjs} +150 -150
- package/dist/{needle-engine.bundle-Cndz6kVg.min.js → needle-engine.bundle-BrDer0-s.min.js} +121 -121
- package/dist/{needle-engine.bundle-_FYakfzP.js → needle-engine.bundle-cGFD3FPS.js} +2456 -2495
- package/dist/needle-engine.d.ts +102 -193
- package/dist/needle-engine.js +3 -3
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/three-examples.js +3294 -4643
- package/dist/three-examples.min.js +13 -47
- package/dist/three-examples.umd.cjs +12 -46
- package/dist/three.js +24892 -15999
- package/dist/three.min.js +214 -214
- package/dist/three.umd.cjs +208 -208
- package/dist/{vendor-DZ45lcA8.min.js → vendor-BPp9F5vR.min.js} +19 -19
- package/dist/{vendor-BsRxp-FT.js → vendor-CQMI3jTS.js} +862 -901
- package/dist/{vendor-BwxpsdCm.umd.cjs → vendor-CipoooTV.umd.cjs} +20 -20
- package/lib/engine/engine_application.d.ts +9 -0
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_feature_flags.d.ts +3 -3
- package/lib/engine/engine_feature_flags.js +3 -5
- package/lib/engine/engine_feature_flags.js.map +1 -1
- package/lib/engine/engine_modules.d.ts +26 -30
- package/lib/engine/engine_modules.js +32 -103
- package/lib/engine/engine_modules.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +57 -144
- package/lib/engine/webcomponents/needle-engine.js +1 -10
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/package.json +4 -2
- package/plugins/next/meshbvhworker-import.cjs +40 -0
- package/plugins/next/next.js +34 -4
- package/plugins/vite/alias.d.ts +1 -1
- package/plugins/vite/alias.js +87 -82
- package/plugins/vite/build-pipeline.js +4 -3
- package/plugins/vite/dependencies.js +7 -5
- package/plugins/vite/drop.js +6 -8
- package/plugins/vite/editor-connection.js +2 -1
- package/plugins/vite/poster.js +2 -1
- package/plugins/vite/reload.js +7 -2
- package/plugins/vite/transform-codegen.js +6 -2
- package/src/engine/engine_application.ts +10 -0
- package/src/engine/engine_feature_flags.ts +3 -7
- package/src/engine/engine_modules.ts +39 -101
- package/src/engine/webcomponents/needle-engine.ts +59 -189
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/dist/gltf-progressive-BacJPTD6.umd.cjs +0 -10
- package/dist/gltf-progressive-BmXoz_HR.min.js +0 -10
- package/dist/gltf-progressive-CzxjNmG6.js +0 -1537
- package/dist/loader.worker-BqODMeeW.js +0 -23
- package/plugins/next/meshbvhworker.cjs +0 -19
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { Context } from "./engine_setup.js";
|
|
2
|
+
declare global {
|
|
3
|
+
interface UserActivation {
|
|
4
|
+
readonly hasBeenActive: boolean;
|
|
5
|
+
readonly isActive: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface Navigator {
|
|
8
|
+
readonly userActivation: UserActivation;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
2
11
|
export declare enum ApplicationEvents {
|
|
3
12
|
Visible = "application-visible",
|
|
4
13
|
Hidden = "application-hidden",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine_application.js","sourceRoot":"","sources":["../../src/engine/engine_application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"engine_application.js","sourceRoot":"","sources":["../../src/engine/engine_application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAapD,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,oDAA+B,CAAA;IAC/B,kDAA6B,CAAA;IAC7B,4DAAuC,CAAA;AAC3C,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED,IAAI,yBAAyB,GAAG,KAAK,CAAC;AACtC,MAAM,wBAAwB,GAAe,EAAE,CAAC;AAChD;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IACzC,IAAI,yBAAyB;QAAE,OAAO;IACtC,IAAI,gBAAgB,EAAE;QAAE,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC/G,yBAAyB,GAAG,IAAI,CAAC;IACjC,MAAM,IAAI,GAAG,CAAC,GAAG,wBAAwB,CAAC,CAAC;IAC3C,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AACD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;AACtE,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;AACtE,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC;AAClE,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;AACtE,QAAQ,CAAC,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|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
export declare const NEEDLE_ENGINE_FEATURE_FLAGS: {
|
|
2
|
+
experimentalSmartHierarchyUpdate: boolean;
|
|
3
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
NEEDLE_ENGINE_FEATURE_FLAGS.experimentalSmartHierarchyUpdate = false;
|
|
5
|
-
})(NEEDLE_ENGINE_FEATURE_FLAGS || (NEEDLE_ENGINE_FEATURE_FLAGS = {}));
|
|
1
|
+
export const NEEDLE_ENGINE_FEATURE_FLAGS = {
|
|
2
|
+
experimentalSmartHierarchyUpdate: false,
|
|
3
|
+
};
|
|
6
4
|
//# sourceMappingURL=engine_feature_flags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine_feature_flags.js","sourceRoot":"","sources":["../../src/engine/engine_feature_flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine_feature_flags.js","sourceRoot":"","sources":["../../src/engine/engine_feature_flags.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACvC,gCAAgC,EAAE,KAAK;CAC1C,CAAC"}
|
|
@@ -5,41 +5,37 @@
|
|
|
5
5
|
*
|
|
6
6
|
* If a module is already loaded it's also available in the `MODULE` variable.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let MAYBEMODULE: TYPE | null;
|
|
8
|
+
export declare const MODULES: {
|
|
9
|
+
MaterialX: {
|
|
10
|
+
MODULE: typeof import("@needle-tools/materialx");
|
|
11
|
+
MAYBEMODULE: typeof import("@needle-tools/materialx") | null;
|
|
13
12
|
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
14
|
-
|
|
13
|
+
ready(): Promise<typeof import("@needle-tools/materialx")>;
|
|
15
14
|
/** Load the module */
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let MAYBEMODULE: TYPE | null;
|
|
15
|
+
load(): Promise<typeof import("@needle-tools/materialx")>;
|
|
16
|
+
};
|
|
17
|
+
RAPIER_PHYSICS: {
|
|
18
|
+
MODULE: typeof import("@dimforge/rapier3d-compat");
|
|
19
|
+
MAYBEMODULE: typeof import("@dimforge/rapier3d-compat") | null;
|
|
22
20
|
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
23
|
-
|
|
21
|
+
ready(): Promise<typeof import("@dimforge/rapier3d-compat")>;
|
|
24
22
|
/** Load the module */
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
let MAYBEMODULE: TYPE | null;
|
|
23
|
+
load(): Promise<typeof import("@dimforge/rapier3d-compat")>;
|
|
24
|
+
};
|
|
25
|
+
POSTPROCESSING: {
|
|
26
|
+
MODULE: typeof import("postprocessing");
|
|
27
|
+
MAYBEMODULE: typeof import("postprocessing") | null;
|
|
31
28
|
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
32
|
-
|
|
29
|
+
ready(): Promise<typeof import("postprocessing")>;
|
|
33
30
|
/** Load the module */
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let MAYBEMODULE: TYPE | null;
|
|
31
|
+
load(): Promise<typeof import("postprocessing")>;
|
|
32
|
+
};
|
|
33
|
+
POSTPROCESSING_AO: {
|
|
34
|
+
MODULE: any;
|
|
35
|
+
MAYBEMODULE: any;
|
|
40
36
|
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
41
|
-
|
|
37
|
+
ready(): Promise<any>;
|
|
42
38
|
/** Load the module */
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
39
|
+
load(): Promise<any>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
function createModule(loader) {
|
|
2
|
+
const callbacks = [];
|
|
3
|
+
const mod = {
|
|
4
|
+
MODULE: undefined,
|
|
5
|
+
MAYBEMODULE: null,
|
|
6
|
+
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
7
|
+
ready() {
|
|
8
|
+
if (mod.MODULE)
|
|
9
|
+
return Promise.resolve(mod.MODULE);
|
|
10
|
+
return new Promise(resolve => { callbacks.push(resolve); });
|
|
11
|
+
},
|
|
12
|
+
/** Load the module */
|
|
13
|
+
async load() {
|
|
14
|
+
if (mod.MODULE)
|
|
15
|
+
return mod.MODULE;
|
|
16
|
+
const module = await loader();
|
|
17
|
+
mod.MODULE = module;
|
|
18
|
+
mod.MAYBEMODULE = module;
|
|
19
|
+
for (const cb of callbacks)
|
|
20
|
+
cb(module);
|
|
21
|
+
callbacks.length = 0;
|
|
22
|
+
return module;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return mod;
|
|
26
|
+
}
|
|
1
27
|
/**
|
|
2
28
|
* External dependencies that are loaded on demand either by the engine automatically when needed or they can be loaded manually by calling the `load` function.
|
|
3
29
|
*
|
|
@@ -5,107 +31,10 @@
|
|
|
5
31
|
*
|
|
6
32
|
* If a module is already loaded it's also available in the `MODULE` variable.
|
|
7
33
|
*/
|
|
8
|
-
export
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
15
|
-
function ready() {
|
|
16
|
-
if (MaterialX.MODULE)
|
|
17
|
-
return Promise.resolve(MaterialX.MODULE);
|
|
18
|
-
return new Promise((resolve) => { callbacks.push(resolve); });
|
|
19
|
-
}
|
|
20
|
-
MaterialX.ready = ready;
|
|
21
|
-
;
|
|
22
|
-
/** Load the module */
|
|
23
|
-
async function load() {
|
|
24
|
-
if (MaterialX.MODULE)
|
|
25
|
-
return MaterialX.MODULE;
|
|
26
|
-
const module = await import("@needle-tools/materialx");
|
|
27
|
-
MaterialX.MODULE = module;
|
|
28
|
-
MaterialX.MAYBEMODULE = module;
|
|
29
|
-
callbacks.forEach((callback) => callback(module));
|
|
30
|
-
callbacks.length = 0;
|
|
31
|
-
return module;
|
|
32
|
-
}
|
|
33
|
-
MaterialX.load = load;
|
|
34
|
-
})(MaterialX = MODULES.MaterialX || (MODULES.MaterialX = {}));
|
|
35
|
-
let RAPIER_PHYSICS;
|
|
36
|
-
(function (RAPIER_PHYSICS) {
|
|
37
|
-
RAPIER_PHYSICS.MAYBEMODULE = null;
|
|
38
|
-
const callbacks = [];
|
|
39
|
-
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
40
|
-
function ready() {
|
|
41
|
-
if (RAPIER_PHYSICS.MODULE)
|
|
42
|
-
return Promise.resolve(RAPIER_PHYSICS.MODULE);
|
|
43
|
-
return new Promise((resolve) => { callbacks.push(resolve); });
|
|
44
|
-
}
|
|
45
|
-
RAPIER_PHYSICS.ready = ready;
|
|
46
|
-
;
|
|
47
|
-
/** Load the module */
|
|
48
|
-
async function load() {
|
|
49
|
-
if (RAPIER_PHYSICS.MODULE)
|
|
50
|
-
return RAPIER_PHYSICS.MODULE;
|
|
51
|
-
const module = await import("@dimforge/rapier3d-compat");
|
|
52
|
-
RAPIER_PHYSICS.MODULE = module;
|
|
53
|
-
RAPIER_PHYSICS.MAYBEMODULE = module;
|
|
54
|
-
callbacks.forEach((callback) => callback(module));
|
|
55
|
-
callbacks.length = 0;
|
|
56
|
-
return module;
|
|
57
|
-
}
|
|
58
|
-
RAPIER_PHYSICS.load = load;
|
|
59
|
-
})(RAPIER_PHYSICS = MODULES.RAPIER_PHYSICS || (MODULES.RAPIER_PHYSICS = {}));
|
|
60
|
-
let POSTPROCESSING;
|
|
61
|
-
(function (POSTPROCESSING) {
|
|
62
|
-
POSTPROCESSING.MAYBEMODULE = null;
|
|
63
|
-
const callbacks = [];
|
|
64
|
-
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
65
|
-
function ready() {
|
|
66
|
-
if (POSTPROCESSING.MODULE)
|
|
67
|
-
return Promise.resolve(POSTPROCESSING.MODULE);
|
|
68
|
-
return new Promise((resolve) => { callbacks.push(resolve); });
|
|
69
|
-
}
|
|
70
|
-
POSTPROCESSING.ready = ready;
|
|
71
|
-
;
|
|
72
|
-
/** Load the module */
|
|
73
|
-
async function load() {
|
|
74
|
-
if (POSTPROCESSING.MODULE)
|
|
75
|
-
return POSTPROCESSING.MODULE;
|
|
76
|
-
const module = await import("postprocessing");
|
|
77
|
-
POSTPROCESSING.MODULE = module;
|
|
78
|
-
POSTPROCESSING.MAYBEMODULE = module;
|
|
79
|
-
callbacks.forEach((callback) => callback(module));
|
|
80
|
-
callbacks.length = 0;
|
|
81
|
-
return module;
|
|
82
|
-
}
|
|
83
|
-
POSTPROCESSING.load = load;
|
|
84
|
-
})(POSTPROCESSING = MODULES.POSTPROCESSING || (MODULES.POSTPROCESSING = {}));
|
|
85
|
-
let POSTPROCESSING_AO;
|
|
86
|
-
(function (POSTPROCESSING_AO) {
|
|
87
|
-
POSTPROCESSING_AO.MAYBEMODULE = null;
|
|
88
|
-
const callbacks = [];
|
|
89
|
-
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
90
|
-
function ready() {
|
|
91
|
-
if (POSTPROCESSING_AO.MODULE)
|
|
92
|
-
return Promise.resolve(POSTPROCESSING_AO.MODULE);
|
|
93
|
-
return new Promise((resolve) => { callbacks.push(resolve); });
|
|
94
|
-
}
|
|
95
|
-
POSTPROCESSING_AO.ready = ready;
|
|
96
|
-
;
|
|
97
|
-
/** Load the module */
|
|
98
|
-
async function load() {
|
|
99
|
-
if (POSTPROCESSING_AO.MODULE)
|
|
100
|
-
return POSTPROCESSING_AO.MODULE;
|
|
101
|
-
const module = await import("n8ao");
|
|
102
|
-
POSTPROCESSING_AO.MODULE = module;
|
|
103
|
-
POSTPROCESSING_AO.MAYBEMODULE = module;
|
|
104
|
-
callbacks.forEach((callback) => callback(module));
|
|
105
|
-
callbacks.length = 0;
|
|
106
|
-
return module;
|
|
107
|
-
}
|
|
108
|
-
POSTPROCESSING_AO.load = load;
|
|
109
|
-
})(POSTPROCESSING_AO = MODULES.POSTPROCESSING_AO || (MODULES.POSTPROCESSING_AO = {}));
|
|
110
|
-
})(MODULES || (MODULES = {}));
|
|
34
|
+
export const MODULES = {
|
|
35
|
+
MaterialX: createModule(() => import("@needle-tools/materialx")),
|
|
36
|
+
RAPIER_PHYSICS: createModule(() => import("@dimforge/rapier3d-compat")),
|
|
37
|
+
POSTPROCESSING: createModule(() => import("postprocessing")),
|
|
38
|
+
POSTPROCESSING_AO: createModule(() => import("n8ao")),
|
|
39
|
+
};
|
|
111
40
|
//# sourceMappingURL=engine_modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine_modules.js","sourceRoot":"","sources":["../../src/engine/engine_modules.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"engine_modules.js","sourceRoot":"","sources":["../../src/engine/engine_modules.ts"],"names":[],"mappings":"AACA,SAAS,YAAY,CAAI,MAAwB;IAC7C,MAAM,SAAS,GAA+B,EAAE,CAAC;IACjD,MAAM,GAAG,GAAG;QACR,MAAM,EAAE,SAAyB;QACjC,WAAW,EAAE,IAAgB;QAC7B,gEAAgE;QAChE,KAAK;YACD,IAAI,GAAG,CAAC,MAAM;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;QACD,sBAAsB;QACtB,KAAK,CAAC,IAAI;YACN,IAAI,GAAG,CAAC,MAAM;gBAAE,OAAO,GAAG,CAAC,MAAM,CAAC;YAClC,MAAM,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;YAC9B,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;YACpB,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC;YACzB,KAAK,MAAM,EAAE,IAAI,SAAS;gBAAE,EAAE,CAAC,MAAM,CAAC,CAAC;YACvC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;YACrB,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;IACF,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,SAAS,EAAE,YAAY,CACnB,GAAG,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAC1C;IACD,cAAc,EAAE,YAAY,CACxB,GAAG,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAC5C;IACD,cAAc,EAAE,YAAY,CACxB,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CACjC;IACD,iBAAiB,EAAE,YAAY,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CACvB;CACJ,CAAC"}
|
|
@@ -6,6 +6,57 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
|
|
9
|
+
/** Supported attributes for the `<needle-engine>` web component. */
|
|
10
|
+
export interface NeedleEngineAttributes {
|
|
11
|
+
/** Change which model gets loaded. */
|
|
12
|
+
'src': string;
|
|
13
|
+
/** String attached to the context for caching/identification. */
|
|
14
|
+
'hash': string;
|
|
15
|
+
/** Set to automatically add OrbitControls to the loaded scene. */
|
|
16
|
+
'camera-controls': string;
|
|
17
|
+
/** Override the default draco decoder path location. */
|
|
18
|
+
'dracoDecoderPath': string;
|
|
19
|
+
/** Override the default draco library type. */
|
|
20
|
+
'dracoDecoderType': 'wasm' | 'js';
|
|
21
|
+
/** Override the default KTX2 transcoder/decoder path. */
|
|
22
|
+
'ktx2DecoderPath': string;
|
|
23
|
+
/** Prevent context from being disposed when element is removed from DOM. */
|
|
24
|
+
'keep-alive': 'true' | 'false';
|
|
25
|
+
/** Loading overlay style. */
|
|
26
|
+
'loading-style': 'dark' | 'light' | 'auto';
|
|
27
|
+
/** URL to .exr, .hdr, .png, .jpg to be used as skybox. */
|
|
28
|
+
'background-image': string;
|
|
29
|
+
/** Rotation of the background image in degrees. */
|
|
30
|
+
'background-rotation': string | number;
|
|
31
|
+
/** URL to .exr, .hdr, .png, .jpg to be used for lighting. */
|
|
32
|
+
'environment-image': string;
|
|
33
|
+
/** Intensity multiplier for environment lighting. */
|
|
34
|
+
'environment-intensity': string;
|
|
35
|
+
/** Blurs the background image. 0 (sharp) to 1 (fully blurred). */
|
|
36
|
+
'background-blurriness': string;
|
|
37
|
+
/** Intensity multiplier for the background image. */
|
|
38
|
+
'background-intensity': string;
|
|
39
|
+
/** CSS background color if no skybox/background image is provided. */
|
|
40
|
+
'background-color': string;
|
|
41
|
+
/** Enable/disable renderer canvas transparency. */
|
|
42
|
+
'transparent': 'true' | 'false';
|
|
43
|
+
/** Enable/disable contact shadows. */
|
|
44
|
+
'contact-shadows': 'true' | 'false';
|
|
45
|
+
/** Tonemapping mode. */
|
|
46
|
+
'tone-mapping': TonemappingAttributeOptions;
|
|
47
|
+
/** Exposure multiplier for tonemapping. */
|
|
48
|
+
'tone-mapping-exposure': string;
|
|
49
|
+
/** CSS selector or HTMLElement for camera focus. */
|
|
50
|
+
'focus-rect': string | HTMLElement;
|
|
51
|
+
/** Allow pointer events to pass through transparent parts. */
|
|
52
|
+
'clickthrough': 'true' | 'false';
|
|
53
|
+
/** Automatically fit model into camera view on load. */
|
|
54
|
+
'auto-fit': 'true' | 'false';
|
|
55
|
+
/** Auto-rotate model until user interacts. */
|
|
56
|
+
'auto-rotate': 'true' | 'false';
|
|
57
|
+
/** Play animations automatically on scene load. */
|
|
58
|
+
'autoplay': 'true' | 'false';
|
|
59
|
+
}
|
|
9
60
|
/**
|
|
10
61
|
* The `<needle-engine>` web component. See {@link NeedleEngineAttributes} attributes for supported attributes
|
|
11
62
|
* The web component creates and manages a Needle Engine context, which is responsible for rendering a 3D scene using threejs.
|
|
@@ -133,150 +184,12 @@ export declare class NeedleEngineWebComponent extends HTMLElement implements INe
|
|
|
133
184
|
private setupElementsForMode;
|
|
134
185
|
private foreachHtmlElement;
|
|
135
186
|
private onBeforeBeginLoading;
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
setAttribute(name: 'hash', value: string): void;
|
|
143
|
-
/** Set to automatically add {@link OrbitControls} to the loaded scene */
|
|
144
|
-
setAttribute(name: 'camera-controls', value: string): void;
|
|
145
|
-
/** Override the default draco decoder path location. */
|
|
146
|
-
setAttribute(name: 'dracoDecoderPath', value: string): void;
|
|
147
|
-
/** Override the default draco library type. */
|
|
148
|
-
setAttribute(name: 'dracoDecoderType', value: 'wasm' | 'js'): void;
|
|
149
|
-
/** Override the default KTX2 transcoder/decoder path */
|
|
150
|
-
setAttribute(name: 'ktx2DecoderPath', value: string): void;
|
|
151
|
-
/** Prevent Needle Engine context from being disposed when the element is removed from the DOM */
|
|
152
|
-
setAttribute(name: 'keep-alive', value: 'true' | 'false'): void;
|
|
153
|
-
/** @private Public key used for licensing and feature gating. */
|
|
154
|
-
setAttribute(name: 'public-key', value: string): void;
|
|
155
|
-
/** @private Engine version string — usually set by the build/runtime. */
|
|
156
|
-
setAttribute(name: 'version', value: string): void;
|
|
157
|
-
/** URL to .exr, .hdr, .png, .jpg to be used as skybox */
|
|
158
|
-
setAttribute(name: 'background-image', value: string): void;
|
|
159
|
-
/** @private Rotation of the background image in degrees. */
|
|
160
|
-
setAttribute(name: 'background-rotation', value: string | number): void;
|
|
161
|
-
/** @deprecated Use 'environment-image' instead. */
|
|
162
|
-
setAttribute(name: 'skybox-image', value: string): void;
|
|
163
|
-
/** URL to .exr, .hdr, .png, .jpg to be used for lighting */
|
|
164
|
-
setAttribute(name: 'environment-image', value: string): void;
|
|
165
|
-
/** Intensity multiplier for environment lighting. */
|
|
166
|
-
setAttribute(name: 'environment-intensity', value: string): void;
|
|
167
|
-
/** Blurs the background image. Strength between 0 (sharp) and 1 (fully blurred). */
|
|
168
|
-
setAttribute(name: 'background-blurriness', value: string): void;
|
|
169
|
-
/** Intensity multiplier for the background image. */
|
|
170
|
-
setAttribute(name: 'background-intensity', value: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* CSS background color value to be used if no skybox or background image is provided.
|
|
173
|
-
* @example "background-color='#ff0000'" will set the background color to red.
|
|
174
|
-
*/
|
|
175
|
-
setAttribute(name: 'background-color', value: string): void;
|
|
176
|
-
/** Enable/disable renderer canvas transparency. */
|
|
177
|
-
setAttribute(name: 'transparent', value: 'true' | 'false'): void;
|
|
178
|
-
/** Enable/disable contact shadows in the rendered scene */
|
|
179
|
-
setAttribute(name: 'contact-shadows', value: 'true' | 'false'): void;
|
|
180
|
-
/** Tonemapping mode. */
|
|
181
|
-
setAttribute(name: 'tone-mapping', value: TonemappingAttributeOptions): void;
|
|
182
|
-
/** Exposure multiplier for tonemapping. */
|
|
183
|
-
setAttribute(name: 'tone-mapping-exposure', value: string): void;
|
|
184
|
-
/** Defines a CSS selector or HTMLElement where the camera should be focused on. Content will be fit into this element. */
|
|
185
|
-
setAttribute(name: 'focus-rect', value: string | HTMLElement): void;
|
|
186
|
-
/** Allow pointer events to pass through transparent parts of the content to the underlying DOM elements. */
|
|
187
|
-
setAttribute(name: 'clickthrough', value: 'true' | 'false'): void;
|
|
188
|
-
/** Automatically fits the model into the camera view on load. */
|
|
189
|
-
setAttribute(name: 'auto-fit', value: 'true' | 'false'): void;
|
|
190
|
-
/** Automatically rotates the model until a user interacts with the scene. */
|
|
191
|
-
setAttribute(name: 'auto-rotate', value: 'true' | 'false'): void;
|
|
192
|
-
/** Play animations automatically on scene load */
|
|
193
|
-
setAttribute(name: "autoplay", value: 'true' | 'false'): void;
|
|
194
|
-
/** @private Used for switching the scene in SceneSwitcher */
|
|
195
|
-
setAttribute(name: 'scene', value: string): void;
|
|
196
|
-
/** @private Experimental.*/
|
|
197
|
-
setAttribute(name: 'loading-blur', value: 'true' | 'false'): void;
|
|
198
|
-
/** @private */
|
|
199
|
-
setAttribute(name: 'alias', value: string): void;
|
|
200
|
-
/** @private */
|
|
201
|
-
setAttribute(name: 'hide-loading-overlay', value: 'true' | 'false'): void;
|
|
202
|
-
/** @private */
|
|
203
|
-
setAttribute(name: 'no-telemetry', value: 'true' | 'false'): void;
|
|
204
|
-
/** Generic typed setter for known Needle Engine attributes */
|
|
205
|
-
setAttribute(qualifiedName: ({} & string), value: string): void;
|
|
206
|
-
/** Change which model gets loaded. This will trigger a reload of the scene.
|
|
207
|
-
* @example src="path/to/scene.glb"
|
|
208
|
-
* @example src="[./path/scene1.glb, myOtherScene.gltf]"
|
|
209
|
-
* */
|
|
210
|
-
getAttribute(name: 'src'): string | null;
|
|
211
|
-
/** Optional. String attached to the context for caching/identification. */
|
|
212
|
-
getAttribute(name: 'hash'): string | null;
|
|
213
|
-
/** Set to automatically add {@link OrbitControls} to the loaded scene */
|
|
214
|
-
getAttribute(name: 'camera-controls'): "true" | "false" | "none" | null;
|
|
215
|
-
/** Override the default draco decoder path location. */
|
|
216
|
-
getAttribute(name: 'dracoDecoderPath'): string | null;
|
|
217
|
-
/** Override the default draco library type. */
|
|
218
|
-
getAttribute(name: 'dracoDecoderType'): "wasm" | "js" | null;
|
|
219
|
-
/** Override the default KTX2 transcoder/decoder path */
|
|
220
|
-
getAttribute(name: 'ktx2DecoderPath'): string | null;
|
|
221
|
-
/** Prevent Needle Engine context from being disposed when the element is removed from the DOM */
|
|
222
|
-
getAttribute(name: 'keep-alive'): string | null;
|
|
223
|
-
/** @private Public key used for licensing and feature gating. */
|
|
224
|
-
getAttribute(name: 'public-key'): string | null;
|
|
225
|
-
/** @private Engine version string — usually set by the build/runtime. */
|
|
226
|
-
getAttribute(name: 'version'): string | null;
|
|
227
|
-
/** URL to .exr, .hdr, .png, .jpg to be used as skybox */
|
|
228
|
-
getAttribute(name: 'background-image'): string | null;
|
|
229
|
-
/** @private Rotation of the background image in degrees. */
|
|
230
|
-
getAttribute(name: 'background-rotation'): string | null;
|
|
231
|
-
/** URL to .exr, .hdr, .png, .jpg to be used for lighting */
|
|
232
|
-
getAttribute(name: 'environment-image'): string | null;
|
|
233
|
-
/** Intensity multiplier for environment lighting. */
|
|
234
|
-
getAttribute(name: 'environment-intensity'): string | null;
|
|
235
|
-
/** Blurs the background image. Strength between 0 (sharp) and 1 (fully blurred). */
|
|
236
|
-
getAttribute(name: 'background-blurriness'): string | null;
|
|
237
|
-
/** Intensity multiplier for the background image. */
|
|
238
|
-
getAttribute(name: 'background-intensity'): string | null;
|
|
239
|
-
/**
|
|
240
|
-
* CSS background color value to be used if no skybox or background image is provided.
|
|
241
|
-
* @example "background-color='#ff0000'" will set the background color to red.
|
|
242
|
-
*/
|
|
243
|
-
getAttribute(name: 'background-color'): string | null;
|
|
244
|
-
/** Enable/disable renderer canvas transparency. */
|
|
245
|
-
getAttribute(name: 'transparent'): string | null;
|
|
246
|
-
/** Enable/disable contact shadows in the rendered scene */
|
|
247
|
-
getAttribute(name: 'contact-shadows'): string | null;
|
|
248
|
-
/** @deprecated Use 'contact-shadows' instead. */
|
|
249
|
-
getAttribute(name: 'contactshadows'): string | null;
|
|
250
|
-
/** Tonemapping mode. */
|
|
251
|
-
getAttribute(name: 'tone-mapping'): TonemappingAttributeOptions | null;
|
|
252
|
-
/** @deprecated Use 'tone-mapping' instead. */
|
|
253
|
-
getAttribute(name: 'tonemapping'): TonemappingAttributeOptions | null;
|
|
254
|
-
/** Exposure multiplier for tonemapping. */
|
|
255
|
-
getAttribute(name: 'tone-mapping-exposure'): string | null;
|
|
256
|
-
/** Defines a CSS selector or HTMLElement where the camera should be focused on. Content will be fit into this element. */
|
|
257
|
-
getAttribute(name: 'focus-rect'): string | null;
|
|
258
|
-
/** Allow pointer events to pass through transparent parts of the content to the underlying DOM elements. */
|
|
259
|
-
getAttribute(name: 'clickthrough'): string | null;
|
|
260
|
-
/** Automatically fits the model into the camera view on load. */
|
|
261
|
-
getAttribute(name: 'auto-fit'): string | null;
|
|
262
|
-
/** @deprecated Use 'auto-fit' instead. */
|
|
263
|
-
getAttribute(name: 'autofit'): string | null;
|
|
264
|
-
/** Automatically rotates the model until a user interacts with the scene. */
|
|
265
|
-
getAttribute(name: 'auto-rotate'): string | null;
|
|
266
|
-
/** Play animations automatically on scene load */
|
|
267
|
-
getAttribute(name: "autoplay"): string | null;
|
|
268
|
-
/** @private Used for switching the scene in SceneSwitcher */
|
|
269
|
-
getAttribute(name: 'scene'): string | null;
|
|
270
|
-
/** @private Experimental.*/
|
|
271
|
-
getAttribute(name: 'loading-blur'): string | null;
|
|
272
|
-
/** @private */
|
|
273
|
-
getAttribute(name: 'alias'): string | null;
|
|
274
|
-
/** @private */
|
|
275
|
-
getAttribute(name: 'hide-loading-overlay'): string | null;
|
|
276
|
-
/** @private */
|
|
277
|
-
getAttribute(name: 'no-telemetry'): string | null;
|
|
278
|
-
/** Typed getter for known NeedleEngine attribute names; returns the typed shape declared in NeedleEngineAttributes or null. */
|
|
279
|
-
getAttribute(qualifiedName: ({} & string)): string | null;
|
|
187
|
+
/** Set a known Needle Engine attribute. See {@link NeedleEngineAttributes} for available attributes. */
|
|
188
|
+
setAttribute<K extends keyof NeedleEngineAttributes>(name: K, value: NeedleEngineAttributes[K]): void;
|
|
189
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
190
|
+
/** Get a known Needle Engine attribute. See {@link NeedleEngineAttributes} for available attributes. */
|
|
191
|
+
getAttribute<K extends keyof NeedleEngineAttributes>(qualifiedName: K): string | null;
|
|
192
|
+
getAttribute(qualifiedName: string): string | null;
|
|
280
193
|
/**
|
|
281
194
|
* Emitted when loading begins for the scene. The event is cancelable — calling `preventDefault()`
|
|
282
195
|
* will stop the default loading UI behavior, so apps can implement custom loading flows.
|
|
@@ -849,18 +849,9 @@ export class NeedleEngineWebComponent extends HTMLElement {
|
|
|
849
849
|
setKtx2TranscoderPath(customKtx2DecoderPath);
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
|
-
// The ones we're using internally:
|
|
853
|
-
/*
|
|
854
|
-
setAttribute(name: "tabindex", value: string): void;
|
|
855
|
-
*/
|
|
856
852
|
setAttribute(qualifiedName, value) {
|
|
857
|
-
super.setAttribute(qualifiedName, value);
|
|
853
|
+
super.setAttribute(qualifiedName, typeof value === "string" ? value : String(value));
|
|
858
854
|
}
|
|
859
|
-
// The ones we're using interally:
|
|
860
|
-
/*
|
|
861
|
-
getAttribute(name: "autostart"): string | null;
|
|
862
|
-
getAttribute(name: "tabindex"): string | null;
|
|
863
|
-
*/
|
|
864
855
|
getAttribute(qualifiedName) {
|
|
865
856
|
return super.getAttribute(qualifiedName);
|
|
866
857
|
}
|