parseNurbsGeometry method
dynamic
parseNurbsGeometry(
- dynamic geoNode
Implementation
parseNurbsGeometry( geoNode ) {
if ( NURBSCurve == null ) {
print( 'THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' );
return new BufferGeometry();
}
var order = int.parse( geoNode.Order );
if ( order == null ) {
print( 'THREE.FBXLoader: Invalid Order ${geoNode.Order} given for geometry ID: ${geoNode.id}' );
return BufferGeometry();
}
var degree = order - 1;
var knots = geoNode.KnotVector.a;
var controlPoints = [];
var pointsValues = geoNode.Points.a;
for ( var i = 0, l = pointsValues.length; i < l; i += 4 ) {
controlPoints.add( Vector4().fromArray( pointsValues, i ) );
}
var startKnot, endKnot;
if ( geoNode.Form == 'Closed' ) {
controlPoints.add( controlPoints[ 0 ] );
} else if ( geoNode.Form == 'Periodic' ) {
startKnot = degree;
endKnot = knots.length - 1 - startKnot;
for ( var i = 0; i < degree; ++ i ) {
controlPoints.add( controlPoints[ i ] );
}
}
var curve = new NURBSCurve( degree, knots, controlPoints, startKnot, endKnot );
var points = curve.getPoints( controlPoints.length * 12 );
return new BufferGeometry().setFromPoints( points );
}