InstancedBufferGeometry.js 631 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { BufferGeometry } from './BufferGeometry.js';
  2. class InstancedBufferGeometry extends BufferGeometry {
  3. constructor() {
  4. super();
  5. this.isInstancedBufferGeometry = true;
  6. this.type = 'InstancedBufferGeometry';
  7. this.instanceCount = Infinity;
  8. }
  9. copy( source ) {
  10. super.copy( source );
  11. this.instanceCount = source.instanceCount;
  12. return this;
  13. }
  14. clone() {
  15. return new this.constructor().copy( this );
  16. }
  17. toJSON() {
  18. const data = super.toJSON( this );
  19. data.instanceCount = this.instanceCount;
  20. data.isInstancedBufferGeometry = true;
  21. return data;
  22. }
  23. }
  24. export { InstancedBufferGeometry };