我试图在顶点上放置一些颜色,但颜色不会出现。我正在使用Three.js库。 这是我正在使用的功能示例:
function parserExpose(arr) {
var geometry = new THREE.PlaneGeometry(60, 60, arr.x - 1, arr.y - 1);
for (var i = 0, l = geometry.vertices.length; i < l; i++) {
geometry.vertices[i].z = (arr.topo[i].topoValues / 65535 * 2470);
geometry.vertices[i].color = new THREE.Color(Math.random() * 0x00ffff);
}
geometry.colorsNeedUpdate = true;
geometry.needsUpdate = true;
geometry.__dirtyVertices = true;
geometry.__dirtyNormals = true;
geometry.computeBoundingSphere();
//vertexColors: THREE.VertexColors
//THREE.FaceColors
var plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({vertexColors: THREE.VertexColors, wireframe: true, wireframeLinewidth: 3}));
scene.add(plane);
}
如果我使用geometry.faces[]
我可以更改颜色,但我只想更改顶点而不是面部。