|
@@ -37,6 +37,16 @@ function ShapeGeometry( shapes, curveSegments ) {
|
|
|
ShapeGeometry.prototype = Object.create( Geometry.prototype );
|
|
|
ShapeGeometry.prototype.constructor = ShapeGeometry;
|
|
|
|
|
|
+ShapeGeometry.prototype.toJSON = function () {
|
|
|
+
|
|
|
+ var data = Geometry.prototype.toJSON.call( this );
|
|
|
+
|
|
|
+ var shapes = this.parameters.shapes;
|
|
|
+
|
|
|
+ return toJSON( shapes, data );
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
// ShapeBufferGeometry
|
|
|
|
|
|
function ShapeBufferGeometry( shapes, curveSegments ) {
|
|
@@ -172,5 +182,41 @@ function ShapeBufferGeometry( shapes, curveSegments ) {
|
|
|
ShapeBufferGeometry.prototype = Object.create( BufferGeometry.prototype );
|
|
|
ShapeBufferGeometry.prototype.constructor = ShapeBufferGeometry;
|
|
|
|
|
|
+ShapeBufferGeometry.prototype.toJSON = function () {
|
|
|
+
|
|
|
+ var data = BufferGeometry.prototype.toJSON.call( this );
|
|
|
+
|
|
|
+ var shapes = this.parameters.shapes;
|
|
|
+
|
|
|
+ return toJSON( shapes, data );
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+//
|
|
|
+
|
|
|
+function toJSON( shapes, data ) {
|
|
|
+
|
|
|
+ data.shapes = [];
|
|
|
+
|
|
|
+ if ( Array.isArray( shapes ) ) {
|
|
|
+
|
|
|
+ for ( var i = 0, l = shapes.length; i < l; i ++ ) {
|
|
|
+
|
|
|
+ var shape = shapes[ i ];
|
|
|
+
|
|
|
+ data.shapes.push( shape.uuid );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ data.shapes.push( shapes.uuid );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return data;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
export { ShapeGeometry, ShapeBufferGeometry };
|