@needle-tools/engine 4.7.4 → 4.8.0-alpha
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/dist/gltf-progressive-VTcU5sMu.min.js +8 -0
- package/dist/gltf-progressive-VXeY4K8o.js +1370 -0
- package/dist/gltf-progressive-_-uQwSK8.umd.cjs +8 -0
- package/dist/loader.worker-D5fjeWJO.js +27 -0
- package/dist/needle-engine.bundle-3y1KBFjI.js +42600 -0
- package/dist/needle-engine.bundle-D5cg00Gf.min.js +1607 -0
- package/dist/needle-engine.bundle-DQ3d-G3Q.umd.cjs +1607 -0
- package/dist/needle-engine.d.ts +15 -15
- package/dist/needle-engine.js +591 -592
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-BzY0H7ry.min.js → postprocessing-ChsrvDkI.min.js} +54 -54
- package/dist/{postprocessing-vKBVFpSz.js → postprocessing-DElbMQgB.js} +479 -483
- package/dist/{postprocessing-Dw2OCMp4.umd.cjs → postprocessing-DtxaELce.umd.cjs} +66 -66
- package/dist/{three-examples-DUcCNw9s.umd.cjs → three-examples-BhQvv1B9.umd.cjs} +11 -11
- package/dist/{three-examples-tvuhV8Ne.js → three-examples-CM6Iip03.js} +23 -27
- package/dist/{three-examples-BMOhDaYR.min.js → three-examples-D2zemuAM.min.js} +12 -12
- package/dist/{three-mesh-ui-CxuWt7m-.js → three-mesh-ui-D6Mz5Yl7.js} +799 -810
- package/dist/three-mesh-ui-DWcMuyQ_.min.js +406 -0
- package/dist/three-mesh-ui-tt0buEDC.umd.cjs +406 -0
- package/dist/{vendor-BmYIgaS1.js → vendor-ClB-U1Hn.js} +10 -10
- package/dist/{vendor-Cavtu3CP.umd.cjs → vendor-bOWOWClg.umd.cjs} +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +8 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/package.json +4 -4
- package/plugins/vite/dependencies.js +28 -19
- package/plugins/vite/dependency-watcher.js +6 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +14 -0
- package/dist/gltf-progressive-Bgh1c4Fd.js +0 -1224
- package/dist/gltf-progressive-D6f5talj.min.js +0 -8
- package/dist/gltf-progressive-otA_hxSA.umd.cjs +0 -8
- package/dist/needle-engine.bundle-Bb6xVcZE.min.js +0 -1607
- package/dist/needle-engine.bundle-BldBPoPh.js +0 -43846
- package/dist/needle-engine.bundle-ByrSH-zp.umd.cjs +0 -1607
- package/dist/three-mesh-ui-B3p3gyUz.min.js +0 -406
- package/dist/three-mesh-ui-CQiIQIlA.umd.cjs +0 -406
|
@@ -27,32 +27,41 @@ export const needleDependencies = (command, config, userSettings) => {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
const excludeDependencies = [
|
|
31
|
+
"three-mesh-bvh",
|
|
32
|
+
"@needle-tools/gltf-progressive"
|
|
33
|
+
]
|
|
34
|
+
|
|
30
35
|
/**
|
|
31
36
|
* @param {import('vite').UserConfig} config
|
|
32
37
|
*/
|
|
33
38
|
function handleOptimizeDeps(config) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
else {
|
|
38
|
-
if (!config.optimizeDeps) {
|
|
39
|
-
config.optimizeDeps = {};
|
|
39
|
+
excludeDependencies.forEach(dep => {
|
|
40
|
+
if (config.optimizeDeps?.include?.includes(dep)) {
|
|
41
|
+
console.log(`[needle-dependencies] ${dep} is included in the optimizeDeps.include array. This may cause issues with the worker import.`);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
config.optimizeDeps
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
else {
|
|
44
|
+
if (!config.optimizeDeps) {
|
|
45
|
+
config.optimizeDeps = {};
|
|
46
|
+
}
|
|
47
|
+
if (!config.optimizeDeps.exclude) {
|
|
48
|
+
config.optimizeDeps.exclude = [];
|
|
49
|
+
}
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
config.
|
|
51
|
+
// This needs to be excluded from optimization because otherwise the worker import fails
|
|
52
|
+
// three-mesh-bvh/src/workers/generateMeshBVH.worker.js?worker
|
|
53
|
+
// same for gltf-progressive
|
|
54
|
+
console.log(`[needle-dependencies] Adding ${dep} to the optimizeDeps.exclude array to support workers.`);
|
|
55
|
+
config.optimizeDeps.exclude.push(dep);
|
|
56
|
+
|
|
57
|
+
if (!config.server) config.server = {};
|
|
58
|
+
if (!config.server.fs) config.server.fs = {};
|
|
59
|
+
if (config.server.fs.strict === undefined) {
|
|
60
|
+
// we need to disable strictness to allow importing the worker from three-mesh-bvh node_modules in our GenerateMeshBVHWorker.js file
|
|
61
|
+
config.server.fs.strict = false;
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
|
-
}
|
|
64
|
+
});
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
/**
|
|
@@ -169,12 +169,17 @@ function testIfInstallIsRequired(projectDir, packageJson) {
|
|
|
169
169
|
expectedVersion === "alpha" ||
|
|
170
170
|
expectedVersion === "canary" ||
|
|
171
171
|
expectedVersion === "experimental";
|
|
172
|
+
// We can not automatically install dependencies with "4" or "4.6" as a version
|
|
173
|
+
// const isFullSemver = expectedVersion.match(/^\d+\.\d+\.\d+(-\w+)?(\.\d+)?$/);
|
|
172
174
|
if (!isRange && !isTagName) {
|
|
173
175
|
const packageJsonPath = path.join(depPath, "package.json");
|
|
174
176
|
/** @type {String} */
|
|
175
177
|
const installedVersion = JSON.parse(readFileSync(packageJsonPath, "utf8")).version;
|
|
178
|
+
let versionToCompare = expectedVersion.split("@").pop();
|
|
179
|
+
while (versionToCompare?.startsWith("^")) versionToCompare = versionToCompare.substring(1);
|
|
176
180
|
// fix check for cases where the version contains a alias e.g. npm:three@0.160.3
|
|
177
|
-
|
|
181
|
+
const actualVersion = installedVersion.split("@").pop();
|
|
182
|
+
if (actualVersion && versionToCompare && versionToCompare.trimEnd().startsWith(actualVersion.trim()) == false) {
|
|
178
183
|
log(`Dependency ${key} is installed but version is not the right one. Expected \"${expectedVersion}/" but got \"${installedVersion}\"`)
|
|
179
184
|
return true;
|
|
180
185
|
}
|
|
@@ -100,6 +100,8 @@ export class PostProcessingHandler {
|
|
|
100
100
|
if (context.composer === this._composer) {
|
|
101
101
|
context.composer = null;
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
this.handleDevicePixelRatio();
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
dispose() {
|
|
@@ -476,6 +478,11 @@ export class PostProcessingHandler {
|
|
|
476
478
|
|
|
477
479
|
}
|
|
478
480
|
|
|
481
|
+
|
|
482
|
+
this.handleDevicePixelRatio();
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
479
486
|
// DEBUG LAND BELOW
|
|
480
487
|
if (debug) console.log("[PostProcessing] Passes →", [...composer.passes], "\n---------------------------------\n• " + composer.passes.map(i => i.name || (i.constructor.name + "*")).join("\n• ") + "\n");
|
|
481
488
|
if (debug) this._onCreateEffectsDebug(this._composer!, cam);
|
|
@@ -497,6 +504,13 @@ export class PostProcessingHandler {
|
|
|
497
504
|
}
|
|
498
505
|
|
|
499
506
|
|
|
507
|
+
private handleDevicePixelRatio() {
|
|
508
|
+
// Keep user device pixel ratio (if any) https://linear.app/needle/issue/NE-6661
|
|
509
|
+
if (typeof this.context.devicePixelRatio === "number") {
|
|
510
|
+
this.context.requestSizeUpdate();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
500
514
|
|
|
501
515
|
private _menuEntry: HTMLSelectElement | null = null;
|
|
502
516
|
private _passIndices: number[] | null = null;
|