我一直在练习在Three.js存储库中克隆示例代码。
在此示例中,有些我不理解。
为什么THREE.InstancedBufferGeometry应该由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 );
也许是关于javascript的,但是我还是不明白。
为什么我不能直接使用InstancedBufferGeometry.copy()?
谢谢,
为什么THREE.InstancedBufferGeometry应该由THREE.BufferGeomtry.prototype复制?
InstancedBufferGeometry
是BufferGeometry
具有重写copy()
方法的的子类。如果InstancedBufferGeometry.copy()
直接使用,则该方法将尝试复制从中InstancedBufferGeometry
调用的特定属性。因此,派生类的属性将变为。instanceCount
BufferGeometry
undefined
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句