@antv/l7-renderer 2.19.10 → 2.20.0

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 (43) hide show
  1. package/es/device/DeviceAttribute.d.ts +13 -0
  2. package/es/device/DeviceAttribute.js +44 -0
  3. package/es/device/DeviceBuffer.d.ts +18 -0
  4. package/es/device/DeviceBuffer.js +65 -0
  5. package/es/device/DeviceElements.d.ts +13 -0
  6. package/es/device/DeviceElements.js +52 -0
  7. package/es/device/DeviceFramebuffer.d.ts +15 -0
  8. package/es/device/DeviceFramebuffer.js +58 -0
  9. package/es/device/DeviceModel.d.ts +36 -0
  10. package/es/device/DeviceModel.js +414 -0
  11. package/es/device/DeviceTexture2D.d.ts +20 -0
  12. package/es/device/DeviceTexture2D.js +116 -0
  13. package/es/device/constants.d.ts +29 -0
  14. package/es/device/constants.js +32 -0
  15. package/es/device/index.d.ts +53 -0
  16. package/es/device/index.js +319 -0
  17. package/es/device/utils/pipeline.d.ts +1 -0
  18. package/es/device/utils/pipeline.js +1 -0
  19. package/es/device/utils/typedarray.d.ts +2 -0
  20. package/es/device/utils/typedarray.js +16 -0
  21. package/es/device/utils/webgl.d.ts +1 -0
  22. package/es/device/utils/webgl.js +9 -0
  23. package/es/index.d.ts +2 -1
  24. package/es/index.js +2 -1
  25. package/es/regl/ReglModel.js +20 -6
  26. package/es/regl/ReglTexture2D.js +1 -1
  27. package/es/regl/index.d.ts +3 -0
  28. package/es/regl/index.js +10 -3
  29. package/lib/device/DeviceAttribute.js +58 -0
  30. package/lib/device/DeviceBuffer.js +68 -0
  31. package/lib/device/DeviceElements.js +66 -0
  32. package/lib/device/DeviceFramebuffer.js +67 -0
  33. package/lib/device/DeviceModel.js +370 -0
  34. package/lib/device/DeviceTexture2D.js +119 -0
  35. package/lib/device/constants.js +117 -0
  36. package/lib/device/index.js +189 -0
  37. package/lib/device/utils/pipeline.js +30 -0
  38. package/lib/device/utils/typedarray.js +43 -0
  39. package/lib/device/utils/webgl.js +34 -0
  40. package/lib/index.js +3 -0
  41. package/lib/regl/ReglModel.js +16 -2
  42. package/lib/regl/index.js +5 -0
  43. package/package.json +15 -15
@@ -0,0 +1,117 @@
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/device/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ blendEquationMap: () => blendEquationMap,
23
+ blendFuncMap: () => blendFuncMap,
24
+ cullFaceMap: () => cullFaceMap,
25
+ depthFuncMap: () => depthFuncMap,
26
+ hintMap: () => hintMap,
27
+ primitiveMap: () => primitiveMap,
28
+ sizeFormatMap: () => sizeFormatMap,
29
+ typedArrayCtorMap: () => typedArrayCtorMap,
30
+ wrapModeMap: () => wrapModeMap
31
+ });
32
+ module.exports = __toCommonJS(constants_exports);
33
+ var import_g_device_api = require("@antv/g-device-api");
34
+ var import_l7_core = require("@antv/l7-core");
35
+ var typedArrayCtorMap = {
36
+ [import_l7_core.gl.FLOAT]: Float32Array,
37
+ [import_l7_core.gl.UNSIGNED_BYTE]: Uint8Array,
38
+ [import_l7_core.gl.SHORT]: Int16Array,
39
+ [import_l7_core.gl.UNSIGNED_SHORT]: Uint16Array,
40
+ [import_l7_core.gl.INT]: Int32Array,
41
+ [import_l7_core.gl.UNSIGNED_INT]: Uint32Array
42
+ };
43
+ var primitiveMap = {
44
+ [import_l7_core.gl.POINTS]: import_g_device_api.PrimitiveTopology.POINTS,
45
+ [import_l7_core.gl.LINES]: import_g_device_api.PrimitiveTopology.LINES,
46
+ [import_l7_core.gl.LINE_LOOP]: import_g_device_api.PrimitiveTopology.LINES,
47
+ [import_l7_core.gl.LINE_STRIP]: import_g_device_api.PrimitiveTopology.LINE_STRIP,
48
+ [import_l7_core.gl.TRIANGLES]: import_g_device_api.PrimitiveTopology.TRIANGLES,
49
+ [import_l7_core.gl.TRIANGLE_FAN]: import_g_device_api.PrimitiveTopology.TRIANGLES,
50
+ [import_l7_core.gl.TRIANGLE_STRIP]: import_g_device_api.PrimitiveTopology.TRIANGLE_STRIP
51
+ };
52
+ var sizeFormatMap = {
53
+ [1]: import_g_device_api.Format.F32_R,
54
+ [2]: import_g_device_api.Format.F32_RG,
55
+ [3]: import_g_device_api.Format.F32_RGB,
56
+ [4]: import_g_device_api.Format.F32_RGBA
57
+ };
58
+ var hintMap = {
59
+ [import_l7_core.gl.STATIC_DRAW]: import_g_device_api.BufferFrequencyHint.STATIC,
60
+ [import_l7_core.gl.DYNAMIC_DRAW]: import_g_device_api.BufferFrequencyHint.DYNAMIC,
61
+ [import_l7_core.gl.STREAM_DRAW]: import_g_device_api.BufferFrequencyHint.DYNAMIC
62
+ };
63
+ var wrapModeMap = {
64
+ [import_l7_core.gl.REPEAT]: import_g_device_api.AddressMode.REPEAT,
65
+ [import_l7_core.gl.CLAMP_TO_EDGE]: import_g_device_api.AddressMode.CLAMP_TO_EDGE,
66
+ [import_l7_core.gl.MIRRORED_REPEAT]: import_g_device_api.AddressMode.MIRRORED_REPEAT
67
+ };
68
+ var depthFuncMap = {
69
+ [import_l7_core.gl.NEVER]: import_g_device_api.CompareFunction.NEVER,
70
+ [import_l7_core.gl.ALWAYS]: import_g_device_api.CompareFunction.ALWAYS,
71
+ [import_l7_core.gl.LESS]: import_g_device_api.CompareFunction.LESS,
72
+ [import_l7_core.gl.LEQUAL]: import_g_device_api.CompareFunction.LEQUAL,
73
+ [import_l7_core.gl.GREATER]: import_g_device_api.CompareFunction.GREATER,
74
+ [import_l7_core.gl.GEQUAL]: import_g_device_api.CompareFunction.GEQUAL,
75
+ [import_l7_core.gl.EQUAL]: import_g_device_api.CompareFunction.EQUAL,
76
+ [import_l7_core.gl.NOTEQUAL]: import_g_device_api.CompareFunction.NOTEQUAL
77
+ };
78
+ var cullFaceMap = {
79
+ [import_l7_core.gl.FRONT]: import_g_device_api.CullMode.FRONT,
80
+ [import_l7_core.gl.BACK]: import_g_device_api.CullMode.BACK
81
+ };
82
+ var blendEquationMap = {
83
+ [import_l7_core.gl.FUNC_ADD]: import_g_device_api.BlendMode.ADD,
84
+ [import_l7_core.gl.MIN_EXT]: import_g_device_api.BlendMode.MIN,
85
+ [import_l7_core.gl.MAX_EXT]: import_g_device_api.BlendMode.MAX,
86
+ [import_l7_core.gl.FUNC_SUBTRACT]: import_g_device_api.BlendMode.SUBSTRACT,
87
+ [import_l7_core.gl.FUNC_REVERSE_SUBTRACT]: import_g_device_api.BlendMode.REVERSE_SUBSTRACT
88
+ };
89
+ var blendFuncMap = {
90
+ [import_l7_core.gl.ZERO]: import_g_device_api.BlendFactor.ZERO,
91
+ [import_l7_core.gl.ONE]: import_g_device_api.BlendFactor.ONE,
92
+ [import_l7_core.gl.SRC_COLOR]: import_g_device_api.BlendFactor.SRC,
93
+ [import_l7_core.gl.ONE_MINUS_SRC_COLOR]: import_g_device_api.BlendFactor.ONE_MINUS_SRC,
94
+ [import_l7_core.gl.SRC_ALPHA]: import_g_device_api.BlendFactor.SRC_ALPHA,
95
+ [import_l7_core.gl.ONE_MINUS_SRC_ALPHA]: import_g_device_api.BlendFactor.ONE_MINUS_SRC_ALPHA,
96
+ [import_l7_core.gl.DST_COLOR]: import_g_device_api.BlendFactor.DST,
97
+ [import_l7_core.gl.ONE_MINUS_DST_COLOR]: import_g_device_api.BlendFactor.ONE_MINUS_DST,
98
+ [import_l7_core.gl.DST_ALPHA]: import_g_device_api.BlendFactor.DST_ALPHA,
99
+ [import_l7_core.gl.ONE_MINUS_DST_ALPHA]: import_g_device_api.BlendFactor.ONE_MINUS_DST_ALPHA,
100
+ [import_l7_core.gl.CONSTANT_COLOR]: import_g_device_api.BlendFactor.CONST,
101
+ [import_l7_core.gl.ONE_MINUS_CONSTANT_COLOR]: import_g_device_api.BlendFactor.ONE_MINUS_CONSTANT,
102
+ [import_l7_core.gl.CONSTANT_ALPHA]: import_g_device_api.BlendFactor.CONST,
103
+ [import_l7_core.gl.ONE_MINUS_CONSTANT_ALPHA]: import_g_device_api.BlendFactor.ONE_MINUS_CONSTANT,
104
+ [import_l7_core.gl.SRC_ALPHA_SATURATE]: import_g_device_api.BlendFactor.SRC_ALPHA_SATURATE
105
+ };
106
+ // Annotate the CommonJS export names for ESM import in node:
107
+ 0 && (module.exports = {
108
+ blendEquationMap,
109
+ blendFuncMap,
110
+ cullFaceMap,
111
+ depthFuncMap,
112
+ hintMap,
113
+ primitiveMap,
114
+ sizeFormatMap,
115
+ typedArrayCtorMap,
116
+ wrapModeMap
117
+ });
@@ -0,0 +1,189 @@
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(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __decorateClass = (decorators, target, key, kind) => {
29
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
30
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
31
+ if (decorator = decorators[i])
32
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
33
+ if (kind && result)
34
+ __defProp(target, key, result);
35
+ return result;
36
+ };
37
+
38
+ // src/device/index.ts
39
+ var device_exports = {};
40
+ __export(device_exports, {
41
+ default: () => DeviceRendererService
42
+ });
43
+ module.exports = __toCommonJS(device_exports);
44
+ var import_g_device_api = require("@antv/g-device-api");
45
+ var import_inversify = require("inversify");
46
+ var import_reflect_metadata = require("reflect-metadata");
47
+ var import_DeviceAttribute = __toESM(require("./DeviceAttribute"));
48
+ var import_DeviceBuffer = __toESM(require("./DeviceBuffer"));
49
+ var import_DeviceElements = __toESM(require("./DeviceElements"));
50
+ var import_DeviceFramebuffer = __toESM(require("./DeviceFramebuffer"));
51
+ var import_DeviceModel = __toESM(require("./DeviceModel"));
52
+ var import_DeviceTexture2D = __toESM(require("./DeviceTexture2D"));
53
+ var import_webgl = require("./utils/webgl");
54
+ var DeviceRendererService = class {
55
+ constructor() {
56
+ this.uniformBuffers = [];
57
+ this.createModel = (options) => new import_DeviceModel.default(this.device, options);
58
+ this.createAttribute = (options) => new import_DeviceAttribute.default(this.device, options);
59
+ this.createBuffer = (options) => new import_DeviceBuffer.default(this.device, options);
60
+ this.createElements = (options) => new import_DeviceElements.default(this.device, options);
61
+ this.createTexture2D = (options) => new import_DeviceTexture2D.default(this.device, options);
62
+ this.createFramebuffer = (options) => new import_DeviceFramebuffer.default(this.device, options);
63
+ this.useFramebuffer = () => {
64
+ };
65
+ this.clear = () => {
66
+ };
67
+ this.viewport = ({
68
+ // x,
69
+ // y,
70
+ width,
71
+ height
72
+ }) => {
73
+ this.width = width;
74
+ this.height = height;
75
+ this.device.width = width;
76
+ this.device.height = height;
77
+ };
78
+ this.readPixels = () => {
79
+ return new Uint8Array();
80
+ };
81
+ this.getViewportSize = () => {
82
+ return {
83
+ // @ts-ignore
84
+ width: this.device.width,
85
+ // @ts-ignore
86
+ height: this.device.height
87
+ };
88
+ };
89
+ this.getContainer = () => {
90
+ var _a;
91
+ return (_a = this.canvas) == null ? void 0 : _a.parentElement;
92
+ };
93
+ this.getCanvas = () => {
94
+ return this.canvas;
95
+ };
96
+ this.getGLContext = () => {
97
+ return this.device["gl"];
98
+ };
99
+ this.destroy = () => {
100
+ var _a;
101
+ this.canvas = null;
102
+ (_a = this.uniformBuffers) == null ? void 0 : _a.forEach((buffer) => {
103
+ buffer.destroy();
104
+ });
105
+ this.device.destroy();
106
+ };
107
+ }
108
+ async init(canvas, cfg) {
109
+ const { enableWebGPU, shaderCompilerPath } = cfg;
110
+ this.canvas = canvas;
111
+ const deviceContribution = enableWebGPU ? new import_g_device_api.WebGPUDeviceContribution({
112
+ shaderCompilerPath
113
+ }) : new import_g_device_api.WebGLDeviceContribution({
114
+ // Use WebGL2 first and downgrade to WebGL1 if WebGL2 is not supported.
115
+ targets: ["webgl2", "webgl1"],
116
+ onContextLost(e) {
117
+ console.warn("context lost", e);
118
+ },
119
+ onContextCreationError(e) {
120
+ console.warn("context creation error", e);
121
+ },
122
+ onContextRestored(e) {
123
+ console.warn("context restored", e);
124
+ }
125
+ });
126
+ const swapChain = await deviceContribution.createSwapChain(canvas);
127
+ swapChain.configureSwapChain(canvas.width, canvas.height);
128
+ this.device = swapChain.getDevice();
129
+ this.swapChain = swapChain;
130
+ const gl = this.device["gl"];
131
+ this.extensionObject = {
132
+ // @ts-ignore
133
+ OES_texture_float: !(0, import_webgl.isWebGL2)(gl) && this.device["OES_texture_float"]
134
+ };
135
+ const renderTargetTexture = this.device.createTexture({
136
+ format: import_g_device_api.Format.U8_RGBA_RT,
137
+ width: canvas.width,
138
+ height: canvas.height,
139
+ usage: import_g_device_api.TextureUsage.RENDER_TARGET
140
+ });
141
+ this.renderTarget = this.device.createRenderTargetFromTexture(renderTargetTexture);
142
+ this.mainDepthRT = this.device.createRenderTargetFromTexture(
143
+ this.device.createTexture({
144
+ format: import_g_device_api.Format.D24_S8,
145
+ width: canvas.width,
146
+ height: canvas.height,
147
+ usage: import_g_device_api.TextureUsage.RENDER_TARGET
148
+ })
149
+ );
150
+ }
151
+ beginFrame() {
152
+ const onscreenTexture = this.swapChain.getOnscreenTexture();
153
+ this.renderPass = this.device.createRenderPass({
154
+ colorAttachment: [this.renderTarget],
155
+ // colorResolveTo: [onscreen ? onscreenTexture : onscreenTexture],
156
+ colorResolveTo: [onscreenTexture],
157
+ colorClearColor: [import_g_device_api.TransparentBlack],
158
+ depthStencilAttachment: this.mainDepthRT,
159
+ depthClearValue: 1
160
+ });
161
+ this.device.renderPass = this.renderPass;
162
+ }
163
+ endFrame() {
164
+ this.device.submitPass(this.renderPass);
165
+ }
166
+ getPointSizeRange() {
167
+ const gl = this.device["gl"];
168
+ return gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
169
+ }
170
+ testExtension(name) {
171
+ return !!this.getGLContext().getExtension(name);
172
+ }
173
+ // TODO: 临时方法
174
+ setState() {
175
+ }
176
+ setBaseState() {
177
+ }
178
+ setCustomLayerDefaults() {
179
+ }
180
+ setDirty(flag) {
181
+ this.isDirty = flag;
182
+ }
183
+ getDirty() {
184
+ return this.isDirty;
185
+ }
186
+ };
187
+ DeviceRendererService = __decorateClass([
188
+ (0, import_inversify.injectable)()
189
+ ], DeviceRendererService);
@@ -0,0 +1,30 @@
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/device/utils/pipeline.ts
20
+ var pipeline_exports = {};
21
+ __export(pipeline_exports, {
22
+ pipelineEquals: () => pipelineEquals
23
+ });
24
+ module.exports = __toCommonJS(pipeline_exports);
25
+ function pipelineEquals() {
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ pipelineEquals
30
+ });
@@ -0,0 +1,43 @@
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/device/utils/typedarray.ts
20
+ var typedarray_exports = {};
21
+ __export(typedarray_exports, {
22
+ isTypedArray: () => isTypedArray
23
+ });
24
+ module.exports = __toCommonJS(typedarray_exports);
25
+ var dtypes = {
26
+ "[object Int8Array]": 5120,
27
+ "[object Int16Array]": 5122,
28
+ "[object Int32Array]": 5124,
29
+ "[object Uint8Array]": 5121,
30
+ "[object Uint8ClampedArray]": 5121,
31
+ "[object Uint16Array]": 5123,
32
+ "[object Uint32Array]": 5125,
33
+ "[object Float32Array]": 5126,
34
+ "[object Float64Array]": 5121,
35
+ "[object ArrayBuffer]": 5121
36
+ };
37
+ function isTypedArray(x) {
38
+ return Object.prototype.toString.call(x) in dtypes;
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ isTypedArray
43
+ });
@@ -0,0 +1,34 @@
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/device/utils/webgl.ts
20
+ var webgl_exports = {};
21
+ __export(webgl_exports, {
22
+ isWebGL2: () => isWebGL2
23
+ });
24
+ module.exports = __toCommonJS(webgl_exports);
25
+ function isWebGL2(gl) {
26
+ if (typeof WebGL2RenderingContext !== "undefined" && gl instanceof WebGL2RenderingContext) {
27
+ return true;
28
+ }
29
+ return Boolean(gl && gl._version === 2);
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ isWebGL2
34
+ });
package/lib/index.js CHANGED
@@ -29,11 +29,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/index.ts
30
30
  var src_exports = {};
31
31
  __export(src_exports, {
32
+ DeviceRendererService: () => import_device.default,
32
33
  ReglRendererService: () => import_regl.default
33
34
  });
34
35
  module.exports = __toCommonJS(src_exports);
36
+ var import_device = __toESM(require("./device"));
35
37
  var import_regl = __toESM(require("./regl"));
36
38
  // Annotate the CommonJS export names for ESM import in node:
37
39
  0 && (module.exports = {
40
+ DeviceRendererService,
38
41
  ReglRendererService
39
42
  });
@@ -22,6 +22,7 @@ __export(ReglModel_exports, {
22
22
  default: () => ReglModel
23
23
  });
24
24
  module.exports = __toCommonJS(ReglModel_exports);
25
+ var import_g_device_api = require("@antv/g-device-api");
25
26
  var import_l7_core = require("@antv/l7-core");
26
27
  var import_l7_utils = require("@antv/l7-utils");
27
28
  var import_constants = require("./constants");
@@ -43,6 +44,15 @@ var ReglModel = class {
43
44
  cull,
44
45
  instances
45
46
  } = options;
47
+ const vendorInfo = {
48
+ platformString: "WebGL1",
49
+ glslVersion: "#version 100",
50
+ explicitBindingLocations: false,
51
+ separateSamplerTextures: false,
52
+ viewportOrigin: import_g_device_api.ViewportOrigin.LOWER_LEFT,
53
+ clipSpaceNearZ: import_g_device_api.ClipSpaceNearZ.NEGATIVE_ONE,
54
+ supportMRT: false
55
+ };
46
56
  const reglUniforms = {};
47
57
  this.options = options;
48
58
  if (uniforms) {
@@ -57,9 +67,13 @@ var ReglModel = class {
57
67
  });
58
68
  const drawParams = {
59
69
  attributes: reglAttributes,
60
- frag: fs,
70
+ frag: (0, import_l7_core.removeDuplicateUniforms)(
71
+ (0, import_g_device_api.preprocessShader_GLSL)(vendorInfo, "frag", fs, null, false)
72
+ ),
61
73
  uniforms: reglUniforms,
62
- vert: vs,
74
+ vert: (0, import_l7_core.removeDuplicateUniforms)(
75
+ (0, import_g_device_api.preprocessShader_GLSL)(vendorInfo, "vert", vs, null, false)
76
+ ),
63
77
  // @ts-ignore
64
78
  colorMask: reGl.prop("colorMask"),
65
79
  lineWidth: 1,
package/lib/regl/index.js CHANGED
@@ -52,6 +52,7 @@ var import_ReglModel = __toESM(require("./ReglModel"));
52
52
  var import_ReglTexture2D = __toESM(require("./ReglTexture2D"));
53
53
  var ReglRendererService = class {
54
54
  constructor() {
55
+ this.uniformBuffers = [];
55
56
  this.createModel = (options) => new import_ReglModel.default(this.gl, options);
56
57
  this.createAttribute = (options) => new import_ReglAttribute.default(this.gl, options);
57
58
  this.createBuffer = (options) => new import_ReglBuffer.default(this.gl, options);
@@ -226,6 +227,10 @@ var ReglRendererService = class {
226
227
  getDirty() {
227
228
  return this.isDirty;
228
229
  }
230
+ beginFrame() {
231
+ }
232
+ endFrame() {
233
+ }
229
234
  };
230
235
  ReglRendererService = __decorateClass([
231
236
  (0, import_inversify.injectable)()
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.19.10",
3
+ "version": "2.20.0",
4
4
  "description": "",
5
+ "license": "ISC",
6
+ "author": "xiaoiver",
7
+ "sideEffects": false,
5
8
  "main": "lib/index.js",
6
9
  "module": "es/index.js",
7
10
  "types": "es/index.d.ts",
8
- "sideEffects": false,
9
11
  "files": [
10
12
  "lib",
11
13
  "es",
@@ -13,31 +15,29 @@
13
15
  ],
14
16
  "scripts": {
15
17
  "tsc": "tsc --project tsconfig.build.json",
16
- "clean": "rimraf dist; rimraf es; rimraf lib;",
17
18
  "build": "father build",
18
19
  "build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
19
20
  "build:esm": "BABEL_ENV=esm babel src --root-mode upward --out-dir es --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
20
- "watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
21
+ "clean": "rimraf dist; rimraf es; rimraf lib;",
21
22
  "sync": "tnpm sync",
22
23
  "test": "umi-test --passWithNoTests",
23
24
  "test-live": "umi-test --watch"
24
25
  },
25
- "author": "xiaoiver",
26
- "license": "ISC",
27
- "devDependencies": {
28
- "@antv/l7-test-utils": "2.19.10",
29
- "gl": "^5.0.3"
30
- },
31
26
  "dependencies": {
32
- "@antv/l7-core": "2.19.10",
33
- "@antv/l7-utils": "2.19.10",
27
+ "@antv/g-device-api": "^1.3.6",
28
+ "@antv/l7-core": "2.20.0",
29
+ "@antv/l7-utils": "2.20.0",
34
30
  "@babel/runtime": "^7.7.7",
35
31
  "inversify": "^5.0.1",
36
32
  "reflect-metadata": "^0.1.13",
37
- "regl": "1.7.0"
33
+ "regl": "1.6.1"
34
+ },
35
+ "devDependencies": {
36
+ "@antv/l7-test-utils": "2.20.0",
37
+ "gl": "^6.0.2"
38
38
  },
39
- "gitHead": "150d3dc74f975ad10d48868612b6f978e4bbce85",
40
39
  "publishConfig": {
41
40
  "access": "public"
42
- }
41
+ },
42
+ "gitHead": "6b1a6b52bae44b05336459d4d80f7cace21da6f1"
43
43
  }