I have been working on replicating a specific piece of code found in the three.js repository related to instanced rendering.
While following this example, I came across a part that is confusing to me.
Why do we need to copy THREE.InstancedBufferGeometry by using THREE.BufferGeomtry.prototype?
loader.load( './models/gltf/Flower/Flower.glb', function ( gltf ) {
const _stemMesh = gltf.scene.getObjectByName( 'Stem' );
const _blossomMesh = gltf.scene.getObjectByName( 'Blossom' );
stemGeometry = new THREE.InstancedBufferGeometry();
blossomGeometry = new THREE.InstancedBufferGeometry();
THREE.BufferGeometry.prototype.copy.call( stemGeometry, _stemMesh.geometry );
THREE.BufferGeometry.prototype.copy.call( blossomGeometry, _blossomMesh.geometry );
It seems like it may be a JavaScript concept, but I am still unclear on why it has to be done this way.
Is there a reason why I can't simply use InstancedBufferGeometry.copy() directly?
Thank you,