Currently, I am utilizing a fixed set of data that contains indices, vertices, and colors, along with multiple instances of THREE.Geometry
to populate a scene with objects. This process is quite slow, as it involves adding and removing numerous objects at once or merging them together.
However, by employing a single THREE.BufferGeometry
, I can leverage _gl.bufferSubData
to add and remove objects, which should ideally have minimal impact on performance.
The challenge I am facing lies in implementing this solution. While I have successfully implemented the bufferSubData
function, I am struggling to incorporate two sets of data within the same BufferGeometry. It seems that the data does not seamlessly flow into each other (due to being separate objects), resulting in both sets using the same indices. You can observe the outcome in this image.
I have created a JSFiddle that contains an array named section
with the chunk data. If anyone could review it and modify it to incorporate both sets of data, it would be highly appreciated:
Additionally, I have been unable to discern the purpose of the index offset. If someone could provide a link or explanation regarding its usage, it would be immensely beneficial.
Thank you for the assistance!