@antv/l7-renderer 2.17.12 → 2.18.2
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/package.json +7 -8
- package/es/index.d.ts +0 -5
- package/es/index.js +0 -5
- package/es/regl/ReglAttribute.d.ts +0 -16
- package/es/regl/ReglAttribute.js +0 -45
- package/es/regl/ReglBuffer.d.ts +0 -17
- package/es/regl/ReglBuffer.js +0 -48
- package/es/regl/ReglElements.d.ts +0 -14
- package/es/regl/ReglElements.js +0 -42
- package/es/regl/ReglFramebuffer.d.ts +0 -16
- package/es/regl/ReglFramebuffer.js +0 -51
- package/es/regl/ReglModel.d.ts +0 -46
- package/es/regl/ReglModel.js +0 -347
- package/es/regl/ReglRenderbuffer.d.ts +0 -16
- package/es/regl/ReglRenderbuffer.js +0 -41
- package/es/regl/ReglTexture2D.d.ts +0 -22
- package/es/regl/ReglTexture2D.js +0 -125
- package/es/regl/constants.d.ts +0 -43
- package/es/regl/constants.js +0 -21
- package/es/regl/index.d.ts +0 -51
- package/es/regl/index.js +0 -276
- package/lib/index.js +0 -39
- package/lib/regl/ReglAttribute.js +0 -49
- package/lib/regl/ReglBuffer.js +0 -53
- package/lib/regl/ReglElements.js +0 -47
- package/lib/regl/ReglFramebuffer.js +0 -51
- package/lib/regl/ReglModel.js +0 -304
- package/lib/regl/ReglRenderbuffer.js +0 -44
- package/lib/regl/ReglTexture2D.js +0 -107
- package/lib/regl/constants.js +0 -170
- package/lib/regl/index.js +0 -237
package/lib/regl/ReglModel.js
DELETED
|
@@ -1,304 +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/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
|
-
vs,
|
|
35
|
-
fs,
|
|
36
|
-
attributes,
|
|
37
|
-
uniforms,
|
|
38
|
-
primitive,
|
|
39
|
-
count,
|
|
40
|
-
elements,
|
|
41
|
-
depth,
|
|
42
|
-
cull,
|
|
43
|
-
instances
|
|
44
|
-
} = options;
|
|
45
|
-
const reglUniforms = {};
|
|
46
|
-
this.options = options;
|
|
47
|
-
if (uniforms) {
|
|
48
|
-
this.uniforms = this.extractUniforms(uniforms);
|
|
49
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
50
|
-
reglUniforms[uniformName] = reGl.prop(uniformName);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const reglAttributes = {};
|
|
54
|
-
Object.keys(attributes).forEach((name) => {
|
|
55
|
-
reglAttributes[name] = attributes[name].get();
|
|
56
|
-
});
|
|
57
|
-
const drawParams = {
|
|
58
|
-
attributes: reglAttributes,
|
|
59
|
-
frag: fs,
|
|
60
|
-
uniforms: reglUniforms,
|
|
61
|
-
vert: vs,
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
colorMask: reGl.prop("colorMask"),
|
|
64
|
-
lineWidth: 1,
|
|
65
|
-
blend: {
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
enable: reGl.prop("blend.enable"),
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
func: reGl.prop("blend.func"),
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
equation: reGl.prop("blend.equation"),
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
color: reGl.prop("blend.color")
|
|
74
|
-
},
|
|
75
|
-
stencil: {
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
enable: reGl.prop("stencil.enable"),
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
mask: reGl.prop("stencil.mask"),
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
func: reGl.prop("stencil.func"),
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
opFront: reGl.prop("stencil.opFront"),
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
opBack: reGl.prop("stencil.opBack")
|
|
86
|
-
},
|
|
87
|
-
primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
|
|
88
|
-
};
|
|
89
|
-
if (instances) {
|
|
90
|
-
drawParams.instances = instances;
|
|
91
|
-
}
|
|
92
|
-
if (count) {
|
|
93
|
-
drawParams.count = count;
|
|
94
|
-
} else if (elements) {
|
|
95
|
-
drawParams.elements = elements.get();
|
|
96
|
-
}
|
|
97
|
-
this.initDepthDrawParams({ depth }, drawParams);
|
|
98
|
-
this.initCullDrawParams({ cull }, drawParams);
|
|
99
|
-
this.drawCommand = reGl(drawParams);
|
|
100
|
-
this.drawParams = drawParams;
|
|
101
|
-
}
|
|
102
|
-
updateAttributesAndElements(attributes, elements) {
|
|
103
|
-
const reglAttributes = {};
|
|
104
|
-
Object.keys(attributes).forEach((name) => {
|
|
105
|
-
reglAttributes[name] = attributes[name].get();
|
|
106
|
-
});
|
|
107
|
-
this.drawParams.attributes = reglAttributes;
|
|
108
|
-
this.drawParams.elements = elements.get();
|
|
109
|
-
this.drawCommand = this.reGl(this.drawParams);
|
|
110
|
-
}
|
|
111
|
-
updateAttributes(attributes) {
|
|
112
|
-
const reglAttributes = {};
|
|
113
|
-
Object.keys(attributes).forEach((name) => {
|
|
114
|
-
reglAttributes[name] = attributes[name].get();
|
|
115
|
-
});
|
|
116
|
-
this.drawParams.attributes = reglAttributes;
|
|
117
|
-
this.drawCommand = this.reGl(this.drawParams);
|
|
118
|
-
}
|
|
119
|
-
addUniforms(uniforms) {
|
|
120
|
-
this.uniforms = {
|
|
121
|
-
...this.uniforms,
|
|
122
|
-
...this.extractUniforms(uniforms)
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
draw(options, pick) {
|
|
126
|
-
if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const uniforms = {
|
|
130
|
-
...this.uniforms,
|
|
131
|
-
...this.extractUniforms(options.uniforms || {})
|
|
132
|
-
};
|
|
133
|
-
const reglDrawProps = {};
|
|
134
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
135
|
-
const type = typeof uniforms[uniformName];
|
|
136
|
-
if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || // @ts-ignore
|
|
137
|
-
uniforms[uniformName].BYTES_PER_ELEMENT) {
|
|
138
|
-
reglDrawProps[uniformName] = uniforms[uniformName];
|
|
139
|
-
} else {
|
|
140
|
-
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
reglDrawProps.blend = pick ? this.getBlendDrawParams({
|
|
144
|
-
blend: { enable: false }
|
|
145
|
-
}) : this.getBlendDrawParams(options);
|
|
146
|
-
reglDrawProps.stencil = this.getStencilDrawParams(options);
|
|
147
|
-
reglDrawProps.colorMask = this.getColorMaskDrawParams(options, pick);
|
|
148
|
-
this.drawCommand(reglDrawProps);
|
|
149
|
-
}
|
|
150
|
-
destroy() {
|
|
151
|
-
var _a, _b;
|
|
152
|
-
(_b = (_a = this.drawParams) == null ? void 0 : _a.elements) == null ? void 0 : _b.destroy();
|
|
153
|
-
if (this.options.attributes) {
|
|
154
|
-
Object.values(this.options.attributes).forEach((attr) => {
|
|
155
|
-
attr == null ? void 0 : attr.destroy();
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
this.destroyed = true;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
|
|
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
|
-
getBlendDrawParams({
|
|
174
|
-
blend
|
|
175
|
-
}) {
|
|
176
|
-
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
177
|
-
return {
|
|
178
|
-
enable: !!enable,
|
|
179
|
-
func: {
|
|
180
|
-
srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
|
|
181
|
-
srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
|
|
182
|
-
dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
|
|
183
|
-
dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
|
|
184
|
-
},
|
|
185
|
-
equation: {
|
|
186
|
-
rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
|
|
187
|
-
alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
|
|
188
|
-
},
|
|
189
|
-
color
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
194
|
-
*/
|
|
195
|
-
getStencilDrawParams({
|
|
196
|
-
stencil
|
|
197
|
-
}) {
|
|
198
|
-
const {
|
|
199
|
-
enable,
|
|
200
|
-
mask = -1,
|
|
201
|
-
func = {
|
|
202
|
-
cmp: import_l7_core.gl.ALWAYS,
|
|
203
|
-
ref: 0,
|
|
204
|
-
mask: -1
|
|
205
|
-
},
|
|
206
|
-
opFront = {
|
|
207
|
-
fail: import_l7_core.gl.KEEP,
|
|
208
|
-
zfail: import_l7_core.gl.KEEP,
|
|
209
|
-
zpass: import_l7_core.gl.KEEP
|
|
210
|
-
},
|
|
211
|
-
opBack = {
|
|
212
|
-
fail: import_l7_core.gl.KEEP,
|
|
213
|
-
zfail: import_l7_core.gl.KEEP,
|
|
214
|
-
zpass: import_l7_core.gl.KEEP
|
|
215
|
-
}
|
|
216
|
-
} = stencil || {};
|
|
217
|
-
return {
|
|
218
|
-
enable: !!enable,
|
|
219
|
-
mask,
|
|
220
|
-
func: {
|
|
221
|
-
...func,
|
|
222
|
-
cmp: import_constants.stencilFuncMap[func.cmp]
|
|
223
|
-
},
|
|
224
|
-
opFront: {
|
|
225
|
-
fail: import_constants.stencilOpMap[opFront.fail],
|
|
226
|
-
zfail: import_constants.stencilOpMap[opFront.zfail],
|
|
227
|
-
zpass: import_constants.stencilOpMap[opFront.zpass]
|
|
228
|
-
},
|
|
229
|
-
opBack: {
|
|
230
|
-
fail: import_constants.stencilOpMap[opBack.fail],
|
|
231
|
-
zfail: import_constants.stencilOpMap[opBack.zfail],
|
|
232
|
-
zpass: import_constants.stencilOpMap[opBack.zpass]
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
getColorMaskDrawParams({ stencil }, pick) {
|
|
237
|
-
const colorMask = (stencil == null ? void 0 : stencil.enable) && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true];
|
|
238
|
-
return colorMask;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
242
|
-
*/
|
|
243
|
-
initCullDrawParams({ cull }, drawParams) {
|
|
244
|
-
if (cull) {
|
|
245
|
-
const { enable, face = import_l7_core.gl.BACK } = cull;
|
|
246
|
-
drawParams.cull = {
|
|
247
|
-
enable: !!enable,
|
|
248
|
-
face: import_constants.cullFaceMap[face]
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* 考虑结构体命名, eg:
|
|
254
|
-
* a: { b: 1 } -> 'a.b'
|
|
255
|
-
* a: [ { b: 1 } ] -> 'a[0].b'
|
|
256
|
-
*/
|
|
257
|
-
extractUniforms(uniforms) {
|
|
258
|
-
const extractedUniforms = {};
|
|
259
|
-
Object.keys(uniforms).forEach((uniformName) => {
|
|
260
|
-
this.extractUniformsRecursively(
|
|
261
|
-
uniformName,
|
|
262
|
-
uniforms[uniformName],
|
|
263
|
-
extractedUniforms,
|
|
264
|
-
""
|
|
265
|
-
);
|
|
266
|
-
});
|
|
267
|
-
return extractedUniforms;
|
|
268
|
-
}
|
|
269
|
-
extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
|
|
270
|
-
if (uniformValue === null || typeof uniformValue === "number" || // u_A: 1
|
|
271
|
-
typeof uniformValue === "boolean" || // u_A: false
|
|
272
|
-
Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || // u_A: [1, 2, 3]
|
|
273
|
-
(0, import_lodash.isTypedArray)(uniformValue) || // u_A: Float32Array
|
|
274
|
-
// @ts-ignore
|
|
275
|
-
uniformValue === "" || "resize" in uniformValue) {
|
|
276
|
-
uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if ((0, import_lodash.isPlainObject)(uniformValue)) {
|
|
280
|
-
Object.keys(uniformValue).forEach((childName) => {
|
|
281
|
-
this.extractUniformsRecursively(
|
|
282
|
-
childName,
|
|
283
|
-
// @ts-ignore
|
|
284
|
-
uniformValue[childName],
|
|
285
|
-
uniforms,
|
|
286
|
-
`${prefix && prefix + "."}${uniformName}`
|
|
287
|
-
);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
if (Array.isArray(uniformValue)) {
|
|
291
|
-
uniformValue.forEach((child, idx) => {
|
|
292
|
-
Object.keys(child).forEach((childName) => {
|
|
293
|
-
this.extractUniformsRecursively(
|
|
294
|
-
childName,
|
|
295
|
-
// @ts-ignore
|
|
296
|
-
child[childName],
|
|
297
|
-
uniforms,
|
|
298
|
-
`${prefix && prefix + "."}${uniformName}[${idx}]`
|
|
299
|
-
);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
@@ -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,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
|
-
};
|
package/lib/regl/constants.js
DELETED
|
@@ -1,170 +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/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
|
-
});
|