【发布时间】:2019-07-20 23:02:04
【问题描述】:
我正在使用 three.js 106 版本。我正在使用一些算法生成地形(从平面几何开始),并且我想根据它的 veritces z 值对地形进行着色。这是我到目前为止得到的结果
const geometry = new THREE.PlaneGeometry(
170,
150,
rows,
cols
);
...
for (let y = 0; y < rows + 1; y++) {
for (let x = 0; x < cols + 1; x++) {
const pos = x * rows + y;
const vertex = geometry.vertices[pos];
if (vertex) {
vertex.z = myAlgorithm();
}
但由于面的数量是顶点的两倍,它并不像
那么简单geometry.faces[pos].color.set(myColorAlgorithm())
【问题讨论】:
标签: javascript three.js