@@ -2399,48 +2399,6 @@ function getNormalizedComponentScale( constructor ) {
2399
2399
2400
2400
}
2401
2401
2402
- function getArrayFromAccessor ( accessor ) {
2403
-
2404
- let outputArray = accessor . array ;
2405
-
2406
- if ( accessor . normalized ) {
2407
-
2408
- const scale = getNormalizedComponentScale ( outputArray . constructor ) ;
2409
- const scaled = new Float32Array ( outputArray . length ) ;
2410
-
2411
- for ( let j = 0 , jl = outputArray . length ; j < jl ; j ++ ) {
2412
-
2413
- scaled [ j ] = outputArray [ j ] * scale ;
2414
-
2415
- }
2416
-
2417
- outputArray = scaled ;
2418
-
2419
- }
2420
-
2421
- return outputArray ;
2422
-
2423
- }
2424
-
2425
- function createCubicSplineTrackInterpolant ( track ) {
2426
-
2427
- track . createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline ( result ) {
2428
-
2429
- // A CUBICSPLINE keyframe in glTF has three output values for each input value,
2430
- // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
2431
- // must be divided by three to get the interpolant's sampleSize argument.
2432
-
2433
- const interpolantType = ( this instanceof QuaternionKeyframeTrack ) ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant ;
2434
-
2435
- return new interpolantType ( this . times , this . values , this . getValueSize ( ) / 3 , result ) ;
2436
-
2437
- } ;
2438
-
2439
- // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
2440
- track . createInterpolant . isInterpolantFactoryMethodGLTFCubicSpline = true ;
2441
-
2442
- }
2443
-
2444
2402
function getImageURIMimeType ( uri ) {
2445
2403
2446
2404
if ( uri . search ( / \. j p e ? g ( $ | \? ) / i ) > 0 || uri . search ( / ^ d a t a \: i m a g e \/ j p e g / ) === 0 ) return 'image/jpeg' ;
@@ -3920,21 +3878,21 @@ class GLTFParser {
3920
3878
const output = animationDef . parameters !== undefined ? animationDef . parameters [ sampler . output ] : sampler . output ;
3921
3879
3922
3880
if ( target . node === undefined ) {
3923
-
3881
+
3924
3882
const nodeDependency = parser . _invokeOne ( function ( ext ) {
3925
3883
3926
3884
return ext . loadAnimationTargetFromChannel && ext . loadAnimationTargetFromChannel ( channel ) ;
3927
3885
3928
3886
} ) ;
3929
3887
3930
3888
pendingNodes . push ( nodeDependency ) ;
3931
-
3889
+
3932
3890
} else {
3933
3891
3934
3892
pendingNodes . push ( this . getDependency ( 'node' , name ) ) ;
3935
-
3893
+
3936
3894
}
3937
-
3895
+
3938
3896
pendingInputAccessors . push ( this . getDependency ( 'accessor' , input ) ) ;
3939
3897
pendingOutputAccessors . push ( this . getDependency ( 'accessor' , output ) ) ;
3940
3898
pendingSamplers . push ( sampler ) ;
@@ -4393,7 +4351,7 @@ class GLTFParser {
4393
4351
4394
4352
const interpolation = sampler . interpolation !== undefined ? INTERPOLATION [ sampler . interpolation ] : InterpolateLinear ;
4395
4353
4396
- const outputArray = getArrayFromAccessor ( outputAccessor ) ;
4354
+ const outputArray = this . getArrayFromAccessor ( outputAccessor ) ;
4397
4355
4398
4356
for ( let j = 0 , jl = targetNames . length ; j < jl ; j ++ ) {
4399
4357
@@ -4407,7 +4365,7 @@ class GLTFParser {
4407
4365
// Override interpolation with custom factory method.
4408
4366
if ( interpolation === 'CUBICSPLINE' ) {
4409
4367
4410
- createCubicSplineTrackInterpolant ( track ) ;
4368
+ this . createCubicSplineTrackInterpolant ( track ) ;
4411
4369
4412
4370
}
4413
4371
@@ -4419,6 +4377,48 @@ class GLTFParser {
4419
4377
4420
4378
}
4421
4379
4380
+ getArrayFromAccessor ( accessor ) {
4381
+
4382
+ let outputArray = accessor . array ;
4383
+
4384
+ if ( accessor . normalized ) {
4385
+
4386
+ const scale = getNormalizedComponentScale ( outputArray . constructor ) ;
4387
+ const scaled = new Float32Array ( outputArray . length ) ;
4388
+
4389
+ for ( let j = 0 , jl = outputArray . length ; j < jl ; j ++ ) {
4390
+
4391
+ scaled [ j ] = outputArray [ j ] * scale ;
4392
+
4393
+ }
4394
+
4395
+ outputArray = scaled ;
4396
+
4397
+ }
4398
+
4399
+ return outputArray ;
4400
+
4401
+ }
4402
+
4403
+ createCubicSplineTrackInterpolant ( track ) {
4404
+
4405
+ track . createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline ( result ) {
4406
+
4407
+ // A CUBICSPLINE keyframe in glTF has three output values for each input value,
4408
+ // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
4409
+ // must be divided by three to get the interpolant's sampleSize argument.
4410
+
4411
+ const interpolantType = ( this instanceof QuaternionKeyframeTrack ) ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant ;
4412
+
4413
+ return new interpolantType ( this . times , this . values , this . getValueSize ( ) / 3 , result ) ;
4414
+
4415
+ } ;
4416
+
4417
+ // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
4418
+ track . createInterpolant . isInterpolantFactoryMethodGLTFCubicSpline = true ;
4419
+
4420
+ }
4421
+
4422
4422
}
4423
4423
4424
4424
/**
0 commit comments