在BufferGeometry上更新顶点

时间:2019-11-16 12:48:18

标签: javascript three.js buffer-geometry

我使用BufferGeometry渲染一个点,因此我只需要3个顶点。 这是我的代码:

let dotGeometry = new THREE.BufferGeometry(),
    vertices = [0, 0, 0],
    texture = loader.load(dot),
    dotGeometry.attributes.position =  new THREE.Float32BufferAttribute( vertices, 3 ),
    mat =  new THREE.PointsMaterial( { size: 1, sizeAttenuation: true, map: texture, alphaTest: 0.5, transparent: true } )

    mat.color.setRGB( 1.0, 0.6, 0.3 );
    dot = new THREE.Points(dotGeometry, mat)


,我想在动画功能中对其进行动画处理:

animate = () {

    let newVertices = getNewVertices()

    dot.geometry.needsUpdate = true
    dot.geometry.attributes.position = new Float32BufferAttribute(newVertices, 3)



}

但是,要点消失了,为什么?

0 个答案:

没有答案