I am working on a custom Geometry that extends the BufferGeometry.
I am just wondering what the best way to update the attributes is ?
When setting up the attributes I have this
this.addAttribute( 'position', new BufferAttribute( positions, 2 )); this.addAttribute( 'uv', new BufferAttribute( uvs, 2 )); this.setIndex( new BufferAttribute( indices, 1 ) );
Where they are of type Float32Array and indices is of type Uint16Array.
How do I deal with updating them, dealing with changing index sizes. Do I completely reset the attributes somehow ? I believe the lengths of the typed arrays can’t change.
Trying to update positions for instance
positions[i++] = x
Keeps the original data there if not all updated because of different lengths and I believe causes problems.
Does calling this again reset the attribute properly and efficient enough ?
this.addAttribute( 'position', new BufferAttribute( positions, 2 ));
Hopefully this is clear.