@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.
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -3
- package/lib/index.d.ts +1 -2
- package/lib/index.js +2 -5
- package/package.json +8 -6
- package/es/regl/ReglAttribute.d.ts +0 -16
- package/es/regl/ReglAttribute.js +0 -29
- package/es/regl/ReglBuffer.d.ts +0 -17
- package/es/regl/ReglBuffer.js +0 -33
- package/es/regl/ReglElements.d.ts +0 -14
- package/es/regl/ReglElements.js +0 -27
- package/es/regl/ReglFramebuffer.d.ts +0 -16
- package/es/regl/ReglFramebuffer.js +0 -31
- package/es/regl/ReglModel.d.ts +0 -46
- package/es/regl/ReglModel.js +0 -302
- package/es/regl/ReglRenderbuffer.d.ts +0 -16
- package/es/regl/ReglRenderbuffer.js +0 -24
- package/es/regl/ReglTexture2D.d.ts +0 -22
- package/es/regl/ReglTexture2D.js +0 -94
- package/es/regl/constants.d.ts +0 -43
- package/es/regl/constants.js +0 -133
- package/es/regl/index.d.ts +0 -56
- package/es/regl/index.js +0 -227
- package/lib/regl/ReglAttribute.d.ts +0 -16
- package/lib/regl/ReglAttribute.js +0 -49
- package/lib/regl/ReglBuffer.d.ts +0 -17
- package/lib/regl/ReglBuffer.js +0 -53
- package/lib/regl/ReglElements.d.ts +0 -14
- package/lib/regl/ReglElements.js +0 -47
- package/lib/regl/ReglFramebuffer.d.ts +0 -16
- package/lib/regl/ReglFramebuffer.js +0 -51
- package/lib/regl/ReglModel.d.ts +0 -46
- package/lib/regl/ReglModel.js +0 -311
- package/lib/regl/ReglRenderbuffer.d.ts +0 -16
- package/lib/regl/ReglRenderbuffer.js +0 -44
- package/lib/regl/ReglTexture2D.d.ts +0 -22
- package/lib/regl/ReglTexture2D.js +0 -107
- package/lib/regl/constants.d.ts +0 -43
- package/lib/regl/constants.js +0 -170
- package/lib/regl/index.d.ts +0 -56
- package/lib/regl/index.js +0 -256
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IElements, IElementsInitializationOptions } from '@antv/l7-core';
|
|
2
|
-
import type regl from 'regl';
|
|
3
|
-
/**
|
|
4
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#elements
|
|
5
|
-
*/
|
|
6
|
-
export default class ReglElements implements IElements {
|
|
7
|
-
private elements;
|
|
8
|
-
constructor(reGl: regl.Regl, options: IElementsInitializationOptions);
|
|
9
|
-
get(): regl.Elements;
|
|
10
|
-
subData({ data, }: {
|
|
11
|
-
data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
|
|
12
|
-
}): void;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
}
|
package/lib/regl/ReglElements.js
DELETED
|
@@ -1,47 +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/ReglElements.ts
|
|
20
|
-
var ReglElements_exports = {};
|
|
21
|
-
__export(ReglElements_exports, {
|
|
22
|
-
default: () => ReglElements
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglElements_exports);
|
|
25
|
-
var import_l7_core = require("@antv/l7-core");
|
|
26
|
-
var import_constants = require("./constants");
|
|
27
|
-
var ReglElements = class {
|
|
28
|
-
constructor(reGl, options) {
|
|
29
|
-
const { data, usage, type, count } = options;
|
|
30
|
-
this.elements = reGl.elements({
|
|
31
|
-
data,
|
|
32
|
-
usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
|
|
33
|
-
type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE],
|
|
34
|
-
count
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
get() {
|
|
38
|
-
return this.elements;
|
|
39
|
-
}
|
|
40
|
-
subData({
|
|
41
|
-
data
|
|
42
|
-
}) {
|
|
43
|
-
this.elements.subdata(data);
|
|
44
|
-
}
|
|
45
|
-
destroy() {
|
|
46
|
-
}
|
|
47
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IFramebuffer, IFramebufferInitializationOptions } from '@antv/l7-core';
|
|
2
|
-
import type regl from 'regl';
|
|
3
|
-
/**
|
|
4
|
-
* adaptor for regl.Framebuffer
|
|
5
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#framebuffers
|
|
6
|
-
*/
|
|
7
|
-
export default class ReglFramebuffer implements IFramebuffer {
|
|
8
|
-
private framebuffer;
|
|
9
|
-
constructor(reGl: regl.Regl, options: IFramebufferInitializationOptions);
|
|
10
|
-
get(): regl.Framebuffer;
|
|
11
|
-
destroy(): void;
|
|
12
|
-
resize({ width, height }: {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
}): void;
|
|
16
|
-
}
|
|
@@ -1,51 +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/ReglFramebuffer.ts
|
|
20
|
-
var ReglFramebuffer_exports = {};
|
|
21
|
-
__export(ReglFramebuffer_exports, {
|
|
22
|
-
default: () => ReglFramebuffer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglFramebuffer_exports);
|
|
25
|
-
var ReglFramebuffer = class {
|
|
26
|
-
constructor(reGl, options) {
|
|
27
|
-
const { width, height, color, colors } = options;
|
|
28
|
-
const framebufferOptions = {
|
|
29
|
-
width,
|
|
30
|
-
height
|
|
31
|
-
};
|
|
32
|
-
if (Array.isArray(colors)) {
|
|
33
|
-
framebufferOptions.colors = colors.map(
|
|
34
|
-
(c) => c.get()
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
if (color && typeof color !== "boolean") {
|
|
38
|
-
framebufferOptions.color = color.get();
|
|
39
|
-
}
|
|
40
|
-
this.framebuffer = reGl.framebuffer(framebufferOptions);
|
|
41
|
-
}
|
|
42
|
-
get() {
|
|
43
|
-
return this.framebuffer;
|
|
44
|
-
}
|
|
45
|
-
destroy() {
|
|
46
|
-
this.framebuffer.destroy();
|
|
47
|
-
}
|
|
48
|
-
resize({ width, height }) {
|
|
49
|
-
this.framebuffer.resize(width, height);
|
|
50
|
-
}
|
|
51
|
-
};
|
package/lib/regl/ReglModel.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { IAttribute, IElements, IModel, IModelDrawOptions, IModelInitializationOptions, IUniform } from '@antv/l7-core';
|
|
2
|
-
import type regl from 'regl';
|
|
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
|
-
updateAttributesAndElements(attributes: {
|
|
15
|
-
[key: string]: IAttribute;
|
|
16
|
-
}, elements: IElements): void;
|
|
17
|
-
updateAttributes(attributes: {
|
|
18
|
-
[key: string]: IAttribute;
|
|
19
|
-
}): void;
|
|
20
|
-
addUniforms(uniforms: {
|
|
21
|
-
[key: string]: IUniform;
|
|
22
|
-
}): void;
|
|
23
|
-
draw(options: IModelDrawOptions, pick?: boolean): void;
|
|
24
|
-
destroy(): void;
|
|
25
|
-
/**
|
|
26
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
|
|
27
|
-
*/
|
|
28
|
-
private initDepthDrawParams;
|
|
29
|
-
private getBlendDrawParams;
|
|
30
|
-
/**
|
|
31
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
32
|
-
*/
|
|
33
|
-
private getStencilDrawParams;
|
|
34
|
-
private getColorMaskDrawParams;
|
|
35
|
-
/**
|
|
36
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
37
|
-
*/
|
|
38
|
-
private initCullDrawParams;
|
|
39
|
-
/**
|
|
40
|
-
* 考虑结构体命名, eg:
|
|
41
|
-
* a: { b: 1 } -> 'a.b'
|
|
42
|
-
* a: [ { b: 1 } ] -> 'a[0].b'
|
|
43
|
-
*/
|
|
44
|
-
private extractUniforms;
|
|
45
|
-
private extractUniformsRecursively;
|
|
46
|
-
}
|
package/lib/regl/ReglModel.js
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(from))
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
|
|
36
|
-
// src/regl/ReglModel.ts
|
|
37
|
-
var ReglModel_exports = {};
|
|
38
|
-
__export(ReglModel_exports, {
|
|
39
|
-
default: () => ReglModel
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(ReglModel_exports);
|
|
42
|
-
var import_g_device_api = require("@antv/g-device-api");
|
|
43
|
-
var import_l7_core = require("@antv/l7-core");
|
|
44
|
-
var import_l7_utils = require("@antv/l7-utils");
|
|
45
|
-
var import_constants = require("./constants");
|
|
46
|
-
var { isPlainObject, isTypedArray } = import_l7_utils.lodashUtil;
|
|
47
|
-
var ReglModel = class {
|
|
48
|
-
constructor(reGl, options) {
|
|
49
|
-
this.destroyed = false;
|
|
50
|
-
this.uniforms = {};
|
|
51
|
-
this.reGl = reGl;
|
|
52
|
-
const { vs, fs, attributes, uniforms, primitive, count, elements, depth, cull, instances } = options;
|
|
53
|
-
const vendorInfo = {
|
|
54
|
-
platformString: "WebGL1",
|
|
55
|
-
glslVersion: "#version 100",
|
|
56
|
-
explicitBindingLocations: false,
|
|
57
|
-
separateSamplerTextures: false,
|
|
58
|
-
viewportOrigin: import_g_device_api.ViewportOrigin.LOWER_LEFT,
|
|
59
|
-
clipSpaceNearZ: import_g_device_api.ClipSpaceNearZ.NEGATIVE_ONE,
|
|
60
|
-
supportMRT: false
|
|
61
|
-
};
|
|
62
|
-
const reglUniforms = {};
|
|
63
|
-
this.options = options;
|
|
64
|
-
if (uniforms) {
|
|
65
|
-
this.uniforms = this.extractUniforms(uniforms);
|
|
66
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
67
|
-
reglUniforms[uniformName] = reGl.prop(uniformName);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
const reglAttributes = {};
|
|
71
|
-
Object.keys(attributes).forEach((name) => {
|
|
72
|
-
reglAttributes[name] = attributes[name].get();
|
|
73
|
-
});
|
|
74
|
-
const frag = (0, import_l7_core.removeDuplicateUniforms)(
|
|
75
|
-
(0, import_g_device_api.preprocessShader_GLSL)(vendorInfo, "frag", fs, null, false)
|
|
76
|
-
);
|
|
77
|
-
const vert = (0, import_l7_core.removeDuplicateUniforms)(
|
|
78
|
-
(0, import_g_device_api.preprocessShader_GLSL)(vendorInfo, "vert", vs, null, false)
|
|
79
|
-
);
|
|
80
|
-
const drawParams = {
|
|
81
|
-
attributes: reglAttributes,
|
|
82
|
-
frag,
|
|
83
|
-
uniforms: reglUniforms,
|
|
84
|
-
vert,
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
colorMask: reGl.prop("colorMask"),
|
|
87
|
-
lineWidth: 1,
|
|
88
|
-
blend: {
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
enable: reGl.prop("blend.enable"),
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
func: reGl.prop("blend.func"),
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
equation: reGl.prop("blend.equation"),
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
color: reGl.prop("blend.color")
|
|
97
|
-
},
|
|
98
|
-
stencil: {
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
enable: reGl.prop("stencil.enable"),
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
mask: reGl.prop("stencil.mask"),
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
func: reGl.prop("stencil.func"),
|
|
105
|
-
// @ts-ignore
|
|
106
|
-
opFront: reGl.prop("stencil.opFront"),
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
opBack: reGl.prop("stencil.opBack")
|
|
109
|
-
},
|
|
110
|
-
primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
|
|
111
|
-
};
|
|
112
|
-
if (instances) {
|
|
113
|
-
drawParams.instances = instances;
|
|
114
|
-
}
|
|
115
|
-
if (count) {
|
|
116
|
-
drawParams.count = count;
|
|
117
|
-
} else if (elements) {
|
|
118
|
-
drawParams.elements = elements.get();
|
|
119
|
-
}
|
|
120
|
-
this.initDepthDrawParams({ depth }, drawParams);
|
|
121
|
-
this.initCullDrawParams({ cull }, drawParams);
|
|
122
|
-
this.drawCommand = reGl(drawParams);
|
|
123
|
-
this.drawParams = drawParams;
|
|
124
|
-
}
|
|
125
|
-
updateAttributesAndElements(attributes, elements) {
|
|
126
|
-
const reglAttributes = {};
|
|
127
|
-
Object.keys(attributes).forEach((name) => {
|
|
128
|
-
reglAttributes[name] = attributes[name].get();
|
|
129
|
-
});
|
|
130
|
-
this.drawParams.attributes = reglAttributes;
|
|
131
|
-
this.drawParams.elements = elements.get();
|
|
132
|
-
this.drawCommand = this.reGl(this.drawParams);
|
|
133
|
-
}
|
|
134
|
-
updateAttributes(attributes) {
|
|
135
|
-
const reglAttributes = {};
|
|
136
|
-
Object.keys(attributes).forEach((name) => {
|
|
137
|
-
reglAttributes[name] = attributes[name].get();
|
|
138
|
-
});
|
|
139
|
-
this.drawParams.attributes = reglAttributes;
|
|
140
|
-
this.drawCommand = this.reGl(this.drawParams);
|
|
141
|
-
}
|
|
142
|
-
addUniforms(uniforms) {
|
|
143
|
-
this.uniforms = __spreadValues(__spreadValues({}, this.uniforms), this.extractUniforms(uniforms));
|
|
144
|
-
}
|
|
145
|
-
draw(options, pick) {
|
|
146
|
-
if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const uniforms = __spreadValues(__spreadValues({}, this.uniforms), this.extractUniforms(options.uniforms || {}));
|
|
150
|
-
const reglDrawProps = {};
|
|
151
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
152
|
-
const type = typeof uniforms[uniformName];
|
|
153
|
-
if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || // @ts-ignore
|
|
154
|
-
uniforms[uniformName].BYTES_PER_ELEMENT) {
|
|
155
|
-
reglDrawProps[uniformName] = uniforms[uniformName];
|
|
156
|
-
} else {
|
|
157
|
-
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
reglDrawProps.blend = pick ? this.getBlendDrawParams({
|
|
161
|
-
blend: { enable: false }
|
|
162
|
-
}) : this.getBlendDrawParams(options);
|
|
163
|
-
reglDrawProps.stencil = this.getStencilDrawParams(options);
|
|
164
|
-
reglDrawProps.colorMask = this.getColorMaskDrawParams(options, pick);
|
|
165
|
-
this.drawCommand(reglDrawProps);
|
|
166
|
-
}
|
|
167
|
-
destroy() {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
(_b = (_a = this.drawParams) == null ? void 0 : _a.elements) == null ? void 0 : _b.destroy();
|
|
170
|
-
if (this.options.attributes) {
|
|
171
|
-
Object.values(this.options.attributes).forEach((attr) => {
|
|
172
|
-
attr == null ? void 0 : attr.destroy();
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
this.destroyed = true;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
|
|
179
|
-
*/
|
|
180
|
-
initDepthDrawParams({ depth }, drawParams) {
|
|
181
|
-
if (depth) {
|
|
182
|
-
drawParams.depth = {
|
|
183
|
-
enable: depth.enable === void 0 ? true : !!depth.enable,
|
|
184
|
-
mask: depth.mask === void 0 ? true : !!depth.mask,
|
|
185
|
-
func: import_constants.depthFuncMap[depth.func || import_l7_core.gl.LESS],
|
|
186
|
-
range: depth.range || [0, 1]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
getBlendDrawParams({ blend }) {
|
|
191
|
-
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
192
|
-
return {
|
|
193
|
-
enable: !!enable,
|
|
194
|
-
func: {
|
|
195
|
-
srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
|
|
196
|
-
srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
|
|
197
|
-
dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
|
|
198
|
-
dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
|
|
199
|
-
},
|
|
200
|
-
equation: {
|
|
201
|
-
rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
|
|
202
|
-
alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
|
|
203
|
-
},
|
|
204
|
-
color
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
209
|
-
*/
|
|
210
|
-
getStencilDrawParams({ stencil }) {
|
|
211
|
-
const {
|
|
212
|
-
enable,
|
|
213
|
-
mask = -1,
|
|
214
|
-
func = {
|
|
215
|
-
cmp: import_l7_core.gl.ALWAYS,
|
|
216
|
-
ref: 0,
|
|
217
|
-
mask: -1
|
|
218
|
-
},
|
|
219
|
-
opFront = {
|
|
220
|
-
fail: import_l7_core.gl.KEEP,
|
|
221
|
-
zfail: import_l7_core.gl.KEEP,
|
|
222
|
-
zpass: import_l7_core.gl.KEEP
|
|
223
|
-
},
|
|
224
|
-
opBack = {
|
|
225
|
-
fail: import_l7_core.gl.KEEP,
|
|
226
|
-
zfail: import_l7_core.gl.KEEP,
|
|
227
|
-
zpass: import_l7_core.gl.KEEP
|
|
228
|
-
}
|
|
229
|
-
} = stencil || {};
|
|
230
|
-
return {
|
|
231
|
-
enable: !!enable,
|
|
232
|
-
mask,
|
|
233
|
-
func: __spreadProps(__spreadValues({}, func), {
|
|
234
|
-
cmp: import_constants.stencilFuncMap[func.cmp]
|
|
235
|
-
}),
|
|
236
|
-
opFront: {
|
|
237
|
-
fail: import_constants.stencilOpMap[opFront.fail],
|
|
238
|
-
zfail: import_constants.stencilOpMap[opFront.zfail],
|
|
239
|
-
zpass: import_constants.stencilOpMap[opFront.zpass]
|
|
240
|
-
},
|
|
241
|
-
opBack: {
|
|
242
|
-
fail: import_constants.stencilOpMap[opBack.fail],
|
|
243
|
-
zfail: import_constants.stencilOpMap[opBack.zfail],
|
|
244
|
-
zpass: import_constants.stencilOpMap[opBack.zpass]
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
getColorMaskDrawParams({ stencil }, pick) {
|
|
249
|
-
const colorMask = (stencil == null ? void 0 : stencil.enable) && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true];
|
|
250
|
-
return colorMask;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
254
|
-
*/
|
|
255
|
-
initCullDrawParams({ cull }, drawParams) {
|
|
256
|
-
if (cull) {
|
|
257
|
-
const { enable, face = import_l7_core.gl.BACK } = cull;
|
|
258
|
-
drawParams.cull = {
|
|
259
|
-
enable: !!enable,
|
|
260
|
-
face: import_constants.cullFaceMap[face]
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* 考虑结构体命名, eg:
|
|
266
|
-
* a: { b: 1 } -> 'a.b'
|
|
267
|
-
* a: [ { b: 1 } ] -> 'a[0].b'
|
|
268
|
-
*/
|
|
269
|
-
extractUniforms(uniforms) {
|
|
270
|
-
const extractedUniforms = {};
|
|
271
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
272
|
-
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
273
|
-
});
|
|
274
|
-
return extractedUniforms;
|
|
275
|
-
}
|
|
276
|
-
extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
|
|
277
|
-
if (uniformValue === null || typeof uniformValue === "number" || // u_A: 1
|
|
278
|
-
typeof uniformValue === "boolean" || // u_A: false
|
|
279
|
-
Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || // u_A: [1, 2, 3]
|
|
280
|
-
isTypedArray(uniformValue) || // u_A: Float32Array
|
|
281
|
-
// @ts-ignore
|
|
282
|
-
uniformValue === "" || "resize" in uniformValue) {
|
|
283
|
-
uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (isPlainObject(uniformValue)) {
|
|
287
|
-
Object.keys(uniformValue).forEach((childName) => {
|
|
288
|
-
this.extractUniformsRecursively(
|
|
289
|
-
childName,
|
|
290
|
-
// @ts-ignore
|
|
291
|
-
uniformValue[childName],
|
|
292
|
-
uniforms,
|
|
293
|
-
`${prefix && prefix + "."}${uniformName}`
|
|
294
|
-
);
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
if (Array.isArray(uniformValue)) {
|
|
298
|
-
uniformValue.forEach((child, idx) => {
|
|
299
|
-
Object.keys(child).forEach((childName) => {
|
|
300
|
-
this.extractUniformsRecursively(
|
|
301
|
-
childName,
|
|
302
|
-
// @ts-ignore
|
|
303
|
-
child[childName],
|
|
304
|
-
uniforms,
|
|
305
|
-
`${prefix && prefix + "."}${uniformName}[${idx}]`
|
|
306
|
-
);
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IRenderbuffer, IRenderbufferInitializationOptions } from '@antv/l7-core';
|
|
2
|
-
import type regl from 'regl';
|
|
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
|
-
}
|
|
@@ -1,44 +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/ReglRenderbuffer.ts
|
|
20
|
-
var ReglRenderbuffer_exports = {};
|
|
21
|
-
__export(ReglRenderbuffer_exports, {
|
|
22
|
-
default: () => ReglRenderbuffer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglRenderbuffer_exports);
|
|
25
|
-
var import_constants = require("./constants");
|
|
26
|
-
var ReglRenderbuffer = class {
|
|
27
|
-
constructor(reGl, options) {
|
|
28
|
-
const { width, height, format } = options;
|
|
29
|
-
this.renderbuffer = reGl.renderbuffer({
|
|
30
|
-
width,
|
|
31
|
-
height,
|
|
32
|
-
format: import_constants.formatMap[format]
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
get() {
|
|
36
|
-
return this.renderbuffer;
|
|
37
|
-
}
|
|
38
|
-
destroy() {
|
|
39
|
-
this.renderbuffer.destroy();
|
|
40
|
-
}
|
|
41
|
-
resize({ width, height }) {
|
|
42
|
-
this.renderbuffer.resize(width, height);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ITexture2D, ITexture2DInitializationOptions } 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 ReglTexture2D implements ITexture2D {
|
|
8
|
-
private texture;
|
|
9
|
-
private width;
|
|
10
|
-
private height;
|
|
11
|
-
private isDestroy;
|
|
12
|
-
constructor(reGl: regl.Regl, options: ITexture2DInitializationOptions);
|
|
13
|
-
get(): regl.Texture2D;
|
|
14
|
-
update(props?: regl.Texture2DOptions): void;
|
|
15
|
-
bind(): void;
|
|
16
|
-
resize({ width, height }: {
|
|
17
|
-
width: number;
|
|
18
|
-
height: number;
|
|
19
|
-
}): void;
|
|
20
|
-
getSize(): [number, number];
|
|
21
|
-
destroy(): void;
|
|
22
|
-
}
|
|
@@ -1,107 +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/ReglTexture2D.ts
|
|
20
|
-
var ReglTexture2D_exports = {};
|
|
21
|
-
__export(ReglTexture2D_exports, {
|
|
22
|
-
default: () => ReglTexture2D
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglTexture2D_exports);
|
|
25
|
-
var import_l7_core = require("@antv/l7-core");
|
|
26
|
-
var import_constants = require("./constants");
|
|
27
|
-
var ReglTexture2D = class {
|
|
28
|
-
constructor(reGl, options) {
|
|
29
|
-
this.isDestroy = false;
|
|
30
|
-
const {
|
|
31
|
-
data,
|
|
32
|
-
type = import_l7_core.gl.UNSIGNED_BYTE,
|
|
33
|
-
width,
|
|
34
|
-
height,
|
|
35
|
-
flipY = false,
|
|
36
|
-
format = import_l7_core.gl.RGBA,
|
|
37
|
-
mipmap = false,
|
|
38
|
-
wrapS = import_l7_core.gl.CLAMP_TO_EDGE,
|
|
39
|
-
wrapT = import_l7_core.gl.CLAMP_TO_EDGE,
|
|
40
|
-
aniso = 0,
|
|
41
|
-
alignment = 1,
|
|
42
|
-
premultiplyAlpha = false,
|
|
43
|
-
mag = import_l7_core.gl.NEAREST,
|
|
44
|
-
min = import_l7_core.gl.NEAREST,
|
|
45
|
-
colorSpace = import_l7_core.gl.BROWSER_DEFAULT_WEBGL,
|
|
46
|
-
x = 0,
|
|
47
|
-
y = 0,
|
|
48
|
-
copy = false
|
|
49
|
-
} = options;
|
|
50
|
-
this.width = width;
|
|
51
|
-
this.height = height;
|
|
52
|
-
const textureOptions = {
|
|
53
|
-
width,
|
|
54
|
-
height,
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
type: import_constants.dataTypeMap[type],
|
|
57
|
-
format: import_constants.formatMap[format],
|
|
58
|
-
wrapS: import_constants.wrapModeMap[wrapS],
|
|
59
|
-
wrapT: import_constants.wrapModeMap[wrapT],
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
mag: import_constants.filterMap[mag],
|
|
62
|
-
min: import_constants.filterMap[min],
|
|
63
|
-
alignment,
|
|
64
|
-
flipY,
|
|
65
|
-
colorSpace: import_constants.colorSpaceMap[colorSpace],
|
|
66
|
-
premultiplyAlpha,
|
|
67
|
-
aniso,
|
|
68
|
-
// copy pixels from current bind framebuffer
|
|
69
|
-
x,
|
|
70
|
-
y,
|
|
71
|
-
copy
|
|
72
|
-
};
|
|
73
|
-
if (data) {
|
|
74
|
-
textureOptions.data = data;
|
|
75
|
-
}
|
|
76
|
-
if (typeof mipmap === "number") {
|
|
77
|
-
textureOptions.mipmap = import_constants.mipmapMap[mipmap];
|
|
78
|
-
} else if (typeof mipmap === "boolean") {
|
|
79
|
-
textureOptions.mipmap = mipmap;
|
|
80
|
-
}
|
|
81
|
-
this.texture = reGl.texture(textureOptions);
|
|
82
|
-
}
|
|
83
|
-
get() {
|
|
84
|
-
return this.texture;
|
|
85
|
-
}
|
|
86
|
-
update(props = {}) {
|
|
87
|
-
this.texture(props);
|
|
88
|
-
}
|
|
89
|
-
bind() {
|
|
90
|
-
this.texture._texture.bind();
|
|
91
|
-
}
|
|
92
|
-
resize({ width, height }) {
|
|
93
|
-
this.texture.resize(width, height);
|
|
94
|
-
this.width = width;
|
|
95
|
-
this.height = height;
|
|
96
|
-
}
|
|
97
|
-
getSize() {
|
|
98
|
-
return [this.width, this.height];
|
|
99
|
-
}
|
|
100
|
-
destroy() {
|
|
101
|
-
var _a;
|
|
102
|
-
if (!this.isDestroy) {
|
|
103
|
-
(_a = this.texture) == null ? void 0 : _a.destroy();
|
|
104
|
-
}
|
|
105
|
-
this.isDestroy = true;
|
|
106
|
-
}
|
|
107
|
-
};
|