This will need some more thought, before we didn't really do anything about BufferGeometry deallocation.
@@ -4,6 +4,8 @@
THREE.BufferGeometry = function () {
+ THREE.EventTarget.call( this );
+
this.id = THREE.GeometryIdCount ++;
// attributes
@@ -540,6 +542,12 @@ THREE.BufferGeometry.prototype = {
this.hasTangents = true;
this.tangentsNeedUpdate = true;
+ },
+ deallocate: function () {
+ this.dispatchEvent( { type: 'deallocate' } );
}
};
@@ -5240,7 +5240,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.needsUpdate ) {
- if ( material.program ) _this.deallocateMaterial( material );
+ if ( material.program ) deallocateMaterial( material );
_this.initMaterial( material, lights, fog, object );
material.needsUpdate = false;