BufferGeometry.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. import { Vector3 } from '../math/Vector3.js';
  2. import { Box3 } from '../math/Box3.js';
  3. import { EventDispatcher } from './EventDispatcher.js';
  4. import { BufferAttribute, Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from './BufferAttribute.js';
  5. import { Sphere } from '../math/Sphere.js';
  6. import { Object3D } from './Object3D.js';
  7. import { Matrix4 } from '../math/Matrix4.js';
  8. import { Matrix3 } from '../math/Matrix3.js';
  9. import { MathUtils } from '../math/MathUtils.js';
  10. import { arrayMax } from '../utils.js';
  11. let _bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id
  12. const _m1 = new Matrix4();
  13. const _obj = new Object3D();
  14. const _offset = new Vector3();
  15. const _box = new Box3();
  16. const _boxMorphTargets = new Box3();
  17. const _vector = new Vector3();
  18. function BufferGeometry() {
  19. Object.defineProperty( this, 'id', { value: _bufferGeometryId += 2 } );
  20. this.uuid = MathUtils.generateUUID();
  21. this.name = '';
  22. this.type = 'BufferGeometry';
  23. this.index = null;
  24. this.attributes = {};
  25. this.morphAttributes = {};
  26. this.morphTargetsRelative = false;
  27. this.groups = [];
  28. this.boundingBox = null;
  29. this.boundingSphere = null;
  30. this.drawRange = { start: 0, count: Infinity };
  31. this.userData = {};
  32. }
  33. BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
  34. constructor: BufferGeometry,
  35. isBufferGeometry: true,
  36. getIndex: function () {
  37. return this.index;
  38. },
  39. setIndex: function ( index ) {
  40. if ( Array.isArray( index ) ) {
  41. this.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
  42. } else {
  43. this.index = index;
  44. }
  45. return this;
  46. },
  47. getAttribute: function ( name ) {
  48. return this.attributes[ name ];
  49. },
  50. setAttribute: function ( name, attribute ) {
  51. this.attributes[ name ] = attribute;
  52. return this;
  53. },
  54. deleteAttribute: function ( name ) {
  55. delete this.attributes[ name ];
  56. return this;
  57. },
  58. hasAttribute: function ( name ) {
  59. return this.attributes[ name ] !== undefined;
  60. },
  61. addGroup: function ( start, count, materialIndex = 0 ) {
  62. this.groups.push( {
  63. start: start,
  64. count: count,
  65. materialIndex: materialIndex
  66. } );
  67. },
  68. clearGroups: function () {
  69. this.groups = [];
  70. },
  71. setDrawRange: function ( start, count ) {
  72. this.drawRange.start = start;
  73. this.drawRange.count = count;
  74. },
  75. applyMatrix4: function ( matrix ) {
  76. const position = this.attributes.position;
  77. if ( position !== undefined ) {
  78. position.applyMatrix4( matrix );
  79. position.needsUpdate = true;
  80. }
  81. const normal = this.attributes.normal;
  82. if ( normal !== undefined ) {
  83. const normalMatrix = new Matrix3().getNormalMatrix( matrix );
  84. normal.applyNormalMatrix( normalMatrix );
  85. normal.needsUpdate = true;
  86. }
  87. const tangent = this.attributes.tangent;
  88. if ( tangent !== undefined ) {
  89. tangent.transformDirection( matrix );
  90. tangent.needsUpdate = true;
  91. }
  92. if ( this.boundingBox !== null ) {
  93. this.computeBoundingBox();
  94. }
  95. if ( this.boundingSphere !== null ) {
  96. this.computeBoundingSphere();
  97. }
  98. return this;
  99. },
  100. rotateX: function ( angle ) {
  101. // rotate geometry around world x-axis
  102. _m1.makeRotationX( angle );
  103. this.applyMatrix4( _m1 );
  104. return this;
  105. },
  106. rotateY: function ( angle ) {
  107. // rotate geometry around world y-axis
  108. _m1.makeRotationY( angle );
  109. this.applyMatrix4( _m1 );
  110. return this;
  111. },
  112. rotateZ: function ( angle ) {
  113. // rotate geometry around world z-axis
  114. _m1.makeRotationZ( angle );
  115. this.applyMatrix4( _m1 );
  116. return this;
  117. },
  118. translate: function ( x, y, z ) {
  119. // translate geometry
  120. _m1.makeTranslation( x, y, z );
  121. this.applyMatrix4( _m1 );
  122. return this;
  123. },
  124. scale: function ( x, y, z ) {
  125. // scale geometry
  126. _m1.makeScale( x, y, z );
  127. this.applyMatrix4( _m1 );
  128. return this;
  129. },
  130. lookAt: function ( vector ) {
  131. _obj.lookAt( vector );
  132. _obj.updateMatrix();
  133. this.applyMatrix4( _obj.matrix );
  134. return this;
  135. },
  136. center: function () {
  137. this.computeBoundingBox();
  138. this.boundingBox.getCenter( _offset ).negate();
  139. this.translate( _offset.x, _offset.y, _offset.z );
  140. return this;
  141. },
  142. setFromPoints: function ( points ) {
  143. const position = [];
  144. for ( let i = 0, l = points.length; i < l; i ++ ) {
  145. const point = points[ i ];
  146. position.push( point.x, point.y, point.z || 0 );
  147. }
  148. this.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
  149. return this;
  150. },
  151. computeBoundingBox: function () {
  152. if ( this.boundingBox === null ) {
  153. this.boundingBox = new Box3();
  154. }
  155. const position = this.attributes.position;
  156. const morphAttributesPosition = this.morphAttributes.position;
  157. if ( position && position.isGLBufferAttribute ) {
  158. console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
  159. this.boundingBox.set(
  160. new Vector3( - Infinity, - Infinity, - Infinity ),
  161. new Vector3( + Infinity, + Infinity, + Infinity )
  162. );
  163. return;
  164. }
  165. if ( position !== undefined ) {
  166. this.boundingBox.setFromBufferAttribute( position );
  167. // process morph attributes if present
  168. if ( morphAttributesPosition ) {
  169. for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
  170. const morphAttribute = morphAttributesPosition[ i ];
  171. _box.setFromBufferAttribute( morphAttribute );
  172. if ( this.morphTargetsRelative ) {
  173. _vector.addVectors( this.boundingBox.min, _box.min );
  174. this.boundingBox.expandByPoint( _vector );
  175. _vector.addVectors( this.boundingBox.max, _box.max );
  176. this.boundingBox.expandByPoint( _vector );
  177. } else {
  178. this.boundingBox.expandByPoint( _box.min );
  179. this.boundingBox.expandByPoint( _box.max );
  180. }
  181. }
  182. }
  183. } else {
  184. this.boundingBox.makeEmpty();
  185. }
  186. if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
  187. console.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
  188. }
  189. },
  190. computeBoundingSphere: function () {
  191. if ( this.boundingSphere === null ) {
  192. this.boundingSphere = new Sphere();
  193. }
  194. const position = this.attributes.position;
  195. const morphAttributesPosition = this.morphAttributes.position;
  196. if ( position && position.isGLBufferAttribute ) {
  197. console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
  198. this.boundingSphere.set( new Vector3(), Infinity );
  199. return;
  200. }
  201. if ( position ) {
  202. // first, find the center of the bounding sphere
  203. const center = this.boundingSphere.center;
  204. _box.setFromBufferAttribute( position );
  205. // process morph attributes if present
  206. if ( morphAttributesPosition ) {
  207. for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
  208. const morphAttribute = morphAttributesPosition[ i ];
  209. _boxMorphTargets.setFromBufferAttribute( morphAttribute );
  210. if ( this.morphTargetsRelative ) {
  211. _vector.addVectors( _box.min, _boxMorphTargets.min );
  212. _box.expandByPoint( _vector );
  213. _vector.addVectors( _box.max, _boxMorphTargets.max );
  214. _box.expandByPoint( _vector );
  215. } else {
  216. _box.expandByPoint( _boxMorphTargets.min );
  217. _box.expandByPoint( _boxMorphTargets.max );
  218. }
  219. }
  220. }
  221. _box.getCenter( center );
  222. // second, try to find a boundingSphere with a radius smaller than the
  223. // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
  224. let maxRadiusSq = 0;
  225. for ( let i = 0, il = position.count; i < il; i ++ ) {
  226. _vector.fromBufferAttribute( position, i );
  227. maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
  228. }
  229. // process morph attributes if present
  230. if ( morphAttributesPosition ) {
  231. for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
  232. const morphAttribute = morphAttributesPosition[ i ];
  233. const morphTargetsRelative = this.morphTargetsRelative;
  234. for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
  235. _vector.fromBufferAttribute( morphAttribute, j );
  236. if ( morphTargetsRelative ) {
  237. _offset.fromBufferAttribute( position, j );
  238. _vector.add( _offset );
  239. }
  240. maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
  241. }
  242. }
  243. }
  244. this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
  245. if ( isNaN( this.boundingSphere.radius ) ) {
  246. console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
  247. }
  248. }
  249. },
  250. computeFaceNormals: function () {
  251. // backwards compatibility
  252. },
  253. computeVertexNormals: function () {
  254. const index = this.index;
  255. const positionAttribute = this.getAttribute( 'position' );
  256. if ( positionAttribute !== undefined ) {
  257. let normalAttribute = this.getAttribute( 'normal' );
  258. if ( normalAttribute === undefined ) {
  259. normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );
  260. this.setAttribute( 'normal', normalAttribute );
  261. } else {
  262. // reset existing normals to zero
  263. for ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {
  264. normalAttribute.setXYZ( i, 0, 0, 0 );
  265. }
  266. }
  267. const pA = new Vector3(), pB = new Vector3(), pC = new Vector3();
  268. const nA = new Vector3(), nB = new Vector3(), nC = new Vector3();
  269. const cb = new Vector3(), ab = new Vector3();
  270. // indexed elements
  271. if ( index ) {
  272. for ( let i = 0, il = index.count; i < il; i += 3 ) {
  273. const vA = index.getX( i + 0 );
  274. const vB = index.getX( i + 1 );
  275. const vC = index.getX( i + 2 );
  276. pA.fromBufferAttribute( positionAttribute, vA );
  277. pB.fromBufferAttribute( positionAttribute, vB );
  278. pC.fromBufferAttribute( positionAttribute, vC );
  279. cb.subVectors( pC, pB );
  280. ab.subVectors( pA, pB );
  281. cb.cross( ab );
  282. nA.fromBufferAttribute( normalAttribute, vA );
  283. nB.fromBufferAttribute( normalAttribute, vB );
  284. nC.fromBufferAttribute( normalAttribute, vC );
  285. nA.add( cb );
  286. nB.add( cb );
  287. nC.add( cb );
  288. normalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );
  289. normalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );
  290. normalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );
  291. }
  292. } else {
  293. // non-indexed elements (unconnected triangle soup)
  294. for ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {
  295. pA.fromBufferAttribute( positionAttribute, i + 0 );
  296. pB.fromBufferAttribute( positionAttribute, i + 1 );
  297. pC.fromBufferAttribute( positionAttribute, i + 2 );
  298. cb.subVectors( pC, pB );
  299. ab.subVectors( pA, pB );
  300. cb.cross( ab );
  301. normalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );
  302. normalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );
  303. normalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );
  304. }
  305. }
  306. this.normalizeNormals();
  307. normalAttribute.needsUpdate = true;
  308. }
  309. },
  310. merge: function ( geometry, offset ) {
  311. if ( ! ( geometry && geometry.isBufferGeometry ) ) {
  312. console.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );
  313. return;
  314. }
  315. if ( offset === undefined ) {
  316. offset = 0;
  317. console.warn(
  318. 'THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. '
  319. + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'
  320. );
  321. }
  322. const attributes = this.attributes;
  323. for ( const key in attributes ) {
  324. if ( geometry.attributes[ key ] === undefined ) continue;
  325. const attribute1 = attributes[ key ];
  326. const attributeArray1 = attribute1.array;
  327. const attribute2 = geometry.attributes[ key ];
  328. const attributeArray2 = attribute2.array;
  329. const attributeOffset = attribute2.itemSize * offset;
  330. const length = Math.min( attributeArray2.length, attributeArray1.length - attributeOffset );
  331. for ( let i = 0, j = attributeOffset; i < length; i ++, j ++ ) {
  332. attributeArray1[ j ] = attributeArray2[ i ];
  333. }
  334. }
  335. return this;
  336. },
  337. normalizeNormals: function () {
  338. const normals = this.attributes.normal;
  339. for ( let i = 0, il = normals.count; i < il; i ++ ) {
  340. _vector.fromBufferAttribute( normals, i );
  341. _vector.normalize();
  342. normals.setXYZ( i, _vector.x, _vector.y, _vector.z );
  343. }
  344. },
  345. toNonIndexed: function () {
  346. function convertBufferAttribute( attribute, indices ) {
  347. const array = attribute.array;
  348. const itemSize = attribute.itemSize;
  349. const normalized = attribute.normalized;
  350. const array2 = new array.constructor( indices.length * itemSize );
  351. let index = 0, index2 = 0;
  352. for ( let i = 0, l = indices.length; i < l; i ++ ) {
  353. index = indices[ i ] * itemSize;
  354. for ( let j = 0; j < itemSize; j ++ ) {
  355. array2[ index2 ++ ] = array[ index ++ ];
  356. }
  357. }
  358. return new BufferAttribute( array2, itemSize, normalized );
  359. }
  360. //
  361. if ( this.index === null ) {
  362. console.warn( 'THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.' );
  363. return this;
  364. }
  365. const geometry2 = new BufferGeometry();
  366. const indices = this.index.array;
  367. const attributes = this.attributes;
  368. // attributes
  369. for ( const name in attributes ) {
  370. const attribute = attributes[ name ];
  371. const newAttribute = convertBufferAttribute( attribute, indices );
  372. geometry2.setAttribute( name, newAttribute );
  373. }
  374. // morph attributes
  375. const morphAttributes = this.morphAttributes;
  376. for ( const name in morphAttributes ) {
  377. const morphArray = [];
  378. const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes
  379. for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {
  380. const attribute = morphAttribute[ i ];
  381. const newAttribute = convertBufferAttribute( attribute, indices );
  382. morphArray.push( newAttribute );
  383. }
  384. geometry2.morphAttributes[ name ] = morphArray;
  385. }
  386. geometry2.morphTargetsRelative = this.morphTargetsRelative;
  387. // groups
  388. const groups = this.groups;
  389. for ( let i = 0, l = groups.length; i < l; i ++ ) {
  390. const group = groups[ i ];
  391. geometry2.addGroup( group.start, group.count, group.materialIndex );
  392. }
  393. return geometry2;
  394. },
  395. toJSON: function () {
  396. const data = {
  397. metadata: {
  398. version: 4.5,
  399. type: 'BufferGeometry',
  400. generator: 'BufferGeometry.toJSON'
  401. }
  402. };
  403. // standard BufferGeometry serialization
  404. data.uuid = this.uuid;
  405. data.type = this.type;
  406. if ( this.name !== '' ) data.name = this.name;
  407. if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
  408. if ( this.parameters !== undefined ) {
  409. const parameters = this.parameters;
  410. for ( const key in parameters ) {
  411. if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];
  412. }
  413. return data;
  414. }
  415. data.data = { attributes: {} };
  416. const index = this.index;
  417. if ( index !== null ) {
  418. data.data.index = {
  419. type: index.array.constructor.name,
  420. array: Array.prototype.slice.call( index.array )
  421. };
  422. }
  423. const attributes = this.attributes;
  424. for ( const key in attributes ) {
  425. const attribute = attributes[ key ];
  426. const attributeData = attribute.toJSON( data.data );
  427. if ( attribute.name !== '' ) attributeData.name = attribute.name;
  428. data.data.attributes[ key ] = attributeData;
  429. }
  430. const morphAttributes = {};
  431. let hasMorphAttributes = false;
  432. for ( const key in this.morphAttributes ) {
  433. const attributeArray = this.morphAttributes[ key ];
  434. const array = [];
  435. for ( let i = 0, il = attributeArray.length; i < il; i ++ ) {
  436. const attribute = attributeArray[ i ];
  437. const attributeData = attribute.toJSON( data.data );
  438. if ( attribute.name !== '' ) attributeData.name = attribute.name;
  439. array.push( attributeData );
  440. }
  441. if ( array.length > 0 ) {
  442. morphAttributes[ key ] = array;
  443. hasMorphAttributes = true;
  444. }
  445. }
  446. if ( hasMorphAttributes ) {
  447. data.data.morphAttributes = morphAttributes;
  448. data.data.morphTargetsRelative = this.morphTargetsRelative;
  449. }
  450. const groups = this.groups;
  451. if ( groups.length > 0 ) {
  452. data.data.groups = JSON.parse( JSON.stringify( groups ) );
  453. }
  454. const boundingSphere = this.boundingSphere;
  455. if ( boundingSphere !== null ) {
  456. data.data.boundingSphere = {
  457. center: boundingSphere.center.toArray(),
  458. radius: boundingSphere.radius
  459. };
  460. }
  461. return data;
  462. },
  463. clone: function () {
  464. /*
  465. // Handle primitives
  466. const parameters = this.parameters;
  467. if ( parameters !== undefined ) {
  468. const values = [];
  469. for ( const key in parameters ) {
  470. values.push( parameters[ key ] );
  471. }
  472. const geometry = Object.create( this.constructor.prototype );
  473. this.constructor.apply( geometry, values );
  474. return geometry;
  475. }
  476. return new this.constructor().copy( this );
  477. */
  478. return new BufferGeometry().copy( this );
  479. },
  480. copy: function ( source ) {
  481. // reset
  482. this.index = null;
  483. this.attributes = {};
  484. this.morphAttributes = {};
  485. this.groups = [];
  486. this.boundingBox = null;
  487. this.boundingSphere = null;
  488. // used for storing cloned, shared data
  489. const data = {};
  490. // name
  491. this.name = source.name;
  492. // index
  493. const index = source.index;
  494. if ( index !== null ) {
  495. this.setIndex( index.clone( data ) );
  496. }
  497. // attributes
  498. const attributes = source.attributes;
  499. for ( const name in attributes ) {
  500. const attribute = attributes[ name ];
  501. this.setAttribute( name, attribute.clone( data ) );
  502. }
  503. // morph attributes
  504. const morphAttributes = source.morphAttributes;
  505. for ( const name in morphAttributes ) {
  506. const array = [];
  507. const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes
  508. for ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {
  509. array.push( morphAttribute[ i ].clone( data ) );
  510. }
  511. this.morphAttributes[ name ] = array;
  512. }
  513. this.morphTargetsRelative = source.morphTargetsRelative;
  514. // groups
  515. const groups = source.groups;
  516. for ( let i = 0, l = groups.length; i < l; i ++ ) {
  517. const group = groups[ i ];
  518. this.addGroup( group.start, group.count, group.materialIndex );
  519. }
  520. // bounding box
  521. const boundingBox = source.boundingBox;
  522. if ( boundingBox !== null ) {
  523. this.boundingBox = boundingBox.clone();
  524. }
  525. // bounding sphere
  526. const boundingSphere = source.boundingSphere;
  527. if ( boundingSphere !== null ) {
  528. this.boundingSphere = boundingSphere.clone();
  529. }
  530. // draw range
  531. this.drawRange.start = source.drawRange.start;
  532. this.drawRange.count = source.drawRange.count;
  533. // user data
  534. this.userData = source.userData;
  535. return this;
  536. },
  537. dispose: function () {
  538. this.dispatchEvent( { type: 'dispose' } );
  539. }
  540. } );
  541. export { BufferGeometry };