Browse Source

HTMLMesh: Introduce dispose(). (#23327)

Michael Herzog 3 years ago
parent
commit
bdfbadfc79
1 changed files with 14 additions and 0 deletions
  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 );
+
+		};
+
 	}
 
 }