我尝试将画布中的纹理(fabric.js)分配给模型查看器的baseColorTexture。但没那么走运。并且错误在promise rejection时暂停。我需要指导。谢谢
var img = new Image();
img.src = document.getElementById('canvas').toDataURL('image/jpeg', 1.0);
const modelViewerTexture = document.querySelector('model-viewer');
modelViewerTexture.model.materials[0].pbrMetallicRoughness['baseColorTexture'].texture.source.setURI(img);发布于 2021-04-28 12:53:39
我已经找到解决方案了
var can = document.getElementById('canvas').toDataURL('image/jpeg', 1.0)
const modelViewerTexture = document.querySelector('model-viewer')
localStorage.setItem('imgData', can)
modelViewerTexture.model.materials[0].pbrMetallicRoughness['baseColorTexture'].texture.source.setURI(localStorage.getItem('imgData'))https://stackoverflow.com/questions/67293440
复制相似问题