@needle-tools/materialx 1.0.1-next.31390e3 → 1.0.1-next.64f3b67
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/README.md +3 -1
- package/codegen/register_types.ts +2 -0
- package/package.json +1 -1
- package/src/loader/loader.needle.ts +25 -38
- package/src/loader/loader.three.ts +124 -394
- package/src/{helper.js → materialx.helper.ts} +144 -205
- package/src/materialx.material.ts +227 -0
- package/src/materialx.ts +133 -100
- package/src/materialx.types.d.ts +50 -0
- package/src/textureHelper.ts +6 -6
- package/src/utils.ts +39 -4
package/src/utils.ts
CHANGED
|
@@ -2,10 +2,7 @@ import { Context, getParam } from "@needle-tools/engine";
|
|
|
2
2
|
import { Mesh } from "three";
|
|
3
3
|
|
|
4
4
|
export const debug = getParam("debugmaterialx");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const debugUpdate = getParam("debugmaterialxupdate");
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
8
|
* =====================================
|
|
@@ -33,6 +30,44 @@ const patchWebGL2 = () => {
|
|
|
33
30
|
}
|
|
34
31
|
return uniform4fv.call(this, location, v);
|
|
35
32
|
};
|
|
33
|
+
|
|
34
|
+
const uniform3fv = WebGL2RenderingContext.prototype.uniform3fv;
|
|
35
|
+
WebGL2RenderingContext.prototype.uniform3fv = function (location: WebGLUniformLocation | null, v: Float32Array | number[]) {
|
|
36
|
+
if (location) {
|
|
37
|
+
const uniformName = programAndNameToUniformLocation.get(location);
|
|
38
|
+
if (true) console.log("Calling uniform3fv", { location, v, name: uniformName?.name });
|
|
39
|
+
}
|
|
40
|
+
return uniform3fv.call(this, location, v);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const uniform3iv = WebGL2RenderingContext.prototype.uniform3iv;
|
|
44
|
+
WebGL2RenderingContext.prototype.uniform3iv = function (location: WebGLUniformLocation | null, v: Int32Array | number[]) {
|
|
45
|
+
if (location) {
|
|
46
|
+
const uniformName = programAndNameToUniformLocation.get(location);
|
|
47
|
+
if (true) console.log("Calling uniform3iv", { location, v, name: uniformName?.name });
|
|
48
|
+
}
|
|
49
|
+
return uniform3iv.call(this, location, v);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const uniform3uiv = WebGL2RenderingContext.prototype.uniform3uiv;
|
|
53
|
+
WebGL2RenderingContext.prototype.uniform3uiv = function (location: WebGLUniformLocation | null, v: Uint32Array | number[]) {
|
|
54
|
+
if (location) {
|
|
55
|
+
const uniformName = programAndNameToUniformLocation.get(location);
|
|
56
|
+
if (true) console.log("Calling uniform3uiv", { location, v, name: uniformName?.name });
|
|
57
|
+
}
|
|
58
|
+
return uniform3uiv.call(this, location, v);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const uniform3f = WebGL2RenderingContext.prototype.uniform3f;
|
|
62
|
+
WebGL2RenderingContext.prototype.uniform3f = function (location: WebGLUniformLocation
|
|
63
|
+
| null, x: number, y: number, z: number) {
|
|
64
|
+
if (location) {
|
|
65
|
+
const uniformName = programAndNameToUniformLocation.get(location);
|
|
66
|
+
if (uniformName?.name !== "diffuse")
|
|
67
|
+
if (true) console.log("Calling uniform3f", { location, x, y, z, name: uniformName?.name });
|
|
68
|
+
}
|
|
69
|
+
return uniform3f.call(this, location, x, y, z);
|
|
70
|
+
};
|
|
36
71
|
};
|
|
37
72
|
// patchWebGL2();
|
|
38
73
|
|