BufferGeometry和LineBasicMaterial:段厚度

时间:2015-09-12 22:31:41

标签: javascript three.js buffer-geometry

所以我使用的是THREE.BufferGeometry,我可以通过color属性很好地控制Line的各个段的颜色。

geometry = new THREE.BufferGeometry();
var material = new THREE.LineBasicMaterial({
  vertexColors: THREE.VertexColors
});
geometry.addAttribute('position', new THREE.BufferAttribute(points, 3));
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3));

scene.add(new THREE.Line(geometry, material, THREE.LinePieces));

有什么办法可以添加自定义属性并将其与LineBasicMaterial.linewidth绑定,这样我就可以更改该行各个段的厚度了吗?

1 个答案:

答案 0 :(得分:0)

您可以创建着色器来构建线条并控制每个线段的厚度。查看本文https://processing.org/tutorials/pshader/(第10章。点和线着色器)