提交 16b2f2cc 编写于 作者: M Mr.doob

FBX2Loader: Removed Array.prototype.findIndex dependency.

上级 6ed3ecf3
......@@ -106,6 +106,18 @@
}
function findIndex( array, func ) {
for ( var i = 0, l = array.length; i < l; i ++ ) {
if ( func( array[ i ] ) ) return i;
}
return -1;
}
var FBXTree = new TextParser().parse( FBXText );
var connections = parseConnections( FBXTree );
......@@ -627,7 +639,8 @@
deformer.array.forEach( function ( subDeformer, subDeformerIndex ) {
var index = subDeformer.indices.findIndex( function ( indx ) {
var index = findIndex( subDeformer.indices, function ( indx ) {
return indx === vertexIndex;
......@@ -1145,7 +1158,7 @@
if ( deformer.map.has( conns.parents[ i ].ID ) ) {
model = new THREE.Bone();
var index = deformer.array.findIndex( function ( subDeformer ) {
var index = findIndex( deformer.array, function ( subDeformer ) {
return subDeformer.FBX_ID === conns.parents[ i ].ID;
......@@ -1308,7 +1321,7 @@
var conns = connections.get( model.FBX_ID );
for ( var parentIndex = 0; parentIndex < conns.parents.length; parentIndex ++ ) {
var pIndex = modelArray.findIndex( function ( mod ) {
var pIndex = findIndex( modelArray, function ( mod ) {
return mod.FBX_ID === conns.parents[ parentIndex ].ID;
......@@ -2485,7 +2498,7 @@
for ( var containerIndicesIndex = containerIndices.length - 1; containerIndicesIndex >= 0; -- containerIndicesIndex ) {
var boneID = sceneGraph.skeleton.bones.findIndex( function ( bone ) {
var boneID = findIndex( sceneGraph.skeleton.bones, function ( bone ) {
return bone.FBX_ID === containerIndices[ containerIndicesIndex ].ID;
......@@ -2945,7 +2958,7 @@
var bone = bones[ bonesIndex ];
var name = bone.name.replace( /.*:/, '' );
var parentIndex = bones.findIndex( function ( parentBone ) {
var parentIndex = findIndex( bones, function ( parentBone ) {
return bone.parent === parentBone;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册