mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
34 lines
959 B
JavaScript
34 lines
959 B
JavaScript
import BaseSerializer from '../BaseSerializer';
|
|
import LightSerializer from './LightSerializer';
|
|
|
|
/**
|
|
* RectAreaLightSerializer
|
|
* @author tengge / https://github.com/tengge1
|
|
*/
|
|
function RectAreaLightSerializer() {
|
|
BaseSerializer.call(this);
|
|
}
|
|
|
|
RectAreaLightSerializer.prototype = Object.create(BaseSerializer.prototype);
|
|
RectAreaLightSerializer.prototype.constructor = RectAreaLightSerializer;
|
|
|
|
RectAreaLightSerializer.prototype.toJSON = function (obj) {
|
|
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
|
|
|
json.width = obj.width;
|
|
json.height = obj.height;
|
|
|
|
return json;
|
|
};
|
|
|
|
RectAreaLightSerializer.prototype.fromJSON = function (json, parent) {
|
|
var obj = parent === undefined ? new THREE.RectAreaLight(json.color, json.intensity, json.width, json.height) : parent;
|
|
|
|
LightSerializer.prototype.fromJSON.call(this, json, obj);
|
|
|
|
obj.isRectAreaLight = true;
|
|
|
|
return obj;
|
|
};
|
|
|
|
export default RectAreaLightSerializer; |