I am working with a mesh that is based on a TubeBufferGeometry
. In each animation cycle, the path of the TubeBufferGeometry
needs to change based on values provided at runtime. To achieve this, I want to update the geometry with a new TubeBufferGeometry
every frame. Currently, I update the mesh's geometry like this:
mesh.geometry.dispose()
mesh.geometry = new THREE.TubeBufferGeometry(newPath, params)
However, this approach is not efficient as it involves creating a new BufferGeometry
each frame. Ideally, I would like to pass an existing geometry to the TubeBufferGeometry
constructor and have it update the buffers of that geometry instead of creating a new one. This way:
THREE.TubeBufferGeometry.overwrite(mesh.geometry, newPath, params)
Since both geometries would use the same params
, the existing geometry's buffers would be large enough to accommodate the new geometry.
Is there a way to achieve this? I find it more convenient to let TubeBufferGeometry
compute the vertex positions, but I need it to do so in an existing buffer rather than creating a new one in each frame.