Skip to content

Commit

Permalink
remove redundant call to prerender from old code, some review fixes (#…
Browse files Browse the repository at this point in the history
…12539)

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

* avoid reallocation use cast
  • Loading branch information
akoylasar authored Jan 24, 2023
1 parent 0cf7b1c commit 60111db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
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

0 comments on commit 60111db

Please sign in to comment.