Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
HARP-11672 Satellite on terrain (#1904)
Browse files Browse the repository at this point in the history
* HARP-11672: Minor changes to support textured terrain.

* HARP-11672: Remove displ. map from terrain material when height coloring is off.

When height coloring is off the default standard material's vertex shader is used,
which displaces the geometry by the given displacement map.
  • Loading branch information
atomicsulfate committed Oct 26, 2020
1 parent 419d66e commit 7fdffce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 9 additions & 3 deletions @here/harp-mapview-decoder/lib/TileDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ export class TileFactory<TileType extends Tile> {
* @param dataSource - [[Datasource]] this class belongs to.
* @param tileKey - Quadtree address of the [[Tile]].
*/
create(dataSource: DataSource, tileKey: TileKey): TileType {
return new this.m_modelConstructor(dataSource, tileKey);
create(dataSource: TileDataSource<TileType>, tileKey: TileKey): TileType {
const tile = new this.m_modelConstructor(dataSource, tileKey);
tile.tileLoader = new TileLoader(
dataSource,
tileKey,
dataSource.dataProvider(),
dataSource.decoder
);
return tile;
}
}

Expand Down Expand Up @@ -238,7 +245,6 @@ export class TileDataSource<TileType extends Tile = Tile> extends DataSource {
*/
getTile(tileKey: TileKey, delayLoad: boolean = false): TileType | undefined {
const tile = this.m_tileFactory.create(this, tileKey);
tile.tileLoader = new TileLoader(this, tileKey, this.m_options.dataProvider, this.decoder);
tile.copyrightInfo = this.m_options.copyrightInfo;
if (this.m_options.copyrightProvider !== undefined) {
this.m_options.copyrightProvider
Expand Down
5 changes: 4 additions & 1 deletion @here/harp-mapview/lib/geometry/TileGeometryCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1459,10 +1459,13 @@ export class TileGeometryCreator {
material: THREE.Material,
terrainColor: number
) {
if (technique.displacementMap === undefined) {
if (!technique.map || !technique.displacementMap) {
// Render terrain using the given color.
const stdMaterial = material as MapMeshStandardMaterial;
stdMaterial.color.set(terrainColor);
// Remove displacement map, otherwise it would elevate terrain geometry and make it
// twice as high as it should be.
stdMaterial.displacementMap = null;
return;
}

Expand Down
9 changes: 6 additions & 3 deletions @here/harp-webtile-datasource/lib/HereWebTileDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class HereTileProvider implements WebTileDataProvider {
/** Copyright provider instance. */
private readonly m_copyrightProvider: UrlCopyrightProvider;
private readonly m_ppi: WebTileDataSource.ppiValue;
private readonly m_resolution: WebTileDataSource.resolutionValue;
private readonly m_tileBaseAddress: string;
private m_languages?: string[];

Expand All @@ -229,6 +230,10 @@ export class HereTileProvider implements WebTileDataProvider {

constructor(private readonly m_options: HereWebTileDataSourceParameters) {
this.m_ppi = getOptionValue(m_options.ppi, WebTileDataSource.ppiValue.ppi72);
this.m_resolution = getOptionValue(
m_options.resolution,
WebTileDataSource.resolutionValue.resolution512
);
this.m_tileBaseAddress = m_options.tileBaseAddress ?? HereTileProvider.TILE_BASE_NORMAL;
if (
this.m_tileBaseAddress === HereTileProvider.TILE_AERIAL_SATELLITE &&
Expand Down Expand Up @@ -259,9 +264,7 @@ export class HereTileProvider implements WebTileDataProvider {

const url =
`https://${server}.${this.m_tileBaseAddress}/` +
`${level}/${column}/${row}/${
(tile.dataSource as HereWebTileDataSource).resolution
}/png8` +
`${level}/${column}/${row}/${this.m_resolution}/png8` +
`${this.getImageRequestParams()}`;

return await this.getRequestHeaders().then(headers => {
Expand Down

0 comments on commit 7fdffce

Please sign in to comment.