UNPKG

1.22 kBJavaScriptView Raw
1import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2import _createClass from "@babel/runtime/helpers/createClass";
3import { gl } from '@antv/g-webgpu-core';
4import { dataTypeMap, usageMap } from './constants';
5/**
6 * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#elements
7 */
8
9var ReglElements = /*#__PURE__*/function () {
10 function ReglElements(reGl, options) {
11 _classCallCheck(this, ReglElements);
12
13 this.elements = void 0;
14 var data = options.data,
15 usage = options.usage,
16 type = options.type,
17 count = options.count;
18 this.elements = reGl.elements({
19 data: data,
20 usage: usageMap[usage || gl.STATIC_DRAW],
21 type: dataTypeMap[type || gl.UNSIGNED_BYTE],
22 count: count
23 });
24 }
25
26 _createClass(ReglElements, [{
27 key: "get",
28 value: function get() {
29 return this.elements;
30 }
31 }, {
32 key: "subData",
33 value: function subData(_ref) {
34 var data = _ref.data;
35 this.elements.subdata(data);
36 }
37 }, {
38 key: "destroy",
39 value: function destroy() {
40 this.elements.destroy();
41 }
42 }]);
43
44 return ReglElements;
45}();
46
47export { ReglElements as default };
48//# sourceMappingURL=ReglElements.js.map
\No newline at end of file