Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make isCompatibleTexture check stricter by requiring equal source
  • Loading branch information
mrxz committed May 29, 2024
commit 6b661035c98330872aa8952c469d8ddca9d36fdc
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