In my Three.js project, I have a large collection of point cloud forms grouped together in a single Points object for efficient rendering using BufferGeometry in WebGLRenderer. The program allows users to interactively select a form from the point cloud, which should disappear and be replaced by a new form.
To achieve this functionality, I loop through the ID numbers assigned to each vertex to identify and remove the vertices associated with the selected form. I then slice the corresponding elements from the attribute arrays within the BufferGeometry and update them to reflect the change. However, after editing the arrays, I encounter erratic behavior where the forms seem to recede from the screen in a patchy manner instead of disappearing as intended.
I'm questioning whether the array length once uploaded to the graphics card is fixed or dynamic, as I've been struggling to find a solution to this issue for several days now. Below, I've isolated the key functions that appear to be causing the problem:
function extractFormFromTypedArray( startIndex, endIndex, itemSize, typedArray ) {
// Logic to remove selected points from the array
}
function swapForm( formID ) {
// Function to swap out the selected form
}
Running on Three.js v74