InstancedBufferGeometry.js 916 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { BufferGeometry } from './BufferGeometry.js';
  2. /**
  3. * @author benaadams / https://twitter.com/ben_a_adams
  4. */
  5. function InstancedBufferGeometry() {
  6. BufferGeometry.call( this );
  7. this.type = 'InstancedBufferGeometry';
  8. this.maxInstancedCount = undefined;
  9. }
  10. InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), {
  11. constructor: InstancedBufferGeometry,
  12. isInstancedBufferGeometry: true,
  13. copy: function ( source ) {
  14. BufferGeometry.prototype.copy.call( this, source );
  15. this.maxInstancedCount = source.maxInstancedCount;
  16. return this;
  17. },
  18. clone: function () {
  19. return new this.constructor().copy( this );
  20. },
  21. toJSON: function () {
  22. var data = BufferGeometry.prototype.toJSON.call( this );
  23. data.maxInstancedCount = this.maxInstancedCount;
  24. data.isInstancedBufferGeometry = true;
  25. return data;
  26. }
  27. } );
  28. export { InstancedBufferGeometry };
粤ICP备19079148号