Przeglądaj źródła

Added `dispose()` method to helpers (#24655)

* Added dispose() method

* Added dispose() method
WestLangley 2 lat temu
rodzic
commit
01185b14d5

+ 5 - 0
docs/api/en/helpers/ArrowHelper.html

@@ -82,6 +82,11 @@
 		Sets the direction of the arrowhelper.
 		</p>
 
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 5 - 0
docs/api/en/helpers/Box3Helper.html

@@ -56,6 +56,11 @@
 			property.
 		</p>
 
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 5 - 0
docs/api/en/helpers/BoxHelper.html

@@ -67,6 +67,11 @@
 			Updates the wireframe box for the passed object.
 		</p>
 
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 8 - 0
docs/api/en/helpers/GridHelper.html

@@ -41,6 +41,14 @@
 		Creates a new [name] of size 'size' and divided into 'divisions' segments per side. Colors are optional.
 		</p>
 
+		<h2>Methods</h2>
+		<p>See the base [page:LineSegments] class for common methods.</p>
+
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 6 - 1
docs/api/en/helpers/PlaneHelper.html

@@ -38,7 +38,7 @@
 		</p>
 
 		<h2>Properties</h2>
-		<p>See the base [page:LineSegments] class for common properties.</p>
+		<p>See the base [page:Line] class for common properties.</p>
 
 		<h3>[property:Plane plane]</h3>
 		<p>The [page:Plane plane] being visualized.</p>
@@ -57,6 +57,11 @@
 			[page:PlaneHelper.size .size] properties.
 		</p>
 
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 8 - 0
docs/api/en/helpers/PolarGridHelper.html

@@ -46,6 +46,14 @@
 		Creates a new [name] of radius 'radius' with 'sectors' number of sectors and 'rings' number of rings, where each circle is smoothed into 'divisions' number of line segments. Colors are optional.
 		</p>
 
+		<h2>Methods</h2>
+		<p>See the base [page:LineSegments] class for common methods.</p>
+
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 7 - 0
docs/api/en/helpers/SkeletonHelper.html

@@ -57,6 +57,13 @@
 		The object passed in the constructor.
 		</p>
 
+		<h2>Methods</h2>
+		<p>See the base [page:LineSegments] class for common methods.</p>
+
+		<h3>[method:undefined dispose]()</h3>
+		<p>
+		Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
+		</p>
 		<h2>Source</h2>
 
 		<p>

+ 9 - 0
src/helpers/ArrowHelper.js

@@ -99,6 +99,15 @@ class ArrowHelper extends Object3D {
 
 	}
 
+	dispose() {
+
+		this.line.geometry.dispose();
+		this.line.material.dispose();
+		this.cone.geometry.dispose();
+		this.cone.material.dispose();
+
+	}
+
 }
 
 

+ 7 - 0
src/helpers/Box3Helper.js

@@ -44,6 +44,13 @@ class Box3Helper extends LineSegments {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+
+	}
+
 }
 
 export { Box3Helper };

+ 7 - 1
src/helpers/BoxHelper.js

@@ -79,7 +79,6 @@ class BoxHelper extends LineSegments {
 
 		this.geometry.computeBoundingSphere();
 
-
 	}
 
 	setFromObject( object ) {
@@ -101,6 +100,13 @@ class BoxHelper extends LineSegments {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+
+	}
+
 }
 
 

+ 7 - 0
src/helpers/GridHelper.js

@@ -43,6 +43,13 @@ class GridHelper extends LineSegments {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+
+	}
+
 }
 
 

+ 9 - 0
src/helpers/PlaneHelper.js

@@ -49,6 +49,15 @@ class PlaneHelper extends Line {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+		this.children[ 0 ].geometry.dispose();
+		this.children[ 0 ].material.dispose();
+
+	}
+
 }
 
 export { PlaneHelper };

+ 7 - 0
src/helpers/PolarGridHelper.js

@@ -83,6 +83,13 @@ class PolarGridHelper extends LineSegments {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+
+	}
+
 }
 
 

+ 7 - 0
src/helpers/SkeletonHelper.js

@@ -94,6 +94,13 @@ class SkeletonHelper extends LineSegments {
 
 	}
 
+	dispose() {
+
+		this.geometry.dispose();
+		this.material.dispose();
+
+	}
+
 }