@antv/l7-renderer 2.5.37-mini2 → 2.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/regl/ReglFramebuffer.ts"],"names":["ReglFramebuffer","reGl","options","width","height","color","colors","depth","stencil","framebufferOptions","Array","isArray","map","c","get","framebuffer","destroy","resize"],"mappings":";;;;IAcqBA,e;AAGnB,2BAAYC,IAAZ,EAA6BC,OAA7B,EAAyE;AAAA;;AAAA;;AACvE,QAAQC,KAAR,GAAyDD,OAAzD,CAAQC,KAAR;AAAA,QAAeC,MAAf,GAAyDF,OAAzD,CAAeE,MAAf;AAAA,QAAuBC,KAAvB,GAAyDH,OAAzD,CAAuBG,KAAvB;AAAA,QAA8BC,MAA9B,GAAyDJ,OAAzD,CAA8BI,MAA9B;AAAA,QAAsCC,KAAtC,GAAyDL,OAAzD,CAAsCK,KAAtC;AAAA,QAA6CC,OAA7C,GAAyDN,OAAzD,CAA6CM,OAA7C;AAEA,QAAMC,kBAA2C,GAAG;AAClDN,MAAAA,KAAK,EAALA,KADkD;AAElDC,MAAAA,MAAM,EAANA;AAFkD,KAApD;;AAKA,QAAIM,KAAK,CAACC,OAAN,CAAcL,MAAd,CAAJ,EAA2B;AACzBG,MAAAA,kBAAkB,CAACH,MAAnB,GAA4BA,MAAM,CAACM,GAAP,CAAW,UAACC,CAAD;AAAA,eACpCA,CAAD,CAAqBC,GAArB,EADqC;AAAA,OAAX,CAA5B;AAGD;;AAED,QAAIT,KAAK,IAAI,OAAOA,KAAP,KAAiB,SAA9B,EAAyC;AACvCI,MAAAA,kBAAkB,CAACJ,KAAnB,GAA4BA,KAAD,CAAyBS,GAAzB,EAA3B;AACD;;AAID,SAAKC,WAAL,GAAmBd,IAAI,CAACc,WAAL,CAAiBN,kBAAjB,CAAnB;AACD;;;;WAED,eAAa;AACX,aAAO,KAAKM,WAAZ;AACD;;;WAED,mBAAiB;AACf,WAAKA,WAAL,CAAiBC,OAAjB;AACD;;;WAED,sBAAoE;AAAA,UAApDb,KAAoD,QAApDA,KAAoD;AAAA,UAA7CC,MAA6C,QAA7CA,MAA6C;AAClE,WAAKW,WAAL,CAAiBE,MAAjB,CAAwBd,KAAxB,EAA+BC,MAA/B;AACD;;;;;;SApCkBJ,e","sourcesContent":["import {\n gl,\n IFramebuffer,\n IFramebufferInitializationOptions,\n IRenderbuffer,\n ITexture2D,\n} from '@antv/l7-core';\nimport regl from 'l7regl';\nimport ReglTexture2D from './ReglTexture2D';\n\n/**\n * adaptor for regl.Framebuffer\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#framebuffers\n */\nexport default class ReglFramebuffer implements IFramebuffer {\n private framebuffer: regl.Framebuffer;\n\n constructor(reGl: regl.Regl, options: IFramebufferInitializationOptions) {\n const { width, height, color, colors, depth, stencil } = options;\n\n const framebufferOptions: regl.FramebufferOptions = {\n width,\n height,\n };\n\n if (Array.isArray(colors)) {\n framebufferOptions.colors = colors.map((c: ITexture2D | IRenderbuffer) =>\n (c as ReglTexture2D).get(),\n );\n }\n\n if (color && typeof color !== 'boolean') {\n framebufferOptions.color = (color as ReglTexture2D).get();\n }\n\n // TODO: depth & stencil\n\n this.framebuffer = reGl.framebuffer(framebufferOptions);\n }\n\n public get() {\n return this.framebuffer;\n }\n\n public destroy() {\n this.framebuffer.destroy();\n }\n\n public resize({ width, height }: { width: number; height: number }) {\n this.framebuffer.resize(width, height);\n }\n}\n"],"file":"ReglFramebuffer.js"}
@@ -0,0 +1,42 @@
1
+ import { IModel, IModelDrawOptions, IModelInitializationOptions, IUniform } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.DrawCommand
5
+ */
6
+ export default class ReglModel implements IModel {
7
+ private reGl;
8
+ private destroyed;
9
+ private drawCommand;
10
+ private drawParams;
11
+ private options;
12
+ private uniforms;
13
+ constructor(reGl: regl.Regl, options: IModelInitializationOptions);
14
+ addUniforms(uniforms: {
15
+ [key: string]: IUniform;
16
+ }): void;
17
+ draw(options: IModelDrawOptions): void;
18
+ destroy(): void;
19
+ /**
20
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
21
+ */
22
+ private initDepthDrawParams;
23
+ /**
24
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending
25
+ */
26
+ private initBlendDrawParams;
27
+ /**
28
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
29
+ */
30
+ private initStencilDrawParams;
31
+ /**
32
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
33
+ */
34
+ private initCullDrawParams;
35
+ /**
36
+ * 考虑结构体命名, eg:
37
+ * a: { b: 1 } -> 'a.b'
38
+ * a: [ { b: 1 } ] -> 'a[0].b'
39
+ */
40
+ private extractUniforms;
41
+ private extractUniformsRecursively;
42
+ }
@@ -0,0 +1,276 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ import _isTypedArray from "lodash/isTypedArray";
6
+ import _isPlainObject from "lodash/isPlainObject";
7
+
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
9
+
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
+
12
+ import { gl } from '@antv/l7-core';
13
+ import { blendEquationMap, blendFuncMap, cullFaceMap, depthFuncMap, primitiveMap, stencilFuncMap, stencilOpMap } from './constants';
14
+
15
+ var ReglModel = function () {
16
+ function ReglModel(reGl, options) {
17
+ _classCallCheck(this, ReglModel);
18
+
19
+ _defineProperty(this, "reGl", void 0);
20
+
21
+ _defineProperty(this, "destroyed", false);
22
+
23
+ _defineProperty(this, "drawCommand", void 0);
24
+
25
+ _defineProperty(this, "drawParams", void 0);
26
+
27
+ _defineProperty(this, "options", void 0);
28
+
29
+ _defineProperty(this, "uniforms", {});
30
+
31
+ this.reGl = reGl;
32
+ var vs = options.vs,
33
+ fs = options.fs,
34
+ attributes = options.attributes,
35
+ uniforms = options.uniforms,
36
+ primitive = options.primitive,
37
+ count = options.count,
38
+ elements = options.elements,
39
+ depth = options.depth,
40
+ blend = options.blend,
41
+ stencil = options.stencil,
42
+ cull = options.cull,
43
+ instances = options.instances;
44
+ var reglUniforms = {};
45
+ this.options = options;
46
+
47
+ if (uniforms) {
48
+ this.uniforms = this.extractUniforms(uniforms);
49
+ Object.keys(uniforms).forEach(function (uniformName) {
50
+ reglUniforms[uniformName] = reGl.prop(uniformName);
51
+ });
52
+ }
53
+
54
+ var reglAttributes = {};
55
+ Object.keys(attributes).forEach(function (name) {
56
+ reglAttributes[name] = attributes[name].get();
57
+ });
58
+ var drawParams = {
59
+ attributes: reglAttributes,
60
+ frag: fs,
61
+ uniforms: reglUniforms,
62
+ vert: vs,
63
+ primitive: primitiveMap[primitive === undefined ? gl.TRIANGLES : primitive]
64
+ };
65
+
66
+ if (instances) {
67
+ drawParams.instances = instances;
68
+ }
69
+
70
+ if (count) {
71
+ drawParams.count = count;
72
+ }
73
+
74
+ if (elements) {
75
+ drawParams.elements = elements.get();
76
+ }
77
+
78
+ this.initDepthDrawParams({
79
+ depth: depth
80
+ }, drawParams);
81
+ this.initBlendDrawParams({
82
+ blend: blend
83
+ }, drawParams);
84
+ this.initStencilDrawParams({
85
+ stencil: stencil
86
+ }, drawParams);
87
+ this.initCullDrawParams({
88
+ cull: cull
89
+ }, drawParams);
90
+ this.drawCommand = reGl(drawParams);
91
+ this.drawParams = drawParams;
92
+ }
93
+
94
+ _createClass(ReglModel, [{
95
+ key: "addUniforms",
96
+ value: function addUniforms(uniforms) {
97
+ this.uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(uniforms));
98
+ }
99
+ }, {
100
+ key: "draw",
101
+ value: function draw(options) {
102
+ if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
103
+ return;
104
+ }
105
+
106
+ var uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(options.uniforms || {}));
107
+
108
+ var reglDrawProps = {};
109
+ Object.keys(uniforms).forEach(function (uniformName) {
110
+ var type = _typeof(uniforms[uniformName]);
111
+
112
+ if (type === 'boolean' || type === 'number' || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
113
+ reglDrawProps[uniformName] = uniforms[uniformName];
114
+ } else {
115
+ reglDrawProps[uniformName] = uniforms[uniformName].get();
116
+ }
117
+ });
118
+ this.drawCommand(reglDrawProps);
119
+ }
120
+ }, {
121
+ key: "destroy",
122
+ value: function destroy() {
123
+ this.drawParams.elements.destroy();
124
+
125
+ if (this.options.attributes) {
126
+ Object.values(this.options.attributes).forEach(function (attr) {
127
+ attr.destroy();
128
+ });
129
+ }
130
+
131
+ this.destroyed = true;
132
+ }
133
+ }, {
134
+ key: "initDepthDrawParams",
135
+ value: function initDepthDrawParams(_ref, drawParams) {
136
+ var depth = _ref.depth;
137
+
138
+ if (depth) {
139
+ drawParams.depth = {
140
+ enable: depth.enable === undefined ? true : !!depth.enable,
141
+ mask: depth.mask === undefined ? true : !!depth.mask,
142
+ func: depthFuncMap[depth.func || gl.LESS],
143
+ range: depth.range || [0, 1]
144
+ };
145
+ }
146
+ }
147
+ }, {
148
+ key: "initBlendDrawParams",
149
+ value: function initBlendDrawParams(_ref2, drawParams) {
150
+ var blend = _ref2.blend;
151
+
152
+ if (blend) {
153
+ var enable = blend.enable,
154
+ func = blend.func,
155
+ equation = blend.equation,
156
+ _blend$color = blend.color,
157
+ color = _blend$color === void 0 ? [0, 0, 0, 0] : _blend$color;
158
+ drawParams.blend = {
159
+ enable: !!enable,
160
+ func: {
161
+ srcRGB: blendFuncMap[func && func.srcRGB || gl.SRC_ALPHA],
162
+ srcAlpha: blendFuncMap[func && func.srcAlpha || gl.SRC_ALPHA],
163
+ dstRGB: blendFuncMap[func && func.dstRGB || gl.ONE_MINUS_SRC_ALPHA],
164
+ dstAlpha: blendFuncMap[func && func.dstAlpha || gl.ONE_MINUS_SRC_ALPHA]
165
+ },
166
+ equation: {
167
+ rgb: blendEquationMap[equation && equation.rgb || gl.FUNC_ADD],
168
+ alpha: blendEquationMap[equation && equation.alpha || gl.FUNC_ADD]
169
+ },
170
+ color: color
171
+ };
172
+ }
173
+ }
174
+ }, {
175
+ key: "initStencilDrawParams",
176
+ value: function initStencilDrawParams(_ref3, drawParams) {
177
+ var stencil = _ref3.stencil;
178
+
179
+ if (stencil) {
180
+ var enable = stencil.enable,
181
+ _stencil$mask = stencil.mask,
182
+ mask = _stencil$mask === void 0 ? -1 : _stencil$mask,
183
+ _stencil$func = stencil.func,
184
+ func = _stencil$func === void 0 ? {
185
+ cmp: gl.ALWAYS,
186
+ ref: 0,
187
+ mask: -1
188
+ } : _stencil$func,
189
+ _stencil$opFront = stencil.opFront,
190
+ opFront = _stencil$opFront === void 0 ? {
191
+ fail: gl.KEEP,
192
+ zfail: gl.KEEP,
193
+ zpass: gl.KEEP
194
+ } : _stencil$opFront,
195
+ _stencil$opBack = stencil.opBack,
196
+ opBack = _stencil$opBack === void 0 ? {
197
+ fail: gl.KEEP,
198
+ zfail: gl.KEEP,
199
+ zpass: gl.KEEP
200
+ } : _stencil$opBack;
201
+ drawParams.stencil = {
202
+ enable: !!enable,
203
+ mask: mask,
204
+ func: _objectSpread(_objectSpread({}, func), {}, {
205
+ cmp: stencilFuncMap[func.cmp]
206
+ }),
207
+ opFront: {
208
+ fail: stencilOpMap[opFront.fail],
209
+ zfail: stencilOpMap[opFront.zfail],
210
+ zpass: stencilOpMap[opFront.zpass]
211
+ },
212
+ opBack: {
213
+ fail: stencilOpMap[opBack.fail],
214
+ zfail: stencilOpMap[opBack.zfail],
215
+ zpass: stencilOpMap[opBack.zpass]
216
+ }
217
+ };
218
+ }
219
+ }
220
+ }, {
221
+ key: "initCullDrawParams",
222
+ value: function initCullDrawParams(_ref4, drawParams) {
223
+ var cull = _ref4.cull;
224
+
225
+ if (cull) {
226
+ var enable = cull.enable,
227
+ _cull$face = cull.face,
228
+ face = _cull$face === void 0 ? gl.BACK : _cull$face;
229
+ drawParams.cull = {
230
+ enable: !!enable,
231
+ face: cullFaceMap[face]
232
+ };
233
+ }
234
+ }
235
+ }, {
236
+ key: "extractUniforms",
237
+ value: function extractUniforms(uniforms) {
238
+ var _this = this;
239
+
240
+ var extractedUniforms = {};
241
+ Object.keys(uniforms).forEach(function (uniformName) {
242
+ _this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, '');
243
+ });
244
+ return extractedUniforms;
245
+ }
246
+ }, {
247
+ key: "extractUniformsRecursively",
248
+ value: function extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
249
+ var _this2 = this;
250
+
251
+ if (uniformValue === null || typeof uniformValue === 'number' || typeof uniformValue === 'boolean' || Array.isArray(uniformValue) && typeof uniformValue[0] === 'number' || _isTypedArray(uniformValue) || uniformValue === '' || 'resize' in uniformValue) {
252
+ uniforms["".concat(prefix && prefix + '.').concat(uniformName)] = uniformValue;
253
+ return;
254
+ }
255
+
256
+ if (_isPlainObject(uniformValue)) {
257
+ Object.keys(uniformValue).forEach(function (childName) {
258
+ _this2.extractUniformsRecursively(childName, uniformValue[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName));
259
+ });
260
+ }
261
+
262
+ if (Array.isArray(uniformValue)) {
263
+ uniformValue.forEach(function (child, idx) {
264
+ Object.keys(child).forEach(function (childName) {
265
+ _this2.extractUniformsRecursively(childName, child[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName, "[").concat(idx, "]"));
266
+ });
267
+ });
268
+ }
269
+ }
270
+ }]);
271
+
272
+ return ReglModel;
273
+ }();
274
+
275
+ export { ReglModel as default };
276
+ //# sourceMappingURL=ReglModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/regl/ReglModel.ts"],"names":["gl","blendEquationMap","blendFuncMap","cullFaceMap","depthFuncMap","primitiveMap","stencilFuncMap","stencilOpMap","ReglModel","reGl","options","vs","fs","attributes","uniforms","primitive","count","elements","depth","blend","stencil","cull","instances","reglUniforms","extractUniforms","Object","keys","forEach","uniformName","prop","reglAttributes","name","get","drawParams","frag","vert","undefined","TRIANGLES","initDepthDrawParams","initBlendDrawParams","initStencilDrawParams","initCullDrawParams","drawCommand","length","reglDrawProps","type","Array","isArray","BYTES_PER_ELEMENT","destroy","values","attr","destroyed","enable","mask","func","LESS","range","equation","color","srcRGB","SRC_ALPHA","srcAlpha","dstRGB","ONE_MINUS_SRC_ALPHA","dstAlpha","rgb","FUNC_ADD","alpha","cmp","ALWAYS","ref","opFront","fail","KEEP","zfail","zpass","opBack","face","BACK","extractedUniforms","extractUniformsRecursively","uniformValue","prefix","childName","child","idx"],"mappings":";;;;;;;;;;;AAAA,SACEA,EADF,QAOO,eAPP;AAUA,SACEC,gBADF,EAEEC,YAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,YALF,EAMEC,cANF,EAOEC,YAPF,QAQO,aARP;;IAiBqBC,S;AAUnB,qBAAYC,IAAZ,EAA6BC,OAA7B,EAAmE;AAAA;;AAAA;;AAAA,uCARtC,KAQsC;;AAAA;;AAAA;;AAAA;;AAAA,sCAF/D,EAE+D;;AACjE,SAAKD,IAAL,GAAYA,IAAZ;AACA,QACEE,EADF,GAaID,OAbJ,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D,SAVD;AAWD;AACF;;;;;;SA1TkB9E,S","sourcesContent":["import {\n gl,\n IAttribute,\n IModel,\n IModelDrawOptions,\n IModelInitializationOptions,\n IUniform,\n} from '@antv/l7-core';\nimport regl from 'l7regl';\nimport { isPlainObject, isTypedArray } from 'lodash';\nimport {\n blendEquationMap,\n blendFuncMap,\n cullFaceMap,\n depthFuncMap,\n primitiveMap,\n stencilFuncMap,\n stencilOpMap,\n} from './constants';\nimport ReglAttribute from './ReglAttribute';\nimport ReglElements from './ReglElements';\nimport ReglFramebuffer from './ReglFramebuffer';\nimport ReglTexture2D from './ReglTexture2D';\n\n/**\n * adaptor for regl.DrawCommand\n */\nexport default class ReglModel implements IModel {\n private reGl: regl.Regl;\n private destroyed: boolean = false;\n private drawCommand: regl.DrawCommand;\n private drawParams: regl.DrawConfig;\n private options: IModelInitializationOptions;\n private uniforms: {\n [key: string]: IUniform;\n } = {};\n\n constructor(reGl: regl.Regl, options: IModelInitializationOptions) {\n this.reGl = reGl;\n const {\n vs,\n fs,\n attributes,\n uniforms,\n primitive,\n count,\n elements,\n depth,\n blend,\n stencil,\n cull,\n instances,\n } = options;\n const reglUniforms: { [key: string]: IUniform } = {};\n this.options = options;\n if (uniforms) {\n this.uniforms = this.extractUniforms(uniforms);\n Object.keys(uniforms).forEach((uniformName) => {\n // use regl prop API\n // @ts-ignore\n reglUniforms[uniformName] = reGl.prop(uniformName);\n });\n }\n\n const reglAttributes: { [key: string]: regl.Attribute } = {};\n Object.keys(attributes).forEach((name: string) => {\n reglAttributes[name] = (attributes[name] as ReglAttribute).get();\n });\n const drawParams: regl.DrawConfig = {\n attributes: reglAttributes,\n frag: fs,\n uniforms: reglUniforms,\n vert: vs,\n primitive:\n primitiveMap[primitive === undefined ? gl.TRIANGLES : primitive],\n };\n if (instances) {\n drawParams.instances = instances;\n }\n\n // elements 中可能包含 count,此时不应传入\n if (count) {\n drawParams.count = count;\n }\n\n if (elements) {\n drawParams.elements = (elements as ReglElements).get();\n }\n\n this.initDepthDrawParams({ depth }, drawParams);\n this.initBlendDrawParams({ blend }, drawParams);\n this.initStencilDrawParams({ stencil }, drawParams);\n this.initCullDrawParams({ cull }, drawParams);\n\n this.drawCommand = reGl(drawParams);\n this.drawParams = drawParams;\n }\n\n public addUniforms(uniforms: { [key: string]: IUniform }) {\n this.uniforms = {\n ...this.uniforms,\n ...this.extractUniforms(uniforms),\n };\n }\n\n public draw(options: IModelDrawOptions) {\n if (\n this.drawParams.attributes &&\n Object.keys(this.drawParams.attributes).length === 0\n ) {\n return;\n }\n const uniforms: {\n [key: string]: IUniform;\n } = {\n ...this.uniforms,\n ...this.extractUniforms(options.uniforms || {}),\n };\n const reglDrawProps: {\n [key: string]:\n | regl.Framebuffer\n | regl.Texture2D\n | number\n | number[]\n | boolean;\n } = {};\n Object.keys(uniforms).forEach((uniformName: string) => {\n const type = typeof uniforms[uniformName];\n if (\n type === 'boolean' ||\n type === 'number' ||\n Array.isArray(uniforms[uniformName]) ||\n // @ts-ignore\n uniforms[uniformName].BYTES_PER_ELEMENT\n ) {\n reglDrawProps[uniformName] = uniforms[uniformName] as\n | number\n | number[]\n | boolean;\n } else {\n reglDrawProps[uniformName] = (uniforms[uniformName] as\n | ReglFramebuffer\n | ReglTexture2D).get();\n }\n });\n this.drawCommand(reglDrawProps);\n }\n\n public destroy() {\n // @ts-ignore\n this.drawParams.elements.destroy();\n if (this.options.attributes) {\n Object.values(this.options.attributes).forEach((attr: any) => {\n // @ts-ignore\n (attr as ReglAttribute).destroy();\n });\n }\n this.destroyed = true;\n }\n\n /**\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer\n */\n private initDepthDrawParams(\n { depth }: Pick<IModelInitializationOptions, 'depth'>,\n drawParams: regl.DrawConfig,\n ) {\n if (depth) {\n drawParams.depth = {\n enable: depth.enable === undefined ? true : !!depth.enable,\n mask: depth.mask === undefined ? true : !!depth.mask,\n func: depthFuncMap[depth.func || gl.LESS],\n range: depth.range || [0, 1],\n };\n }\n }\n\n /**\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending\n */\n private initBlendDrawParams(\n { blend }: Pick<IModelInitializationOptions, 'blend'>,\n drawParams: regl.DrawConfig,\n ) {\n if (blend) {\n const { enable, func, equation, color = [0, 0, 0, 0] } = blend;\n // @ts-ignore\n drawParams.blend = {\n enable: !!enable,\n func: {\n srcRGB: blendFuncMap[(func && func.srcRGB) || gl.SRC_ALPHA],\n srcAlpha: blendFuncMap[(func && func.srcAlpha) || gl.SRC_ALPHA],\n dstRGB: blendFuncMap[(func && func.dstRGB) || gl.ONE_MINUS_SRC_ALPHA],\n dstAlpha:\n blendFuncMap[(func && func.dstAlpha) || gl.ONE_MINUS_SRC_ALPHA],\n },\n equation: {\n rgb: blendEquationMap[(equation && equation.rgb) || gl.FUNC_ADD],\n alpha: blendEquationMap[(equation && equation.alpha) || gl.FUNC_ADD],\n },\n color,\n };\n }\n }\n\n /**\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil\n */\n private initStencilDrawParams(\n { stencil }: Pick<IModelInitializationOptions, 'stencil'>,\n drawParams: regl.DrawConfig,\n ) {\n if (stencil) {\n const {\n enable,\n mask = -1,\n func = {\n cmp: gl.ALWAYS,\n ref: 0,\n mask: -1,\n },\n opFront = {\n fail: gl.KEEP,\n zfail: gl.KEEP,\n zpass: gl.KEEP,\n },\n opBack = {\n fail: gl.KEEP,\n zfail: gl.KEEP,\n zpass: gl.KEEP,\n },\n } = stencil;\n drawParams.stencil = {\n enable: !!enable,\n mask,\n func: {\n ...func,\n cmp: stencilFuncMap[func.cmp],\n },\n opFront: {\n fail: stencilOpMap[opFront.fail],\n zfail: stencilOpMap[opFront.zfail],\n zpass: stencilOpMap[opFront.zpass],\n },\n opBack: {\n fail: stencilOpMap[opBack.fail],\n zfail: stencilOpMap[opBack.zfail],\n zpass: stencilOpMap[opBack.zpass],\n },\n };\n }\n }\n\n /**\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling\n */\n private initCullDrawParams(\n { cull }: Pick<IModelInitializationOptions, 'cull'>,\n drawParams: regl.DrawConfig,\n ) {\n if (cull) {\n const { enable, face = gl.BACK } = cull;\n drawParams.cull = {\n enable: !!enable,\n face: cullFaceMap[face],\n };\n }\n }\n\n /**\n * 考虑结构体命名, eg:\n * a: { b: 1 } -> 'a.b'\n * a: [ { b: 1 } ] -> 'a[0].b'\n */\n private extractUniforms(uniforms: {\n [key: string]: IUniform;\n }): {\n [key: string]: IUniform;\n } {\n const extractedUniforms = {};\n Object.keys(uniforms).forEach((uniformName) => {\n this.extractUniformsRecursively(\n uniformName,\n uniforms[uniformName],\n extractedUniforms,\n '',\n );\n });\n\n return extractedUniforms;\n }\n\n private extractUniformsRecursively(\n uniformName: string,\n uniformValue: IUniform,\n uniforms: {\n [key: string]: IUniform;\n },\n prefix: string,\n ) {\n if (\n uniformValue === null ||\n typeof uniformValue === 'number' || // u_A: 1\n typeof uniformValue === 'boolean' || // u_A: false\n (Array.isArray(uniformValue) && typeof uniformValue[0] === 'number') || // u_A: [1, 2, 3]\n isTypedArray(uniformValue) || // u_A: Float32Array\n // @ts-ignore\n uniformValue === '' ||\n 'resize' in uniformValue\n ) {\n uniforms[`${prefix && prefix + '.'}${uniformName}`] = uniformValue;\n return;\n }\n\n // u_Struct.a.b.c\n if (isPlainObject(uniformValue)) {\n Object.keys(uniformValue).forEach((childName) => {\n this.extractUniformsRecursively(\n childName,\n // @ts-ignore\n uniformValue[childName],\n uniforms,\n `${prefix && prefix + '.'}${uniformName}`,\n );\n });\n }\n\n // u_Struct[0].a\n if (Array.isArray(uniformValue)) {\n uniformValue.forEach((child, idx) => {\n Object.keys(child).forEach((childName) => {\n this.extractUniformsRecursively(\n childName,\n // @ts-ignore\n child[childName],\n uniforms,\n `${prefix && prefix + '.'}${uniformName}[${idx}]`,\n );\n });\n });\n }\n }\n}\n"],"file":"ReglModel.js"}
@@ -0,0 +1,16 @@
1
+ import { IRenderbuffer, IRenderbufferInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.Renderbuffer
5
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#renderbuffers
6
+ */
7
+ export default class ReglRenderbuffer implements IRenderbuffer {
8
+ private renderbuffer;
9
+ constructor(reGl: regl.Regl, options: IRenderbufferInitializationOptions);
10
+ get(): regl.Renderbuffer;
11
+ destroy(): void;
12
+ resize({ width, height }: {
13
+ width: number;
14
+ height: number;
15
+ }): void;
16
+ }
@@ -0,0 +1,45 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { formatMap } from './constants';
5
+
6
+ var ReglRenderbuffer = function () {
7
+ function ReglRenderbuffer(reGl, options) {
8
+ _classCallCheck(this, ReglRenderbuffer);
9
+
10
+ _defineProperty(this, "renderbuffer", void 0);
11
+
12
+ var width = options.width,
13
+ height = options.height,
14
+ format = options.format;
15
+ this.renderbuffer = reGl.renderbuffer({
16
+ width: width,
17
+ height: height,
18
+ format: formatMap[format]
19
+ });
20
+ }
21
+
22
+ _createClass(ReglRenderbuffer, [{
23
+ key: "get",
24
+ value: function get() {
25
+ return this.renderbuffer;
26
+ }
27
+ }, {
28
+ key: "destroy",
29
+ value: function destroy() {
30
+ this.renderbuffer.destroy();
31
+ }
32
+ }, {
33
+ key: "resize",
34
+ value: function resize(_ref) {
35
+ var width = _ref.width,
36
+ height = _ref.height;
37
+ this.renderbuffer.resize(width, height);
38
+ }
39
+ }]);
40
+
41
+ return ReglRenderbuffer;
42
+ }();
43
+
44
+ export { ReglRenderbuffer as default };
45
+ //# sourceMappingURL=ReglRenderbuffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/regl/ReglRenderbuffer.ts"],"names":["formatMap","ReglRenderbuffer","reGl","options","width","height","format","renderbuffer","destroy","resize"],"mappings":";;;AAKA,SAASA,SAAT,QAA0B,aAA1B;;IAMqBC,gB;AAGnB,4BAAYC,IAAZ,EAA6BC,OAA7B,EAA0E;AAAA;;AAAA;;AACxE,QAAQC,KAAR,GAAkCD,OAAlC,CAAQC,KAAR;AAAA,QAAeC,MAAf,GAAkCF,OAAlC,CAAeE,MAAf;AAAA,QAAuBC,MAAvB,GAAkCH,OAAlC,CAAuBG,MAAvB;AACA,SAAKC,YAAL,GAAoBL,IAAI,CAACK,YAAL,CAAkB;AACpCH,MAAAA,KAAK,EAALA,KADoC;AAEpCC,MAAAA,MAAM,EAANA,MAFoC;AAGpCC,MAAAA,MAAM,EAAEN,SAAS,CAACM,MAAD;AAHmB,KAAlB,CAApB;AAKD;;;;WAED,eAAa;AACX,aAAO,KAAKC,YAAZ;AACD;;;WAED,mBAAiB;AACf,WAAKA,YAAL,CAAkBC,OAAlB;AACD;;;WAED,sBAAoE;AAAA,UAApDJ,KAAoD,QAApDA,KAAoD;AAAA,UAA7CC,MAA6C,QAA7CA,MAA6C;AAClE,WAAKE,YAAL,CAAkBE,MAAlB,CAAyBL,KAAzB,EAAgCC,MAAhC;AACD;;;;;;SAtBkBJ,gB","sourcesContent":["import {\n IRenderbuffer,\n IRenderbufferInitializationOptions,\n} from '@antv/l7-core';\nimport regl from 'l7regl';\nimport { formatMap } from './constants';\n\n/**\n * adaptor for regl.Renderbuffer\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#renderbuffers\n */\nexport default class ReglRenderbuffer implements IRenderbuffer {\n private renderbuffer: regl.Renderbuffer;\n\n constructor(reGl: regl.Regl, options: IRenderbufferInitializationOptions) {\n const { width, height, format } = options;\n this.renderbuffer = reGl.renderbuffer({\n width,\n height,\n format: formatMap[format] as regl.RenderbufferFormat,\n });\n }\n\n public get() {\n return this.renderbuffer;\n }\n\n public destroy() {\n this.renderbuffer.destroy();\n }\n\n public resize({ width, height }: { width: number; height: number }) {\n this.renderbuffer.resize(width, height);\n }\n}\n"],"file":"ReglRenderbuffer.js"}
@@ -0,0 +1,20 @@
1
+ import { ITexture2D, ITexture2DInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.Buffer
5
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#buffers
6
+ */
7
+ export default class ReglTexture2D implements ITexture2D {
8
+ private texture;
9
+ private width;
10
+ private height;
11
+ constructor(reGl: regl.Regl, options: ITexture2DInitializationOptions);
12
+ get(): regl.Texture2D;
13
+ update(props?: regl.Texture2DOptions): void;
14
+ bind(): void;
15
+ resize({ width, height }: {
16
+ width: number;
17
+ height: number;
18
+ }): void;
19
+ destroy(): void;
20
+ }
@@ -0,0 +1,111 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { gl } from '@antv/l7-core';
5
+ import { colorSpaceMap, dataTypeMap, filterMap, formatMap, mipmapMap, wrapModeMap } from './constants';
6
+
7
+ var ReglTexture2D = function () {
8
+ function ReglTexture2D(reGl, options) {
9
+ _classCallCheck(this, ReglTexture2D);
10
+
11
+ _defineProperty(this, "texture", void 0);
12
+
13
+ _defineProperty(this, "width", void 0);
14
+
15
+ _defineProperty(this, "height", void 0);
16
+
17
+ var data = options.data,
18
+ _options$type = options.type,
19
+ type = _options$type === void 0 ? gl.UNSIGNED_BYTE : _options$type,
20
+ width = options.width,
21
+ height = options.height,
22
+ _options$flipY = options.flipY,
23
+ flipY = _options$flipY === void 0 ? false : _options$flipY,
24
+ _options$format = options.format,
25
+ format = _options$format === void 0 ? gl.RGBA : _options$format,
26
+ _options$mipmap = options.mipmap,
27
+ mipmap = _options$mipmap === void 0 ? false : _options$mipmap,
28
+ _options$wrapS = options.wrapS,
29
+ wrapS = _options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapS,
30
+ _options$wrapT = options.wrapT,
31
+ wrapT = _options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapT,
32
+ _options$aniso = options.aniso,
33
+ aniso = _options$aniso === void 0 ? 0 : _options$aniso,
34
+ _options$alignment = options.alignment,
35
+ alignment = _options$alignment === void 0 ? 1 : _options$alignment,
36
+ _options$premultiplyA = options.premultiplyAlpha,
37
+ premultiplyAlpha = _options$premultiplyA === void 0 ? false : _options$premultiplyA,
38
+ _options$mag = options.mag,
39
+ mag = _options$mag === void 0 ? gl.NEAREST : _options$mag,
40
+ _options$min = options.min,
41
+ min = _options$min === void 0 ? gl.NEAREST : _options$min,
42
+ _options$colorSpace = options.colorSpace,
43
+ colorSpace = _options$colorSpace === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _options$colorSpace;
44
+ this.width = width;
45
+ this.height = height;
46
+ var textureOptions = {
47
+ width: width,
48
+ height: height,
49
+ type: dataTypeMap[type],
50
+ format: formatMap[format],
51
+ wrapS: wrapModeMap[wrapS],
52
+ wrapT: wrapModeMap[wrapT],
53
+ mag: filterMap[mag],
54
+ min: filterMap[min],
55
+ alignment: alignment,
56
+ flipY: flipY,
57
+ colorSpace: colorSpaceMap[colorSpace],
58
+ premultiplyAlpha: premultiplyAlpha,
59
+ aniso: aniso
60
+ };
61
+
62
+ if (data) {
63
+ textureOptions.data = data;
64
+ }
65
+
66
+ if (typeof mipmap === 'number') {
67
+ textureOptions.mipmap = mipmapMap[mipmap];
68
+ } else if (typeof mipmap === 'boolean') {
69
+ textureOptions.mipmap = mipmap;
70
+ }
71
+
72
+ this.texture = reGl.texture(textureOptions);
73
+ }
74
+
75
+ _createClass(ReglTexture2D, [{
76
+ key: "get",
77
+ value: function get() {
78
+ return this.texture;
79
+ }
80
+ }, {
81
+ key: "update",
82
+ value: function update() {
83
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
84
+ this.texture(props);
85
+ }
86
+ }, {
87
+ key: "bind",
88
+ value: function bind() {
89
+ this.texture._texture.bind();
90
+ }
91
+ }, {
92
+ key: "resize",
93
+ value: function resize(_ref) {
94
+ var width = _ref.width,
95
+ height = _ref.height;
96
+ this.texture.resize(width, height);
97
+ this.width = width;
98
+ this.height = height;
99
+ }
100
+ }, {
101
+ key: "destroy",
102
+ value: function destroy() {
103
+ this.texture.destroy();
104
+ }
105
+ }]);
106
+
107
+ return ReglTexture2D;
108
+ }();
109
+
110
+ export { ReglTexture2D as default };
111
+ //# sourceMappingURL=ReglTexture2D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/regl/ReglTexture2D.ts"],"names":["gl","colorSpaceMap","dataTypeMap","filterMap","formatMap","mipmapMap","wrapModeMap","ReglTexture2D","reGl","options","data","type","UNSIGNED_BYTE","width","height","flipY","format","RGBA","mipmap","wrapS","CLAMP_TO_EDGE","wrapT","aniso","alignment","premultiplyAlpha","mag","NEAREST","min","colorSpace","BROWSER_DEFAULT_WEBGL","textureOptions","texture","props","_texture","bind","resize","destroy"],"mappings":";;;AAAA,SAASA,EAAT,QAAgE,eAAhE;AAEA,SACEC,aADF,EAEEC,WAFF,EAGEC,SAHF,EAIEC,SAJF,EAKEC,SALF,EAMEC,WANF,QAOO,aAPP;;IAaqBC,a;AAKnB,yBAAYC,IAAZ,EAA6BC,OAA7B,EAAuE;AAAA;;AAAA;;AAAA;;AAAA;;AACrE,QACEC,IADF,GAgBID,OAhBJ,CACEC,IADF;AAAA,wBAgBID,OAhBJ,CAEEE,IAFF;AAAA,QAEEA,IAFF,8BAESX,EAAE,CAACY,aAFZ;AAAA,QAGEC,KAHF,GAgBIJ,OAhBJ,CAGEI,KAHF;AAAA,QAIEC,MAJF,GAgBIL,OAhBJ,CAIEK,MAJF;AAAA,yBAgBIL,OAhBJ,CAKEM,KALF;AAAA,QAKEA,KALF,+BAKU,KALV;AAAA,0BAgBIN,OAhBJ,CAMEO,MANF;AAAA,QAMEA,MANF,gCAMWhB,EAAE,CAACiB,IANd;AAAA,0BAgBIR,OAhBJ,CAOES,MAPF;AAAA,QAOEA,MAPF,gCAOW,KAPX;AAAA,yBAgB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CAAC2B,UAAD,CAbmB;AAc5CJ,MAAAA,gBAAgB,EAAhBA,gBAd4C;AAe5CF,MAAAA,KAAK,EAALA;AAf4C,KAA9C;;AAkBA,QAAIZ,IAAJ,EAAU;AACRoB,MAAAA,cAAc,CAACpB,IAAf,GAAsBA,IAAtB;AACD;;AAED,QAAI,OAAOQ,MAAP,KAAkB,QAAtB,EAAgC;AAC9BY,MAAAA,cAAc,CAACZ,MAAf,GAAwBb,SAAS,CAACa,MAAD,CAAjC;AACD,KAFD,MAEO,IAAI,OAAOA,MAAP,KAAkB,SAAtB,EAAiC;AACtCY,MAAAA,cAAc,CAACZ,MAAf,GAAwBA,MAAxB;AACD;;AAED,SAAKa,OAAL,GAAevB,IAAI,CAACuB,OAAL,CAAaD,cAAb,CAAf;AACD;;;;WAED,eAAa;AACX,aAAO,KAAKC,OAAZ;AACD;;;WACD,kBAAiD;AAAA,UAAnCC,KAAmC,uEAAJ,EAAI;AAC/C,WAAKD,OAAL,CAAaC,KAAb;AACD;;;WAED,gBAAc;AAEZ,WAAKD,OAAL,CAAaE,QAAb,CAAsBC,IAAtB;AACD;;;WAED,sBAA0E;AAAA,UAA1DrB,KAA0D,QAA1DA,KAA0D;AAAA,UAAnDC,MAAmD,QAAnDA,MAAmD;AACxE,WAAKiB,OAAL,CAAaI,MAAb,CAAoBtB,KAApB,EAA2BC,MAA3B;AACA,WAAKD,KAAL,GAAaA,KAAb;AACA,WAAKC,MAAL,GAAcA,MAAd;AACD;;;WAED,mBAAiB;AACf,WAAKiB,OAAL,CAAaK,OAAb;AACD;;;;;;SA7EkB7B,a","sourcesContent":["import { gl, ITexture2D, ITexture2DInitializationOptions } from '@antv/l7-core';\nimport regl from 'l7regl';\nimport {\n colorSpaceMap,\n dataTypeMap,\n filterMap,\n formatMap,\n mipmapMap,\n wrapModeMap,\n} from './constants';\n\n/**\n * adaptor for regl.Buffer\n * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#buffers\n */\nexport default class ReglTexture2D implements ITexture2D {\n private texture: regl.Texture2D;\n private width: number;\n private height: number;\n\n constructor(reGl: regl.Regl, options: ITexture2DInitializationOptions) {\n const {\n data,\n type = gl.UNSIGNED_BYTE,\n width,\n height,\n flipY = false,\n format = gl.RGBA,\n mipmap = false,\n wrapS = gl.CLAMP_TO_EDGE,\n wrapT = gl.CLAMP_TO_EDGE,\n aniso = 0,\n alignment = 1,\n premultiplyAlpha = false,\n mag = gl.NEAREST,\n min = gl.NEAREST,\n colorSpace = gl.BROWSER_DEFAULT_WEBGL,\n } = options;\n this.width = width;\n this.height = height;\n\n const textureOptions: regl.Texture2DOptions = {\n width,\n height,\n // @ts-ignore\n type: dataTypeMap[type],\n format: formatMap[format],\n wrapS: wrapModeMap[wrapS],\n wrapT: wrapModeMap[wrapT],\n // @ts-ignore\n mag: filterMap[mag],\n min: filterMap[min],\n alignment,\n flipY,\n colorSpace: colorSpaceMap[colorSpace],\n premultiplyAlpha,\n aniso,\n };\n\n if (data) {\n textureOptions.data = data;\n }\n\n if (typeof mipmap === 'number') {\n textureOptions.mipmap = mipmapMap[mipmap];\n } else if (typeof mipmap === 'boolean') {\n textureOptions.mipmap = mipmap;\n }\n\n this.texture = reGl.texture(textureOptions);\n }\n\n public get() {\n return this.texture;\n }\n public update(props: regl.Texture2DOptions = {}) {\n this.texture(props);\n }\n\n public bind() {\n // @ts-ignore\n this.texture._texture.bind();\n }\n\n public resize({ width, height }: { width: number; height: number }): void {\n this.texture.resize(width, height);\n this.width = width;\n this.height = height;\n }\n\n public destroy() {\n this.texture.destroy();\n }\n}\n"],"file":"ReglTexture2D.js"}
@@ -0,0 +1,43 @@
1
+ import regl from 'l7regl';
2
+ export declare const primitiveMap: {
3
+ [key: string]: 'points' | 'lines' | 'line loop' | 'line strip' | 'triangles' | 'triangle strip' | 'triangle fan';
4
+ };
5
+ export declare const usageMap: {
6
+ [key: string]: 'static' | 'dynamic' | 'stream';
7
+ };
8
+ export declare const dataTypeMap: {
9
+ [key: string]: 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32' | 'float';
10
+ };
11
+ export declare const formatMap: {
12
+ [key: string]: 'alpha' | 'luminance' | 'luminance alpha' | 'rgb' | 'rgba' | 'rgba4' | 'rgb5 a1' | 'rgb565' | 'depth' | 'depth stencil';
13
+ };
14
+ export declare const mipmapMap: {
15
+ [key: string]: 'dont care' | 'nice' | 'fast';
16
+ };
17
+ export declare const filterMap: {
18
+ [key: string]: 'nearest' | 'linear' | 'mipmap' | 'nearest mipmap linear' | 'linear mipmap nearest' | 'nearest mipmap nearest';
19
+ };
20
+ export declare const wrapModeMap: {
21
+ [key: string]: 'repeat' | 'clamp' | 'mirror';
22
+ };
23
+ export declare const colorSpaceMap: {
24
+ [key: string]: 'none' | 'browser';
25
+ };
26
+ export declare const depthFuncMap: {
27
+ [key: string]: 'never' | 'always' | 'less' | 'lequal' | 'greater' | 'gequal' | 'equal' | 'notequal';
28
+ };
29
+ export declare const blendEquationMap: {
30
+ [key: string]: regl.BlendingEquation;
31
+ };
32
+ export declare const blendFuncMap: {
33
+ [key: string]: regl.BlendingFunction;
34
+ };
35
+ export declare const stencilFuncMap: {
36
+ [key: string]: regl.ComparisonOperatorType;
37
+ };
38
+ export declare const stencilOpMap: {
39
+ [key: string]: regl.StencilOperationType;
40
+ };
41
+ export declare const cullFaceMap: {
42
+ [key: string]: regl.FaceOrientationType;
43
+ };
@@ -0,0 +1,20 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ var _primitiveMap, _usageMap, _dataTypeMap, _formatMap, _mipmapMap, _filterMap, _wrapModeMap, _colorSpaceMap, _depthFuncMap, _blendEquationMap, _blendFuncMap, _stencilFuncMap, _stencilOpMap, _cullFaceMap;
4
+
5
+ import { gl } from '@antv/l7-core';
6
+ export var primitiveMap = (_primitiveMap = {}, _defineProperty(_primitiveMap, gl.POINTS, 'points'), _defineProperty(_primitiveMap, gl.LINES, 'lines'), _defineProperty(_primitiveMap, gl.LINE_LOOP, 'line loop'), _defineProperty(_primitiveMap, gl.LINE_STRIP, 'line strip'), _defineProperty(_primitiveMap, gl.TRIANGLES, 'triangles'), _defineProperty(_primitiveMap, gl.TRIANGLE_FAN, 'triangle fan'), _defineProperty(_primitiveMap, gl.TRIANGLE_STRIP, 'triangle strip'), _primitiveMap);
7
+ export var usageMap = (_usageMap = {}, _defineProperty(_usageMap, gl.STATIC_DRAW, 'static'), _defineProperty(_usageMap, gl.DYNAMIC_DRAW, 'dynamic'), _defineProperty(_usageMap, gl.STREAM_DRAW, 'stream'), _usageMap);
8
+ export var dataTypeMap = (_dataTypeMap = {}, _defineProperty(_dataTypeMap, gl.BYTE, 'int8'), _defineProperty(_dataTypeMap, gl.UNSIGNED_INT, 'int16'), _defineProperty(_dataTypeMap, gl.INT, 'int32'), _defineProperty(_dataTypeMap, gl.UNSIGNED_BYTE, 'uint8'), _defineProperty(_dataTypeMap, gl.UNSIGNED_SHORT, 'uint16'), _defineProperty(_dataTypeMap, gl.UNSIGNED_INT, 'uint32'), _defineProperty(_dataTypeMap, gl.FLOAT, 'float'), _dataTypeMap);
9
+ export var formatMap = (_formatMap = {}, _defineProperty(_formatMap, gl.ALPHA, 'alpha'), _defineProperty(_formatMap, gl.LUMINANCE, 'luminance'), _defineProperty(_formatMap, gl.LUMINANCE_ALPHA, 'luminance alpha'), _defineProperty(_formatMap, gl.RGB, 'rgb'), _defineProperty(_formatMap, gl.RGBA, 'rgba'), _defineProperty(_formatMap, gl.RGBA4, 'rgba4'), _defineProperty(_formatMap, gl.RGB5_A1, 'rgb5 a1'), _defineProperty(_formatMap, gl.RGB565, 'rgb565'), _defineProperty(_formatMap, gl.DEPTH_COMPONENT, 'depth'), _defineProperty(_formatMap, gl.DEPTH_STENCIL, 'depth stencil'), _formatMap);
10
+ export var mipmapMap = (_mipmapMap = {}, _defineProperty(_mipmapMap, gl.DONT_CARE, 'dont care'), _defineProperty(_mipmapMap, gl.NICEST, 'nice'), _defineProperty(_mipmapMap, gl.FASTEST, 'fast'), _mipmapMap);
11
+ export var filterMap = (_filterMap = {}, _defineProperty(_filterMap, gl.NEAREST, 'nearest'), _defineProperty(_filterMap, gl.LINEAR, 'linear'), _defineProperty(_filterMap, gl.LINEAR_MIPMAP_LINEAR, 'mipmap'), _defineProperty(_filterMap, gl.NEAREST_MIPMAP_LINEAR, 'nearest mipmap linear'), _defineProperty(_filterMap, gl.LINEAR_MIPMAP_NEAREST, 'linear mipmap nearest'), _defineProperty(_filterMap, gl.NEAREST_MIPMAP_NEAREST, 'nearest mipmap nearest'), _filterMap);
12
+ export var wrapModeMap = (_wrapModeMap = {}, _defineProperty(_wrapModeMap, gl.REPEAT, 'repeat'), _defineProperty(_wrapModeMap, gl.CLAMP_TO_EDGE, 'clamp'), _defineProperty(_wrapModeMap, gl.MIRRORED_REPEAT, 'mirror'), _wrapModeMap);
13
+ export var colorSpaceMap = (_colorSpaceMap = {}, _defineProperty(_colorSpaceMap, gl.NONE, 'none'), _defineProperty(_colorSpaceMap, gl.BROWSER_DEFAULT_WEBGL, 'browser'), _colorSpaceMap);
14
+ export var depthFuncMap = (_depthFuncMap = {}, _defineProperty(_depthFuncMap, gl.NEVER, 'never'), _defineProperty(_depthFuncMap, gl.ALWAYS, 'always'), _defineProperty(_depthFuncMap, gl.LESS, 'less'), _defineProperty(_depthFuncMap, gl.LEQUAL, 'lequal'), _defineProperty(_depthFuncMap, gl.GREATER, 'greater'), _defineProperty(_depthFuncMap, gl.GEQUAL, 'gequal'), _defineProperty(_depthFuncMap, gl.EQUAL, 'equal'), _defineProperty(_depthFuncMap, gl.NOTEQUAL, 'notequal'), _depthFuncMap);
15
+ export var blendEquationMap = (_blendEquationMap = {}, _defineProperty(_blendEquationMap, gl.FUNC_ADD, 'add'), _defineProperty(_blendEquationMap, gl.MIN_EXT, 'min'), _defineProperty(_blendEquationMap, gl.MAX_EXT, 'max'), _defineProperty(_blendEquationMap, gl.FUNC_SUBTRACT, 'subtract'), _defineProperty(_blendEquationMap, gl.FUNC_REVERSE_SUBTRACT, 'reverse subtract'), _blendEquationMap);
16
+ export var blendFuncMap = (_blendFuncMap = {}, _defineProperty(_blendFuncMap, gl.ZERO, 'zero'), _defineProperty(_blendFuncMap, gl.ONE, 'one'), _defineProperty(_blendFuncMap, gl.SRC_COLOR, 'src color'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_COLOR, 'one minus src color'), _defineProperty(_blendFuncMap, gl.SRC_ALPHA, 'src alpha'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_ALPHA, 'one minus src alpha'), _defineProperty(_blendFuncMap, gl.DST_COLOR, 'dst color'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_COLOR, 'one minus dst color'), _defineProperty(_blendFuncMap, gl.DST_ALPHA, 'dst alpha'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_ALPHA, 'one minus dst alpha'), _defineProperty(_blendFuncMap, gl.CONSTANT_COLOR, 'constant color'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_COLOR, 'one minus constant color'), _defineProperty(_blendFuncMap, gl.CONSTANT_ALPHA, 'constant alpha'), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_ALPHA, 'one minus constant alpha'), _defineProperty(_blendFuncMap, gl.SRC_ALPHA_SATURATE, 'src alpha saturate'), _blendFuncMap);
17
+ export var stencilFuncMap = (_stencilFuncMap = {}, _defineProperty(_stencilFuncMap, gl.NEVER, 'never'), _defineProperty(_stencilFuncMap, gl.ALWAYS, 'always'), _defineProperty(_stencilFuncMap, gl.LESS, 'less'), _defineProperty(_stencilFuncMap, gl.LEQUAL, 'lequal'), _defineProperty(_stencilFuncMap, gl.GREATER, 'greater'), _defineProperty(_stencilFuncMap, gl.GEQUAL, 'gequal'), _defineProperty(_stencilFuncMap, gl.EQUAL, 'equal'), _defineProperty(_stencilFuncMap, gl.NOTEQUAL, 'notequal'), _stencilFuncMap);
18
+ export var stencilOpMap = (_stencilOpMap = {}, _defineProperty(_stencilOpMap, gl.ZERO, 'zero'), _defineProperty(_stencilOpMap, gl.KEEP, 'keep'), _defineProperty(_stencilOpMap, gl.REPLACE, 'replace'), _defineProperty(_stencilOpMap, gl.INVERT, 'invert'), _defineProperty(_stencilOpMap, gl.INCR, 'increment'), _defineProperty(_stencilOpMap, gl.DECR, 'decrement'), _defineProperty(_stencilOpMap, gl.INCR_WRAP, 'increment wrap'), _defineProperty(_stencilOpMap, gl.DECR_WRAP, 'decrement wrap'), _stencilOpMap);
19
+ export var cullFaceMap = (_cullFaceMap = {}, _defineProperty(_cullFaceMap, gl.FRONT, 'front'), _defineProperty(_cullFaceMap, gl.BACK, 'back'), _cullFaceMap);
20
+ //# sourceMappingURL=constants.js.map