@needle-tools/gltf-progressive 3.6.0-alpha.2 → 3.6.0-beta.1
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 +7 -0
- package/README.md +42 -8
- package/examples/modelviewer-multiple.html +4 -4
- package/examples/modelviewer.html +4 -4
- package/examples/offscreen/index.html +15 -0
- package/examples/offscreen/main.js +98 -0
- package/examples/react-three-fiber/index.html +2 -2
- package/examples/react-three-fiber/package-lock.json +482 -484
- package/examples/react-three-fiber/package.json +4 -4
- package/examples/react-three-fiber/src/App.tsx +76 -21
- package/examples/react-three-fiber/src/styles.css +2 -4
- package/examples/react-three-fiber/vite.config.js +2 -2
- package/examples/shared/example-utils.js +297 -0
- package/examples/shared/example.css +44 -0
- package/examples/shared/runtime.js +34 -0
- package/examples/threejs/index.html +6 -10
- package/examples/threejs/main.js +5 -23
- package/examples/webgpu/index.html +15 -0
- package/examples/webgpu/main.js +105 -0
- package/examples/worker-rendering/index.html +15 -0
- package/examples/worker-rendering/main.js +109 -0
- package/examples/worker-rendering/worker.js +166 -0
- package/gltf-progressive.js +670 -559
- package/gltf-progressive.min.js +9 -9
- package/gltf-progressive.umd.cjs +9 -9
- package/lib/extension.d.ts +6 -0
- package/lib/extension.js +85 -16
- package/lib/loaders.d.ts +1 -8
- package/lib/loaders.js +15 -2
- package/lib/lods.debug.js +1 -1
- package/lib/lods.manager.d.ts +3 -0
- package/lib/lods.manager.js +62 -18
- package/lib/utils.d.ts +1 -1
- package/lib/utils.internal.d.ts +27 -0
- package/lib/utils.internal.js +68 -25
- package/lib/version.js +1 -1
- package/lib/worker/loader.mainthread.js +6 -4
- package/package.json +8 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box3, BufferAttribute, BufferGeometry, CompressedTexture, InterleavedBuffer, InterleavedBufferAttribute, Matrix3, Sphere, Texture, Vector3 } from "three";
|
|
2
2
|
import { createLoaders, GET_LOADER_LOCATION_CONFIG } from "../loaders.js";
|
|
3
|
-
import { isMobileDevice } from "../utils.internal.js";
|
|
3
|
+
import { getTextureDimensions, isMobileDevice } from "../utils.internal.js";
|
|
4
4
|
import { debug } from "../lods.debug.js";
|
|
5
5
|
const workers = new Array();
|
|
6
6
|
let getWorkerId = 0;
|
|
@@ -51,7 +51,10 @@ class GLTFLoaderWorker {
|
|
|
51
51
|
url = URL.createObjectURL(new Blob([url]));
|
|
52
52
|
}
|
|
53
53
|
else if (!url.startsWith("blob:") && !url.startsWith("http:") && !url.startsWith("https:")) {
|
|
54
|
-
|
|
54
|
+
const base = globalThis.location?.href;
|
|
55
|
+
if (base) {
|
|
56
|
+
url = new URL(url, base).toString();
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
const options = {
|
|
57
60
|
type: "load",
|
|
@@ -152,8 +155,7 @@ function processReceivedData(data) {
|
|
|
152
155
|
let newTexture = null;
|
|
153
156
|
if (texture.isCompressedTexture) {
|
|
154
157
|
const mipmaps = texture.mipmaps;
|
|
155
|
-
const width
|
|
156
|
-
const height = texture.image?.height || texture.source?.data?.height || -1;
|
|
158
|
+
const { width, height } = getTextureDimensions(texture);
|
|
157
159
|
newTexture = new CompressedTexture(mipmaps, width, height, texture.format, texture.type, texture.mapping, texture.wrapS, texture.wrapT, texture.magFilter, texture.minFilter, texture.anisotropy, texture.colorSpace);
|
|
158
160
|
}
|
|
159
161
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-progressive",
|
|
3
|
-
"version": "3.6.0-
|
|
3
|
+
"version": "3.6.0-beta.1",
|
|
4
4
|
"description": "three.js support for loading glTF or GLB files that contain progressive loading data",
|
|
5
5
|
"homepage": "https://needle.tools",
|
|
6
6
|
"author": {
|
|
@@ -59,10 +59,13 @@
|
|
|
59
59
|
"three": ">= 0.160.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@needle-tools/engine": "^5.1.0-alpha.6",
|
|
63
|
+
"@needle-tools/three-test-matrix": "^0.1.0",
|
|
62
64
|
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
|
63
|
-
"@types/three": "0.
|
|
65
|
+
"@types/three": "0.183.1",
|
|
64
66
|
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
65
67
|
"@typescript-eslint/parser": "^6.2.0",
|
|
68
|
+
"@vitest/browser-playwright": "^4.1.8",
|
|
66
69
|
"eslint": "^8.56.0",
|
|
67
70
|
"eslint-plugin-import": "^2.29.1",
|
|
68
71
|
"eslint-plugin-no-secrets": "^0.8.9",
|
|
@@ -71,8 +74,10 @@
|
|
|
71
74
|
"eslint-plugin-xss": "^0.1.12",
|
|
72
75
|
"nodemon": "^3.1.4",
|
|
73
76
|
"npm-watch": "^0.13.0",
|
|
77
|
+
"playwright": "^1.60.0",
|
|
74
78
|
"three": ">= 0.160.0",
|
|
75
|
-
"vite": "7"
|
|
79
|
+
"vite": "7",
|
|
80
|
+
"vitest": "^4.1.8"
|
|
76
81
|
},
|
|
77
82
|
"types": "./lib/index.d.ts"
|
|
78
83
|
}
|