未验证 提交 1bbe8066 编写于 作者: R Ryan Henning 提交者: GitHub

Add missing `dispose()` methods (#21577)

* Add missing `dispose()` methods for AxesHelper and CameraHelper

* Add missing `dispose()` methods for Light and LightShadow

* Add `dispose()` to docs for AxesHelper and CameraHelper

* Add `dispose()` to docs for Lights and LightShadow

* Fix eslint issues

* Replace spaces with tabs in documentation
上级 2bfd25cd
......@@ -44,6 +44,11 @@ scene.add( axesHelper );
<h2>Methods</h2>
<p>See the base [page:LineSegments] class for common methods.</p>
<h3>[method:AxesHelper dispose]()</h3>
<p>
Disposes of the internally-created [page:Line.material material] and [page:Line.geometry geometry] used by this helper.
</p>
<h2>Source</h2>
<p>
......
......@@ -68,6 +68,10 @@ scene.add( helper );
<h2>Methods</h2>
<p>See the base [page:LineSegments] class for common methods.</p>
<h3>[method:CameraHelper dispose]()</h3>
<p>
Disposes of the internally-created [page:Line.material material] and [page:Line.geometry geometry] used by this helper.
</p>
<h3>[method:null update]()</h3>
<p>Updates the helper based on the projectionMatrix of the camera.</p>
......
......@@ -117,6 +117,12 @@
<p>See the base [page:Light Light] class for common methods.</p>
<h3>[method:DirectionalLight dispose]()</h3>
<p>
Override of base class's [page:Light.dispose dispose].
Disposes of this light's [page:DirectionalLightShadow shadow].
</p>
<h3>[method:DirectionalLight copy]( [param:DirectionalLight source] )</h3>
<p>
Copies value of all the properties from the [page:DirectionalLight source] to this
......
......@@ -52,6 +52,10 @@
See the base [page:Object3D Object3D] class for common methods.
</p>
<h3>[method:Light dispose]()</h3>
<p>
Abstract dispose method for lights; implemented by subclasses that have disposable resources.
</p>
<h3>[method:Light copy]( [param:Light source] )</h3>
<p>
......
......@@ -105,6 +105,12 @@ scene.add( light );
See the base [page:Light Light] class for common methods.
</p>
<h3>[method:PointLight dispose]()</h3>
<p>
Override of base class's [page:Light.dispose dispose].
Disposes of this light's [page:PointLightShadow shadow].
</p>
<h3>[method:PointLight copy]( [param:PointLight source] )</h3>
<p>
Copies value of all the properties from the [page:PointLight source] to this
......
......@@ -163,6 +163,12 @@ light.target = targetObject;
<p>See the base [page:Light Light] class for common methods.</p>
<h3>[method:SpotLight dispose]()</h3>
<p>
Override of base class's [page:Light.dispose dispose].
Disposes of this light's [page:SpotLightShadow shadow].
</p>
<h3>[method:SpotLight copy]( [param:SpotLight source] )</h3>
<p>
Copies value of all the properties from the [page:SpotLight source] to this
......
......@@ -122,6 +122,11 @@
Used internally by the renderer to get the number of viewports that need to be rendered for this shadow.
</p>
<h3>[method:LightShadow dispose]()</h3>
<p>
Disposes of this shadow's textures ([page:LightShadow.map map] and [page:LightShadow.mapPass mapPass]).
</p>
<h3>[method:LightShadow copy]( [param:LightShadow source] )</h3>
<p>
Copies value of all the properties from the [page:LightShadow source] to this
......
......@@ -31,6 +31,13 @@ class AxesHelper extends LineSegments {
}
dispose() {
this.geometry.dispose();
this.material.dispose();
}
}
......
......@@ -177,6 +177,13 @@ class CameraHelper extends LineSegments {
}
dispose() {
this.geometry.dispose();
this.material.dispose();
}
}
......
......@@ -19,6 +19,12 @@ class DirectionalLight extends Light {
}
dispose() {
this.shadow.dispose();
}
copy( source ) {
super.copy( source );
......
......@@ -14,6 +14,12 @@ class Light extends Object3D {
}
dispose() {
// Empty here in base class; some subclasses override.
}
copy( source ) {
super.copy( source );
......
......@@ -91,6 +91,22 @@ class LightShadow {
}
dispose() {
if ( this.map ) {
this.map.dispose();
}
if ( this.mapPass ) {
this.mapPass.dispose();
}
}
copy( source ) {
this.camera = source.camera.clone();
......
......@@ -32,6 +32,12 @@ class PointLight extends Light {
}
dispose() {
this.shadow.dispose();
}
copy( source ) {
super.copy( source );
......
......@@ -40,6 +40,12 @@ class SpotLight extends Light {
}
dispose() {
this.shadow.dispose();
}
copy( source ) {
super.copy( source );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册