未验证 提交 6e21d441 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #20906 from Kimbatt/fbxloader-speedup

FBXLoader - Speed up getTimesForAllAxes
......@@ -2790,16 +2790,34 @@ THREE.FBXLoader = ( function () {
if ( curves.y !== undefined ) times = times.concat( curves.y.times );
if ( curves.z !== undefined ) times = times.concat( curves.z.times );
// then sort them and remove duplicates
// then sort them
times = times.sort( function ( a, b ) {
return a - b;
} ).filter( function ( elem, index, array ) {
} );
return array.indexOf( elem ) == index;
// and remove duplicates
if ( times.length > 1 ) {
} );
var targetIndex = 1;
var lastValue = times[ 0 ];
for ( var i = 1; i < times.length; i ++ ) {
var currentValue = times[ i ];
if ( currentValue !== lastValue ) {
times[ targetIndex ] = currentValue;
lastValue = currentValue;
targetIndex ++;
}
}
times = times.slice( 0, targetIndex );
}
return times;
......
......@@ -2837,16 +2837,34 @@ var FBXLoader = ( function () {
if ( curves.y !== undefined ) times = times.concat( curves.y.times );
if ( curves.z !== undefined ) times = times.concat( curves.z.times );
// then sort them and remove duplicates
// then sort them
times = times.sort( function ( a, b ) {
return a - b;
} ).filter( function ( elem, index, array ) {
} );
return array.indexOf( elem ) == index;
// and remove duplicates
if ( times.length > 1 ) {
} );
var targetIndex = 1;
var lastValue = times[ 0 ];
for ( var i = 1; i < times.length; i ++ ) {
var currentValue = times[ i ];
if ( currentValue !== lastValue ) {
times[ targetIndex ] = currentValue;
lastValue = currentValue;
targetIndex ++;
}
}
times = times.slice( 0, targetIndex );
}
return times;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册