Skip to content

Commit

Permalink
Initialize scratch variables at module scope
Browse files Browse the repository at this point in the history
  • Loading branch information
javagl authored and pupitetris committed Mar 4, 2024
1 parent ba075e1 commit 877bd16
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions packages/engine/Source/Scene/Model/ModelAnimationChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ function createSplines(times, points, interpolation, path, count) {
return splines;
}

let scratchCartesian3;
let scratchQuaternion;
const scratchCartesian3 = new Cartesian3();
const scratchQuaternion = new Quaternion();

function initialize(runtimeChannel) {
const channel = runtimeChannel._channel;
Expand All @@ -237,19 +237,6 @@ function initialize(runtimeChannel) {

runtimeChannel._splines = splines;
runtimeChannel._path = path;

switch (path) {
case AnimatedPropertyType.TRANSLATION:
case AnimatedPropertyType.SCALE:
scratchCartesian3 = new Cartesian3();
break;
case AnimatedPropertyType.ROTATION:
scratchQuaternion = new Quaternion();
break;
case AnimatedPropertyType.WEIGHTS:
// This is unused when setting a node's morph weights.
break;
}
}

/**
Expand Down

0 comments on commit 877bd16

Please sign in to comment.