提交 b4d89001 编写于 作者: P prafullit

.clone() and .toJSON() added to AreaLight

Add .clone() and .toJSON() to AreaLight
上级 4b18cf51
/**
* @author MPanknin / http://www.redplant.de/
* @author alteredq / http://alteredqualia.com/
* @author prafullit
*/
THREE.AreaLight = function ( color, intensity ) {
......@@ -26,3 +27,31 @@ THREE.AreaLight = function ( color, intensity ) {
THREE.AreaLight.prototype = Object.create( THREE.Light.prototype );
THREE.AreaLight.prototype.constructor = THREE.AreaLight;
THREE.AreaLight.prototype.clone = function () {
var light = new THREE.AreaLight();
THREE.Light.prototype.clone.call( this, light );
light.normal.copy(this.normal);
light.right.copy(this.right);
light.intensity = this.intensity;
light.width = this.width;
light.height = this.height;
light.constantAttenuation = this.constantAttenuation;
light.linearAttenuation = this.linearAttenuation;
light.quadraticAttenuation = this.quadraticAttenuation
return light;
};
THREE.AreaLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
return data;
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册