yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
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
import defined from "./defined.js";
 
/**
 * Describes a compressed texture and contains a compressed texture buffer.
 * @alias CompressedTextureBuffer
 * @constructor
 *
 * @param {PixelFormat} internalFormat The pixel format of the compressed texture.
 * @param {PixelDatatype} pixelDatatype The pixel datatype of the compressed texture.
 * @param {Number} width The width of the texture.
 * @param {Number} height The height of the texture.
 * @param {Uint8Array} buffer The compressed texture buffer.
 */
function CompressedTextureBuffer(
  internalFormat,
  pixelDatatype,
  width,
  height,
  buffer
) {
  this._format = internalFormat;
  this._datatype = pixelDatatype;
  this._width = width;
  this._height = height;
  this._buffer = buffer;
}
 
Object.defineProperties(CompressedTextureBuffer.prototype, {
  /**
   * The format of the compressed texture.
   * @type PixelFormat
   * @readonly
   * @memberof CompressedTextureBuffer.prototype
   */
  internalFormat: {
    get: function () {
      return this._format;
    },
  },
  /**
   * The datatype of the compressed texture.
   * @type PixelDatatype
   * @readonly
   * @memberof CompressedTextureBuffer.prototype
   */
  pixelDatatype: {
    get: function () {
      return this._datatype;
    },
  },
  /**
   * The width of the texture.
   * @type Number
   * @readonly
   * @memberof CompressedTextureBuffer.prototype
   */
  width: {
    get: function () {
      return this._width;
    },
  },
  /**
   * The height of the texture.
   * @type Number
   * @readonly
   * @memberof CompressedTextureBuffer.prototype
   */
  height: {
    get: function () {
      return this._height;
    },
  },
  /**
   * The compressed texture buffer.
   * @type Uint8Array
   * @readonly
   * @memberof CompressedTextureBuffer.prototype
   */
  bufferView: {
    get: function () {
      return this._buffer;
    },
  },
});
 
/**
 * Creates a shallow clone of a compressed texture buffer.
 *
 * @param {CompressedTextureBuffer} object The compressed texture buffer to be cloned.
 * @return {CompressedTextureBuffer} A shallow clone of the compressed texture buffer.
 */
CompressedTextureBuffer.clone = function (object) {
  if (!defined(object)) {
    return undefined;
  }
 
  return new CompressedTextureBuffer(
    object._format,
    object._datatype,
    object._width,
    object._height,
    object._buffer
  );
};
 
/**
 * Creates a shallow clone of this compressed texture buffer.
 *
 * @return {CompressedTextureBuffer} A shallow clone of the compressed texture buffer.
 */
CompressedTextureBuffer.prototype.clone = function () {
  return CompressedTextureBuffer.clone(this);
};
export default CompressedTextureBuffer;