Skip to content

Commit f1ffa66

Browse files
committed
Changes condition for early exit of requestRectangleData
1 parent 7d5baee commit f1ffa66

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

packages/engine/Source/Scene/ClippingPolygonCollection.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ import VectorPipeline from "../Core/VectorPipeline.js";
3333
// Reused flyweight for reading/writing individual BufferPolygons.
3434
const bufferPolygonScratch = new BufferPolygon();
3535

36-
const scratchRectangle = new Rectangle();
37-
3836
/**
3937
* A ClippingPolygon paired with the index of its mirrored primitive in a collection's BufferPolygonCollection.
4038
*
@@ -1177,12 +1175,7 @@ ClippingPolygonCollection.prototype.requestRectangleData = function (
11771175

11781176
const vectorTileData = {};
11791177

1180-
// Early out if there are no polygons or the rectangle does not intersect the collection's bounding rectangle
1181-
const collectionRectangle = this._vectorCollectionData.rectangle;
1182-
if (
1183-
this.length === 0 ||
1184-
!Rectangle.intersection(rectangle, collectionRectangle, scratchRectangle)
1185-
) {
1178+
if (this.length === 0) {
11861179
return vectorTileData;
11871180
}
11881181

@@ -1193,6 +1186,11 @@ ClippingPolygonCollection.prototype.requestRectangleData = function (
11931186
vectorTileData,
11941187
);
11951188

1189+
// No overlapping polygons means no textures to pack (and the caller can skip the clipping rendering step)
1190+
if (vectorTileData.polygonRings.length === 0) {
1191+
return vectorTileData;
1192+
}
1193+
11961194
VectorPipeline.packPolygonGrid(vectorTileData);
11971195

11981196
VectorPipeline.packPolygonTextures(context, vectorTileData);

0 commit comments

Comments
 (0)