Skip to content

Commit

Permalink
Make isCompatibleTexture check stricter by requiring equal source (#5529
Browse files Browse the repository at this point in the history
)

Co-authored-by: Noeri Huisman <[email protected]>
  • Loading branch information
mrxz and mrxz authored May 29, 2024
1 parent 6aea9e7 commit b005a66
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,16 @@ module.exports.handleTextureEvents = handleTextureEvents;
* @returns {boolean} True if the texture is compatible with the source, false otherwise
*/
function isCompatibleTexture (texture, source) {
if (texture.source !== source) {
return false;
}

if (source.data instanceof HTMLCanvasElement) {
return texture.isCanvasTexture;
}

if (source.data instanceof HTMLVideoElement) {
// VideoTexture can't have its source changed after initial user
return texture.isVideoTexture && texture.source === source;
return texture.isVideoTexture;
}

return texture.isTexture && !texture.isCanvasTexture && !texture.isVideoTexture;
Expand Down

0 comments on commit b005a66

Please sign in to comment.