fireball/lib/core/InstancedBufferAttribute.js

46 lines
923 B
JavaScript
Raw Normal View History

2018-12-25 13:59:22 +00:00
import { BufferAttribute } from './BufferAttribute.js';
/**
* @author benaadams / https://twitter.com/ben_a_adams
*/
function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) {
if ( typeof ( normalized ) === 'number' ) {
meshPerAttribute = normalized;
normalized = false;
console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );
}
BufferAttribute.call( this, array, itemSize, normalized );
this.meshPerAttribute = meshPerAttribute || 1;
}
InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), {
constructor: InstancedBufferAttribute,
isInstancedBufferAttribute: true,
copy: function ( source ) {
BufferAttribute.prototype.copy.call( this, source );
this.meshPerAttribute = source.meshPerAttribute;
return this;
}
} );
export { InstancedBufferAttribute };