0

我以为我理解了这个例子,但是我尝试将它应用到我的代码中会产生实心黑线。有人可以帮我理解为什么这可能不起作用吗?

function(ptArray) {
  var geometry = new THREE.BufferGeometry(),
      material = new THREE.LineBasicMaterial({
        color: 0xffffff,
        linewidth: 4,
        vertexColors: THREE.VertexColors
      }),
      linePositions = new Float32Array(pts),
      lineColors = new Float32Array(pts),
      visible = new Float32Array(pts / 3);

  visible.fill(1.0);

  for (var p = 0; p < pts; p ++) {
    linePositions[p] = ptArray[p];
    lineColors[p] = new THREE.Color(0xffffff).setHSL(p/pts, 1.0, 0.5);
  }

  geometry.addAttribute('position', new THREE.BufferAttribute(linePositions, 3));
  geometry.addAttribute('vertColor', new THREE.BufferAttribute(lineColors, 3));
  geometry.addAttribute('visible', new THREE.BufferAttribute(visible, 1));

  scene.add(new THREE.LineSegments(geometry, material);
}
4

0 回答 0