Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Dec 8, 2022
1 parent 462b014 commit 718c235
Show file tree
Hide file tree
Showing 36 changed files with 383 additions and 356 deletions.
25 changes: 17 additions & 8 deletions build/geo-three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ class UnitsUtils {
const longitude = Math.atan2(dir.y, dir.x) * radToDeg;
return new Geolocation(latitude, longitude);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
}
}
UnitsUtils.EARTH_RADIUS = 6371008;
UnitsUtils.EARTH_RADIUS_A = 6378137.0;
Expand Down Expand Up @@ -543,13 +546,18 @@ class MapHeightNode extends MapNode {
if (this.mapView.heightProvider === null) {
throw new Error('GeoThree: MapView.heightProvider provider is null.');
}
const image = yield this.mapView.heightProvider.fetchTile(this.level, this.x, this.y);
const canvas = CanvasUtils.createOffscreenCanvas(this.geometrySize + 1, this.geometrySize + 1);
const context = canvas.getContext('2d');
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, MapHeightNode.tileSize, MapHeightNode.tileSize, 0, 0, canvas.width, canvas.height);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
this.geometry = new MapNodeHeightGeometry(1, 1, this.geometrySize, this.geometrySize, true, 10.0, imageData, true);
try {
const image = yield this.mapView.heightProvider.fetchTile(this.level, this.x, this.y);
const canvas = CanvasUtils.createOffscreenCanvas(this.geometrySize + 1, this.geometrySize + 1);
const context = canvas.getContext('2d');
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, MapHeightNode.tileSize, MapHeightNode.tileSize, 0, 0, canvas.width, canvas.height);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
this.geometry = new MapNodeHeightGeometry(1, 1, this.geometrySize, this.geometrySize, true, 10.0, imageData, true);
}
catch (e) {
this.geometry = MapPlaneNode.baseGeometry;
}
this.heightLoaded = true;
});
}
Expand Down Expand Up @@ -783,7 +791,7 @@ class MapHeightNodeShader extends MapHeightNode {
}
catch (e) {
console.error('Geo-Three: Failed to load node tile height data.', this);
this.material.map = TextureUtils.createFillTexture('#000000');
this.material.userData.heightMap.value = TextureUtils.createFillTexture('#017090');
}
this.material.needsUpdate = true;
this.heightLoaded = true;
Expand Down Expand Up @@ -1844,6 +1852,7 @@ class CancelablePromise {
exports.BingMapsProvider = BingMapsProvider;
exports.CancelablePromise = CancelablePromise;
exports.DebugProvider = DebugProvider;
exports.Geolocation = Geolocation;
exports.GeolocationUtils = GeolocationUtils;
exports.GoogleMapsProvider = GoogleMapsProvider;
exports.HeightDebugProvider = HeightDebugProvider;
Expand Down
5 changes: 1 addition & 4 deletions build/geo-three.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) :
typeof define === 'function' && define.amd ? define(['exports', 'three'], factory) :
Expand Down Expand Up @@ -793,7 +791,7 @@
}
catch (e) {
console.error('Geo-Three: Failed to load node tile height data.', this);
this.material.userData.heightMap.value = TextureUtils.createFillTexture('#019090');
this.material.userData.heightMap.value = TextureUtils.createFillTexture('#017090');
}
this.material.needsUpdate = true;
this.heightLoaded = true;
Expand Down Expand Up @@ -1882,4 +1880,3 @@
Object.defineProperty(exports, '__esModule', { value: true });

}));
//# sourceMappingURL=geo-three.js.map
2 changes: 1 addition & 1 deletion build/geo-three.js.map

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions build/geo-three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ class UnitsUtils {
const longitude = Math.atan2(dir.y, dir.x) * radToDeg;
return new Geolocation(latitude, longitude);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
}
}
UnitsUtils.EARTH_RADIUS = 6371008;
UnitsUtils.EARTH_RADIUS_A = 6378137.0;
Expand Down Expand Up @@ -539,13 +542,18 @@ class MapHeightNode extends MapNode {
if (this.mapView.heightProvider === null) {
throw new Error('GeoThree: MapView.heightProvider provider is null.');
}
const image = yield this.mapView.heightProvider.fetchTile(this.level, this.x, this.y);
const canvas = CanvasUtils.createOffscreenCanvas(this.geometrySize + 1, this.geometrySize + 1);
const context = canvas.getContext('2d');
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, MapHeightNode.tileSize, MapHeightNode.tileSize, 0, 0, canvas.width, canvas.height);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
this.geometry = new MapNodeHeightGeometry(1, 1, this.geometrySize, this.geometrySize, true, 10.0, imageData, true);
try {
const image = yield this.mapView.heightProvider.fetchTile(this.level, this.x, this.y);
const canvas = CanvasUtils.createOffscreenCanvas(this.geometrySize + 1, this.geometrySize + 1);
const context = canvas.getContext('2d');
context.imageSmoothingEnabled = false;
context.drawImage(image, 0, 0, MapHeightNode.tileSize, MapHeightNode.tileSize, 0, 0, canvas.width, canvas.height);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
this.geometry = new MapNodeHeightGeometry(1, 1, this.geometrySize, this.geometrySize, true, 10.0, imageData, true);
}
catch (e) {
this.geometry = MapPlaneNode.baseGeometry;
}
this.heightLoaded = true;
});
}
Expand Down Expand Up @@ -779,7 +787,7 @@ class MapHeightNodeShader extends MapHeightNode {
}
catch (e) {
console.error('Geo-Three: Failed to load node tile height data.', this);
this.material.map = TextureUtils.createFillTexture('#000000');
this.material.userData.heightMap.value = TextureUtils.createFillTexture('#017090');
}
this.material.needsUpdate = true;
this.heightLoaded = true;
Expand Down Expand Up @@ -1837,4 +1845,4 @@ class CancelablePromise {
}
}

export { BingMapsProvider, CancelablePromise, DebugProvider, GeolocationUtils, GoogleMapsProvider, HeightDebugProvider, HereMapsProvider, LODFrustum, LODRadial, LODRaycast, MapBoxProvider, MapHeightNode, MapHeightNodeShader, MapNode, MapNodeGeometry, MapNodeHeightGeometry, MapPlaneNode, MapProvider, MapSphereNode, MapSphereNodeGeometry, MapTilerProvider, MapView, OpenMapTilesProvider, OpenStreetMapsProvider, UnitsUtils, XHRUtils };
export { BingMapsProvider, CancelablePromise, DebugProvider, Geolocation, GeolocationUtils, GoogleMapsProvider, HeightDebugProvider, HereMapsProvider, LODFrustum, LODRadial, LODRaycast, MapBoxProvider, MapHeightNode, MapHeightNodeShader, MapNode, MapNodeGeometry, MapNodeHeightGeometry, MapPlaneNode, MapProvider, MapSphereNode, MapSphereNodeGeometry, MapTilerProvider, MapView, OpenMapTilesProvider, OpenStreetMapsProvider, UnitsUtils, XHRUtils };
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

Loading

0 comments on commit 718c235

Please sign in to comment.