-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
@ansis awesome! |
@ansis I was able to build and run these changes on iPhone 5 as well as Samsung Note 3. Here are two screenshots with pitch hardcoded to 45 degrees. It felt a little slower on Note 3 (but this could very well be a general Android issue. I think this repo doesn't have changes to call HTTPAndroidRequest::cancel on right thread for Android. This is causing crash on Android when one zooms in.). Also is it possible to share more details at a logical level regarding this change with everyone? |
Drag two fingers upward to tilt the map. Implements #2116
Basic iOS gesture support is over in |
@mb12 thanks for testing! The implementation is pretty much the same as the one in -js. mapbox/mapbox-gl-js#1049 and mapbox/mapbox-gl-js#1114 The orthographic projection matrix was replaced with a perspective matrix. Two new transform properties were added to control the projection. pitch controls how tilted the map is and altitude controls how quickly lines approach the vanishing point. Only pitch is exposed externally.
A basic api for getting and setting the pitch was added. Many of the changes are related to adapting antialiasing. Lines and text need different levels of blur depending on how far away they are. Both of these now have approximate solutions that work well enough but aren't 100% mathematically correct. This is probably the hardest and weirdest part of the perspective implementation. Layers now have slightly different depthRanges. Both ends of the depthRange are shifted for each layer so that depth values between layers are different enough at both ends of the depth range. We could have made each layer have a single depth value instead of a range, but we'll need ranges for 3d buildings later. Line labels are projected onto the surface because it was easier to render them that way. |
Should mbgl be responsible for clamping the pitch to a reasonable value, or should that be left up to the platform bindings? Setting the pitch above π rad currently triggers this assertion failure:
while setting it below 0 rad causes the map to go blank. But should we clamp to just the values that’ll cause this kind of behavior, or should we be stricter and disallow showing the horizon? |
We should probably leave this to the platforms, just like right now how we don't allow rotation at low zoom levels on iOS and animate it back into place. |
Blocker to merge: #2139 Otherwise things like the user dot don't trace the right geo point on the map, and e.g. long-press to drop a pin will put things in the wrong place. Plus, these are needed in general for mobile-based app coordinate transformation. |
This pull request is already getting pretty big. Should we review and merge this into master? There are things that still need to be improved but it would probably be easier to review and merge those separately. This branch shouldn't break or regress anything in non-perspective views. |
It does in #2139. |
Another regression: #2174. |
Drag two fingers upward to tilt the map. Implements #2116
Drag two fingers upward to tilt the map. Implements mapbox#2116
Ports perspective view from -js.
fixes #1140
TODO: