InstancedInterleavedBuffer.js 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { InterleavedBuffer } from './InterleavedBuffer.js';
  2. function InstancedInterleavedBuffer( array, stride, meshPerAttribute ) {
  3. InterleavedBuffer.call( this, array, stride );
  4. this.meshPerAttribute = meshPerAttribute || 1;
  5. }
  6. InstancedInterleavedBuffer.prototype = Object.assign( Object.create( InterleavedBuffer.prototype ), {
  7. constructor: InstancedInterleavedBuffer,
  8. isInstancedInterleavedBuffer: true,
  9. copy: function ( source ) {
  10. InterleavedBuffer.prototype.copy.call( this, source );
  11. this.meshPerAttribute = source.meshPerAttribute;
  12. return this;
  13. },
  14. clone: function ( data ) {
  15. const ib = InterleavedBuffer.prototype.clone.call( this, data );
  16. ib.meshPerAttribute = this.meshPerAttribute;
  17. return ib;
  18. },
  19. toJSON: function ( data ) {
  20. const json = InterleavedBuffer.prototype.toJSON.call( this, data );
  21. json.isInstancedInterleavedBuffer = true;
  22. json.meshPerAttribute = this.meshPerAttribute;
  23. return json;
  24. }
  25. } );
  26. export { InstancedInterleavedBuffer };
粤ICP备19079148号