UNPKG

1.33 kBJavaScriptView Raw
1import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2import _createClass from "@babel/runtime/helpers/createClass";
3import * as WebGPUConstants from '@webgpu/types/dist/constants';
4import WebGPUBuffer from './WebGPUBuffer';
5
6var WebGPUElements = /*#__PURE__*/function () {
7 function WebGPUElements(engine, options) {
8 _classCallCheck(this, WebGPUElements);
9
10 this.engine = engine;
11 this.options = options;
12 this.indexCount = void 0;
13 this.buffer = void 0;
14 var _options = options,
15 data = _options.data,
16 usage = _options.usage,
17 type = _options.type,
18 count = _options.count;
19 this.indexCount = count || 0;
20 this.buffer = new WebGPUBuffer(engine, {
21 // @ts-ignore
22 data: data instanceof Array ? new Uint16Array(data) : data,
23 usage: WebGPUConstants.BufferUsage.Index | WebGPUConstants.BufferUsage.CopyDst
24 });
25 }
26
27 _createClass(WebGPUElements, [{
28 key: "get",
29 value: function get() {
30 return this.buffer;
31 }
32 }, {
33 key: "subData",
34 value: function subData(options) {
35 this.buffer.subData(options);
36 }
37 }, {
38 key: "destroy",
39 value: function destroy() {
40 this.buffer.destroy();
41 }
42 }]);
43
44 return WebGPUElements;
45}();
46
47export { WebGPUElements as default };
48//# sourceMappingURL=WebGPUElements.js.map
\No newline at end of file