@antv/l7-renderer 2.28.14 → 2.29.1

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.
Files changed (41) hide show
  1. package/es/index.d.ts +1 -2
  2. package/es/index.js +1 -3
  3. package/lib/index.d.ts +1 -2
  4. package/lib/index.js +2 -5
  5. package/package.json +8 -6
  6. package/es/regl/ReglAttribute.d.ts +0 -16
  7. package/es/regl/ReglAttribute.js +0 -29
  8. package/es/regl/ReglBuffer.d.ts +0 -17
  9. package/es/regl/ReglBuffer.js +0 -33
  10. package/es/regl/ReglElements.d.ts +0 -14
  11. package/es/regl/ReglElements.js +0 -27
  12. package/es/regl/ReglFramebuffer.d.ts +0 -16
  13. package/es/regl/ReglFramebuffer.js +0 -31
  14. package/es/regl/ReglModel.d.ts +0 -46
  15. package/es/regl/ReglModel.js +0 -302
  16. package/es/regl/ReglRenderbuffer.d.ts +0 -16
  17. package/es/regl/ReglRenderbuffer.js +0 -24
  18. package/es/regl/ReglTexture2D.d.ts +0 -22
  19. package/es/regl/ReglTexture2D.js +0 -94
  20. package/es/regl/constants.d.ts +0 -43
  21. package/es/regl/constants.js +0 -133
  22. package/es/regl/index.d.ts +0 -56
  23. package/es/regl/index.js +0 -227
  24. package/lib/regl/ReglAttribute.d.ts +0 -16
  25. package/lib/regl/ReglAttribute.js +0 -49
  26. package/lib/regl/ReglBuffer.d.ts +0 -17
  27. package/lib/regl/ReglBuffer.js +0 -53
  28. package/lib/regl/ReglElements.d.ts +0 -14
  29. package/lib/regl/ReglElements.js +0 -47
  30. package/lib/regl/ReglFramebuffer.d.ts +0 -16
  31. package/lib/regl/ReglFramebuffer.js +0 -51
  32. package/lib/regl/ReglModel.d.ts +0 -46
  33. package/lib/regl/ReglModel.js +0 -311
  34. package/lib/regl/ReglRenderbuffer.d.ts +0 -16
  35. package/lib/regl/ReglRenderbuffer.js +0 -44
  36. package/lib/regl/ReglTexture2D.d.ts +0 -22
  37. package/lib/regl/ReglTexture2D.js +0 -107
  38. package/lib/regl/constants.d.ts +0 -43
  39. package/lib/regl/constants.js +0 -170
  40. package/lib/regl/index.d.ts +0 -56
  41. package/lib/regl/index.js +0 -256
@@ -1,94 +0,0 @@
1
- // src/regl/ReglTexture2D.ts
2
- import { gl } from "@antv/l7-core";
3
- import {
4
- colorSpaceMap,
5
- dataTypeMap,
6
- filterMap,
7
- formatMap,
8
- mipmapMap,
9
- wrapModeMap
10
- } from "./constants";
11
- var ReglTexture2D = class {
12
- constructor(reGl, options) {
13
- this.isDestroy = false;
14
- const {
15
- data,
16
- type = gl.UNSIGNED_BYTE,
17
- width,
18
- height,
19
- flipY = false,
20
- format = gl.RGBA,
21
- mipmap = false,
22
- wrapS = gl.CLAMP_TO_EDGE,
23
- wrapT = gl.CLAMP_TO_EDGE,
24
- aniso = 0,
25
- alignment = 1,
26
- premultiplyAlpha = false,
27
- mag = gl.NEAREST,
28
- min = gl.NEAREST,
29
- colorSpace = gl.BROWSER_DEFAULT_WEBGL,
30
- x = 0,
31
- y = 0,
32
- copy = false
33
- } = options;
34
- this.width = width;
35
- this.height = height;
36
- const textureOptions = {
37
- width,
38
- height,
39
- // @ts-ignore
40
- type: dataTypeMap[type],
41
- format: formatMap[format],
42
- wrapS: wrapModeMap[wrapS],
43
- wrapT: wrapModeMap[wrapT],
44
- // @ts-ignore
45
- mag: filterMap[mag],
46
- min: filterMap[min],
47
- alignment,
48
- flipY,
49
- colorSpace: colorSpaceMap[colorSpace],
50
- premultiplyAlpha,
51
- aniso,
52
- // copy pixels from current bind framebuffer
53
- x,
54
- y,
55
- copy
56
- };
57
- if (data) {
58
- textureOptions.data = data;
59
- }
60
- if (typeof mipmap === "number") {
61
- textureOptions.mipmap = mipmapMap[mipmap];
62
- } else if (typeof mipmap === "boolean") {
63
- textureOptions.mipmap = mipmap;
64
- }
65
- this.texture = reGl.texture(textureOptions);
66
- }
67
- get() {
68
- return this.texture;
69
- }
70
- update(props = {}) {
71
- this.texture(props);
72
- }
73
- bind() {
74
- this.texture._texture.bind();
75
- }
76
- resize({ width, height }) {
77
- this.texture.resize(width, height);
78
- this.width = width;
79
- this.height = height;
80
- }
81
- getSize() {
82
- return [this.width, this.height];
83
- }
84
- destroy() {
85
- var _a;
86
- if (!this.isDestroy) {
87
- (_a = this.texture) == null ? void 0 : _a.destroy();
88
- }
89
- this.isDestroy = true;
90
- }
91
- };
92
- export {
93
- ReglTexture2D as default
94
- };
@@ -1,43 +0,0 @@
1
- import type regl from 'regl';
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
- };
@@ -1,133 +0,0 @@
1
- // src/regl/constants.ts
2
- import { gl } from "@antv/l7-core";
3
- var primitiveMap = {
4
- [gl.POINTS]: "points",
5
- [gl.LINES]: "lines",
6
- [gl.LINE_LOOP]: "line loop",
7
- [gl.LINE_STRIP]: "line strip",
8
- [gl.TRIANGLES]: "triangles",
9
- [gl.TRIANGLE_FAN]: "triangle fan",
10
- [gl.TRIANGLE_STRIP]: "triangle strip"
11
- };
12
- var usageMap = {
13
- [gl.STATIC_DRAW]: "static",
14
- [gl.DYNAMIC_DRAW]: "dynamic",
15
- [gl.STREAM_DRAW]: "stream"
16
- };
17
- var dataTypeMap = {
18
- [gl.BYTE]: "int8",
19
- // [gl.UNSIGNED_INT]: 'int16',
20
- [gl.INT]: "int32",
21
- [gl.UNSIGNED_BYTE]: "uint8",
22
- [gl.UNSIGNED_SHORT]: "uint16",
23
- [gl.UNSIGNED_INT]: "uint32",
24
- [gl.FLOAT]: "float"
25
- };
26
- var formatMap = {
27
- [gl.ALPHA]: "alpha",
28
- [gl.LUMINANCE]: "luminance",
29
- [gl.LUMINANCE_ALPHA]: "luminance alpha",
30
- [gl.RGB]: "rgb",
31
- [gl.RGBA]: "rgba",
32
- [gl.RGBA4]: "rgba4",
33
- [gl.RGB5_A1]: "rgb5 a1",
34
- [gl.RGB565]: "rgb565",
35
- [gl.DEPTH_COMPONENT]: "depth",
36
- [gl.DEPTH_STENCIL]: "depth stencil"
37
- };
38
- var mipmapMap = {
39
- [gl.DONT_CARE]: "dont care",
40
- [gl.NICEST]: "nice",
41
- [gl.FASTEST]: "fast"
42
- };
43
- var filterMap = {
44
- [gl.NEAREST]: "nearest",
45
- [gl.LINEAR]: "linear",
46
- [gl.LINEAR_MIPMAP_LINEAR]: "mipmap",
47
- [gl.NEAREST_MIPMAP_LINEAR]: "nearest mipmap linear",
48
- [gl.LINEAR_MIPMAP_NEAREST]: "linear mipmap nearest",
49
- [gl.NEAREST_MIPMAP_NEAREST]: "nearest mipmap nearest"
50
- };
51
- var wrapModeMap = {
52
- [gl.REPEAT]: "repeat",
53
- [gl.CLAMP_TO_EDGE]: "clamp",
54
- [gl.MIRRORED_REPEAT]: "mirror"
55
- };
56
- var colorSpaceMap = {
57
- [gl.NONE]: "none",
58
- [gl.BROWSER_DEFAULT_WEBGL]: "browser"
59
- };
60
- var depthFuncMap = {
61
- [gl.NEVER]: "never",
62
- [gl.ALWAYS]: "always",
63
- [gl.LESS]: "less",
64
- [gl.LEQUAL]: "lequal",
65
- [gl.GREATER]: "greater",
66
- [gl.GEQUAL]: "gequal",
67
- [gl.EQUAL]: "equal",
68
- [gl.NOTEQUAL]: "notequal"
69
- };
70
- var blendEquationMap = {
71
- [gl.FUNC_ADD]: "add",
72
- [gl.MIN_EXT]: "min",
73
- [gl.MAX_EXT]: "max",
74
- [gl.FUNC_SUBTRACT]: "subtract",
75
- [gl.FUNC_REVERSE_SUBTRACT]: "reverse subtract"
76
- };
77
- var blendFuncMap = {
78
- [gl.ZERO]: "zero",
79
- [gl.ONE]: "one",
80
- [gl.SRC_COLOR]: "src color",
81
- [gl.ONE_MINUS_SRC_COLOR]: "one minus src color",
82
- [gl.SRC_ALPHA]: "src alpha",
83
- [gl.ONE_MINUS_SRC_ALPHA]: "one minus src alpha",
84
- [gl.DST_COLOR]: "dst color",
85
- [gl.ONE_MINUS_DST_COLOR]: "one minus dst color",
86
- [gl.DST_ALPHA]: "dst alpha",
87
- [gl.ONE_MINUS_DST_ALPHA]: "one minus dst alpha",
88
- [gl.CONSTANT_COLOR]: "constant color",
89
- [gl.ONE_MINUS_CONSTANT_COLOR]: "one minus constant color",
90
- [gl.CONSTANT_ALPHA]: "constant alpha",
91
- [gl.ONE_MINUS_CONSTANT_ALPHA]: "one minus constant alpha",
92
- [gl.SRC_ALPHA_SATURATE]: "src alpha saturate"
93
- };
94
- var stencilFuncMap = {
95
- [gl.NEVER]: "never",
96
- [gl.ALWAYS]: "always",
97
- [gl.LESS]: "less",
98
- [gl.LEQUAL]: "lequal",
99
- [gl.GREATER]: "greater",
100
- [gl.GEQUAL]: "gequal",
101
- [gl.EQUAL]: "equal",
102
- [gl.NOTEQUAL]: "notequal"
103
- };
104
- var stencilOpMap = {
105
- [gl.ZERO]: "zero",
106
- [gl.KEEP]: "keep",
107
- [gl.REPLACE]: "replace",
108
- [gl.INVERT]: "invert",
109
- [gl.INCR]: "increment",
110
- [gl.DECR]: "decrement",
111
- [gl.INCR_WRAP]: "increment wrap",
112
- [gl.DECR_WRAP]: "decrement wrap"
113
- };
114
- var cullFaceMap = {
115
- [gl.FRONT]: "front",
116
- [gl.BACK]: "back"
117
- };
118
- export {
119
- blendEquationMap,
120
- blendFuncMap,
121
- colorSpaceMap,
122
- cullFaceMap,
123
- dataTypeMap,
124
- depthFuncMap,
125
- filterMap,
126
- formatMap,
127
- mipmapMap,
128
- primitiveMap,
129
- stencilFuncMap,
130
- stencilOpMap,
131
- usageMap,
132
- wrapModeMap
133
- };
@@ -1,56 +0,0 @@
1
- /**
2
- * render w/ regl
3
- * @see https://github.com/regl-project/regl/blob/gh-pages/API.md
4
- */
5
- import type { IAttribute, IAttributeInitializationOptions, IBuffer, IBufferInitializationOptions, IClearOptions, IElements, IElementsInitializationOptions, IExtensions, IFramebuffer, IFramebufferInitializationOptions, IModel, IModelInitializationOptions, IReadPixelsOptions, IRenderConfig, IRendererService, ITexture2D, ITexture2DInitializationOptions } from '@antv/l7-core';
6
- import regl from 'regl';
7
- import ReglFramebuffer from './ReglFramebuffer';
8
- /**
9
- * regl renderer
10
- */
11
- export default class ReglRendererService implements IRendererService {
12
- uniformBuffers: IBuffer[];
13
- extensionObject: IExtensions;
14
- private gl;
15
- private $container;
16
- private canvas;
17
- private width;
18
- private height;
19
- private isDirty;
20
- queryVerdorInfo: () => string;
21
- init(canvas: HTMLCanvasElement, cfg: IRenderConfig, gl?: regl.Regl): Promise<void>;
22
- getPointSizeRange(): any;
23
- testExtension(name: string): boolean;
24
- createModel: (options: IModelInitializationOptions) => IModel;
25
- createAttribute: (options: IAttributeInitializationOptions) => IAttribute;
26
- createBuffer: (options: IBufferInitializationOptions) => IBuffer;
27
- createElements: (options: IElementsInitializationOptions) => IElements;
28
- createTexture2D: (options: ITexture2DInitializationOptions) => ITexture2D;
29
- createFramebuffer: (options: IFramebufferInitializationOptions) => ReglFramebuffer;
30
- useFramebuffer: (framebuffer: IFramebuffer | null, drawCommands: () => void) => void;
31
- useFramebufferAsync: (framebuffer: IFramebuffer | null, drawCommands: () => Promise<void>) => Promise<void>;
32
- clear: (options: IClearOptions) => void;
33
- viewport: ({ x, y, width, height, }: {
34
- x: number;
35
- y: number;
36
- width: number;
37
- height: number;
38
- }) => void;
39
- readPixels: (options: IReadPixelsOptions) => Uint8Array;
40
- readPixelsAsync: (options: IReadPixelsOptions) => Promise<Uint8Array>;
41
- getViewportSize: () => {
42
- width: number;
43
- height: number;
44
- };
45
- getContainer: () => HTMLElement | null;
46
- getCanvas: () => HTMLCanvasElement;
47
- getGLContext: () => WebGLRenderingContext;
48
- setState(): void;
49
- setBaseState(): void;
50
- setCustomLayerDefaults(): void;
51
- setDirty(flag: boolean): void;
52
- getDirty(): boolean;
53
- destroy: () => void;
54
- beginFrame(): void;
55
- endFrame(): void;
56
- }
package/es/regl/index.js DELETED
@@ -1,227 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
-
22
- // src/regl/index.ts
23
- import regl from "regl";
24
- import ReglAttribute from "./ReglAttribute";
25
- import ReglBuffer from "./ReglBuffer";
26
- import ReglElements from "./ReglElements";
27
- import ReglFramebuffer from "./ReglFramebuffer";
28
- import ReglModel from "./ReglModel";
29
- import ReglTexture2D from "./ReglTexture2D";
30
- var ReglRendererService = class {
31
- constructor() {
32
- this.uniformBuffers = [];
33
- this.queryVerdorInfo = () => {
34
- return "WebGL1";
35
- };
36
- this.createModel = (options) => new ReglModel(this.gl, options);
37
- this.createAttribute = (options) => new ReglAttribute(this.gl, options);
38
- this.createBuffer = (options) => new ReglBuffer(this.gl, options);
39
- this.createElements = (options) => new ReglElements(this.gl, options);
40
- this.createTexture2D = (options) => new ReglTexture2D(this.gl, options);
41
- this.createFramebuffer = (options) => new ReglFramebuffer(this.gl, options);
42
- this.useFramebuffer = (framebuffer, drawCommands) => {
43
- this.gl({
44
- framebuffer: framebuffer ? framebuffer.get() : null
45
- })(drawCommands);
46
- };
47
- this.useFramebufferAsync = (framebuffer, drawCommands) => __async(this, null, function* () {
48
- this.gl({
49
- framebuffer: framebuffer ? framebuffer.get() : null
50
- })(drawCommands);
51
- });
52
- this.clear = (options) => {
53
- var _a;
54
- const { color, depth, stencil, framebuffer = null } = options;
55
- const reglClearOptions = {
56
- color,
57
- depth,
58
- stencil
59
- };
60
- reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
61
- (_a = this.gl) == null ? void 0 : _a.clear(reglClearOptions);
62
- };
63
- this.viewport = ({
64
- x,
65
- y,
66
- width,
67
- height
68
- }) => {
69
- this.gl._gl.viewport(x, y, width, height);
70
- this.width = width;
71
- this.height = height;
72
- this.gl._refresh();
73
- };
74
- this.readPixels = (options) => {
75
- const { framebuffer, x, y, width, height } = options;
76
- const readPixelsOptions = {
77
- x,
78
- y,
79
- width,
80
- height
81
- };
82
- if (framebuffer) {
83
- readPixelsOptions.framebuffer = framebuffer.get();
84
- }
85
- return this.gl.read(readPixelsOptions);
86
- };
87
- this.readPixelsAsync = (options) => __async(this, null, function* () {
88
- return this.readPixels(options);
89
- });
90
- this.getViewportSize = () => {
91
- return {
92
- width: this.gl._gl.drawingBufferWidth,
93
- height: this.gl._gl.drawingBufferHeight
94
- };
95
- };
96
- this.getContainer = () => {
97
- var _a;
98
- return (_a = this.canvas) == null ? void 0 : _a.parentElement;
99
- };
100
- this.getCanvas = () => {
101
- return this.canvas;
102
- };
103
- this.getGLContext = () => {
104
- return this.gl._gl;
105
- };
106
- this.destroy = () => {
107
- var _a, _b, _c;
108
- this.canvas = null;
109
- (_c = (_b = (_a = this.gl) == null ? void 0 : _a._gl) == null ? void 0 : _b.getExtension("WEBGL_lose_context")) == null ? void 0 : _c.loseContext();
110
- this.gl.destroy();
111
- this.gl = null;
112
- };
113
- }
114
- init(canvas, cfg, gl) {
115
- return __async(this, null, function* () {
116
- this.canvas = canvas;
117
- if (gl) {
118
- this.gl = gl;
119
- } else {
120
- this.gl = yield new Promise((resolve, reject) => {
121
- regl({
122
- canvas: this.canvas,
123
- attributes: {
124
- alpha: true,
125
- // use TAA instead of MSAA
126
- // @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
127
- antialias: cfg.antialias,
128
- premultipliedAlpha: true,
129
- preserveDrawingBuffer: cfg.preserveDrawingBuffer,
130
- stencil: cfg.stencil
131
- },
132
- // TODO: use extensions
133
- extensions: [
134
- "OES_element_index_uint",
135
- "OES_standard_derivatives",
136
- // wireframe
137
- "ANGLE_instanced_arrays"
138
- // VSM shadow map
139
- ],
140
- optionalExtensions: [
141
- "oes_texture_float_linear",
142
- "OES_texture_float",
143
- "EXT_texture_filter_anisotropic",
144
- "EXT_blend_minmax",
145
- "WEBGL_depth_texture",
146
- "WEBGL_lose_context"
147
- ],
148
- profile: true,
149
- onDone: (err, r) => {
150
- if (err || !r) {
151
- reject(err);
152
- }
153
- resolve(r);
154
- }
155
- });
156
- });
157
- }
158
- this.extensionObject = {
159
- OES_texture_float: this.testExtension("OES_texture_float")
160
- };
161
- });
162
- }
163
- getPointSizeRange() {
164
- return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE);
165
- }
166
- testExtension(name) {
167
- return !!this.getGLContext().getExtension(name);
168
- }
169
- // TODO: 临时方法
170
- setState() {
171
- this.gl({
172
- cull: {
173
- enable: false,
174
- face: "back"
175
- },
176
- viewport: {
177
- x: 0,
178
- y: 0,
179
- height: this.width,
180
- width: this.height
181
- },
182
- blend: {
183
- enable: true,
184
- equation: "add"
185
- },
186
- framebuffer: null
187
- });
188
- this.gl._refresh();
189
- }
190
- setBaseState() {
191
- this.gl({
192
- cull: {
193
- enable: false,
194
- face: "back"
195
- },
196
- viewport: {
197
- x: 0,
198
- y: 0,
199
- height: this.width,
200
- width: this.height
201
- },
202
- blend: {
203
- enable: false,
204
- equation: "add"
205
- },
206
- framebuffer: null
207
- });
208
- this.gl._refresh();
209
- }
210
- setCustomLayerDefaults() {
211
- const gl = this.getGLContext();
212
- gl.disable(gl.CULL_FACE);
213
- }
214
- setDirty(flag) {
215
- this.isDirty = flag;
216
- }
217
- getDirty() {
218
- return this.isDirty;
219
- }
220
- beginFrame() {
221
- }
222
- endFrame() {
223
- }
224
- };
225
- export {
226
- ReglRendererService as default
227
- };
@@ -1,16 +0,0 @@
1
- import type { IAttribute, IAttributeInitializationOptions } from '@antv/l7-core';
2
- import type regl from 'regl';
3
- /**
4
- * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#attributes
5
- */
6
- export default class ReglAttribute implements IAttribute {
7
- private attribute;
8
- private buffer;
9
- constructor(gl: regl.Regl, options: IAttributeInitializationOptions);
10
- get(): regl.Attribute;
11
- updateBuffer(options: {
12
- data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
13
- offset: number;
14
- }): void;
15
- destroy(): void;
16
- }
@@ -1,49 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/regl/ReglAttribute.ts
20
- var ReglAttribute_exports = {};
21
- __export(ReglAttribute_exports, {
22
- default: () => ReglAttribute
23
- });
24
- module.exports = __toCommonJS(ReglAttribute_exports);
25
- var ReglAttribute = class {
26
- constructor(gl, options) {
27
- const { buffer, offset, stride, normalized, size, divisor } = options;
28
- this.buffer = buffer;
29
- this.attribute = {
30
- buffer: buffer.get(),
31
- offset: offset || 0,
32
- stride: stride || 0,
33
- normalized: normalized || false,
34
- divisor: divisor || 0
35
- };
36
- if (size) {
37
- this.attribute.size = size;
38
- }
39
- }
40
- get() {
41
- return this.attribute;
42
- }
43
- updateBuffer(options) {
44
- this.buffer.subData(options);
45
- }
46
- destroy() {
47
- this.buffer.destroy();
48
- }
49
- };
@@ -1,17 +0,0 @@
1
- import type { IBuffer, IBufferInitializationOptions } from '@antv/l7-core';
2
- import type regl from 'regl';
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 ReglBuffer implements IBuffer {
8
- private buffer;
9
- private isDestroyed;
10
- constructor(reGl: regl.Regl, options: IBufferInitializationOptions);
11
- get(): regl.Buffer;
12
- destroy(): void;
13
- subData({ data, offset, }: {
14
- data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
15
- offset: number;
16
- }): void;
17
- }
@@ -1,53 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/regl/ReglBuffer.ts
20
- var ReglBuffer_exports = {};
21
- __export(ReglBuffer_exports, {
22
- default: () => ReglBuffer
23
- });
24
- module.exports = __toCommonJS(ReglBuffer_exports);
25
- var import_l7_core = require("@antv/l7-core");
26
- var import_constants = require("./constants");
27
- var ReglBuffer = class {
28
- constructor(reGl, options) {
29
- this.isDestroyed = false;
30
- const { data, usage, type } = options;
31
- this.buffer = reGl.buffer({
32
- data,
33
- usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
34
- type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE]
35
- // length: 0,
36
- });
37
- }
38
- get() {
39
- return this.buffer;
40
- }
41
- destroy() {
42
- if (!this.isDestroyed) {
43
- this.buffer.destroy();
44
- }
45
- this.isDestroyed = true;
46
- }
47
- subData({
48
- data,
49
- offset
50
- }) {
51
- this.buffer.subdata(data, offset);
52
- }
53
- };