-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] port matrix and antialiasing cleanup #7444
Conversation
@ansis, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @1ec5 and @incanus to be potential reviewers. |
It's a breaking change to an undocumented API, so kind of a grey area. We're already breaking this API for iOS 3.2.0, and could conceivably squeeze this change into that release. However, Android 4.2.0 shipped today, and it's a breaking change there as well. |
We're going to merge release-ios-3.4.0 back to master tomorrow following today's release of iOS SDK v3.4.0-beta.5. The release branch contains some significant changes to custom layers (#7250) that would conflict with this branch if you were to update the existing custom style layer API. Of note, the drawing parameters are now contained in a struct, which means we could simply add fieldOfView alongside the (meaningless, unused) perspectiveSkew field (which maps to altitude in mbgl). But I'd actually prefer that we go ahead and replace perspectiveSkew, since we haven't officially released our other backwards-incompatible changes yet. |
Meanwhile, I can remove the perspectiveSkew field on the release branch. |
Wasn't it hardcoded to 1.5? This is why I figured it would be safe to remove without much fuss. |
b837ab5
to
b2772e9
Compare
I replaced All this needs is review |
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.
I agree. Can you squash the last commit with 6aa1f92 so that there aren't and failing intermediate commits?
6617ff8
to
c598672
Compare
@@ -109,7 +110,7 @@ class TransformState { | |||
double x = 0, y = 0; | |||
double angle = 0; | |||
double scale = 1; | |||
double altitude = 1.5; | |||
double fov = 0.6435011087932844; |
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.
Oh, any chance that you could replace this with an expression or add a comment to the same effect?
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.
This comment should also be updated to point to this field.
ported from -js: c52a09639ceeeb809cd837360993df9c45b45420 This replaces a hardcoded shader approximation with a more correct, FOV-dependent one. `gl_Position.w - 0.5` is replaced with `gl_Position.w / tan(fov)` The `/ tan(fov)` is handled by multiplying `1 / tan(fov)` into `u_gamma` outside the shader. I think `- 0.5` was just chosen as something that looked right for the default fov.lease enter the commit message for your changes. Lines starting
c598672
to
dc7047a
Compare
ported from -js: eb6c6596c6a7a61363d30356674e0002153b1d19 `altitude` was a terribly-named variable that was used to indirectly control the fov. This should eliminate some confusion. `altitude` was equivalent to `cameraToCenterDistance / height`
ported from -js: ef5582dd3bc5c15a3112e875ed66494dab8e9d0b Project the extrusion and compare it's projected pixel length with the actual pixel length and adjust antialiasing accordingly. The previous approach calculated the adjustment much more indirectly and had no intuitive explanation.
dc7047a
to
d0a0d81
Compare
fix #7439
ports mapbox/mapbox-gl-js#3790
TODO:
I removed
altitude
fromCustomLayerRenderParameters
and addedfieldOfView
. Is this considered an external interface / breaking change? Should I remove it from the platform bindings as well? Or should I calculate it and add it? The old altitude value is just0.5 / tan(fov / 2) * height
@jfirebaugh