-
-
Notifications
You must be signed in to change notification settings - Fork 414
Frustum Offset Proposal #3676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Frustum Offset Proposal #3676
Conversation
Bloaty Results (iOS) 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-3676-compared-to-main.txt |
Bloaty Results 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-3676-compared-to-main.txtCompared to d387090 (legacy)
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-3676-compared-to-legacy.txt |
Benchmark Results ⚡
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-3676-compared-to-main.txt |
include/mbgl/map/map_options.hpp
Outdated
* @param offset_ A set of edge insets in logical pixels. | ||
* @return reference to MapOptions for chaining options together. | ||
*/ | ||
MapOptions& withFrustumOffset(const EdgeInsets& offset_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using MapOptions::withFrustumOffset
for static setup sounds like a worse option than resizing the draw surface to match the content. I think Map::setFrustumOffset
handles all use cases and encourages dynamic updates (when needed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if you need to draw to a larger area layer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I'd think that most people would solve it via composition instead of searching for this specific option. If withFrustumOffset
is used the color and depth attachments are still allocated to the full size. My point is it's not the most intuitive option for static layouts and if you still need it you can use Map::setFrustumOffset
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1cbe8db
to
87176e9
Compare
/** | ||
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 modofied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offset applied to camera frustum and scissor rectangle. The camrea frustum is modofied | |
Offset applied to camera frustum and scissor rectangle. The camrea frustum is modified |
@@ -117,6 +117,13 @@ public void enableRenderingStatsView(boolean value) { | |||
nativeMapView.enableRenderingStatsView(value); | |||
} | |||
|
|||
/** | |||
* Set frustum offset to disable rendering for edges of the screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could make the documentation comments similar for iOS and Android.
|
||
class ScissorRect { | ||
public: | ||
int32_t x, y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put these on their own lines.
int32_t x, y; | ||
uint32_t width, height; | ||
|
||
bool operator==(const ScissorRect& other) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using C++20 I think we can use = default
now for both operator==
and operator!=
. https://en.cppreference.com/w/cpp/language/default_comparisons.html
class ScissorRect { | ||
public: | ||
int32_t x, y; | ||
uint32_t width, height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put on individual lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider adding some kind of test coverage, if only for the setters/getters of the platforms.
Android Build needs to be fixed.
This PR adds the following:
frustumOffset
property in iOS and Android that allows a user to specify how much of the edges of the screen is out of view and shouldn't be rendered in logical pixel units.frustumOffset
property.frustumOffset
to reject fragments at the edges of the screen which might be behind UI elements.