Skip to content

Commit

Permalink
break circular dependency, final minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akoylasar committed Jan 24, 2023
1 parent ff45cae commit 0979259
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions debug/satellites-custom-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const satellitesLayer = {
if (this.satData) {
this.updateBuffers();

const primitiveCount = this.posEcef.length / 3;
gl.enable(gl.DEPTH_TEST);
if (projection && projection.name === 'globe') { // globe projection and globe to mercator transition
gl.useProgram(this.globeProgram);
Expand All @@ -156,13 +157,12 @@ const satellitesLayer = {
gl.uniformMatrix4fv(gl.getUniformLocation(this.globeProgram, "u_globeToMercMatrix"), false, globeToMercMatrix);
gl.uniform1f(gl.getUniformLocation(this.globeProgram, "u_globeToMercatorTransition"), transition);

const count = this.posEcef.length / 3;
gl.drawArrays(gl.POINTS, 0, count);
gl.drawArrays(gl.POINTS, 0, primitiveCount);
} else { // mercator projection
gl.useProgram(this.mercProgram);
updateVboAndActivateAttrib(gl, this.mercProgram, this.posMercVbo, this.posMerc, "a_pos_merc");
gl.uniformMatrix4fv(gl.getUniformLocation(this.mercProgram, "u_projection"), false, projectionMatrix);
gl.drawArrays(gl.POINTS, 0, this.posEcef.length / 3);
gl.drawArrays(gl.POINTS, 0, primitiveCount);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/geo/lng_lat.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import {GLOBE_RADIUS, globeMetersToEcef, latLngToECEF} from '../geo/projection/g
*/
export const earthRadius = 6371008.8;

/*
* The average circumference of the earth in meters.
*/
export const earthCircumference = 2 * Math.PI * earthRadius;

/**
* A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.
* These coordinates use longitude, latitude coordinate order (as opposed to latitude, longitude)
Expand Down
7 changes: 1 addition & 6 deletions src/geo/mercator_coordinate.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// @flow

import LngLat, {earthRadius} from '../geo/lng_lat.js';
import LngLat, {earthCircumference} from '../geo/lng_lat.js';
import type {LngLatLike} from '../geo/lng_lat.js';

/*
* The average circumference of the world in meters.
*/
const earthCircumference = 2 * Math.PI * earthRadius; // meters

/*
* The circumference at a line of latitude in meters.
*/
Expand Down

0 comments on commit 0979259

Please sign in to comment.