BufferGeometry: toIndexed

Thank you for your insight. Would it also help the engine to do this?

if (! ([1,2,3,4].includes(itemSize) ) {
    console.error("Invalid itemSize %d.", itemSize);
    return null;
}

Now the subsequent nested loop can in principle be unrolled on the valid itemSize cases statically.

OK. I agree that it is wise to deliver them with the asset. (I am not used to thinking in assets, as I like to generate geometry on the fly.) But what if your user is not done moving the vertices? Then the automatic computeBoundingSphere is just an annoying extra wait. To me it looks a bit like you are “forcing” your way onto the user, since the else clauses are for specifically those cases where no bounding sphere is present yet, which may have been a user choice, (e.g. because that happens later in their workflow.) But it’s no big deal, of course. Easy to change if any of the conservative voices among the three.js maintainers asks.

I hope your PR gets merged, as this would be a nice addition to three.js. :raised_hands: