All files / engine/Source/Scene KeyframeNode.js

70% Statements 14/20
0% Branches 0/2
75% Functions 3/4
70% Lines 14/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 621x                                     31x 31x 31x 31x 31x 31x 31x             1x                           1x 13x             1x 86x     1x      
const LoadState = Object.freeze({
  UNLOADED: 0, // Has no data and is in dormant state
  RECEIVING: 1, // Is waiting on data from the provider
  PROCESSING: 2, // Data received.  Contents are being processed for rendering.  Depending on the content, it might make its own requests for external data.
  LOADED: 3, // Processed data from provider
  FAILED: 4, // Failed to receive data from the provider
  UNAVAILABLE: 5, // No data available for this tile
});
 
/**
 * @alias KeyframeNode
 * @constructor
 *
 * @param {SpatialNode} spatialNode
 * @param {number} keyframe
 *
 * @private
 */
function KeyframeNode(spatialNode, keyframe) {
  this.spatialNode = spatialNode;
  this.keyframe = keyframe;
  this.state = LoadState.UNLOADED;
  this.content = undefined;
  this.megatextureIndex = -1;
  this.priority = -Number.MAX_VALUE;
  this.highPriorityFrameNumber = -1;
}
 
/**
 * Frees the resources used by this object.
 * @private
 */
KeyframeNode.prototype.unload = function () {
  this.content = this.content && this.content.destroy();
 
  this.spatialNode = undefined;
  this.state = LoadState.UNLOADED;
  this.megatextureIndex = -1;
  this.priority = -Number.MAX_VALUE;
  this.highPriorityFrameNumber = -1;
};
 
/**
 * @param {KeyframeNode} a
 * @param {KeyframeNode} b
 */
KeyframeNode.priorityComparator = function (a, b) {
  return a.priority - b.priority;
};
 
/**
 * @param {KeyframeNode} a
 * @param {KeyframeNode} b
 */
KeyframeNode.searchComparator = function (a, b) {
  return a.keyframe - b.keyframe;
};
 
KeyframeNode.LoadState = LoadState;
 
export default KeyframeNode;