|
@@ -31,6 +31,7 @@ import { LineSegments } from '../objects/LineSegments.js';
|
|
|
import { LOD } from '../objects/LOD.js';
|
|
|
import { Mesh } from '../objects/Mesh.js';
|
|
|
import { SkinnedMesh } from '../objects/SkinnedMesh.js';
|
|
|
+import { Shape } from '../extras/core/Shape.js';
|
|
|
import { Fog } from '../scenes/Fog.js';
|
|
|
import { FogExp2 } from '../scenes/FogExp2.js';
|
|
|
import { HemisphereLight } from '../lights/HemisphereLight.js';
|
|
@@ -123,7 +124,8 @@ Object.assign( ObjectLoader.prototype, {
|
|
|
|
|
|
parse: function ( json, onLoad ) {
|
|
|
|
|
|
- var geometries = this.parseGeometries( json.geometries );
|
|
|
+ var shapes = this.parseShape( json.shapes );
|
|
|
+ var geometries = this.parseGeometries( json.geometries, shapes );
|
|
|
|
|
|
var images = this.parseImages( json.images, function () {
|
|
|
|
|
@@ -152,7 +154,27 @@ Object.assign( ObjectLoader.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- parseGeometries: function ( json ) {
|
|
|
+ parseShape: function ( json ) {
|
|
|
+
|
|
|
+ var shapes = {};
|
|
|
+
|
|
|
+ if ( json !== undefined ) {
|
|
|
+
|
|
|
+ for ( var i = 0, l = json.length; i < l; i ++ ) {
|
|
|
+
|
|
|
+ var shape = new Shape().fromJSON( json[ i ] );
|
|
|
+
|
|
|
+ shapes[ shape.uuid ] = shape;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return shapes;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ parseGeometries: function ( json, shapes ) {
|
|
|
|
|
|
var geometries = {};
|
|
|
|
|
@@ -334,6 +356,26 @@ Object.assign( ObjectLoader.prototype, {
|
|
|
|
|
|
break;
|
|
|
|
|
|
+ case 'ShapeGeometry':
|
|
|
+ case 'ShapeBufferGeometry':
|
|
|
+
|
|
|
+ var geometryShapes = [];
|
|
|
+
|
|
|
+ for ( var i = 0, l = data.shapes.length; i < l; i ++ ) {
|
|
|
+
|
|
|
+ var shape = shapes[ data.shapes[ i ] ];
|
|
|
+
|
|
|
+ geometryShapes.push( shape );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ geometry = new Geometries[ data.type ](
|
|
|
+ geometryShapes,
|
|
|
+ data.curveSegments
|
|
|
+ );
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
case 'BufferGeometry':
|
|
|
|
|
|
geometry = bufferGeometryLoader.parse( data );
|