Skip to content

Commit

Permalink
Refactor globe getProjectionData
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Dec 1, 2024
1 parent c20881d commit d5a6cf8
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/geo/projection/globe_transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,16 @@ export class GlobeTransform implements ITransform {
}

getProjectionData(params: ProjectionDataParams): ProjectionData {
const {overscaledTileID, aligned, applyTerrainMatrix, applyGlobeMatrix} = params;
const data = this._mercatorTransform.getProjectionData({overscaledTileID, aligned, applyTerrainMatrix});
const {overscaledTileID, applyGlobeMatrix} = params;
const mercatorProjectionData = this._mercatorTransform.getProjectionData(params)

// Set 'projectionMatrix' to actual globe transform
if (this.isGlobeRendering) {
data.mainMatrix = this._globeViewProjMatrix32f;
}

data.clippingPlane = this._cachedClippingPlane as [number, number, number, number];
data.projectionTransition = applyGlobeMatrix ? this._globeness : 0;

return data;
return {
mainMatrix: this.isGlobeRendering ? this._globeViewProjMatrix32f : mercatorProjectionData.mainMatrix,
tileMercatorCoords: this._helper.getTileMercatorCoordinates(overscaledTileID),
clippingPlane: this._cachedClippingPlane as [number, number, number, number],
projectionTransition: applyGlobeMatrix ? this._globeness : 0,
fallbackMatrix: mercatorProjectionData.mainMatrix
};
}

private _computeClippingPlane(globeRadiusPixels: number): vec4 {
Expand Down

0 comments on commit d5a6cf8

Please sign in to comment.