Allow setting frustum offset to not render edges of the screen (#3676)

Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
yousifd
2025-11-19 20:30:50 +03:00
committed by GitHub
parent e37a39edcc
commit 2809961b09
42 changed files with 408 additions and 50 deletions

View File

@@ -117,6 +117,18 @@ public final class MapLibreMap {
nativeMapView.enableRenderingStatsView(value);
}
/**
* Frustum offset used to disable rendering of elements at the edge of the screen
*
* Offset applied to camera frustum and scissor rectangle. The camrea frustum is modified
* to avoid loading geometry that's behind UI elements at the top of the screen. The scissor
* rectangle is used to avoid shading fragments that are behind UI elements at the edges of
* the screen. All values are in logical pixels.
*/
public void setFrustumOffset(@NonNull RectF offset) {
nativeMapView.setFrustumOffset(offset);
}
public void setSwapBehaviorFlush(boolean flush) {
nativeMapView.setSwapBehaviorFlush(flush);
}

View File

@@ -270,6 +270,8 @@ interface NativeMap {
void enableRenderingStatsView(boolean value);
void setFrustumOffset(RectF offset);
void setSwapBehaviorFlush(boolean flush);
//

View File

@@ -1149,6 +1149,14 @@ final class NativeMapView implements NativeMap {
nativeEnableRenderingStatsView(value);
}
@Override
public void setFrustumOffset(RectF offset) {
if (checkState("setFrustumOffset")) {
return;
}
nativeSetFrustumOffset(offset);
}
@Override
public void setSwapBehaviorFlush(boolean flush) {
mapRenderer.setSwapBehaviorFlush(flush);
@@ -1746,6 +1754,9 @@ final class NativeMapView implements NativeMap {
@Keep
private native void nativeEnableRenderingStatsView(boolean enabled);
@Keep
private native void nativeSetFrustumOffset(RectF offsset);
//
// Snapshot
//