【发布时间】:2021-08-01 22:01:08
【问题描述】:
我正在通过 STL 加载器添加模型元素,并且可以在那里设置顶点颜色。稍后我还需要更改此颜色,并且我正在尝试通过以下代码进行更改。不幸的是颜色没有改变。有人知道怎么改吗?
let geometry = this.scene.getObjectByName("myFile.stl").geometry
const color = new THREE.Color(0xFF0000);
// @ts-ignore
for(let idx = 0; idx < geometry.attributes.color.count; idx++)
{
// @ts-ignore
geometry.getAttribute("color").setXYZ( idx, color.r, color.g, color.b )
}
【问题讨论】:
标签: typescript three.js