UNPKG

1.31 kBJavaScriptView Raw
1import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2import _createClass from "@babel/runtime/helpers/createClass";
3
4/**
5 * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#attributes
6 */
7var ReglAttribute = /*#__PURE__*/function () {
8 function ReglAttribute(gl, options) {
9 _classCallCheck(this, ReglAttribute);
10
11 this.attribute = void 0;
12 this.buffer = void 0;
13 var buffer = options.buffer,
14 offset = options.offset,
15 stride = options.stride,
16 normalized = options.normalized,
17 size = options.size,
18 divisor = options.divisor;
19 this.buffer = buffer;
20 this.attribute = {
21 buffer: buffer.get(),
22 offset: offset || 0,
23 stride: stride || 0,
24 normalized: normalized || false,
25 divisor: divisor || 0
26 };
27
28 if (size) {
29 this.attribute.size = size;
30 }
31 }
32
33 _createClass(ReglAttribute, [{
34 key: "get",
35 value: function get() {
36 return this.attribute;
37 }
38 }, {
39 key: "updateBuffer",
40 value: function updateBuffer(options) {
41 this.buffer.subData(options);
42 }
43 }, {
44 key: "destroy",
45 value: function destroy() {
46 this.buffer.destroy();
47 }
48 }]);
49
50 return ReglAttribute;
51}();
52
53export { ReglAttribute as default };
54//# sourceMappingURL=ReglAttribute.js.map
\No newline at end of file