InstancedInterleavedBuffer.js 747 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { InterleavedBuffer } from './InterleavedBuffer.js';
  2. class InstancedInterleavedBuffer extends InterleavedBuffer {
  3. constructor( array, stride, meshPerAttribute = 1 ) {
  4. super( array, stride );
  5. this.isInstancedInterleavedBuffer = true;
  6. this.meshPerAttribute = meshPerAttribute;
  7. }
  8. copy( source ) {
  9. super.copy( source );
  10. this.meshPerAttribute = source.meshPerAttribute;
  11. return this;
  12. }
  13. clone( data ) {
  14. const ib = super.clone( data );
  15. ib.meshPerAttribute = this.meshPerAttribute;
  16. return ib;
  17. }
  18. toJSON( data ) {
  19. const json = super.toJSON( data );
  20. json.isInstancedInterleavedBuffer = true;
  21. json.meshPerAttribute = this.meshPerAttribute;
  22. return json;
  23. }
  24. }
  25. export { InstancedInterleavedBuffer };