All files / engine/Source/Scene/Model/Extensions/Gpm PpeTexture.js

100% Statements 15/15
100% Branches 0/0
100% Functions 7/7
100% Lines 15/15

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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128                                                                3x 3x     3x 3x 3x 3x 3x 3x     1x                     9x                           1x                         5x                         5x                         4x                         4x            
import Check from "../../../../Core/Check.js";
 
/**
 * @typedef {object} PpeTexture.ConstructorOptions
 *
 * Initialization options for the PpeTexture constructor
 *
 * @property {PpeMetadata} traits The traits that indicate which data is stored in this texture
 * @property {number} index The index of the texture inside the glTF textures array
 * @property {number|undefined} [texCoord] The optional set index for the TEXCOORD attribute
 * @property {number|undefined} [noData] The value to represent missing data
 * @property {number|undefined} [offset] An offset to apply to property values.
 * @property {number|undefined} [scale] A scale to apply to property values.
 */
 
/**
 * PPE (Per-Point Error) texture in `NGA_gpm_local`.
 *
 * This reflects the `ppeTexture` definition of the
 * {@link https://nsgreg.nga.mil/csmwg.jsp|NGA_gpm_local} glTF extension.
 *
 * This is a valid glTF `TextureInfo` object (with a required `index`
 * and an optional `texCoord)`, with additional properties that
 * describe the structure of the metdata that is stored in the texture.
 *
 * @constructor
 * @param {PpeTexture.ConstructorOptions} options An object describing initialization options
 *
 * @private
 */
function PpeTexture(options) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("options.traits", options.traits);
  Check.typeOf.number.greaterThanOrEquals("options.index", options.index, 0);
  //>>includeEnd('debug');
 
  this._traits = options.traits;
  this._noData = options.noData;
  this._offset = options.offset;
  this._scale = options.scale;
  this._index = options.index;
  this._texCoord = options.texCoord;
}
 
Object.defineProperties(PpeTexture.prototype, {
  /**
   * The data contained here applies to this node and corresponding
   * texture.
   *
   * @memberof PpeTexture.prototype
   * @type {PpeMetadata}
   * @readonly
   */
  traits: {
    get: function () {
      return this._traits;
    },
  },
 
  /**
   * A value to represent missing data - also known as a sentinel value -
   * wherever it appears.
   *
   * @memberof PpeTexture.prototype
   * @type {number|undefined}
   * @readonly
   */
  noData: {
    get: function () {
      return this._noData;
    },
  },
 
  /**
   * An offset to apply to property values.
   *
   * @memberof PpeTexture.prototype
   * @type {number|undefined}
   * @readonly
   */
  offset: {
    get: function () {
      return this._offset;
    },
  },
 
  /**
   * An scale to apply to property values.
   *
   * @memberof PpeTexture.prototype
   * @type {number|undefined}
   * @readonly
   */
  scale: {
    get: function () {
      return this._scale;
    },
  },
 
  /**
   * The index of the texture
   *
   * @memberof PpeTexture.prototype
   * @type {number}
   * @readonly
   */
  index: {
    get: function () {
      return this._index;
    },
  },
 
  /**
   * The set index of texture's TEXCOORD attribute used for texture coordinate mapping.
   *
   * @memberof PpeTexture.prototype
   * @type {number|undefined}
   * @readonly
   */
  texCoord: {
    get: function () {
      return this._texCoord;
    },
  },
});
 
export default PpeTexture;