|
|
@@ -192,6 +192,18 @@ class RenderList {
|
|
|
*/
|
|
|
this.occlusionQueryCount = 0;
|
|
|
|
|
|
+ /**
|
|
|
+ * The last object that was counted for occlusion query testing. Used to
|
|
|
+ * avoid counting an object more than once when it produces multiple render
|
|
|
+ * items (e.g. a mesh with multiple material groups), since such an object
|
|
|
+ * is covered by a single occlusion query.
|
|
|
+ *
|
|
|
+ * @private
|
|
|
+ * @type {?Object3D}
|
|
|
+ * @default null
|
|
|
+ */
|
|
|
+ this._lastOcclusionObject = null;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -290,7 +302,12 @@ class RenderList {
|
|
|
|
|
|
const renderItem = this.getNextRenderItem( object, geometry, material, groupOrder, z, group, clippingContext );
|
|
|
|
|
|
- if ( object.occlusionTest === true ) this.occlusionQueryCount ++;
|
|
|
+ if ( object.occlusionTest === true && this._lastOcclusionObject !== object ) {
|
|
|
+
|
|
|
+ this.occlusionQueryCount ++;
|
|
|
+ this._lastOcclusionObject = object;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
if ( material.transparent === true || material.transmission > 0 ||
|
|
|
( material.transmissionNode && material.transmissionNode.isNode ) ||
|
|
|
@@ -415,6 +432,8 @@ class RenderList {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ this._lastOcclusionObject = null;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|