Skip to content

Commit

Permalink
Expose InterpolationBuffer on NAF global (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed Dec 29, 2023
1 parent 9cfa6aa commit e4e25eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/networked.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/* global AFRAME, NAF, THREE */
var deepEqual = require('../DeepEquals');
var InterpolationBuffer = require('buffered-interpolation');
// InterpolationBuffer.MODE_LERP is not exported, it's undefined
var MODE_LERP = 0;
var DEG2RAD = THREE.MathUtils.DEG2RAD;
var OBJECT3D_COMPONENTS = ['position', 'rotation', 'scale'];

// Expose InterpolationBuffer on NAF global
NAF.InterpolationBuffer = InterpolationBuffer;

function defaultRequiresUpdate() {
let cachedData = null;

Expand Down Expand Up @@ -543,7 +548,7 @@ AFRAME.registerComponent('networked', {
}

if (!bufferInfo) {
bufferInfo = { buffer: new InterpolationBuffer(InterpolationBuffer.MODE_LERP, 0.1),
bufferInfo = { buffer: new InterpolationBuffer(MODE_LERP, 0.1),
object3D: el.object3D,
componentNames: [componentName] };
this.bufferInfos.push(bufferInfo);
Expand Down

0 comments on commit e4e25eb

Please sign in to comment.