提交 df590909 编写于 作者: M MiiBond 提交者: Mr.doob

Added dispose methods for cleaning up light helpers

上级 dfa26949
......@@ -37,6 +37,14 @@ THREE.DirectionalLightHelper = function ( light, size ) {
THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
THREE.DirectionalLightHelper.prototype.dispose = function () {
this.lightPlane.geometry.dispose();
this.lightPlane.material.dispose();
this.targetLine.geometry.dispose();
this.targetLine.material.dispose();
};
THREE.DirectionalLightHelper.prototype.update = function () {
var vector = new THREE.Vector3();
......
......@@ -35,6 +35,11 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz
THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype );
THREE.HemisphereLightHelper.prototype.dispose = function () {
this.lightSphere.geometry.dispose();
this.lightSphere.material.dispose();
};
THREE.HemisphereLightHelper.prototype.update = function () {
var vector = new THREE.Vector3();
......
......@@ -43,6 +43,12 @@ THREE.PointLightHelper = function ( light, sphereSize ) {
THREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype );
THREE.PointLightHelper.prototype.dispose = function () {
this.geometry.dispose();
this.material.dispose();
};
THREE.PointLightHelper.prototype.update = function () {
this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
......
......@@ -30,6 +30,11 @@ THREE.SpotLightHelper = function ( light ) {
THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype );
THREE.SpotLightHelper.prototype.dispose = function () {
this.cone.geometry.dispose();
this.cone.material.dispose();
};
THREE.SpotLightHelper.prototype.update = function () {
var vector = new THREE.Vector3();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册