Skip to content
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

Fix incorrect circle bucket up direction #11904

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/render/program/circle_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import {

import type Context from '../../gl/context.js';
import type {UniformValues, UniformLocations} from '../uniform_binding.js';
import type {OverscaledTileID} from '../../source/tile_id.js';
import {CanonicalTileID, OverscaledTileID} from '../../source/tile_id.js';
import type Tile from '../../source/tile.js';
import type CircleStyleLayer from '../../style/style_layer/circle_style_layer.js';
import type Painter from '../painter.js';
import browser from '../../util/browser.js';
import {mat4} from 'gl-matrix';
import {globeToMercatorTransition, globePixelsToTileUnits} from '../../geo/projection/globe_util.js';
import EXTENT from '../../data/extent.js';

export type CircleUniformsType = {|
'u_camera_to_center_distance': Uniform1f,
Expand Down Expand Up @@ -94,7 +95,9 @@ const circleUniformValues = (
values['u_merc_center'] = mercatorCenter;
values['u_tile_id'] = [coord.canonical.x, coord.canonical.y, 1 << coord.canonical.z];
values['u_zoom_transition'] = globeToMercatorTransition(transform.zoom);
values['u_up_dir'] = (transform.projection.upVector(coord.canonical, mercatorCenter[0], mercatorCenter[1]): any);
const x = mercatorCenter[0] * EXTENT;
const y = mercatorCenter[1] * EXTENT;
values['u_up_dir'] = (transform.projection.upVector(new CanonicalTileID(0, 0, 0), x, y): any);
}

return values;
Expand Down
7 changes: 5 additions & 2 deletions src/render/program/heatmap_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import type Tile from '../../source/tile.js';
import type {UniformValues, UniformLocations} from '../uniform_binding.js';
import type Painter from '../painter.js';
import type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer.js';
import type {OverscaledTileID} from '../../source/tile_id.js';
import {CanonicalTileID, OverscaledTileID} from '../../source/tile_id.js';
import {mat4} from 'gl-matrix';
import {globeToMercatorTransition, globePixelsToTileUnits} from '../../geo/projection/globe_util.js';
import EXTENT from '../../data/extent.js';

export type HeatmapUniformsType = {|
'u_extrude_scale': Uniform1f,
Expand Down Expand Up @@ -83,7 +84,9 @@ const heatmapUniformValues = (
values['u_merc_center'] = mercatorCenter;
values['u_tile_id'] = [coord.canonical.x, coord.canonical.y, 1 << coord.canonical.z];
values['u_zoom_transition'] = globeToMercatorTransition(transform.zoom);
values['u_up_dir'] = (transform.projection.upVector(coord.canonical, mercatorCenter[0], mercatorCenter[1]): any);
const x = mercatorCenter[0] * EXTENT;
const y = mercatorCenter[1] * EXTENT;
values['u_up_dir'] = (transform.projection.upVector(new CanonicalTileID(0, 0, 0), x, y): any);
}

return values;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.