Browse Source

Handle degree 1 NURBS curves as polylines

Luis Fraguada 4 years ago
parent
commit
95d20e8291
1 changed files with 8 additions and 8 deletions
  1. 8 8
      examples/jsm/loaders/3DMLoader.js

+ 8 - 8
examples/jsm/loaders/3DMLoader.js

@@ -156,12 +156,6 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	parse: function ( data, onLoad, onError ) {
 
-		if ( data instanceof Uint8Array ) {
-
-			data = new Uint8Array( data ).buffer;
-
-		}
-
 		this.decodeObjects( data, '' )
 			.then( onLoad )
 			.catch( onError );
@@ -1355,12 +1349,18 @@ Rhino3dmLoader.Rhino3dmWorker = function () {
 
 		if ( curve instanceof rhino.NurbsCurve && curve.degree === 1 ) {
 
-			if ( curve.segmentCount === undefined || curve.segmentCount === 1 ) {
+			const pLine = curve.tryGetPolyline();
 
-				return [ curve.pointAtStart, curve.pointAtEnd ];
+			for ( var i = 0; i < pLine.count; i ++ ) {
+
+				rc.push( pLine.get( i ) );
 
 			}
 
+			pLine.delete();
+
+			return rc;
+
 		}
 
 		var domain = curve.domain;