Hey guys, I just updated to r131.3. Im using typescript, so thats the latest type supported version right now. Since then Im getting an error
threejs r 0.131.3
types/three 0.131.1
Angular 10.1.6
Invalid value used as weak map key
at WeakMap.set ()
at Object.get (three.module.js:18955)
at setTexture2D (three.module.js:21772)
at WebGLTextures.safeSetTexture2D (three.module.js:22784)
at SingleUniform.setValueT1 [as setValue] (three.module.js:17165) <---- Texture type boolean
at Function.push.Womt.WebGLUniforms.upload (three.module.js:17647) <— Texture type WebGLTexture
at setProgram (three.module.js:26430)
at WebGLRenderer.renderBufferDirect (three.module.js:25385)
at renderObject (three.module.js:26017)
at renderObjects (three.module.js:25976)
Im logging from three.module.js
watching different variables and found that at SingleUniform.setValueT1 [as setValue] (three.module.js:17165)
the textures passed are still all type WebGLTextures.
Then at WebGLTextures.safeSetTexture2D (three.module.js:22784)
the texture that is passed to the function, is not a texture anymore but a boolean.
My guess was that at the last line of setValueT1
function, when textures.safeSetTexture2D
is called. The passing of v || emptyTexture
is not passing either v
or emptyTexture
, but is passing the whole as a condition (true || false). v is type boolean, emptyTexture is type Texture at that point
function setValueT1( gl, v, textures ) {
const cache = this.cache;
const unit = textures.allocateTextureUnit();
if ( cache[ 0 ] !== unit ) {
gl.uniform1i( this.addr, unit );
cache[ 0 ] = unit;
}
// Tries to pass v or emptyTexture
textures.safeSetTexture2D( v || emptyTexture, unit );
}
In the function safeSetTexture2D
, the texture is true
function safeSetTexture2D( texture, slot ) {
// This is logging: true, 0
console.log('safeSetTexture2D', texture, slot)
...
}
I guess this is a bug? Or could it be possible that I forgot to migrate sth and passing a wrong value?
Should i report it at threejs github or threejs types?
Any help appreaciated