@needle-tools/materialx 1.0.0-next.ed2b37f → 1.0.1-next.19d0723

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.
@@ -40,7 +40,7 @@ export function renderPMREMToEquirect(renderer: WebGLRenderer, pmremTexture: Tex
40
40
  } else {
41
41
  imageHeight = 256; // Final fallback
42
42
  }
43
-
43
+
44
44
  const maxMip = Math.log2(imageHeight) - 2;
45
45
  const cubeUVHeight = imageHeight;
46
46
  const cubeUVWidth = 3 * Math.max(Math.pow(2, maxMip), 7 * 16);
@@ -129,14 +129,14 @@ export function renderPMREMToEquirect(renderer: WebGLRenderer, pmremTexture: Tex
129
129
  const currentAutoClear = renderer.autoClear;
130
130
  const currentXrEnabled = renderer.xr.enabled;
131
131
  const currentShadowMapEnabled = renderer.shadowMap.enabled;
132
-
132
+
133
133
  renderTarget.texture.generateMipmaps = true;
134
-
134
+
135
135
  try {
136
136
  // Disable XR and shadow mapping during our render to avoid interference
137
137
  renderer.xr.enabled = false;
138
138
  renderer.shadowMap.enabled = false;
139
-
139
+
140
140
  // Render to our target
141
141
  renderer.autoClear = true;
142
142
  renderer.setRenderTarget(renderTarget);
@@ -148,7 +148,7 @@ export function renderPMREMToEquirect(renderer: WebGLRenderer, pmremTexture: Tex
148
148
  renderer.autoClear = currentAutoClear;
149
149
  renderer.xr.enabled = currentXrEnabled;
150
150
  renderer.shadowMap.enabled = currentShadowMapEnabled;
151
-
151
+
152
152
  // Clean up temporary objects
153
153
  geometry.dispose();
154
154
  material.dispose();
@@ -159,7 +159,7 @@ export function renderPMREMToEquirect(renderer: WebGLRenderer, pmremTexture: Tex
159
159
  renderTarget.texture.mapping = EquirectangularReflectionMapping;
160
160
 
161
161
  // Log mipmap infos
162
- if (debug) console.log('PMREM to Equirect Render Target:', {
162
+ if (debug) console.log('[MaterialX] PMREM to Equirect Render Target:', {
163
163
  width: renderTarget.width,
164
164
  height: renderTarget.height,
165
165
  mipmaps: renderTarget.texture.mipmaps?.length,
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