Skip to content

Commit

Permalink
FBXLoader2: Removed more unneeded allocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Mar 28, 2017
1 parent ac8c3e6 commit 6cd8973
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions examples/js/loaders/FBXLoader2.js
Expand Up @@ -3403,11 +3403,11 @@
if ( match ) {

var nodeName = match[ 1 ].trim().replace( /^"/, '' ).replace( /"$/, "" );
var nodeAttrs = match[ 2 ].split( ',' ).map( function ( element ) {
var nodeAttrs = match[ 2 ].split( ',' );

return element.trim().replace( /^"/, '' ).replace( /"$/, '' );

} );
for ( var i = 0, l = nodeAttrs.length; i < l; i ++ ) {
nodeAttrs[ i ] = nodeAttrs[ i ].trim().replace( /^"/, '' ).replace( /"$/, '' );
}

this.parseNodeBegin( l, nodeName, nodeAttrs || null );
continue;
Expand Down Expand Up @@ -3658,11 +3658,11 @@
// P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1
// into array like below
// ["Lcl Scaling", "Lcl Scaling", "", "A", "1,1,1" ]
var props = propValue.split( '",' ).map( function ( element ) {
var props = propValue.split( '",' );

return element.trim().replace( /^\"/, '' ).replace( /\s/, '_' );

} );
for ( var i = 0, l = props.length; i < l; i ++ ) {
props[ i ] = props[ i ].trim().replace( /^\"/, '' ).replace( /\s/, '_' );
}

var innerPropName = props[ 0 ];
var innerPropType1 = props[ 1 ];
Expand All @@ -3689,7 +3689,7 @@

case "ColorRGB":
case "Vector3D":
innerPropValue = new THREE.Vector3().fromArray( parseFloatArray( innerPropValue ) );
innerPropValue = parseFloatArray( innerPropValue );
break;

}
Expand Down Expand Up @@ -3979,7 +3979,7 @@
*/
function parseVector3( property ) {

return new THREE.Vector3( parseFloat( property.value.x ), parseFloat( property.value.y ), parseFloat( property.value.z ) );
return new THREE.Vector3().fromArray( property.value );

}

Expand All @@ -3990,7 +3990,7 @@
*/
function parseColor( property ) {

return new THREE.Color( parseFloat( property.value.x ), parseFloat( property.value.y ), parseFloat( property.value.z ) );
return new THREE.Color().fromArray( property.value );

}

Expand Down

0 comments on commit 6cd8973

Please sign in to comment.