@antv/l7-renderer 2.20.6 → 2.20.9

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.
@@ -35,6 +35,10 @@ export default class DeviceModel implements IModel {
35
35
  destroy(): void;
36
36
  private initDepthDrawParams;
37
37
  private getBlendDrawParams;
38
+ /**
39
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
40
+ */
41
+ private getStencilDrawParams;
38
42
  /**
39
43
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
40
44
  */
@@ -2,12 +2,12 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
- import { BlendFactor, BlendMode, ChannelWriteMask, CompareFunction, CullMode, Format, TransparentBlack, VertexStepMode } from '@antv/g-device-api';
5
+ import { BlendFactor, BlendMode, ChannelWriteMask, CompareFunction, CullMode, Format, StencilOp, TransparentBlack, VertexStepMode } from '@antv/g-device-api';
6
6
  import { gl } from '@antv/l7-core';
7
7
  import { lodashUtil } from '@antv/l7-utils';
8
8
  import DeviceFramebuffer from "./DeviceFramebuffer";
9
9
  import DeviceTexture2D from "./DeviceTexture2D";
10
- import { blendEquationMap, blendFuncMap, cullFaceMap, depthFuncMap, primitiveMap, sizeFormatMap } from "./constants";
10
+ import { blendEquationMap, blendFuncMap, cullFaceMap, depthFuncMap, primitiveMap, sizeFormatMap, stencilFuncMap, stencilOpMap } from "./constants";
11
11
  var isPlainObject = lodashUtil.isPlainObject,
12
12
  isTypedArray = lodashUtil.isTypedArray;
13
13
  var DeviceModel = /*#__PURE__*/function () {
@@ -93,7 +93,8 @@ var DeviceModel = /*#__PURE__*/function () {
93
93
  primitive = _options$primitive === void 0 ? gl.TRIANGLES : _options$primitive,
94
94
  depth = options.depth,
95
95
  cull = options.cull,
96
- blend = options.blend;
96
+ blend = options.blend,
97
+ stencil = options.stencil;
97
98
  var depthParams = this.initDepthDrawParams({
98
99
  depth: depth
99
100
  });
@@ -107,6 +108,10 @@ var DeviceModel = /*#__PURE__*/function () {
107
108
  blend: blend
108
109
  });
109
110
  var blendEnabled = !!(blendParams && blendParams.enable);
111
+ var stencilParams = this.getStencilDrawParams({
112
+ stencil: stencil
113
+ });
114
+ var stencilEnabled = !!(stencilParams && stencilParams.enable);
110
115
  return this.device.createRenderPipeline({
111
116
  inputLayout: this.inputLayout,
112
117
  program: this.program,
@@ -127,7 +132,7 @@ var DeviceModel = /*#__PURE__*/function () {
127
132
  blendDstFactor: BlendFactor.ZERO
128
133
  }
129
134
  } : {
130
- channelWriteMask: ChannelWriteMask.ALL,
135
+ channelWriteMask: stencilEnabled && stencilParams.opFront.zpass === StencilOp.REPLACE ? ChannelWriteMask.NONE : ChannelWriteMask.ALL,
131
136
  rgbBlendState: {
132
137
  blendMode: blendEnabled && blendParams.equation.rgb || BlendMode.ADD,
133
138
  blendSrcFactor: blendEnabled && blendParams.func.srcRGB || BlendFactor.SRC_ALPHA,
@@ -143,7 +148,15 @@ var DeviceModel = /*#__PURE__*/function () {
143
148
  depthWrite: depthEnabled,
144
149
  depthCompare: depthEnabled && depthParams.func || CompareFunction.LESS,
145
150
  cullMode: cullEnabled && cullParams.face || CullMode.NONE,
146
- stencilWrite: false
151
+ stencilWrite: stencilEnabled,
152
+ stencilFront: {
153
+ compare: stencilEnabled ? stencilParams.func.cmp : CompareFunction.ALWAYS,
154
+ passOp: stencilParams.opFront.zpass
155
+ },
156
+ stencilBack: {
157
+ compare: stencilEnabled ? stencilParams.func.cmp : CompareFunction.ALWAYS,
158
+ passOp: stencilParams.opBack.zpass
159
+ }
147
160
  }
148
161
  });
149
162
  }
@@ -175,10 +188,7 @@ var DeviceModel = /*#__PURE__*/function () {
175
188
  value: function draw(options, pick) {
176
189
  var _this2 = this;
177
190
  var mergedOptions = _objectSpread(_objectSpread({}, this.options), options);
178
- var _mergedOptions$depth = mergedOptions.depth,
179
- _mergedOptions$depth2 = _mergedOptions$depth === void 0 ? {} : _mergedOptions$depth,
180
- depthEnabled = _mergedOptions$depth2.enable,
181
- _mergedOptions$count = mergedOptions.count,
191
+ var _mergedOptions$count = mergedOptions.count,
182
192
  count = _mergedOptions$count === void 0 ? 0 : _mergedOptions$count,
183
193
  instances = mergedOptions.instances,
184
194
  elements = mergedOptions.elements,
@@ -197,6 +207,7 @@ var DeviceModel = /*#__PURE__*/function () {
197
207
  this.pipeline = this.createPipeline(mergedOptions, pick);
198
208
  renderPass.setViewport(0, 0, (currentFramebuffer === null || currentFramebuffer === void 0 ? void 0 : currentFramebuffer['width']) || width, (currentFramebuffer === null || currentFramebuffer === void 0 ? void 0 : currentFramebuffer['height']) || height);
199
209
  renderPass.setPipeline(this.pipeline);
210
+ renderPass.setStencilReference(1);
200
211
  renderPass.setVertexInput(this.inputLayout, this.vertexBuffers.map(function (buffer) {
201
212
  return {
202
213
  buffer: buffer
@@ -303,71 +314,61 @@ var DeviceModel = /*#__PURE__*/function () {
303
314
  };
304
315
  }
305
316
 
306
- // /**
307
- // * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
308
- // */
309
- // private getStencilDrawParams({
310
- // stencil,
311
- // }: Pick<IModelInitializationOptions, 'stencil'>) {
312
- // const {
313
- // enable,
314
- // mask = -1,
315
- // func = {
316
- // cmp: gl.ALWAYS,
317
- // ref: 0,
318
- // mask: -1,
319
- // },
320
- // opFront = {
321
- // fail: gl.KEEP,
322
- // zfail: gl.KEEP,
323
- // zpass: gl.KEEP,
324
- // },
325
- // opBack = {
326
- // fail: gl.KEEP,
327
- // zfail: gl.KEEP,
328
- // zpass: gl.KEEP,
329
- // },
330
- // } = stencil || {};
331
- // return {
332
- // enable: !!enable,
333
- // mask,
334
- // func: {
335
- // ...func,
336
- // cmp: stencilFuncMap[func.cmp],
337
- // },
338
- // opFront: {
339
- // fail: stencilOpMap[opFront.fail],
340
- // zfail: stencilOpMap[opFront.zfail],
341
- // zpass: stencilOpMap[opFront.zpass],
342
- // },
343
- // opBack: {
344
- // fail: stencilOpMap[opBack.fail],
345
- // zfail: stencilOpMap[opBack.zfail],
346
- // zpass: stencilOpMap[opBack.zpass],
347
- // },
348
- // };
349
- // }
350
-
351
- // private getColorMaskDrawParams(
352
- // { stencil }: Pick<IModelInitializationOptions, 'stencil'>,
353
- // pick: boolean,
354
- // ) {
355
- // // TODO: 重构相关参数
356
- // // 掩膜模式下,颜色通道全部关闭
357
- // const colorMask =
358
- // stencil?.enable && stencil.opFront && !pick
359
- // ? [false, false, false, false]
360
- // : [true, true, true, true]; // 非掩码模式下,颜色通道全部开启
361
- // return colorMask;
362
- // }
317
+ /**
318
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
319
+ */
320
+ }, {
321
+ key: "getStencilDrawParams",
322
+ value: function getStencilDrawParams(_ref4) {
323
+ var stencil = _ref4.stencil;
324
+ var _ref5 = stencil || {},
325
+ enable = _ref5.enable,
326
+ _ref5$mask = _ref5.mask,
327
+ mask = _ref5$mask === void 0 ? -1 : _ref5$mask,
328
+ _ref5$func = _ref5.func,
329
+ func = _ref5$func === void 0 ? {
330
+ cmp: gl.ALWAYS,
331
+ ref: 0,
332
+ mask: -1
333
+ } : _ref5$func,
334
+ _ref5$opFront = _ref5.opFront,
335
+ opFront = _ref5$opFront === void 0 ? {
336
+ fail: gl.KEEP,
337
+ zfail: gl.KEEP,
338
+ zpass: gl.KEEP
339
+ } : _ref5$opFront,
340
+ _ref5$opBack = _ref5.opBack,
341
+ opBack = _ref5$opBack === void 0 ? {
342
+ fail: gl.KEEP,
343
+ zfail: gl.KEEP,
344
+ zpass: gl.KEEP
345
+ } : _ref5$opBack;
346
+ return {
347
+ enable: !!enable,
348
+ mask: mask,
349
+ func: _objectSpread(_objectSpread({}, func), {}, {
350
+ cmp: stencilFuncMap[func.cmp]
351
+ }),
352
+ opFront: {
353
+ fail: stencilOpMap[opFront.fail],
354
+ zfail: stencilOpMap[opFront.zfail],
355
+ zpass: stencilOpMap[opFront.zpass]
356
+ },
357
+ opBack: {
358
+ fail: stencilOpMap[opBack.fail],
359
+ zfail: stencilOpMap[opBack.zfail],
360
+ zpass: stencilOpMap[opBack.zpass]
361
+ }
362
+ };
363
+ }
363
364
 
364
365
  /**
365
366
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
366
367
  */
367
368
  }, {
368
369
  key: "initCullDrawParams",
369
- value: function initCullDrawParams(_ref4) {
370
- var cull = _ref4.cull;
370
+ value: function initCullDrawParams(_ref6) {
371
+ var cull = _ref6.cull;
371
372
  if (cull) {
372
373
  var enable = cull.enable,
373
374
  _cull$face = cull.face,
@@ -1,4 +1,4 @@
1
- import { AddressMode, BlendFactor, BlendMode, BufferFrequencyHint, CompareFunction, CullMode, Format, PrimitiveTopology } from '@antv/g-device-api';
1
+ import { AddressMode, BlendFactor, BlendMode, BufferFrequencyHint, CompareFunction, CullMode, Format, PrimitiveTopology, StencilOp } from '@antv/g-device-api';
2
2
  import type { TypedArray } from './utils/typedarray';
3
3
  export declare const typedArrayCtorMap: {
4
4
  [key: string]: new (data: number[]) => TypedArray;
@@ -27,3 +27,9 @@ export declare const blendEquationMap: {
27
27
  export declare const blendFuncMap: {
28
28
  [key: string]: BlendFactor;
29
29
  };
30
+ export declare const stencilOpMap: {
31
+ [key: string]: StencilOp;
32
+ };
33
+ export declare const stencilFuncMap: {
34
+ [key: string]: CompareFunction;
35
+ };
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- var _typedArrayCtorMap, _primitiveMap, _sizeFormatMap, _hintMap, _wrapModeMap, _depthFuncMap, _cullFaceMap, _blendEquationMap, _blendFuncMap;
3
- import { AddressMode, BlendFactor, BlendMode, BufferFrequencyHint, CompareFunction, CullMode, Format, PrimitiveTopology } from '@antv/g-device-api';
2
+ var _typedArrayCtorMap, _primitiveMap, _sizeFormatMap, _hintMap, _wrapModeMap, _depthFuncMap, _cullFaceMap, _blendEquationMap, _blendFuncMap, _stencilOpMap, _stencilFuncMap;
3
+ import { AddressMode, BlendFactor, BlendMode, BufferFrequencyHint, CompareFunction, CullMode, Format, PrimitiveTopology, StencilOp } from '@antv/g-device-api';
4
4
  import { gl } from '@antv/l7-core';
5
5
  export var typedArrayCtorMap = (_typedArrayCtorMap = {}, _defineProperty(_typedArrayCtorMap, gl.FLOAT, Float32Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_BYTE, Uint8Array), _defineProperty(_typedArrayCtorMap, gl.SHORT, Int16Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_SHORT, Uint16Array), _defineProperty(_typedArrayCtorMap, gl.INT, Int32Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_INT, Uint32Array), _typedArrayCtorMap);
6
6
  export var primitiveMap = (_primitiveMap = {}, _defineProperty(_primitiveMap, gl.POINTS, PrimitiveTopology.POINTS), _defineProperty(_primitiveMap, gl.LINES, PrimitiveTopology.LINES), _defineProperty(_primitiveMap, gl.LINE_LOOP, PrimitiveTopology.LINES), _defineProperty(_primitiveMap, gl.LINE_STRIP, PrimitiveTopology.LINE_STRIP), _defineProperty(_primitiveMap, gl.TRIANGLES, PrimitiveTopology.TRIANGLES), _defineProperty(_primitiveMap, gl.TRIANGLE_FAN, PrimitiveTopology.TRIANGLES), _defineProperty(_primitiveMap, gl.TRIANGLE_STRIP, PrimitiveTopology.TRIANGLE_STRIP), _primitiveMap);
@@ -11,6 +11,8 @@ export var depthFuncMap = (_depthFuncMap = {}, _defineProperty(_depthFuncMap, gl
11
11
  export var cullFaceMap = (_cullFaceMap = {}, _defineProperty(_cullFaceMap, gl.FRONT, CullMode.FRONT), _defineProperty(_cullFaceMap, gl.BACK, CullMode.BACK), _cullFaceMap);
12
12
  export var blendEquationMap = (_blendEquationMap = {}, _defineProperty(_blendEquationMap, gl.FUNC_ADD, BlendMode.ADD), _defineProperty(_blendEquationMap, gl.MIN_EXT, BlendMode.MIN), _defineProperty(_blendEquationMap, gl.MAX_EXT, BlendMode.MAX), _defineProperty(_blendEquationMap, gl.FUNC_SUBTRACT, BlendMode.SUBSTRACT), _defineProperty(_blendEquationMap, gl.FUNC_REVERSE_SUBTRACT, BlendMode.REVERSE_SUBSTRACT), _blendEquationMap);
13
13
  export var blendFuncMap = (_blendFuncMap = {}, _defineProperty(_blendFuncMap, gl.ZERO, BlendFactor.ZERO), _defineProperty(_blendFuncMap, gl.ONE, BlendFactor.ONE), _defineProperty(_blendFuncMap, gl.SRC_COLOR, BlendFactor.SRC), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_COLOR, BlendFactor.ONE_MINUS_SRC), _defineProperty(_blendFuncMap, gl.SRC_ALPHA, BlendFactor.SRC_ALPHA), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA), _defineProperty(_blendFuncMap, gl.DST_COLOR, BlendFactor.DST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_COLOR, BlendFactor.ONE_MINUS_DST), _defineProperty(_blendFuncMap, gl.DST_ALPHA, BlendFactor.DST_ALPHA), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_ALPHA, BlendFactor.ONE_MINUS_DST_ALPHA), _defineProperty(_blendFuncMap, gl.CONSTANT_COLOR, BlendFactor.CONST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_COLOR, BlendFactor.ONE_MINUS_CONSTANT), _defineProperty(_blendFuncMap, gl.CONSTANT_ALPHA, BlendFactor.CONST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_ALPHA, BlendFactor.ONE_MINUS_CONSTANT), _defineProperty(_blendFuncMap, gl.SRC_ALPHA_SATURATE, BlendFactor.SRC_ALPHA_SATURATE), _blendFuncMap);
14
+ export var stencilOpMap = (_stencilOpMap = {}, _defineProperty(_stencilOpMap, gl.REPLACE, StencilOp.REPLACE), _defineProperty(_stencilOpMap, gl.KEEP, StencilOp.KEEP), _defineProperty(_stencilOpMap, gl.ZERO, StencilOp.ZERO), _defineProperty(_stencilOpMap, gl.INVERT, StencilOp.INVERT), _defineProperty(_stencilOpMap, gl.INCR, StencilOp.INCREMENT_CLAMP), _defineProperty(_stencilOpMap, gl.DECR, StencilOp.DECREMENT_CLAMP), _defineProperty(_stencilOpMap, gl.INCR_WRAP, StencilOp.INCREMENT_WRAP), _defineProperty(_stencilOpMap, gl.DECR_WRAP, StencilOp.DECREMENT_WRAP), _stencilOpMap);
15
+ export var stencilFuncMap = (_stencilFuncMap = {}, _defineProperty(_stencilFuncMap, gl.ALWAYS, CompareFunction.ALWAYS), _defineProperty(_stencilFuncMap, gl.EQUAL, CompareFunction.EQUAL), _defineProperty(_stencilFuncMap, gl.GEQUAL, CompareFunction.GEQUAL), _defineProperty(_stencilFuncMap, gl.GREATER, CompareFunction.GREATER), _defineProperty(_stencilFuncMap, gl.LEQUAL, CompareFunction.LEQUAL), _defineProperty(_stencilFuncMap, gl.LESS, CompareFunction.LESS), _defineProperty(_stencilFuncMap, gl.NEVER, CompareFunction.NEVER), _defineProperty(_stencilFuncMap, gl.NOTEQUAL, CompareFunction.NOTEQUAL), _stencilFuncMap);
14
16
 
15
17
  // export const filterMap: {
16
18
  // [key: string]: FilterMode;
@@ -105,13 +105,15 @@ var DeviceModel = class {
105
105
  this.pipeline = this.createPipeline(options);
106
106
  }
107
107
  createPipeline(options, pick) {
108
- const { primitive = import_l7_core.gl.TRIANGLES, depth, cull, blend } = options;
108
+ const { primitive = import_l7_core.gl.TRIANGLES, depth, cull, blend, stencil } = options;
109
109
  const depthParams = this.initDepthDrawParams({ depth });
110
110
  const depthEnabled = !!(depthParams && depthParams.enable);
111
111
  const cullParams = this.initCullDrawParams({ cull });
112
112
  const cullEnabled = !!(cullParams && cullParams.enable);
113
113
  const blendParams = this.getBlendDrawParams({ blend });
114
114
  const blendEnabled = !!(blendParams && blendParams.enable);
115
+ const stencilParams = this.getStencilDrawParams({ stencil });
116
+ const stencilEnabled = !!(stencilParams && stencilParams.enable);
115
117
  return this.device.createRenderPipeline({
116
118
  inputLayout: this.inputLayout,
117
119
  program: this.program,
@@ -133,7 +135,7 @@ var DeviceModel = class {
133
135
  blendDstFactor: import_g_device_api.BlendFactor.ZERO
134
136
  }
135
137
  } : {
136
- channelWriteMask: import_g_device_api.ChannelWriteMask.ALL,
138
+ channelWriteMask: stencilEnabled && stencilParams.opFront.zpass === import_g_device_api.StencilOp.REPLACE ? import_g_device_api.ChannelWriteMask.NONE : import_g_device_api.ChannelWriteMask.ALL,
137
139
  rgbBlendState: {
138
140
  blendMode: blendEnabled && blendParams.equation.rgb || import_g_device_api.BlendMode.ADD,
139
141
  blendSrcFactor: blendEnabled && blendParams.func.srcRGB || import_g_device_api.BlendFactor.SRC_ALPHA,
@@ -150,7 +152,15 @@ var DeviceModel = class {
150
152
  depthWrite: depthEnabled,
151
153
  depthCompare: depthEnabled && depthParams.func || import_g_device_api.CompareFunction.LESS,
152
154
  cullMode: cullEnabled && cullParams.face || import_g_device_api.CullMode.NONE,
153
- stencilWrite: false
155
+ stencilWrite: stencilEnabled,
156
+ stencilFront: {
157
+ compare: stencilEnabled ? stencilParams.func.cmp : import_g_device_api.CompareFunction.ALWAYS,
158
+ passOp: stencilParams.opFront.zpass
159
+ },
160
+ stencilBack: {
161
+ compare: stencilEnabled ? stencilParams.func.cmp : import_g_device_api.CompareFunction.ALWAYS,
162
+ passOp: stencilParams.opBack.zpass
163
+ }
154
164
  }
155
165
  });
156
166
  }
@@ -181,7 +191,6 @@ var DeviceModel = class {
181
191
  ...options
182
192
  };
183
193
  const {
184
- depth: { enable: depthEnabled } = {},
185
194
  count = 0,
186
195
  instances,
187
196
  elements,
@@ -202,6 +211,7 @@ var DeviceModel = class {
202
211
  (currentFramebuffer == null ? void 0 : currentFramebuffer["height"]) || height
203
212
  );
204
213
  renderPass.setPipeline(this.pipeline);
214
+ renderPass.setStencilReference(1);
205
215
  renderPass.setVertexInput(
206
216
  this.inputLayout,
207
217
  this.vertexBuffers.map((buffer) => ({
@@ -293,62 +303,50 @@ var DeviceModel = class {
293
303
  color
294
304
  };
295
305
  }
296
- // /**
297
- // * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
298
- // */
299
- // private getStencilDrawParams({
300
- // stencil,
301
- // }: Pick<IModelInitializationOptions, 'stencil'>) {
302
- // const {
303
- // enable,
304
- // mask = -1,
305
- // func = {
306
- // cmp: gl.ALWAYS,
307
- // ref: 0,
308
- // mask: -1,
309
- // },
310
- // opFront = {
311
- // fail: gl.KEEP,
312
- // zfail: gl.KEEP,
313
- // zpass: gl.KEEP,
314
- // },
315
- // opBack = {
316
- // fail: gl.KEEP,
317
- // zfail: gl.KEEP,
318
- // zpass: gl.KEEP,
319
- // },
320
- // } = stencil || {};
321
- // return {
322
- // enable: !!enable,
323
- // mask,
324
- // func: {
325
- // ...func,
326
- // cmp: stencilFuncMap[func.cmp],
327
- // },
328
- // opFront: {
329
- // fail: stencilOpMap[opFront.fail],
330
- // zfail: stencilOpMap[opFront.zfail],
331
- // zpass: stencilOpMap[opFront.zpass],
332
- // },
333
- // opBack: {
334
- // fail: stencilOpMap[opBack.fail],
335
- // zfail: stencilOpMap[opBack.zfail],
336
- // zpass: stencilOpMap[opBack.zpass],
337
- // },
338
- // };
339
- // }
340
- // private getColorMaskDrawParams(
341
- // { stencil }: Pick<IModelInitializationOptions, 'stencil'>,
342
- // pick: boolean,
343
- // ) {
344
- // // TODO: 重构相关参数
345
- // // 掩膜模式下,颜色通道全部关闭
346
- // const colorMask =
347
- // stencil?.enable && stencil.opFront && !pick
348
- // ? [false, false, false, false]
349
- // : [true, true, true, true]; // 非掩码模式下,颜色通道全部开启
350
- // return colorMask;
351
- // }
306
+ /**
307
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
308
+ */
309
+ getStencilDrawParams({
310
+ stencil
311
+ }) {
312
+ const {
313
+ enable,
314
+ mask = -1,
315
+ func = {
316
+ cmp: import_l7_core.gl.ALWAYS,
317
+ ref: 0,
318
+ mask: -1
319
+ },
320
+ opFront = {
321
+ fail: import_l7_core.gl.KEEP,
322
+ zfail: import_l7_core.gl.KEEP,
323
+ zpass: import_l7_core.gl.KEEP
324
+ },
325
+ opBack = {
326
+ fail: import_l7_core.gl.KEEP,
327
+ zfail: import_l7_core.gl.KEEP,
328
+ zpass: import_l7_core.gl.KEEP
329
+ }
330
+ } = stencil || {};
331
+ return {
332
+ enable: !!enable,
333
+ mask,
334
+ func: {
335
+ ...func,
336
+ cmp: import_constants.stencilFuncMap[func.cmp]
337
+ },
338
+ opFront: {
339
+ fail: import_constants.stencilOpMap[opFront.fail],
340
+ zfail: import_constants.stencilOpMap[opFront.zfail],
341
+ zpass: import_constants.stencilOpMap[opFront.zpass]
342
+ },
343
+ opBack: {
344
+ fail: import_constants.stencilOpMap[opBack.fail],
345
+ zfail: import_constants.stencilOpMap[opBack.zfail],
346
+ zpass: import_constants.stencilOpMap[opBack.zpass]
347
+ }
348
+ };
349
+ }
352
350
  /**
353
351
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
354
352
  */
@@ -26,6 +26,8 @@ __export(constants_exports, {
26
26
  hintMap: () => hintMap,
27
27
  primitiveMap: () => primitiveMap,
28
28
  sizeFormatMap: () => sizeFormatMap,
29
+ stencilFuncMap: () => stencilFuncMap,
30
+ stencilOpMap: () => stencilOpMap,
29
31
  typedArrayCtorMap: () => typedArrayCtorMap,
30
32
  wrapModeMap: () => wrapModeMap
31
33
  });
@@ -103,6 +105,26 @@ var blendFuncMap = {
103
105
  [import_l7_core.gl.ONE_MINUS_CONSTANT_ALPHA]: import_g_device_api.BlendFactor.ONE_MINUS_CONSTANT,
104
106
  [import_l7_core.gl.SRC_ALPHA_SATURATE]: import_g_device_api.BlendFactor.SRC_ALPHA_SATURATE
105
107
  };
108
+ var stencilOpMap = {
109
+ [import_l7_core.gl.REPLACE]: import_g_device_api.StencilOp.REPLACE,
110
+ [import_l7_core.gl.KEEP]: import_g_device_api.StencilOp.KEEP,
111
+ [import_l7_core.gl.ZERO]: import_g_device_api.StencilOp.ZERO,
112
+ [import_l7_core.gl.INVERT]: import_g_device_api.StencilOp.INVERT,
113
+ [import_l7_core.gl.INCR]: import_g_device_api.StencilOp.INCREMENT_CLAMP,
114
+ [import_l7_core.gl.DECR]: import_g_device_api.StencilOp.DECREMENT_CLAMP,
115
+ [import_l7_core.gl.INCR_WRAP]: import_g_device_api.StencilOp.INCREMENT_WRAP,
116
+ [import_l7_core.gl.DECR_WRAP]: import_g_device_api.StencilOp.DECREMENT_WRAP
117
+ };
118
+ var stencilFuncMap = {
119
+ [import_l7_core.gl.ALWAYS]: import_g_device_api.CompareFunction.ALWAYS,
120
+ [import_l7_core.gl.EQUAL]: import_g_device_api.CompareFunction.EQUAL,
121
+ [import_l7_core.gl.GEQUAL]: import_g_device_api.CompareFunction.GEQUAL,
122
+ [import_l7_core.gl.GREATER]: import_g_device_api.CompareFunction.GREATER,
123
+ [import_l7_core.gl.LEQUAL]: import_g_device_api.CompareFunction.LEQUAL,
124
+ [import_l7_core.gl.LESS]: import_g_device_api.CompareFunction.LESS,
125
+ [import_l7_core.gl.NEVER]: import_g_device_api.CompareFunction.NEVER,
126
+ [import_l7_core.gl.NOTEQUAL]: import_g_device_api.CompareFunction.NOTEQUAL
127
+ };
106
128
  // Annotate the CommonJS export names for ESM import in node:
107
129
  0 && (module.exports = {
108
130
  blendEquationMap,
@@ -112,6 +134,8 @@ var blendFuncMap = {
112
134
  hintMap,
113
135
  primitiveMap,
114
136
  sizeFormatMap,
137
+ stencilFuncMap,
138
+ stencilOpMap,
115
139
  typedArrayCtorMap,
116
140
  wrapModeMap
117
141
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.20.6",
3
+ "version": "2.20.9",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "xiaoiver",
@@ -25,19 +25,19 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@antv/g-device-api": "^1.4.5",
28
- "@antv/l7-core": "2.20.6",
29
- "@antv/l7-utils": "2.20.6",
28
+ "@antv/l7-core": "2.20.9",
29
+ "@antv/l7-utils": "2.20.9",
30
30
  "@babel/runtime": "^7.7.7",
31
31
  "inversify": "^5.0.1",
32
32
  "reflect-metadata": "^0.2.1",
33
33
  "regl": "1.6.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@antv/l7-test-utils": "2.20.6",
36
+ "@antv/l7-test-utils": "2.20.9",
37
37
  "gl": "^6.0.2"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "b5af1f23f8f5524cbbb2ea858399fefba63b0163"
42
+ "gitHead": "09352d485c5be1478d063e37a7266edecefecb9a"
43
43
  }