Skip to content

Commit

Permalink
Fix animation error (galacean#2014)
Browse files Browse the repository at this point in the history
* fix: animation error
  • Loading branch information
gz65555 authored Feb 27, 2024
1 parent 329e52f commit 7ac7d5c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/loader/src/gltf/parser/GLTFAnimationParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ export class GLTFAnimationParser extends GLTFParser {
const { glTF } = context;
const { accessors, bufferViews } = glTF;
const { channels, samplers } = animationInfo;
const sampleDataCollection = new Array<SampleData>();
const len = samplers.length;
const sampleDataCollection = new Array<SampleData>(len);
const entities = context.get<Entity>(GLTFParserType.Entity);

let duration = -1;
let promises = new Array<Promise<void | Entity[]>>();

// parse samplers
for (let j = 0, m = samplers.length; j < m; j++) {
for (let j = 0, m = len; j < m; j++) {
const glTFSampler = samplers[j];
const inputAccessor = accessors[glTFSampler.input];
const outputAccessor = accessors[glTFSampler.output];
Expand Down Expand Up @@ -84,13 +85,13 @@ export class GLTFAnimationParser extends GLTFParser {
duration = maxTime;
}

sampleDataCollection.push({
sampleDataCollection[j] = {
type: outputAccessor.type,
interpolation: samplerInterpolation,
input,
output,
outputSize: outputStride
});
};
});
promises.push(promise);
}
Expand Down

0 comments on commit 7ac7d5c

Please sign in to comment.