@needle-tools/materialx 1.0.0-next.85f6ffd → 1.0.0-next.c8c3181

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 CHANGED
@@ -1,17 +1,24 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.0.0-next.85f6ffd",
3
+ "version": "1.0.0-next.c8c3181",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
- "dependencies": {},
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.ts",
9
+ "require": "./index.js"
10
+ },
11
+ "./package.json": "./package.json"
12
+ },
7
13
  "peerDependencies": {
8
14
  "@needle-tools/engine": "4.x",
9
15
  "three": "npm:@needle-tools/three@^0.169.5"
10
16
  },
11
17
  "devDependencies": {
12
18
  "@needle-tools/engine": "4.x",
19
+ "@types/three": "0.169.0",
13
20
  "three": "npm:@needle-tools/three@^0.169.5",
14
- "@types/three": "0.169.0"
21
+ "vite": "^7.0.3"
15
22
  },
16
23
  "publishConfig": {
17
24
  "access": "public",
package/src/materialx.ts CHANGED
@@ -5,6 +5,14 @@ import { renderPMREMToEquirect } from "./textureHelper.js";
5
5
  import { Light, MeshBasicMaterial, Object3D, PMREMGenerator } from "three";
6
6
  import { registerLights } from "./helper.js";
7
7
 
8
+ // @ts-ignore
9
+ import coreWasmUrl from "../bin/JsMaterialXCore.wasm?url";
10
+ // @ts-ignore
11
+ import shaderWasmUrl from "../bin/JsMaterialXGenShader.wasm?url";
12
+ // @ts-ignore
13
+ import shaderDataUrl from "../bin/JsMaterialXGenShader.data?url";
14
+
15
+
8
16
  // Configure MaterialX with the correct path for its data files
9
17
  const materialXConfig = {
10
18
  locateFile: (path: string, scriptDirectory: string) => {
@@ -12,9 +20,19 @@ const materialXConfig = {
12
20
 
13
21
  // Return the correct path for MaterialX data files
14
22
  if (path.endsWith('.data') || path.endsWith('.wasm')) {
23
+ if(path.includes("JsMaterialXCore.wasm")) {
24
+ return coreWasmUrl; // Use the URL for the core WASM file
25
+ }
26
+ else if (path.includes("JsMaterialXGenShader.wasm")) {
27
+ return shaderWasmUrl; // Use the URL for the shader WASM file
28
+ }
29
+ else if (path.includes("JsMaterialXGenShader.data")) {
30
+ return shaderDataUrl; // Use the URL for the shader data file
31
+ }
15
32
  // For Vite dev server, we need to use the correct module path
16
- const correctPath = new URL(`../bin/${path}`, import.meta.url).href;
17
- if (debug) console.log("Resolved path:", correctPath);
33
+ const url = new URL(`../bin/${path}?url`, import.meta.url);
34
+ const correctPath = url.href;
35
+ if (debug) console.debug("MaterialX locateFile resolved:", correctPath, { url, meta_url: import.meta.url });
18
36
  return correctPath;
19
37
  }
20
38
  return scriptDirectory + path;
package/bin/README.md DELETED
@@ -1,5 +0,0 @@
1
- Source: https://github.com/AcademySoftwareFoundation/MaterialX/tree/gh-pages
2
-
3
- Edits:
4
-
5
- - `JsMaterialXGenShader.js` added `export default MaterialX;` at bottom