@antv/l7-renderer 2.14.0 → 2.14.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/es/regl/ReglModel.d.ts +3 -6
- package/es/regl/ReglModel.js +122 -121
- package/lib/regl/ReglModel.js +82 -95
- package/package.json +5 -5
package/es/regl/ReglModel.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export default class ReglModel implements IModel {
|
|
|
7
7
|
private reGl;
|
|
8
8
|
private destroyed;
|
|
9
9
|
private drawCommand;
|
|
10
|
-
private drawPickCommand;
|
|
11
10
|
private drawParams;
|
|
12
11
|
private options;
|
|
13
12
|
private uniforms;
|
|
@@ -27,14 +26,12 @@ export default class ReglModel implements IModel {
|
|
|
27
26
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
|
|
28
27
|
*/
|
|
29
28
|
private initDepthDrawParams;
|
|
30
|
-
|
|
31
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending
|
|
32
|
-
*/
|
|
33
|
-
private initBlendDrawParams;
|
|
29
|
+
private getBlendDrawParams;
|
|
34
30
|
/**
|
|
35
31
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
36
32
|
*/
|
|
37
|
-
private
|
|
33
|
+
private getStencilDrawParams;
|
|
34
|
+
private getColorMaskDrawParams;
|
|
38
35
|
/**
|
|
39
36
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
40
37
|
*/
|
package/es/regl/ReglModel.js
CHANGED
|
@@ -4,7 +4,7 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import { gl } from '@antv/l7-core';
|
|
7
|
-
import {
|
|
7
|
+
import { isPlainObject, isTypedArray } from 'lodash';
|
|
8
8
|
import { blendEquationMap, blendFuncMap, cullFaceMap, depthFuncMap, primitiveMap, stencilFuncMap, stencilOpMap } from "./constants";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -19,9 +19,7 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
19
19
|
_defineProperty(this, "uniforms", {});
|
|
20
20
|
|
|
21
21
|
this.reGl = reGl;
|
|
22
|
-
var
|
|
23
|
-
pick = _options$pick === void 0 ? true : _options$pick,
|
|
24
|
-
vs = options.vs,
|
|
22
|
+
var vs = options.vs,
|
|
25
23
|
fs = options.fs,
|
|
26
24
|
attributes = options.attributes,
|
|
27
25
|
uniforms = options.uniforms,
|
|
@@ -29,8 +27,6 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
29
27
|
count = options.count,
|
|
30
28
|
elements = options.elements,
|
|
31
29
|
depth = options.depth,
|
|
32
|
-
blend = options.blend,
|
|
33
|
-
stencil = options.stencil,
|
|
34
30
|
cull = options.cull,
|
|
35
31
|
instances = options.instances;
|
|
36
32
|
var reglUniforms = {};
|
|
@@ -54,7 +50,30 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
54
50
|
frag: fs,
|
|
55
51
|
uniforms: reglUniforms,
|
|
56
52
|
vert: vs,
|
|
57
|
-
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
colorMask: reGl.prop('colorMask'),
|
|
55
|
+
blend: {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
enable: reGl.prop('blend.enable'),
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
func: reGl.prop('blend.func'),
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
equation: reGl.prop('blend.equation'),
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
color: reGl.prop('blend.color')
|
|
64
|
+
},
|
|
65
|
+
stencil: {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
enable: reGl.prop('stencil.enable'),
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
mask: reGl.prop('stencil.mask'),
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
func: reGl.prop('stencil.func'),
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
opFront: reGl.prop('stencil.opFront'),
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
opBack: reGl.prop('stencil.opBack')
|
|
76
|
+
},
|
|
58
77
|
primitive: primitiveMap[primitive === undefined ? gl.TRIANGLES : primitive]
|
|
59
78
|
};
|
|
60
79
|
|
|
@@ -73,26 +92,13 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
73
92
|
|
|
74
93
|
this.initDepthDrawParams({
|
|
75
94
|
depth: depth
|
|
76
|
-
}, drawParams);
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
}, drawParams);
|
|
80
|
-
this.initStencilDrawParams({
|
|
81
|
-
stencil: stencil
|
|
82
|
-
}, drawParams);
|
|
95
|
+
}, drawParams); // this.initBlendDrawParams({ blend }, drawParams);
|
|
96
|
+
// this.initStencilDrawParams({ stencil }, drawParams);
|
|
97
|
+
|
|
83
98
|
this.initCullDrawParams({
|
|
84
99
|
cull: cull
|
|
85
100
|
}, drawParams);
|
|
86
101
|
this.drawCommand = reGl(drawParams);
|
|
87
|
-
|
|
88
|
-
if (pick) {
|
|
89
|
-
var pickDrawParams = cloneDeep(drawParams);
|
|
90
|
-
pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
|
|
91
|
-
enable: false
|
|
92
|
-
});
|
|
93
|
-
this.drawPickCommand = reGl(pickDrawParams);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
102
|
this.drawParams = drawParams;
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -106,14 +112,6 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
106
112
|
this.drawParams.attributes = reglAttributes;
|
|
107
113
|
this.drawParams.elements = elements.get();
|
|
108
114
|
this.drawCommand = this.reGl(this.drawParams);
|
|
109
|
-
|
|
110
|
-
if (this.options.pick) {
|
|
111
|
-
var pickDrawParams = cloneDeep(this.drawParams);
|
|
112
|
-
pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
|
|
113
|
-
enable: false
|
|
114
|
-
});
|
|
115
|
-
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
116
|
-
}
|
|
117
115
|
}
|
|
118
116
|
}, {
|
|
119
117
|
key: "updateAttributes",
|
|
@@ -124,14 +122,6 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
124
122
|
});
|
|
125
123
|
this.drawParams.attributes = reglAttributes;
|
|
126
124
|
this.drawCommand = this.reGl(this.drawParams);
|
|
127
|
-
|
|
128
|
-
if (this.options.pick) {
|
|
129
|
-
var pickDrawParams = cloneDeep(this.drawParams);
|
|
130
|
-
pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
|
|
131
|
-
enable: false
|
|
132
|
-
});
|
|
133
|
-
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
134
|
-
}
|
|
135
125
|
}
|
|
136
126
|
}, {
|
|
137
127
|
key: "addUniforms",
|
|
@@ -158,17 +148,22 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
158
148
|
} else {
|
|
159
149
|
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
160
150
|
}
|
|
161
|
-
}); //
|
|
151
|
+
}); // 更新 blend
|
|
152
|
+
// @ts-ignore
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.drawPickCommand(reglDrawProps);
|
|
154
|
+
reglDrawProps.blend = pick // picking 操作不应该使用 blend
|
|
155
|
+
? this.getBlendDrawParams({
|
|
156
|
+
blend: {
|
|
157
|
+
enable: false
|
|
168
158
|
}
|
|
169
|
-
}
|
|
170
|
-
//
|
|
159
|
+
}) : this.getBlendDrawParams(options); // 更新stentil 配置
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
|
|
162
|
+
reglDrawProps.stencil = this.getStencilDrawParams(options); // @ts-ignore
|
|
163
|
+
|
|
164
|
+
reglDrawProps.colorMask = this.getColorMaskDrawParams(options, pick); // 在进行拾取操作的绘制中,不应该使用叠加模式 - picking 根据拾取的颜色作为判断的输入,而叠加模式会产生新的,在 id 序列中不存在的颜色
|
|
171
165
|
|
|
166
|
+
this.drawCommand(reglDrawProps);
|
|
172
167
|
}
|
|
173
168
|
}, {
|
|
174
169
|
key: "destroy",
|
|
@@ -205,87 +200,93 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
205
200
|
};
|
|
206
201
|
}
|
|
207
202
|
}
|
|
208
|
-
/**
|
|
209
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
203
|
}, {
|
|
213
|
-
key: "
|
|
214
|
-
value: function
|
|
204
|
+
key: "getBlendDrawParams",
|
|
205
|
+
value: function getBlendDrawParams(_ref2) {
|
|
215
206
|
var blend = _ref2.blend;
|
|
216
207
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
208
|
+
var _ref3 = blend || {},
|
|
209
|
+
enable = _ref3.enable,
|
|
210
|
+
func = _ref3.func,
|
|
211
|
+
equation = _ref3.equation,
|
|
212
|
+
_ref3$color = _ref3.color,
|
|
213
|
+
color = _ref3$color === void 0 ? [0, 0, 0, 0] : _ref3$color; // @ts-ignore
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
enable: !!enable,
|
|
218
|
+
func: {
|
|
219
|
+
srcRGB: blendFuncMap[func && func.srcRGB || gl.SRC_ALPHA],
|
|
220
|
+
srcAlpha: blendFuncMap[func && func.srcAlpha || gl.SRC_ALPHA],
|
|
221
|
+
dstRGB: blendFuncMap[func && func.dstRGB || gl.ONE_MINUS_SRC_ALPHA],
|
|
222
|
+
dstAlpha: blendFuncMap[func && func.dstAlpha || gl.ONE_MINUS_SRC_ALPHA]
|
|
223
|
+
},
|
|
224
|
+
equation: {
|
|
225
|
+
rgb: blendEquationMap[equation && equation.rgb || gl.FUNC_ADD],
|
|
226
|
+
alpha: blendEquationMap[equation && equation.alpha || gl.FUNC_ADD]
|
|
227
|
+
},
|
|
228
|
+
color: color
|
|
229
|
+
};
|
|
239
230
|
}
|
|
240
231
|
/**
|
|
241
232
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
242
233
|
*/
|
|
243
234
|
|
|
244
235
|
}, {
|
|
245
|
-
key: "
|
|
246
|
-
value: function
|
|
247
|
-
var stencil =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
}
|
|
236
|
+
key: "getStencilDrawParams",
|
|
237
|
+
value: function getStencilDrawParams(_ref4) {
|
|
238
|
+
var stencil = _ref4.stencil;
|
|
239
|
+
|
|
240
|
+
var _ref5 = stencil || {},
|
|
241
|
+
enable = _ref5.enable,
|
|
242
|
+
_ref5$mask = _ref5.mask,
|
|
243
|
+
mask = _ref5$mask === void 0 ? -1 : _ref5$mask,
|
|
244
|
+
_ref5$func = _ref5.func,
|
|
245
|
+
func = _ref5$func === void 0 ? {
|
|
246
|
+
cmp: gl.ALWAYS,
|
|
247
|
+
ref: 0,
|
|
248
|
+
mask: -1
|
|
249
|
+
} : _ref5$func,
|
|
250
|
+
_ref5$opFront = _ref5.opFront,
|
|
251
|
+
opFront = _ref5$opFront === void 0 ? {
|
|
252
|
+
fail: gl.KEEP,
|
|
253
|
+
zfail: gl.KEEP,
|
|
254
|
+
zpass: gl.KEEP
|
|
255
|
+
} : _ref5$opFront,
|
|
256
|
+
_ref5$opBack = _ref5.opBack,
|
|
257
|
+
opBack = _ref5$opBack === void 0 ? {
|
|
258
|
+
fail: gl.KEEP,
|
|
259
|
+
zfail: gl.KEEP,
|
|
260
|
+
zpass: gl.KEEP
|
|
261
|
+
} : _ref5$opBack;
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
enable: !!enable,
|
|
265
|
+
mask: mask,
|
|
266
|
+
func: _objectSpread(_objectSpread({}, func), {}, {
|
|
267
|
+
cmp: stencilFuncMap[func.cmp]
|
|
268
|
+
}),
|
|
269
|
+
opFront: {
|
|
270
|
+
fail: stencilOpMap[opFront.fail],
|
|
271
|
+
zfail: stencilOpMap[opFront.zfail],
|
|
272
|
+
zpass: stencilOpMap[opFront.zpass]
|
|
273
|
+
},
|
|
274
|
+
opBack: {
|
|
275
|
+
fail: stencilOpMap[opBack.fail],
|
|
276
|
+
zfail: stencilOpMap[opBack.zfail],
|
|
277
|
+
zpass: stencilOpMap[opBack.zpass]
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}, {
|
|
282
|
+
key: "getColorMaskDrawParams",
|
|
283
|
+
value: function getColorMaskDrawParams(_ref6, pick) {
|
|
284
|
+
var stencil = _ref6.stencil;
|
|
285
|
+
// TODO: 重构相关参数
|
|
286
|
+
// 掩膜模式下,颜色通道全部关闭
|
|
287
|
+
var colorMask = stencil !== null && stencil !== void 0 && stencil.enable && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true]; // 非掩码模式下,颜色通道全部开启
|
|
288
|
+
|
|
289
|
+
return colorMask;
|
|
289
290
|
}
|
|
290
291
|
/**
|
|
291
292
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
@@ -293,8 +294,8 @@ var ReglModel = /*#__PURE__*/function () {
|
|
|
293
294
|
|
|
294
295
|
}, {
|
|
295
296
|
key: "initCullDrawParams",
|
|
296
|
-
value: function initCullDrawParams(
|
|
297
|
-
var cull =
|
|
297
|
+
value: function initCullDrawParams(_ref7, drawParams) {
|
|
298
|
+
var cull = _ref7.cull;
|
|
298
299
|
|
|
299
300
|
if (cull) {
|
|
300
301
|
var enable = cull.enable,
|
package/lib/regl/ReglModel.js
CHANGED
|
@@ -31,7 +31,6 @@ var ReglModel = class {
|
|
|
31
31
|
this.uniforms = {};
|
|
32
32
|
this.reGl = reGl;
|
|
33
33
|
const {
|
|
34
|
-
pick = true,
|
|
35
34
|
vs,
|
|
36
35
|
fs,
|
|
37
36
|
attributes,
|
|
@@ -40,8 +39,6 @@ var ReglModel = class {
|
|
|
40
39
|
count,
|
|
41
40
|
elements,
|
|
42
41
|
depth,
|
|
43
|
-
blend,
|
|
44
|
-
stencil,
|
|
45
42
|
cull,
|
|
46
43
|
instances
|
|
47
44
|
} = options;
|
|
@@ -62,7 +59,20 @@ var ReglModel = class {
|
|
|
62
59
|
frag: fs,
|
|
63
60
|
uniforms: reglUniforms,
|
|
64
61
|
vert: vs,
|
|
65
|
-
|
|
62
|
+
colorMask: reGl.prop("colorMask"),
|
|
63
|
+
blend: {
|
|
64
|
+
enable: reGl.prop("blend.enable"),
|
|
65
|
+
func: reGl.prop("blend.func"),
|
|
66
|
+
equation: reGl.prop("blend.equation"),
|
|
67
|
+
color: reGl.prop("blend.color")
|
|
68
|
+
},
|
|
69
|
+
stencil: {
|
|
70
|
+
enable: reGl.prop("stencil.enable"),
|
|
71
|
+
mask: reGl.prop("stencil.mask"),
|
|
72
|
+
func: reGl.prop("stencil.func"),
|
|
73
|
+
opFront: reGl.prop("stencil.opFront"),
|
|
74
|
+
opBack: reGl.prop("stencil.opBack")
|
|
75
|
+
},
|
|
66
76
|
primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
|
|
67
77
|
};
|
|
68
78
|
if (instances) {
|
|
@@ -74,18 +84,8 @@ var ReglModel = class {
|
|
|
74
84
|
drawParams.elements = elements.get();
|
|
75
85
|
}
|
|
76
86
|
this.initDepthDrawParams({ depth }, drawParams);
|
|
77
|
-
this.initBlendDrawParams({ blend }, drawParams);
|
|
78
|
-
this.initStencilDrawParams({ stencil }, drawParams);
|
|
79
87
|
this.initCullDrawParams({ cull }, drawParams);
|
|
80
88
|
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
89
|
this.drawParams = drawParams;
|
|
90
90
|
}
|
|
91
91
|
updateAttributesAndElements(attributes, elements) {
|
|
@@ -96,14 +96,6 @@ var ReglModel = class {
|
|
|
96
96
|
this.drawParams.attributes = reglAttributes;
|
|
97
97
|
this.drawParams.elements = elements.get();
|
|
98
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
99
|
}
|
|
108
100
|
updateAttributes(attributes) {
|
|
109
101
|
const reglAttributes = {};
|
|
@@ -112,14 +104,6 @@ var ReglModel = class {
|
|
|
112
104
|
});
|
|
113
105
|
this.drawParams.attributes = reglAttributes;
|
|
114
106
|
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
107
|
}
|
|
124
108
|
addUniforms(uniforms) {
|
|
125
109
|
this.uniforms = {
|
|
@@ -144,13 +128,12 @@ var ReglModel = class {
|
|
|
144
128
|
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
145
129
|
}
|
|
146
130
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
131
|
+
reglDrawProps.blend = pick ? this.getBlendDrawParams({
|
|
132
|
+
blend: { enable: false }
|
|
133
|
+
}) : this.getBlendDrawParams(options);
|
|
134
|
+
reglDrawProps.stencil = this.getStencilDrawParams(options);
|
|
135
|
+
reglDrawProps.colorMask = this.getColorMaskDrawParams(options, pick);
|
|
136
|
+
this.drawCommand(reglDrawProps);
|
|
154
137
|
}
|
|
155
138
|
destroy() {
|
|
156
139
|
var _a, _b;
|
|
@@ -172,65 +155,69 @@ var ReglModel = class {
|
|
|
172
155
|
};
|
|
173
156
|
}
|
|
174
157
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
158
|
+
getBlendDrawParams({
|
|
159
|
+
blend
|
|
160
|
+
}) {
|
|
161
|
+
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
162
|
+
return {
|
|
163
|
+
enable: !!enable,
|
|
164
|
+
func: {
|
|
165
|
+
srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
|
|
166
|
+
srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
|
|
167
|
+
dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
|
|
168
|
+
dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
|
|
169
|
+
},
|
|
170
|
+
equation: {
|
|
171
|
+
rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
|
|
172
|
+
alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
|
|
173
|
+
},
|
|
174
|
+
color
|
|
175
|
+
};
|
|
193
176
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
}
|
|
177
|
+
getStencilDrawParams({
|
|
178
|
+
stencil
|
|
179
|
+
}) {
|
|
180
|
+
const {
|
|
181
|
+
enable,
|
|
182
|
+
mask = -1,
|
|
183
|
+
func = {
|
|
184
|
+
cmp: import_l7_core.gl.ALWAYS,
|
|
185
|
+
ref: 0,
|
|
186
|
+
mask: -1
|
|
187
|
+
},
|
|
188
|
+
opFront = {
|
|
189
|
+
fail: import_l7_core.gl.KEEP,
|
|
190
|
+
zfail: import_l7_core.gl.KEEP,
|
|
191
|
+
zpass: import_l7_core.gl.KEEP
|
|
192
|
+
},
|
|
193
|
+
opBack = {
|
|
194
|
+
fail: import_l7_core.gl.KEEP,
|
|
195
|
+
zfail: import_l7_core.gl.KEEP,
|
|
196
|
+
zpass: import_l7_core.gl.KEEP
|
|
197
|
+
}
|
|
198
|
+
} = stencil || {};
|
|
199
|
+
return {
|
|
200
|
+
enable: !!enable,
|
|
201
|
+
mask,
|
|
202
|
+
func: {
|
|
203
|
+
...func,
|
|
204
|
+
cmp: import_constants.stencilFuncMap[func.cmp]
|
|
205
|
+
},
|
|
206
|
+
opFront: {
|
|
207
|
+
fail: import_constants.stencilOpMap[opFront.fail],
|
|
208
|
+
zfail: import_constants.stencilOpMap[opFront.zfail],
|
|
209
|
+
zpass: import_constants.stencilOpMap[opFront.zpass]
|
|
210
|
+
},
|
|
211
|
+
opBack: {
|
|
212
|
+
fail: import_constants.stencilOpMap[opBack.fail],
|
|
213
|
+
zfail: import_constants.stencilOpMap[opBack.zfail],
|
|
214
|
+
zpass: import_constants.stencilOpMap[opBack.zpass]
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
getColorMaskDrawParams({ stencil }, pick) {
|
|
219
|
+
const colorMask = (stencil == null ? void 0 : stencil.enable) && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true];
|
|
220
|
+
return colorMask;
|
|
234
221
|
}
|
|
235
222
|
initCullDrawParams({ cull }, drawParams) {
|
|
236
223
|
if (cull) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-renderer",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"author": "xiaoiver",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@antv/l7-test-utils": "2.14.
|
|
28
|
+
"@antv/l7-test-utils": "2.14.2",
|
|
29
29
|
"gl": "^5.0.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@antv/l7-core": "2.14.
|
|
33
|
-
"@antv/l7-utils": "2.14.
|
|
32
|
+
"@antv/l7-core": "2.14.2",
|
|
33
|
+
"@antv/l7-utils": "2.14.2",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"inversify": "^5.0.1",
|
|
36
36
|
"l7regl": "^0.0.20",
|
|
37
37
|
"lodash": "^4.17.15",
|
|
38
38
|
"reflect-metadata": "^0.1.13"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "21cf191b577dbd06836ff20ebf545870f1b6b281",
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
}
|