@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.
- package/dist/index.js +14 -13
- 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
|
|
1084
|
-
*
|
|
1085
|
-
*
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
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
|
|
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 =
|
|
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
|
-
}
|
|
1157
|
+
}
|
|
1158
|
+
if (params.depthEnable) material.depthFunc = LessEqualDepth;
|
|
1158
1159
|
this.patchMaterial(material, { lightingEnable: params.lightingEnable });
|
|
1159
1160
|
return material;
|
|
1160
1161
|
}
|