Explorar o código

HTMLMesh: Introduce dispose(). (#23327)

Michael Herzog %!s(int64=3) %!d(string=hai) anos
pai
achega
bdfbadfc79
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      examples/jsm/interactive/HTMLMesh.js

+ 14 - 0
examples/jsm/interactive/HTMLMesh.js

@@ -29,6 +29,20 @@ class HTMLMesh extends Mesh {
 		this.addEventListener( 'mouseup', onEvent );
 		this.addEventListener( 'click', onEvent );
 
+		this.dispose = function () {
+
+			geometry.dispose();
+			material.dispose();
+
+			material.map.dispose();
+
+			this.removeEventListener( 'mousedown', onEvent );
+			this.removeEventListener( 'mousemove', onEvent );
+			this.removeEventListener( 'mouseup', onEvent );
+			this.removeEventListener( 'click', onEvent );
+
+		};
+
 	}
 
 }