@antv/l7-renderer 2.9.32-alpha.2 → 2.9.32-alpha.4

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,170 @@
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/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ blendEquationMap: () => blendEquationMap,
23
+ blendFuncMap: () => blendFuncMap,
24
+ colorSpaceMap: () => colorSpaceMap,
25
+ cullFaceMap: () => cullFaceMap,
26
+ dataTypeMap: () => dataTypeMap,
27
+ depthFuncMap: () => depthFuncMap,
28
+ filterMap: () => filterMap,
29
+ formatMap: () => formatMap,
30
+ mipmapMap: () => mipmapMap,
31
+ primitiveMap: () => primitiveMap,
32
+ stencilFuncMap: () => stencilFuncMap,
33
+ stencilOpMap: () => stencilOpMap,
34
+ usageMap: () => usageMap,
35
+ wrapModeMap: () => wrapModeMap
36
+ });
37
+ module.exports = __toCommonJS(constants_exports);
38
+ var import_l7_core = require("@antv/l7-core");
39
+ var primitiveMap = {
40
+ [import_l7_core.gl.POINTS]: "points",
41
+ [import_l7_core.gl.LINES]: "lines",
42
+ [import_l7_core.gl.LINE_LOOP]: "line loop",
43
+ [import_l7_core.gl.LINE_STRIP]: "line strip",
44
+ [import_l7_core.gl.TRIANGLES]: "triangles",
45
+ [import_l7_core.gl.TRIANGLE_FAN]: "triangle fan",
46
+ [import_l7_core.gl.TRIANGLE_STRIP]: "triangle strip"
47
+ };
48
+ var usageMap = {
49
+ [import_l7_core.gl.STATIC_DRAW]: "static",
50
+ [import_l7_core.gl.DYNAMIC_DRAW]: "dynamic",
51
+ [import_l7_core.gl.STREAM_DRAW]: "stream"
52
+ };
53
+ var dataTypeMap = {
54
+ [import_l7_core.gl.BYTE]: "int8",
55
+ [import_l7_core.gl.UNSIGNED_INT]: "int16",
56
+ [import_l7_core.gl.INT]: "int32",
57
+ [import_l7_core.gl.UNSIGNED_BYTE]: "uint8",
58
+ [import_l7_core.gl.UNSIGNED_SHORT]: "uint16",
59
+ [import_l7_core.gl.UNSIGNED_INT]: "uint32",
60
+ [import_l7_core.gl.FLOAT]: "float"
61
+ };
62
+ var formatMap = {
63
+ [import_l7_core.gl.ALPHA]: "alpha",
64
+ [import_l7_core.gl.LUMINANCE]: "luminance",
65
+ [import_l7_core.gl.LUMINANCE_ALPHA]: "luminance alpha",
66
+ [import_l7_core.gl.RGB]: "rgb",
67
+ [import_l7_core.gl.RGBA]: "rgba",
68
+ [import_l7_core.gl.RGBA4]: "rgba4",
69
+ [import_l7_core.gl.RGB5_A1]: "rgb5 a1",
70
+ [import_l7_core.gl.RGB565]: "rgb565",
71
+ [import_l7_core.gl.DEPTH_COMPONENT]: "depth",
72
+ [import_l7_core.gl.DEPTH_STENCIL]: "depth stencil"
73
+ };
74
+ var mipmapMap = {
75
+ [import_l7_core.gl.DONT_CARE]: "dont care",
76
+ [import_l7_core.gl.NICEST]: "nice",
77
+ [import_l7_core.gl.FASTEST]: "fast"
78
+ };
79
+ var filterMap = {
80
+ [import_l7_core.gl.NEAREST]: "nearest",
81
+ [import_l7_core.gl.LINEAR]: "linear",
82
+ [import_l7_core.gl.LINEAR_MIPMAP_LINEAR]: "mipmap",
83
+ [import_l7_core.gl.NEAREST_MIPMAP_LINEAR]: "nearest mipmap linear",
84
+ [import_l7_core.gl.LINEAR_MIPMAP_NEAREST]: "linear mipmap nearest",
85
+ [import_l7_core.gl.NEAREST_MIPMAP_NEAREST]: "nearest mipmap nearest"
86
+ };
87
+ var wrapModeMap = {
88
+ [import_l7_core.gl.REPEAT]: "repeat",
89
+ [import_l7_core.gl.CLAMP_TO_EDGE]: "clamp",
90
+ [import_l7_core.gl.MIRRORED_REPEAT]: "mirror"
91
+ };
92
+ var colorSpaceMap = {
93
+ [import_l7_core.gl.NONE]: "none",
94
+ [import_l7_core.gl.BROWSER_DEFAULT_WEBGL]: "browser"
95
+ };
96
+ var depthFuncMap = {
97
+ [import_l7_core.gl.NEVER]: "never",
98
+ [import_l7_core.gl.ALWAYS]: "always",
99
+ [import_l7_core.gl.LESS]: "less",
100
+ [import_l7_core.gl.LEQUAL]: "lequal",
101
+ [import_l7_core.gl.GREATER]: "greater",
102
+ [import_l7_core.gl.GEQUAL]: "gequal",
103
+ [import_l7_core.gl.EQUAL]: "equal",
104
+ [import_l7_core.gl.NOTEQUAL]: "notequal"
105
+ };
106
+ var blendEquationMap = {
107
+ [import_l7_core.gl.FUNC_ADD]: "add",
108
+ [import_l7_core.gl.MIN_EXT]: "min",
109
+ [import_l7_core.gl.MAX_EXT]: "max",
110
+ [import_l7_core.gl.FUNC_SUBTRACT]: "subtract",
111
+ [import_l7_core.gl.FUNC_REVERSE_SUBTRACT]: "reverse subtract"
112
+ };
113
+ var blendFuncMap = {
114
+ [import_l7_core.gl.ZERO]: "zero",
115
+ [import_l7_core.gl.ONE]: "one",
116
+ [import_l7_core.gl.SRC_COLOR]: "src color",
117
+ [import_l7_core.gl.ONE_MINUS_SRC_COLOR]: "one minus src color",
118
+ [import_l7_core.gl.SRC_ALPHA]: "src alpha",
119
+ [import_l7_core.gl.ONE_MINUS_SRC_ALPHA]: "one minus src alpha",
120
+ [import_l7_core.gl.DST_COLOR]: "dst color",
121
+ [import_l7_core.gl.ONE_MINUS_DST_COLOR]: "one minus dst color",
122
+ [import_l7_core.gl.DST_ALPHA]: "dst alpha",
123
+ [import_l7_core.gl.ONE_MINUS_DST_ALPHA]: "one minus dst alpha",
124
+ [import_l7_core.gl.CONSTANT_COLOR]: "constant color",
125
+ [import_l7_core.gl.ONE_MINUS_CONSTANT_COLOR]: "one minus constant color",
126
+ [import_l7_core.gl.CONSTANT_ALPHA]: "constant alpha",
127
+ [import_l7_core.gl.ONE_MINUS_CONSTANT_ALPHA]: "one minus constant alpha",
128
+ [import_l7_core.gl.SRC_ALPHA_SATURATE]: "src alpha saturate"
129
+ };
130
+ var stencilFuncMap = {
131
+ [import_l7_core.gl.NEVER]: "never",
132
+ [import_l7_core.gl.ALWAYS]: "always",
133
+ [import_l7_core.gl.LESS]: "less",
134
+ [import_l7_core.gl.LEQUAL]: "lequal",
135
+ [import_l7_core.gl.GREATER]: "greater",
136
+ [import_l7_core.gl.GEQUAL]: "gequal",
137
+ [import_l7_core.gl.EQUAL]: "equal",
138
+ [import_l7_core.gl.NOTEQUAL]: "notequal"
139
+ };
140
+ var stencilOpMap = {
141
+ [import_l7_core.gl.ZERO]: "zero",
142
+ [import_l7_core.gl.KEEP]: "keep",
143
+ [import_l7_core.gl.REPLACE]: "replace",
144
+ [import_l7_core.gl.INVERT]: "invert",
145
+ [import_l7_core.gl.INCR]: "increment",
146
+ [import_l7_core.gl.DECR]: "decrement",
147
+ [import_l7_core.gl.INCR_WRAP]: "increment wrap",
148
+ [import_l7_core.gl.DECR_WRAP]: "decrement wrap"
149
+ };
150
+ var cullFaceMap = {
151
+ [import_l7_core.gl.FRONT]: "front",
152
+ [import_l7_core.gl.BACK]: "back"
153
+ };
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ blendEquationMap,
157
+ blendFuncMap,
158
+ colorSpaceMap,
159
+ cullFaceMap,
160
+ dataTypeMap,
161
+ depthFuncMap,
162
+ filterMap,
163
+ formatMap,
164
+ mipmapMap,
165
+ primitiveMap,
166
+ stencilFuncMap,
167
+ stencilOpMap,
168
+ usageMap,
169
+ wrapModeMap
170
+ });
@@ -0,0 +1,225 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __decorateClass = (decorators, target, key, kind) => {
22
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
23
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
24
+ if (decorator = decorators[i])
25
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
26
+ if (kind && result)
27
+ __defProp(target, key, result);
28
+ return result;
29
+ };
30
+
31
+ // src/regl/index.ts
32
+ var regl_exports = {};
33
+ __export(regl_exports, {
34
+ default: () => ReglRendererService
35
+ });
36
+ module.exports = __toCommonJS(regl_exports);
37
+ var import_l7_utils = require("@antv/l7-utils");
38
+ var import_inversify = require("inversify");
39
+ var import_l7regl = __toESM(require("l7regl"));
40
+ var import_reflect_metadata = require("reflect-metadata");
41
+ var import_ReglAttribute = __toESM(require("./ReglAttribute"));
42
+ var import_ReglBuffer = __toESM(require("./ReglBuffer"));
43
+ var import_ReglElements = __toESM(require("./ReglElements"));
44
+ var import_ReglFramebuffer = __toESM(require("./ReglFramebuffer"));
45
+ var import_ReglModel = __toESM(require("./ReglModel"));
46
+ var import_ReglTexture2D = __toESM(require("./ReglTexture2D"));
47
+ var ReglRendererService = class {
48
+ constructor() {
49
+ this.createModel = (options) => new import_ReglModel.default(this.gl, options);
50
+ this.createAttribute = (options) => new import_ReglAttribute.default(this.gl, options);
51
+ this.createBuffer = (options) => new import_ReglBuffer.default(this.gl, options);
52
+ this.createElements = (options) => new import_ReglElements.default(this.gl, options);
53
+ this.createTexture2D = (options) => new import_ReglTexture2D.default(this.gl, options);
54
+ this.createFramebuffer = (options) => new import_ReglFramebuffer.default(this.gl, options);
55
+ this.useFramebuffer = (framebuffer, drawCommands) => {
56
+ this.gl({
57
+ framebuffer: framebuffer ? framebuffer.get() : null
58
+ })(drawCommands);
59
+ };
60
+ this.clear = (options) => {
61
+ var _a;
62
+ const { color, depth, stencil, framebuffer = null } = options;
63
+ const reglClearOptions = {
64
+ color,
65
+ depth,
66
+ stencil
67
+ };
68
+ reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
69
+ (_a = this.gl) == null ? void 0 : _a.clear(reglClearOptions);
70
+ };
71
+ this.viewport = ({
72
+ x,
73
+ y,
74
+ width,
75
+ height
76
+ }) => {
77
+ this.gl._gl.viewport(x, y, width, height);
78
+ this.width = width;
79
+ this.height = height;
80
+ this.gl._refresh();
81
+ };
82
+ this.readPixels = (options) => {
83
+ const { framebuffer, x, y, width, height } = options;
84
+ const readPixelsOptions = {
85
+ x,
86
+ y,
87
+ width,
88
+ height
89
+ };
90
+ if (framebuffer) {
91
+ readPixelsOptions.framebuffer = framebuffer.get();
92
+ }
93
+ return this.gl.read(readPixelsOptions);
94
+ };
95
+ this.getViewportSize = () => {
96
+ return {
97
+ width: this.gl._gl.drawingBufferWidth,
98
+ height: this.gl._gl.drawingBufferHeight
99
+ };
100
+ };
101
+ this.getContainer = () => {
102
+ var _a;
103
+ if (import_l7_utils.isMini) {
104
+ return this.canvas;
105
+ } else {
106
+ return (_a = this.canvas) == null ? void 0 : _a.parentElement;
107
+ }
108
+ };
109
+ this.getCanvas = () => {
110
+ return this.canvas;
111
+ };
112
+ this.getGLContext = () => {
113
+ return this.gl._gl;
114
+ };
115
+ this.destroy = () => {
116
+ var _a, _b, _c;
117
+ this.canvas = null;
118
+ (_c = (_b = (_a = this.gl) == null ? void 0 : _a._gl) == null ? void 0 : _b.getExtension("WEBGL_lose_context")) == null ? void 0 : _c.loseContext();
119
+ this.gl.destroy();
120
+ this.gl = null;
121
+ };
122
+ }
123
+ async init(canvas, cfg, gl) {
124
+ this.canvas = canvas;
125
+ if (gl) {
126
+ this.gl = gl;
127
+ } else {
128
+ this.gl = await new Promise((resolve, reject) => {
129
+ (0, import_l7regl.default)({
130
+ canvas: this.canvas,
131
+ attributes: {
132
+ alpha: true,
133
+ antialias: cfg.antialias,
134
+ premultipliedAlpha: true,
135
+ preserveDrawingBuffer: cfg.preserveDrawingBuffer,
136
+ stencil: cfg.stencil
137
+ },
138
+ extensions: [
139
+ "OES_element_index_uint",
140
+ "OES_standard_derivatives",
141
+ "ANGLE_instanced_arrays"
142
+ ],
143
+ optionalExtensions: [
144
+ "oes_texture_float_linear",
145
+ "OES_texture_float",
146
+ "EXT_texture_filter_anisotropic",
147
+ "EXT_blend_minmax",
148
+ "WEBGL_depth_texture"
149
+ ],
150
+ profile: true,
151
+ onDone: (err, r) => {
152
+ if (err || !r) {
153
+ reject(err);
154
+ }
155
+ resolve(r);
156
+ }
157
+ });
158
+ });
159
+ }
160
+ this.extensionObject = {
161
+ OES_texture_float: this.testExtension("OES_texture_float")
162
+ };
163
+ }
164
+ getPointSizeRange() {
165
+ return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE);
166
+ }
167
+ testExtension(name) {
168
+ return !!this.getGLContext().getExtension(name);
169
+ }
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
+ };
221
+ ReglRendererService = __decorateClass([
222
+ (0, import_inversify.injectable)()
223
+ ], ReglRendererService);
224
+ // Annotate the CommonJS export names for ESM import in node:
225
+ 0 && (module.exports = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.9.32-alpha.2",
3
+ "version": "2.9.32-alpha.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,19 +25,19 @@
25
25
  "author": "xiaoiver",
26
26
  "license": "ISC",
27
27
  "devDependencies": {
28
- "@antv/l7-test-utils": "2.9.32-alpha.2",
28
+ "@antv/l7-test-utils": "2.9.32-alpha.4",
29
29
  "gl": "^5.0.3"
30
30
  },
31
31
  "dependencies": {
32
- "@antv/l7-core": "2.9.32-alpha.2",
33
- "@antv/l7-utils": "2.9.32-alpha.2",
32
+ "@antv/l7-core": "2.9.32-alpha.4",
33
+ "@antv/l7-utils": "2.9.32-alpha.4",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "inversify": "^5.0.1",
36
36
  "l7regl": "^0.0.20",
37
37
  "lodash": "^4.17.15",
38
38
  "reflect-metadata": "^0.1.13"
39
39
  },
40
- "gitHead": "16555be9682edaeeabec85082fc8c9e49fefabc0",
40
+ "gitHead": "17a8a05d41a0007db94568d2902a8f539d6e3abc",
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  }