|
@@ -1,21 +1,6 @@
|
|
|
import { Quaternion } from '../math/Quaternion.js';
|
|
|
import { AdditiveAnimationBlendMode } from '../constants.js';
|
|
|
|
|
|
-// same as Array.prototype.slice, but also works on typed arrays
|
|
|
-function arraySlice( array, from, to ) {
|
|
|
-
|
|
|
- if ( isTypedArray( array ) ) {
|
|
|
-
|
|
|
- // in ios9 array.subarray(from, undefined) will return empty array
|
|
|
- // but array.subarray(from) or array.subarray(from, len) is correct
|
|
|
- return new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return array.slice( from, to );
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
// converts an array to a specific type
|
|
|
function convertArray( array, type, forceClone ) {
|
|
|
|
|
@@ -279,14 +264,14 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
|
|
|
// Reference frame is earlier than the first keyframe, so just use the first keyframe
|
|
|
const startIndex = referenceOffset;
|
|
|
const endIndex = referenceValueSize - referenceOffset;
|
|
|
- referenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );
|
|
|
+ referenceValue = referenceTrack.values.slice( startIndex, endIndex );
|
|
|
|
|
|
} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {
|
|
|
|
|
|
// Reference frame is after the last keyframe, so just use the last keyframe
|
|
|
const startIndex = lastIndex * referenceValueSize + referenceOffset;
|
|
|
const endIndex = startIndex + referenceValueSize - referenceOffset;
|
|
|
- referenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );
|
|
|
+ referenceValue = referenceTrack.values.slice( startIndex, endIndex );
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -295,7 +280,7 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
|
|
|
const startIndex = referenceOffset;
|
|
|
const endIndex = referenceValueSize - referenceOffset;
|
|
|
interpolant.evaluate( referenceTime );
|
|
|
- referenceValue = arraySlice( interpolant.resultBuffer, startIndex, endIndex );
|
|
|
+ referenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -350,7 +335,6 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
|
|
|
}
|
|
|
|
|
|
const AnimationUtils = {
|
|
|
- arraySlice: arraySlice,
|
|
|
convertArray: convertArray,
|
|
|
isTypedArray: isTypedArray,
|
|
|
getKeyframeOrder: getKeyframeOrder,
|
|
@@ -361,7 +345,6 @@ const AnimationUtils = {
|
|
|
};
|
|
|
|
|
|
export {
|
|
|
- arraySlice,
|
|
|
convertArray,
|
|
|
isTypedArray,
|
|
|
getKeyframeOrder,
|