marcofugaro / three-projected-material

📽 Three.js Material which lets you do Texture Projection on a 3d Model
https://marcofugaro.github.io/three-projected-material/
MIT License
671 stars 57 forks source link

fix: wrong check caused setting a new texture not to work if not yet loaded #40

Closed trusktr closed 2 years ago

trusktr commented 2 years ago

The missing .value was causing that conditional branch to never run, so trying to do the following wasn't working:

material.texture = new TextureLoader.load('foo.jpg') // does not wait for load, causes saveDimensions to result in [1,1]

Before this change it required a workaround:

new TextureLoader.load('foo.jpg', tex => {
  material.texture = tex // now it measures dimensions because the image is loaded
})