1 | import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
2 | import _createClass from "@babel/runtime/helpers/createClass";
|
3 |
|
4 | var WebGPUAttribute = function () {
|
5 | function WebGPUAttribute(engine, options) {
|
6 | _classCallCheck(this, WebGPUAttribute);
|
7 |
|
8 | this.engine = engine;
|
9 | this.options = options;
|
10 | this.attribute = void 0;
|
11 | this.buffer = void 0;
|
12 | var _options = options,
|
13 | buffer = _options.buffer,
|
14 | offset = _options.offset,
|
15 | stride = _options.stride,
|
16 | normalized = _options.normalized,
|
17 | size = _options.size,
|
18 | divisor = _options.divisor,
|
19 | arrayStride = _options.arrayStride,
|
20 | attributes = _options.attributes,
|
21 | stepMode = _options.stepMode;
|
22 | this.buffer = buffer;
|
23 | this.attribute = {
|
24 | buffer: buffer.get(),
|
25 | offset: offset || 0,
|
26 | stride: stride || 0,
|
27 | normalized: normalized || false,
|
28 | divisor: divisor || 0,
|
29 | arrayStride: arrayStride || 0,
|
30 |
|
31 | attributes: attributes,
|
32 | stepMode: stepMode || 'vertex'
|
33 | };
|
34 |
|
35 | if (size) {
|
36 | this.attribute.size = size;
|
37 | }
|
38 | }
|
39 |
|
40 | _createClass(WebGPUAttribute, [{
|
41 | key: "get",
|
42 | value: function get() {
|
43 | return this.attribute;
|
44 | }
|
45 | }, {
|
46 | key: "updateBuffer",
|
47 | value: function updateBuffer(options) {
|
48 | this.buffer.subData(options);
|
49 | }
|
50 | }, {
|
51 | key: "destroy",
|
52 | value: function destroy() {
|
53 | this.buffer.destroy();
|
54 | }
|
55 | }]);
|
56 |
|
57 | return WebGPUAttribute;
|
58 | }();
|
59 |
|
60 | export { WebGPUAttribute as default };
|
61 |
|
\ | No newline at end of file |