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

remove redundant call to prerender from old code, some review fixes #12539

Merged
merged 2 commits into from
Jan 24, 2023
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
3 changes: 1 addition & 2 deletions src/geo/lng_lat.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ class LngLat {
toEcef(altitude: number): [number, number, number] {
const altInEcef = globeMetersToEcef(altitude);
const radius = GLOBE_RADIUS + altInEcef;
const ecef = latLngToECEF(this.lat, this.lng, radius);
return [ecef[0], ecef[1], ecef[2]];
return (latLngToECEF(this.lat, this.lng, radius): any);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/geo/projection/globe_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {members as globeLayoutAttributes} from '../../terrain/globe_attributes.j
import posAttributes from '../../data/pos_attributes.js';
import {TriangleIndexArray, GlobeVertexArray, LineIndexArray, PosArray} from '../../data/array_types.js';
import {Aabb, Ray} from '../../util/primitives.js';
import LngLat from '../lng_lat.js';
import LngLat, {earthRadius} from '../lng_lat.js';
import LngLatBounds from '../lng_lat_bounds.js';

import type Painter from '../../render/painter.js';
Expand Down Expand Up @@ -68,7 +68,7 @@ const GLOBE_LOW_ZOOM_TILE_AABBS = [
];

export function globeMetersToEcef(d: number): number {
return d * mercatorZfromAltitude(1, 0.0) * 2.0 * GLOBE_RADIUS * Math.PI;
return d * GLOBE_RADIUS / earthRadius;
}

export function globePointCoordinate(tr: Transform, x: number, y: number, clampToHorizon: boolean = true): ?MercatorCoordinate {
Expand Down
1 change: 0 additions & 1 deletion src/render/draw_custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function drawCustom(painter: Painter, sourceCache: SourceCache, layer: CustomSty
painter.setCustomLayerDefaults();
context.setColorMode(painter.colorModeForRenderPass());

prerender.call(implementation, context.gl, painter.transform.customLayerMatrix());
if (painter.transform.projection.name === "globe") {
prerender.call(implementation, context.gl, painter.transform.customLayerMatrix(), painter.transform.getProjection(), painter.transform.globeToMercatorMatrix(), globeToMercatorTransition(painter.transform.zoom));
} else {
Expand Down