InstancedBufferGeometry.js 833 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { BufferGeometry } from './BufferGeometry.js';
  2. function InstancedBufferGeometry() {
  3. BufferGeometry.call( this );
  4. this.type = 'InstancedBufferGeometry';
  5. this.instanceCount = Infinity;
  6. }
  7. InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), {
  8. constructor: InstancedBufferGeometry,
  9. isInstancedBufferGeometry: true,
  10. copy: function ( source ) {
  11. BufferGeometry.prototype.copy.call( this, source );
  12. this.instanceCount = source.instanceCount;
  13. return this;
  14. },
  15. clone: function () {
  16. return new this.constructor().copy( this );
  17. },
  18. toJSON: function () {
  19. const data = BufferGeometry.prototype.toJSON.call( this );
  20. data.instanceCount = this.instanceCount;
  21. data.isInstancedBufferGeometry = true;
  22. return data;
  23. }
  24. } );
  25. export { InstancedBufferGeometry };