提交 fdb737d0 编写于 作者: M Mr.doob

Sending target in the deallocate event.

Still unsure of whether to rename it to dispose instead.
I guess a problem of the world deallocate is that you're unsure wether it is dealocate or deallocate.
上级 bbc42c12
......@@ -546,7 +546,7 @@ THREE.BufferGeometry.prototype = {
deallocate: function () {
this.dispatchEvent( { type: 'deallocate' } );
this.dispatchEvent( { type: 'deallocate', target: this } );
}
......
......@@ -738,7 +738,7 @@ THREE.Geometry.prototype = {
deallocate: function () {
this.dispatchEvent( { type: 'deallocate' } );
this.dispatchEvent( { type: 'deallocate', target: this } );
}
......
......@@ -118,7 +118,7 @@ THREE.Material.prototype.clone = function ( material ) {
THREE.Material.prototype.deallocate = function () {
this.dispatchEvent( { type: 'deallocate' } );
this.dispatchEvent( { type: 'deallocate', target: this } );
};
......
......@@ -66,6 +66,6 @@ THREE.WebGLRenderTarget.prototype.clone = function() {
THREE.WebGLRenderTarget.prototype.deallocate = function () {
this.dispatchEvent( { type: 'deallocate' } );
this.dispatchEvent( { type: 'deallocate', target: this } );
};
......@@ -462,42 +462,50 @@ THREE.WebGLRenderer = function ( parameters ) {
// Events
var onGeometryDeallocate = function () {
var onGeometryDeallocate = function ( event ) {
this.removeEventListener( 'deallocate', onGeometryDeallocate );
var geometry = event.target;
deallocateGeometry( this );
geometry.removeEventListener( 'deallocate', onGeometryDeallocate );
deallocateGeometry( geometry );
_this.info.memory.geometries --;
};
var onTextureDeallocate = function () {
var onTextureDeallocate = function ( event ) {
var texture = event.target;
this.removeEventListener( 'deallocate', onTextureDeallocate );
texture.removeEventListener( 'deallocate', onTextureDeallocate );
deallocateTexture( this );
deallocateTexture( texture );
_this.info.memory.textures --;
};
var onRenderTargetDeallocate = function () {
var onRenderTargetDeallocate = function ( event ) {
this.removeEventListener( 'deallocate', onRenderTargetDeallocate );
var renderTarget = event.target;
deallocateRenderTarget( this );
renderTarget.removeEventListener( 'deallocate', onRenderTargetDeallocate );
deallocateRenderTarget( renderTarget );
_this.info.memory.textures --;
};
var onMaterialDeallocate = function () {
var onMaterialDeallocate = function ( event ) {
var material = event.target;
this.removeEventListener( 'deallocate', onMaterialDeallocate );
material.removeEventListener( 'deallocate', onMaterialDeallocate );
deallocateMaterial( this );
deallocateMaterial( material );
};
......
......@@ -79,7 +79,7 @@ THREE.Texture.prototype = {
deallocate: function () {
this.dispatchEvent( { type: 'deallocate' } );
this.dispatchEvent( { type: 'deallocate', target: this } );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册