| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | class WebGPUGeometries {	constructor( attributes, info ) {		this.attributes = attributes;		this.info = info;		this.geometries = new WeakMap();	}	update( geometry ) {		if ( this.geometries.has( geometry ) === false ) {			const disposeCallback = onGeometryDispose.bind( this );			this.geometries.set( geometry, disposeCallback );			this.info.memory.geometries ++;			geometry.addEventListener( 'dispose', disposeCallback );		}		const geometryAttributes = geometry.attributes;		for ( const name in geometryAttributes ) {			this.attributes.update( geometryAttributes[ name ] );		}		const index = geometry.index;		if ( index !== null ) {			this.attributes.update( index, true );		}	}}function onGeometryDispose( event ) {	const geometry = event.target;	const disposeCallback = this.geometries.get( geometry );	this.geometries.delete( geometry );	this.info.memory.geometries --;	geometry.removeEventListener( 'dispose', disposeCallback );	//	const index = geometry.index;	const geometryAttributes = geometry.attributes;	if ( index !== null ) {		this.attributes.remove( index );	}	for ( const name in geometryAttributes ) {		this.attributes.remove( geometryAttributes[ name ] );	}}export default WebGPUGeometries;
 |