@needle-tools/materialx 1.4.0-next.326ed81 → 1.4.0-next.76e7a87
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 +2 -1
- package/src/materialx.js +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/materialx",
|
|
3
|
-
"version": "1.4.0-next.
|
|
3
|
+
"version": "1.4.0-next.76e7a87",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@needle-tools/engine": "4.x",
|
|
29
29
|
"@types/three": "0.169.0",
|
|
30
|
+
"dotenv": "^17.2.4",
|
|
30
31
|
"three": "npm:@needle-tools/three@^0.169.5"
|
|
31
32
|
},
|
|
32
33
|
"files": [
|
package/src/materialx.js
CHANGED
|
@@ -49,17 +49,20 @@ export async function ready() {
|
|
|
49
49
|
try {
|
|
50
50
|
|
|
51
51
|
const useRemoteUrls = true;
|
|
52
|
+
const remoteVersion = "1.4.0";
|
|
52
53
|
|
|
53
54
|
/** @type {Array<string>} */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
let urls;
|
|
56
|
+
|
|
57
|
+
if (useRemoteUrls) {
|
|
58
|
+
urls = [
|
|
59
|
+
`https://cdn.needle.tools/static/materialx/${remoteVersion}/JsMaterialXCore.wasm`,
|
|
60
|
+
`https://cdn.needle.tools/static/materialx/${remoteVersion}/JsMaterialXGenShader.wasm`,
|
|
61
|
+
`https://cdn.needle.tools/static/materialx/${remoteVersion}/JsMaterialXGenShader.data.txt`,
|
|
62
|
+
];
|
|
63
|
+
} else {
|
|
64
|
+
// For local paths, import the files as assets so Vite copies them to the dist folder
|
|
65
|
+
urls = await Promise.all([
|
|
63
66
|
/** @ts-ignore */
|
|
64
67
|
import( /* @vite-ignore */ `../bin/JsMaterialXCore.wasm?url`).then(m => m.default || m),
|
|
65
68
|
/** @ts-ignore */
|
|
@@ -67,6 +70,7 @@ export async function ready() {
|
|
|
67
70
|
/** @ts-ignore */
|
|
68
71
|
import( /* @vite-ignore */ `../bin/JsMaterialXGenShader.data.txt?url`).then(m => m.default || m),
|
|
69
72
|
]);
|
|
73
|
+
}
|
|
70
74
|
const [JsMaterialXCore, JsMaterialXGenShader, JsMaterialXGenShader_data] = urls;
|
|
71
75
|
|
|
72
76
|
const module = await MaterialX({
|