@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.
- package/es/index.d.ts +5 -0
- package/es/index.js +5 -0
- package/es/regl/ReglAttribute.d.ts +16 -0
- package/es/regl/ReglAttribute.js +51 -0
- package/es/regl/ReglBuffer.d.ts +16 -0
- package/es/regl/ReglBuffer.js +47 -0
- package/es/regl/ReglElements.d.ts +14 -0
- package/es/regl/ReglElements.js +45 -0
- package/es/regl/ReglFramebuffer.d.ts +16 -0
- package/es/regl/ReglFramebuffer.js +59 -0
- package/es/regl/ReglModel.d.ts +49 -0
- package/es/regl/ReglModel.js +362 -0
- package/es/regl/ReglRenderbuffer.d.ts +16 -0
- package/es/regl/ReglRenderbuffer.js +45 -0
- package/es/regl/ReglTexture2D.d.ts +21 -0
- package/es/regl/ReglTexture2D.js +130 -0
- package/es/regl/constants.d.ts +43 -0
- package/es/regl/constants.js +23 -0
- package/es/regl/index.d.ts +51 -0
- package/es/regl/index.js +313 -0
- package/lib/index.js +32 -0
- package/lib/regl/ReglAttribute.js +51 -0
- package/lib/regl/ReglBuffer.js +50 -0
- package/lib/regl/ReglElements.js +49 -0
- package/lib/regl/ReglFramebuffer.js +51 -0
- package/lib/regl/ReglModel.js +269 -0
- package/lib/regl/ReglRenderbuffer.js +46 -0
- package/lib/regl/ReglTexture2D.js +103 -0
- package/lib/regl/constants.js +170 -0
- package/lib/regl/index.js +225 -0
- package/package.json +5 -5
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
const { data, usage, type } = options;
|
|
30
|
+
this.buffer = reGl.buffer({
|
|
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
|
+
});
|
|
35
|
+
}
|
|
36
|
+
get() {
|
|
37
|
+
return this.buffer;
|
|
38
|
+
}
|
|
39
|
+
destroy() {
|
|
40
|
+
this.buffer.destroy();
|
|
41
|
+
}
|
|
42
|
+
subData({
|
|
43
|
+
data,
|
|
44
|
+
offset
|
|
45
|
+
}) {
|
|
46
|
+
this.buffer.subdata(data, offset);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,51 @@
|
|
|
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, depth, stencil } = options;
|
|
28
|
+
const framebufferOptions = {
|
|
29
|
+
width,
|
|
30
|
+
height
|
|
31
|
+
};
|
|
32
|
+
if (Array.isArray(colors)) {
|
|
33
|
+
framebufferOptions.colors = colors.map((c) => c.get());
|
|
34
|
+
}
|
|
35
|
+
if (color && typeof color !== "boolean") {
|
|
36
|
+
framebufferOptions.color = color.get();
|
|
37
|
+
}
|
|
38
|
+
this.framebuffer = reGl.framebuffer(framebufferOptions);
|
|
39
|
+
}
|
|
40
|
+
get() {
|
|
41
|
+
return this.framebuffer;
|
|
42
|
+
}
|
|
43
|
+
destroy() {
|
|
44
|
+
this.framebuffer.destroy();
|
|
45
|
+
}
|
|
46
|
+
resize({ width, height }) {
|
|
47
|
+
this.framebuffer.resize(width, height);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,269 @@
|
|
|
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/ReglModel.ts
|
|
20
|
+
var ReglModel_exports = {};
|
|
21
|
+
__export(ReglModel_exports, {
|
|
22
|
+
default: () => ReglModel
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ReglModel_exports);
|
|
25
|
+
var import_l7_core = require("@antv/l7-core");
|
|
26
|
+
var import_lodash = require("lodash");
|
|
27
|
+
var import_constants = require("./constants");
|
|
28
|
+
var ReglModel = class {
|
|
29
|
+
constructor(reGl, options) {
|
|
30
|
+
this.destroyed = false;
|
|
31
|
+
this.uniforms = {};
|
|
32
|
+
this.reGl = reGl;
|
|
33
|
+
const {
|
|
34
|
+
pick = true,
|
|
35
|
+
vs,
|
|
36
|
+
fs,
|
|
37
|
+
attributes,
|
|
38
|
+
uniforms,
|
|
39
|
+
primitive,
|
|
40
|
+
count,
|
|
41
|
+
elements,
|
|
42
|
+
depth,
|
|
43
|
+
blend,
|
|
44
|
+
stencil,
|
|
45
|
+
cull,
|
|
46
|
+
instances
|
|
47
|
+
} = options;
|
|
48
|
+
const reglUniforms = {};
|
|
49
|
+
this.options = options;
|
|
50
|
+
if (uniforms) {
|
|
51
|
+
this.uniforms = this.extractUniforms(uniforms);
|
|
52
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
53
|
+
reglUniforms[uniformName] = reGl.prop(uniformName);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const reglAttributes = {};
|
|
57
|
+
Object.keys(attributes).forEach((name) => {
|
|
58
|
+
reglAttributes[name] = attributes[name].get();
|
|
59
|
+
});
|
|
60
|
+
const drawParams = {
|
|
61
|
+
attributes: reglAttributes,
|
|
62
|
+
frag: fs,
|
|
63
|
+
uniforms: reglUniforms,
|
|
64
|
+
vert: vs,
|
|
65
|
+
blend: {},
|
|
66
|
+
primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
|
|
67
|
+
};
|
|
68
|
+
if (instances) {
|
|
69
|
+
drawParams.instances = instances;
|
|
70
|
+
}
|
|
71
|
+
if (count) {
|
|
72
|
+
drawParams.count = count;
|
|
73
|
+
} else if (elements) {
|
|
74
|
+
drawParams.elements = elements.get();
|
|
75
|
+
}
|
|
76
|
+
this.initDepthDrawParams({ depth }, drawParams);
|
|
77
|
+
this.initBlendDrawParams({ blend }, drawParams);
|
|
78
|
+
this.initStencilDrawParams({ stencil }, drawParams);
|
|
79
|
+
this.initCullDrawParams({ cull }, drawParams);
|
|
80
|
+
this.drawCommand = reGl(drawParams);
|
|
81
|
+
if (pick) {
|
|
82
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(drawParams);
|
|
83
|
+
pickDrawParams.blend = {
|
|
84
|
+
...pickDrawParams.blend,
|
|
85
|
+
enable: false
|
|
86
|
+
};
|
|
87
|
+
this.drawPickCommand = reGl(pickDrawParams);
|
|
88
|
+
}
|
|
89
|
+
this.drawParams = drawParams;
|
|
90
|
+
}
|
|
91
|
+
updateAttributesAndElements(attributes, elements) {
|
|
92
|
+
const reglAttributes = {};
|
|
93
|
+
Object.keys(attributes).forEach((name) => {
|
|
94
|
+
reglAttributes[name] = attributes[name].get();
|
|
95
|
+
});
|
|
96
|
+
this.drawParams.attributes = reglAttributes;
|
|
97
|
+
this.drawParams.elements = elements.get();
|
|
98
|
+
this.drawCommand = this.reGl(this.drawParams);
|
|
99
|
+
if (this.options.pick) {
|
|
100
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
|
|
101
|
+
pickDrawParams.blend = {
|
|
102
|
+
...pickDrawParams.blend,
|
|
103
|
+
enable: false
|
|
104
|
+
};
|
|
105
|
+
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
updateAttributes(attributes) {
|
|
109
|
+
const reglAttributes = {};
|
|
110
|
+
Object.keys(attributes).forEach((name) => {
|
|
111
|
+
reglAttributes[name] = attributes[name].get();
|
|
112
|
+
});
|
|
113
|
+
this.drawParams.attributes = reglAttributes;
|
|
114
|
+
this.drawCommand = this.reGl(this.drawParams);
|
|
115
|
+
if (this.options.pick) {
|
|
116
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
|
|
117
|
+
pickDrawParams.blend = {
|
|
118
|
+
...pickDrawParams.blend,
|
|
119
|
+
enable: false
|
|
120
|
+
};
|
|
121
|
+
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
addUniforms(uniforms) {
|
|
125
|
+
this.uniforms = {
|
|
126
|
+
...this.uniforms,
|
|
127
|
+
...this.extractUniforms(uniforms)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
draw(options, pick) {
|
|
131
|
+
if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const uniforms = {
|
|
135
|
+
...this.uniforms,
|
|
136
|
+
...this.extractUniforms(options.uniforms || {})
|
|
137
|
+
};
|
|
138
|
+
const reglDrawProps = {};
|
|
139
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
140
|
+
const type = typeof uniforms[uniformName];
|
|
141
|
+
if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
|
|
142
|
+
reglDrawProps[uniformName] = uniforms[uniformName];
|
|
143
|
+
} else {
|
|
144
|
+
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
if (!pick) {
|
|
148
|
+
this.drawCommand(reglDrawProps);
|
|
149
|
+
} else {
|
|
150
|
+
this.drawPickCommand && this.drawPickCommand(reglDrawProps);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
destroy() {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
(_b = (_a = this.drawParams) == null ? void 0 : _a.elements) == null ? void 0 : _b.destroy();
|
|
156
|
+
if (this.options.attributes) {
|
|
157
|
+
Object.values(this.options.attributes).forEach((attr) => {
|
|
158
|
+
attr == null ? void 0 : attr.destroy();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
this.destroyed = true;
|
|
162
|
+
}
|
|
163
|
+
initDepthDrawParams({ depth }, drawParams) {
|
|
164
|
+
if (depth) {
|
|
165
|
+
drawParams.depth = {
|
|
166
|
+
enable: depth.enable === void 0 ? true : !!depth.enable,
|
|
167
|
+
mask: depth.mask === void 0 ? true : !!depth.mask,
|
|
168
|
+
func: import_constants.depthFuncMap[depth.func || import_l7_core.gl.LESS],
|
|
169
|
+
range: depth.range || [0, 1]
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
initBlendDrawParams({ blend }, drawParams) {
|
|
174
|
+
if (blend) {
|
|
175
|
+
const { enable, func, equation, color = [0, 0, 0, 0] } = blend;
|
|
176
|
+
drawParams.blend = {
|
|
177
|
+
enable: !!enable,
|
|
178
|
+
func: {
|
|
179
|
+
srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
|
|
180
|
+
srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
|
|
181
|
+
dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
|
|
182
|
+
dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
|
|
183
|
+
},
|
|
184
|
+
equation: {
|
|
185
|
+
rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
|
|
186
|
+
alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
|
|
187
|
+
},
|
|
188
|
+
color
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
initStencilDrawParams({ stencil }, drawParams) {
|
|
193
|
+
if (stencil) {
|
|
194
|
+
const {
|
|
195
|
+
enable,
|
|
196
|
+
mask = -1,
|
|
197
|
+
func = {
|
|
198
|
+
cmp: import_l7_core.gl.ALWAYS,
|
|
199
|
+
ref: 0,
|
|
200
|
+
mask: -1
|
|
201
|
+
},
|
|
202
|
+
opFront = {
|
|
203
|
+
fail: import_l7_core.gl.KEEP,
|
|
204
|
+
zfail: import_l7_core.gl.KEEP,
|
|
205
|
+
zpass: import_l7_core.gl.KEEP
|
|
206
|
+
},
|
|
207
|
+
opBack = {
|
|
208
|
+
fail: import_l7_core.gl.KEEP,
|
|
209
|
+
zfail: import_l7_core.gl.KEEP,
|
|
210
|
+
zpass: import_l7_core.gl.KEEP
|
|
211
|
+
}
|
|
212
|
+
} = stencil;
|
|
213
|
+
drawParams.stencil = {
|
|
214
|
+
enable: !!enable,
|
|
215
|
+
mask,
|
|
216
|
+
func: {
|
|
217
|
+
...func,
|
|
218
|
+
cmp: import_constants.stencilFuncMap[func.cmp]
|
|
219
|
+
},
|
|
220
|
+
opFront: {
|
|
221
|
+
fail: import_constants.stencilOpMap[opFront.fail],
|
|
222
|
+
zfail: import_constants.stencilOpMap[opFront.zfail],
|
|
223
|
+
zpass: import_constants.stencilOpMap[opFront.zpass]
|
|
224
|
+
},
|
|
225
|
+
opBack: {
|
|
226
|
+
fail: import_constants.stencilOpMap[opBack.fail],
|
|
227
|
+
zfail: import_constants.stencilOpMap[opBack.zfail],
|
|
228
|
+
zpass: import_constants.stencilOpMap[opBack.zpass]
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
initCullDrawParams({ cull }, drawParams) {
|
|
234
|
+
if (cull) {
|
|
235
|
+
const { enable, face = import_l7_core.gl.BACK } = cull;
|
|
236
|
+
drawParams.cull = {
|
|
237
|
+
enable: !!enable,
|
|
238
|
+
face: import_constants.cullFaceMap[face]
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
extractUniforms(uniforms) {
|
|
243
|
+
const extractedUniforms = {};
|
|
244
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
245
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
246
|
+
});
|
|
247
|
+
return extractedUniforms;
|
|
248
|
+
}
|
|
249
|
+
extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
|
|
250
|
+
if (uniformValue === null || typeof uniformValue === "number" || typeof uniformValue === "boolean" || Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || (0, import_lodash.isTypedArray)(uniformValue) || uniformValue === "" || "resize" in uniformValue) {
|
|
251
|
+
uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if ((0, import_lodash.isPlainObject)(uniformValue)) {
|
|
255
|
+
Object.keys(uniformValue).forEach((childName) => {
|
|
256
|
+
this.extractUniformsRecursively(childName, uniformValue[childName], uniforms, `${prefix && prefix + "."}${uniformName}`);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (Array.isArray(uniformValue)) {
|
|
260
|
+
uniformValue.forEach((child, idx) => {
|
|
261
|
+
Object.keys(child).forEach((childName) => {
|
|
262
|
+
this.extractUniformsRecursively(childName, child[childName], uniforms, `${prefix && prefix + "."}${uniformName}[${idx}]`);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
269
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,103 @@
|
|
|
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.isDistroy = 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
|
+
type: import_constants.dataTypeMap[type],
|
|
56
|
+
format: import_constants.formatMap[format],
|
|
57
|
+
wrapS: import_constants.wrapModeMap[wrapS],
|
|
58
|
+
wrapT: import_constants.wrapModeMap[wrapT],
|
|
59
|
+
mag: import_constants.filterMap[mag],
|
|
60
|
+
min: import_constants.filterMap[min],
|
|
61
|
+
alignment,
|
|
62
|
+
flipY,
|
|
63
|
+
colorSpace: import_constants.colorSpaceMap[colorSpace],
|
|
64
|
+
premultiplyAlpha,
|
|
65
|
+
aniso,
|
|
66
|
+
x,
|
|
67
|
+
y,
|
|
68
|
+
copy
|
|
69
|
+
};
|
|
70
|
+
if (data) {
|
|
71
|
+
textureOptions.data = data;
|
|
72
|
+
}
|
|
73
|
+
if (typeof mipmap === "number") {
|
|
74
|
+
textureOptions.mipmap = import_constants.mipmapMap[mipmap];
|
|
75
|
+
} else if (typeof mipmap === "boolean") {
|
|
76
|
+
textureOptions.mipmap = mipmap;
|
|
77
|
+
}
|
|
78
|
+
this.texture = reGl.texture(textureOptions);
|
|
79
|
+
}
|
|
80
|
+
get() {
|
|
81
|
+
return this.texture;
|
|
82
|
+
}
|
|
83
|
+
update(props = {}) {
|
|
84
|
+
this.texture(props);
|
|
85
|
+
}
|
|
86
|
+
bind() {
|
|
87
|
+
this.texture._texture.bind();
|
|
88
|
+
}
|
|
89
|
+
resize({ width, height }) {
|
|
90
|
+
this.texture.resize(width, height);
|
|
91
|
+
this.width = width;
|
|
92
|
+
this.height = height;
|
|
93
|
+
}
|
|
94
|
+
destroy() {
|
|
95
|
+
var _a;
|
|
96
|
+
if (!this.isDistroy) {
|
|
97
|
+
(_a = this.texture) == null ? void 0 : _a.destroy();
|
|
98
|
+
}
|
|
99
|
+
this.isDistroy = true;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {});
|