@expofp/renderer 3.2.3 → 3.2.5

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1080,14 +1080,13 @@ var dimColorFrag = `
1080
1080
  */
1081
1081
  var POLYGON_OFFSET_MULTIPLIER = 12;
1082
1082
  /**
1083
- * Stencil refs for line materials are allocated downward from 255 to stay clear of
1084
- * maplibre's stencil IDs (tile clipping masks), which grow upward from 1 in external
1085
- * mode where the stencil buffer is shared. Allocation wraps back to 255 at the floor;
1086
- * two line layers only share a ref (and stop blending where they overlap) in scenes
1087
- * with more line layers than the 255..200 range holds.
1083
+ * Stencil ref used by every line material. The stencil buffer is cleared before each line
1084
+ * batch draws (see {@link MaterialSystem.createLineMaterial}), so the ref only has to be
1085
+ * non-zero distinguishing "stamped by this batch" from the cleared-to-zero background is
1086
+ * all the per-pixel dedup needs. A single constant works for all layers precisely because
1087
+ * the clear, not a unique ref, is what isolates one batch's stamps from another's.
1088
1088
  */
1089
- var LINE_STENCIL_REF_MAX = 255;
1090
- var LINE_STENCIL_REF_MIN = 200;
1089
+ var LINE_STENCIL_REF = 255;
1091
1090
  var sharedParameters = {
1092
1091
  side: DoubleSide,
1093
1092
  forceSinglePass: true,
@@ -1098,7 +1097,6 @@ var MaterialSystem = class {
1098
1097
  backgroundMaterial;
1099
1098
  viewport = new Vector4();
1100
1099
  lightingMaterials = [];
1101
- nextLineStencilRef = LINE_STENCIL_REF_MAX;
1102
1100
  /**
1103
1101
  * Creates a line material.
1104
1102
  * @param params {@link LineMaterialParameters}
@@ -1112,8 +1110,7 @@ var MaterialSystem = class {
1112
1110
  material.stencilWrite = true;
1113
1111
  material.stencilFunc = NotEqualStencilFunc;
1114
1112
  material.stencilZPass = ReplaceStencilOp;
1115
- material.stencilRef = this.nextLineStencilRef;
1116
- this.nextLineStencilRef = this.nextLineStencilRef <= LINE_STENCIL_REF_MIN ? LINE_STENCIL_REF_MAX : this.nextLineStencilRef - 1;
1113
+ material.stencilRef = LINE_STENCIL_REF;
1117
1114
  material.onBeforeCompile = (shader) => {
1118
1115
  shader.defines ??= {};
1119
1116
  shader.defines["USE_BATCHING_COLOR"] = "";
@@ -1126,6 +1123,7 @@ var MaterialSystem = class {
1126
1123
  `);
1127
1124
  };
1128
1125
  material.onBeforeRender = (renderer) => {
1126
+ renderer.clearStencil();
1129
1127
  const uniforms = material.uniforms;
1130
1128
  if (uniforms) {
1131
1129
  renderer.getViewport(this.viewport);
@@ -1148,13 +1146,16 @@ var MaterialSystem = class {
1148
1146
  const material = new materialConstructor({
1149
1147
  ...sharedParameters,
1150
1148
  color,
1151
- opacity,
1152
- transparent
1149
+ opacity
1153
1150
  });
1151
+ material.blending = CustomBlending;
1152
+ material.blendSrc = SrcAlphaFactor;
1153
+ material.blendSrcAlpha = OneFactor;
1154
1154
  if (transparent) {
1155
1155
  material.depthWrite = false;
1156
1156
  material.depthFunc = LessDepth;
1157
- } else if (params.depthEnable) material.depthFunc = LessEqualDepth;
1157
+ }
1158
+ if (params.depthEnable) material.depthFunc = LessEqualDepth;
1158
1159
  this.patchMaterial(material, { lightingEnable: params.lightingEnable });
1159
1160
  return material;
1160
1161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/renderer",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"