Skip to content

Commit 7e33e73

Browse files
committed
Disable model.show in inverse mode when no clipping overlap
1 parent 99a8a42 commit 7e33e73

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

  • packages/engine/Source/Scene/Model

packages/engine/Source/Scene/Model/Model.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,22 @@ function updateShowCreditsOnScreen(model) {
26332633
}
26342634
}
26352635

2636+
/**
2637+
* Determines whether a model is wholly clipped away by inverse clipping. In
2638+
* inverse mode a model with no polygon geometry lies entirely outside every
2639+
* polygon, so all of it is clipped and it should not be drawn.
2640+
* @param {Model} model
2641+
* @returns {boolean}
2642+
* @private
2643+
*/
2644+
function isModelClippedAwayByInversePolygons(model) {
2645+
return (
2646+
model.isClippingPolygonsEnabled() &&
2647+
model._clippingPolygons.inverse &&
2648+
(model._clippingPolygonData?.polygonRings.length ?? 0) === 0
2649+
);
2650+
}
2651+
26362652
function submitDrawCommands(model, frameState) {
26372653
// Check that show is true after draw commands are built;
26382654
// we want the user to be able to instantly see the model
@@ -2653,7 +2669,8 @@ function submitDrawCommands(model, frameState) {
26532669
model._show &&
26542670
model._computedScale !== 0 &&
26552671
displayConditionPassed &&
2656-
(!invisible || silhouette);
2672+
(!invisible || silhouette) &&
2673+
!isModelClippedAwayByInversePolygons(model);
26572674

26582675
const passes = frameState.passes;
26592676
const submitCommandsForPass =

0 commit comments

Comments
 (0)