0

我有以下代码:

var geometry = new THREE.BufferGeometry(4, 4, 4);
var length = parsedData.length;
var positions = new Float32Array(length * 3);
var colors = new Float32Array(length * 3);

var color = new THREE.Color();

var i = 0;
for (i; i < length * 3; i += 3) {
    var index = Math.floor(i / 3);
    positions[i] = parsedData[index].vector.x;
    positions[i + 1] = parsedData[index].vector.y;
    positions[i + 2] = parsedData[index].vector.z;

    color.setHex(parsedData[index].color);
    colors[i] = color.r;
    colors[i + 1] = color.g;
    colors[i + 2] = color.b;
}

geometry.addAttribute('position', new THREE.BufferAttribute(positions, 3));
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3));

var material = new THREE.PointsMaterial({vertexColors: THREE.VertexColors});
var particleSystem = new THREE.Points(geometry, material);
scene.add(particleSystem);
render();

这将快速和精细地渲染立方体,但我需要球体。任何人都可以向我解释这如何与修订版 74 一起工作吗?我发现了这个问题,但是它不再起作用了。

谢谢!

4

0 回答 0