我正在尝试获取动态加载的网格几何体的快照图像,我可以将图像转换为纹理,但没有找到任何东西来获取3d网格几何图像,任何人都知道怎么做它?
答案 0 :(得分:1)
我已经搜索了很长时间,直到找到了我想要的东西。请查看此示例:https://codepen.io/shivasaxena/pen/QEzAAv
function saveAsImage() {
var imgData, imgNode;
try {
var strMime = "image/jpeg";
imgData = renderer.domElement.toDataURL(strMime);
saveFile(imgData.replace(strMime, strDownloadMime), "test.jpg");
} catch (e) {
console.log(e);
return;
}
}
var saveFile = function (strData, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
document.body.appendChild(link); //Firefox requires the link to be in the body
link.download = filename;
link.href = strData;
link.click();
document.body.removeChild(link); //remove the link when done
} else {
location.replace(uri);
}
}
也许这就是你正在寻找的东西
此致