BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

DirectionalLight.dispose()

描述

DirectionalLight.dispose() 方法从内存中移除方向光对象及其关联的资源以释放内存。

语法

directionalLight.dispose();

参数

None

返回值

None

示例

var scene = new THREE.Scene();
var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
scene.add( directionalLight );

// Dispose directionalLight
directionalLight.dispose();

备注

使用dispose()方法释放资源是十分重要的,否则将导致内存泄漏。

在您需要销毁一个方向光对象时,这个方法将会非常有用。

请确保您不再需要该对象,并且您调用了 dispose() 方法,否则该对象会一直保留在内存中。

相关API

参考文献