简体   繁体   English

在Three.js中仅绘制一行

[英]Painting only one line in Three.js

I have several lines in an array. 我在数组中有几行。 When I want to paint just one a certain color, they are all painted that color instead. 当我只想绘制一种特定的颜色时,它们全部都用该颜色绘制。 What can I can do to make it paint only the lines that I want? 我该怎么做才能使其仅绘制所需的线条?

图片范例

var materialSide = new THREE.LineBasicMaterial( { color: "#000000"} );
line[i] = new THREE.Line( Geometria[i], materialSide);
.
.
.
line[24].material.color=new THREE.Color( 0xffffff ); 
line[24].material.needsUpdate = true;

You are using the same material for all the lines; 所有行都使用相同的材​​料; that is why you are seeing that effect. 这就是为什么您看到这种效果的原因。 Create another material materialPainted that has the different color that you want and then you assign the materialPainted material to your line. 创建另一个材料materialPainted有您需要的不同的颜色,然后你分配materialPainted材料,您的线。

line[24].material = materialPainted;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM