@expofp/renderer 3.2.2 → 3.2.4

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 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AlwaysDepth, BatchedMesh, Box3, BufferAttribute, BufferGeometry, Camera, Clock, Color, CustomBlending, DataTexture, DirectionalLight, DoubleSide, DynamicDrawUsage, FloatType, Frustum, Group, HemisphereLight, IntType, LessDepth, LessEqualDepth, LinearSRGBColorSpace, MathUtils, Matrix3, Matrix4, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, NotEqualStencilFunc, OneFactor, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, Quaternion, RGBAFormat, RGBAIntegerFormat, RGFormat, RGIntegerFormat, Raycaster, RedFormat, RedIntegerFormat, ReplaceStencilOp, SRGBColorSpace, Scene, Sphere, Spherical, StreamDrawUsage, Texture, UnsignedIntType, Vector2, Vector3, Vector4, WebGLRenderer } from "three";
1
+ import { AlwaysDepth, BatchedMesh, Box3, BufferAttribute, BufferGeometry, Camera, Clock, Color, CustomBlending, DataTexture, DirectionalLight, DoubleSide, DynamicDrawUsage, FloatType, Frustum, Group, HemisphereLight, IntType, LessDepth, LessEqualDepth, LinearSRGBColorSpace, MathUtils, Matrix3, Matrix4, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, NotEqualStencilFunc, OneFactor, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, Quaternion, RGBAFormat, RGBAIntegerFormat, RGFormat, RGIntegerFormat, Raycaster, RedFormat, RedIntegerFormat, ReplaceStencilOp, SRGBColorSpace, Scene, Sphere, Spherical, SrcAlphaFactor, StreamDrawUsage, Texture, UnsignedIntType, Vector2, Vector3, Vector4, WebGLRenderer } from "three";
2
2
  import { traverseAncestorsGenerator } from "three/examples/jsm/utils/SceneUtils.js";
3
3
  import createLog from "debug";
4
4
  import { BatchedText, Text } from "troika-three-text";
@@ -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);
@@ -1166,10 +1164,12 @@ var MaterialSystem = class {
1166
1164
  createTextureMaterial(params) {
1167
1165
  const material = new MeshBasicMaterial({
1168
1166
  ...sharedParameters,
1169
- map: params.map,
1170
- transparent: true,
1171
- depthFunc: LessDepth
1167
+ map: params.map
1172
1168
  });
1169
+ material.blending = CustomBlending;
1170
+ material.blendSrc = SrcAlphaFactor;
1171
+ material.blendSrcAlpha = OneFactor;
1172
+ if (params.depthEnable) material.depthFunc = LessEqualDepth;
1173
1173
  if (params.uvOffset) material.onBeforeCompile = (shader) => {
1174
1174
  shader.vertexShader = shader.vertexShader.replace("#include <uv_vertex>", `
1175
1175
  #include <uv_vertex>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/renderer",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"