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