ShadowEditor/ShadowEditor.Web/src/serialization/geometry/CircleBufferGeometrySerializer.js

32 lines
1.0 KiB
JavaScript

import BaseSerializer from '../BaseSerializer';
import BufferGeometrySerializer from './BufferGeometrySerializer';
/**
* CircleBufferGeometrySerializer
* @author tengge / https://github.com/tengge1
*/
function CircleBufferGeometrySerializer() {
BaseSerializer.call(this);
}
CircleBufferGeometrySerializer.prototype = Object.create(BaseSerializer.prototype);
CircleBufferGeometrySerializer.prototype.constructor = CircleBufferGeometrySerializer;
CircleBufferGeometrySerializer.prototype.toJSON = function (obj) {
return BufferGeometrySerializer.prototype.toJSON.call(this, obj);
};
CircleBufferGeometrySerializer.prototype.fromJSON = function (json, parent) {
var obj = parent === undefined ? new THREE.CircleBufferGeometry(
json.parameters.radius,
json.parameters.segments,
json.parameters.thetaStart,
json.parameters.thetaLength
) : parent;
BufferGeometrySerializer.prototype.fromJSON.call(this, json, obj);
return obj;
};
export default CircleBufferGeometrySerializer;