@antv/l7-renderer 2.21.9 → 2.21.11-beta.0

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.
@@ -45,7 +45,7 @@ import {
45
45
  stencilFuncMap,
46
46
  stencilOpMap
47
47
  } from "./constants";
48
- var { isPlainObject, isTypedArray } = lodashUtil;
48
+ var { isPlainObject, isTypedArray, isNil } = lodashUtil;
49
49
  var DeviceModel = class {
50
50
  constructor(device, options, service) {
51
51
  this.device = device;
@@ -113,6 +113,7 @@ var DeviceModel = class {
113
113
  this.pipeline = this.createPipeline(options);
114
114
  }
115
115
  createPipeline(options, pick) {
116
+ var _a;
116
117
  const { primitive = gl.TRIANGLES, depth, cull, blend, stencil } = options;
117
118
  const depthParams = this.initDepthDrawParams({ depth });
118
119
  const depthEnabled = !!(depthParams && depthParams.enable);
@@ -122,7 +123,7 @@ var DeviceModel = class {
122
123
  const blendEnabled = !!(blendParams && blendParams.enable);
123
124
  const stencilParams = this.getStencilDrawParams({ stencil });
124
125
  const stencilEnabled = !!(stencilParams && stencilParams.enable);
125
- return this.device.createRenderPipeline({
126
+ const pipeline = this.device.createRenderPipeline({
126
127
  // return this.service.renderCache.createRenderPipeline({
127
128
  inputLayout: this.inputLayout,
128
129
  program: this.program,
@@ -178,6 +179,10 @@ var DeviceModel = class {
178
179
  }
179
180
  }
180
181
  });
182
+ if (stencilEnabled && !isNil((_a = stencil == null ? void 0 : stencil.func) == null ? void 0 : _a.ref)) {
183
+ pipeline.stencilFuncReference = stencil.func.ref;
184
+ }
185
+ return pipeline;
181
186
  }
182
187
  updateAttributesAndElements() {
183
188
  }
@@ -221,7 +226,9 @@ var DeviceModel = class {
221
226
  );
222
227
  device["swapChainHeight"] = tmpHeight;
223
228
  renderPass.setPipeline(this.pipeline);
224
- renderPass.setStencilReference(1);
229
+ if (!isNil(this.pipeline.stencilFuncReference)) {
230
+ renderPass.setStencilReference(this.pipeline.stencilFuncReference);
231
+ }
225
232
  renderPass.setVertexInput(
226
233
  this.inputLayout,
227
234
  this.vertexBuffers.map((buffer) => ({
@@ -176,13 +176,14 @@ var DeviceRendererService = class {
176
176
  }
177
177
  init(canvas, cfg) {
178
178
  return __async(this, null, function* () {
179
- const { enableWebGPU, shaderCompilerPath } = cfg;
179
+ const { enableWebGPU, shaderCompilerPath, antialias } = cfg;
180
180
  this.canvas = canvas;
181
181
  const deviceContribution = enableWebGPU ? new WebGPUDeviceContribution({
182
182
  shaderCompilerPath
183
183
  }) : new WebGLDeviceContribution({
184
184
  // Use WebGL2 first and downgrade to WebGL1 if WebGL2 is not supported.
185
185
  targets: ["webgl2", "webgl1"],
186
+ antialias,
186
187
  onContextLost(e) {
187
188
  console.warn("context lost", e);
188
189
  },
package/es/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- *
3
- */
4
1
  import DeviceRendererService from './device';
5
2
  import ReglRendererService from './regl';
6
3
  export { DeviceRendererService, ReglRendererService };
@@ -55,7 +55,7 @@ var import_l7_utils = require("@antv/l7-utils");
55
55
  var import_DeviceFramebuffer = __toESM(require("./DeviceFramebuffer"));
56
56
  var import_DeviceTexture2D = __toESM(require("./DeviceTexture2D"));
57
57
  var import_constants = require("./constants");
58
- var { isPlainObject, isTypedArray } = import_l7_utils.lodashUtil;
58
+ var { isPlainObject, isTypedArray, isNil } = import_l7_utils.lodashUtil;
59
59
  var DeviceModel = class {
60
60
  constructor(device, options, service) {
61
61
  this.device = device;
@@ -123,6 +123,7 @@ var DeviceModel = class {
123
123
  this.pipeline = this.createPipeline(options);
124
124
  }
125
125
  createPipeline(options, pick) {
126
+ var _a;
126
127
  const { primitive = import_l7_core.gl.TRIANGLES, depth, cull, blend, stencil } = options;
127
128
  const depthParams = this.initDepthDrawParams({ depth });
128
129
  const depthEnabled = !!(depthParams && depthParams.enable);
@@ -132,7 +133,7 @@ var DeviceModel = class {
132
133
  const blendEnabled = !!(blendParams && blendParams.enable);
133
134
  const stencilParams = this.getStencilDrawParams({ stencil });
134
135
  const stencilEnabled = !!(stencilParams && stencilParams.enable);
135
- return this.device.createRenderPipeline({
136
+ const pipeline = this.device.createRenderPipeline({
136
137
  // return this.service.renderCache.createRenderPipeline({
137
138
  inputLayout: this.inputLayout,
138
139
  program: this.program,
@@ -188,6 +189,10 @@ var DeviceModel = class {
188
189
  }
189
190
  }
190
191
  });
192
+ if (stencilEnabled && !isNil((_a = stencil == null ? void 0 : stencil.func) == null ? void 0 : _a.ref)) {
193
+ pipeline.stencilFuncReference = stencil.func.ref;
194
+ }
195
+ return pipeline;
191
196
  }
192
197
  updateAttributesAndElements() {
193
198
  }
@@ -231,7 +236,9 @@ var DeviceModel = class {
231
236
  );
232
237
  device["swapChainHeight"] = tmpHeight;
233
238
  renderPass.setPipeline(this.pipeline);
234
- renderPass.setStencilReference(1);
239
+ if (!isNil(this.pipeline.stencilFuncReference)) {
240
+ renderPass.setStencilReference(this.pipeline.stencilFuncReference);
241
+ }
235
242
  renderPass.setVertexInput(
236
243
  this.inputLayout,
237
244
  this.vertexBuffers.map((buffer) => ({
@@ -200,13 +200,14 @@ var DeviceRendererService = class {
200
200
  }
201
201
  init(canvas, cfg) {
202
202
  return __async(this, null, function* () {
203
- const { enableWebGPU, shaderCompilerPath } = cfg;
203
+ const { enableWebGPU, shaderCompilerPath, antialias } = cfg;
204
204
  this.canvas = canvas;
205
205
  const deviceContribution = enableWebGPU ? new import_g_device_api.WebGPUDeviceContribution({
206
206
  shaderCompilerPath
207
207
  }) : new import_g_device_api.WebGLDeviceContribution({
208
208
  // Use WebGL2 first and downgrade to WebGL1 if WebGL2 is not supported.
209
209
  targets: ["webgl2", "webgl1"],
210
+ antialias,
210
211
  onContextLost(e) {
211
212
  console.warn("context lost", e);
212
213
  },
package/lib/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- *
3
- */
4
1
  import DeviceRendererService from './device';
5
2
  import ReglRendererService from './regl';
6
3
  export { DeviceRendererService, ReglRendererService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.21.9",
3
+ "version": "2.21.11-beta.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "https://github.com/orgs/antvis/people",
@@ -16,11 +16,11 @@
16
16
  "@antv/g-device-api": "^1.6.4",
17
17
  "@babel/runtime": "^7.7.7",
18
18
  "regl": "1.6.1",
19
- "@antv/l7-core": "2.21.9",
20
- "@antv/l7-utils": "2.21.9"
19
+ "@antv/l7-core": "2.21.11-beta.0",
20
+ "@antv/l7-utils": "2.21.11-beta.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@antv/l7-test-utils": "^2.21.9"
23
+ "@antv/l7-test-utils": "^2.21.11-beta.0"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public",