summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders/collision_circle.cpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-01-04 13:37:41 -0800
committerChris Loer <chris.loer@mapbox.com>2018-01-04 14:24:37 -0800
commit5bfa20d71dc099416c5d715e7857ae836db160ed (patch)
tree1881ce247b0e4db8e490d41765a14315fc7ce109 /src/mbgl/shaders/collision_circle.cpp
parentc62b0af24fc76b4bb2eb34100611dd3ee9ee5536 (diff)
downloadqtlocation-mapboxgl-5bfa20d71dc099416c5d715e7857ae836db160ed.tar.gz
Fix distant collision perspective ratios (#10794).
Analog of GL JS issue #5911. Add native ignore for tilejson-bounds.
Diffstat (limited to 'src/mbgl/shaders/collision_circle.cpp')
-rw-r--r--src/mbgl/shaders/collision_circle.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/shaders/collision_circle.cpp b/src/mbgl/shaders/collision_circle.cpp
index 1e85d99a33..ac2d71d7fc 100644
--- a/src/mbgl/shaders/collision_circle.cpp
+++ b/src/mbgl/shaders/collision_circle.cpp
@@ -26,19 +26,19 @@ varying vec2 v_extrude_scale;
void main() {
vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);
highp float camera_to_anchor_distance = projectedPoint.w;
- highp float collision_perspective_ratio = 0.5 + 0.5 * (camera_to_anchor_distance / u_camera_to_center_distance);
+ highp float collision_perspective_ratio = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);
gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);
highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur
- gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w / collision_perspective_ratio;
+ gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;
v_placed = a_placed.x;
v_notUsed = a_placed.y;
v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius
v_extrude = a_extrude * padding_factor;
- v_extrude_scale = u_extrude_scale * u_camera_to_center_distance / collision_perspective_ratio;
+ v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;
}
)MBGL_SHADER";