Skip to content

Commit

Permalink
Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Dec 26, 2022
1 parent 76633ab commit 89c3ac2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 91 deletions.
96 changes: 48 additions & 48 deletions example/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31199,7 +31199,7 @@
return new Vector3(-Math.cos(rotX + Math.PI) * cos, Math.sin(rotY), Math.sin(rotX + Math.PI) * cos);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
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;
Expand Down Expand Up @@ -32582,7 +32582,7 @@
}
}

var canvas = document.getElementById("canvas");
var canvas = document.getElementById('canvas');
var renderer = new WebGLRenderer({
canvas: canvas,
antialias: true
Expand All @@ -32593,46 +32593,46 @@
scene.add(sky);
var providers = createProviders();
function createProviders() {
var DEV_MAPBOX_API_KEY = document.getElementById("mapbox_api").value;
var DEV_HEREMAPS_APP_ID = document.getElementById("heremaps_id").value;
var DEV_HEREMAPS_APP_CODE = document.getElementById("heremaps_code").value;
var DEV_BING_API_KEY = document.getElementById("bing_api").value;
var DEV_MAPTILER_API_KEY = document.getElementById("maptiler_api").value;
var OPEN_MAP_TILES_SERVER_MAP = document.getElementById("openmap_tiles_server").value;
var DEV_MAPBOX_API_KEY = document.getElementById('mapbox_api').value;
var DEV_HEREMAPS_APP_ID = document.getElementById('heremaps_id').value;
var DEV_HEREMAPS_APP_CODE = document.getElementById('heremaps_code').value;
var DEV_BING_API_KEY = document.getElementById('bing_api').value;
var DEV_MAPTILER_API_KEY = document.getElementById('maptiler_api').value;
var OPEN_MAP_TILES_SERVER_MAP = document.getElementById('openmap_tiles_server').value;
return [
["Vector OpenSteet Maps", new OpenStreetMapsProvider(),],
["Vector OpenTile Maps", new OpenMapTilesProvider(OPEN_MAP_TILES_SERVER_MAP)],
["Vector Map Box", new MapBoxProvider(DEV_MAPBOX_API_KEY, "mapbox/streets-v10", MapBoxProvider.STYLE)],
["Vector Here Maps", new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, "base", "normal.day")],
["Vector Here Maps Night", new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, "base", "normal.night")],
["Vector Here Maps Terrain", new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, "aerial", "terrain.day")],
["Vector Bing Maps", new BingMapsProvider(DEV_BING_API_KEY, BingMapsProvider.ROAD)],
["Vector Map Tiler Basic", new MapTilerProvider(DEV_MAPTILER_API_KEY, "maps", "basic", "png")],
["Vector Map Tiler Outdoor", new MapTilerProvider(DEV_MAPTILER_API_KEY, "maps", "outdoor", "png")],
["Satellite Map Box", new MapBoxProvider(DEV_MAPBOX_API_KEY, "mapbox.satellite", MapBoxProvider.MAP_ID, "jpg70", false)],
["Satellite Map Box Labels", new MapBoxProvider(DEV_MAPBOX_API_KEY, "mapbox/satellite-streets-v10", MapBoxProvider.STYLE, "jpg70")],
["Satellite Here Maps", new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, "aerial", "satellite.day", "jpg")],
["Satellite Bing Maps", new BingMapsProvider(DEV_BING_API_KEY, BingMapsProvider.AERIAL)],
["Satellite Maps Tiler Labels", new MapTilerProvider(DEV_MAPTILER_API_KEY, "maps", "hybrid", "jpg")],
["Satellite Maps Tiler", new MapTilerProvider(DEV_MAPTILER_API_KEY, "tiles", "satellite", "jpg")],
["Height Map Box", new MapBoxProvider(DEV_MAPBOX_API_KEY, "mapbox.terrain-rgb", MapBoxProvider.MAP_ID, "pngraw")],
["Height Map Tiler", new MapTilerProvider(DEV_MAPTILER_API_KEY, "tiles", "terrain-rgb", "png")],
["Debug Height Map Box", new HeightDebugProvider(new MapBoxProvider(DEV_MAPBOX_API_KEY, "mapbox.terrain-rgb", MapBoxProvider.MAP_ID, "pngraw"))],
["Debug", new DebugProvider()]
['Vector OpenSteet Maps', new OpenStreetMapsProvider()],
['Vector OpenTile Maps', new OpenMapTilesProvider(OPEN_MAP_TILES_SERVER_MAP)],
['Vector Map Box', new MapBoxProvider(DEV_MAPBOX_API_KEY, 'mapbox/streets-v10', MapBoxProvider.STYLE)],
['Vector Here Maps', new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, 'base', 'normal.day')],
['Vector Here Maps Night', new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, 'base', 'normal.night')],
['Vector Here Maps Terrain', new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, 'aerial', 'terrain.day')],
['Vector Bing Maps', new BingMapsProvider(DEV_BING_API_KEY, BingMapsProvider.ROAD)],
['Vector Map Tiler Basic', new MapTilerProvider(DEV_MAPTILER_API_KEY, 'maps', 'basic', 'png')],
['Vector Map Tiler Outdoor', new MapTilerProvider(DEV_MAPTILER_API_KEY, 'maps', 'outdoor', 'png')],
['Satellite Map Box', new MapBoxProvider(DEV_MAPBOX_API_KEY, 'mapbox.satellite', MapBoxProvider.MAP_ID, 'jpg70', false)],
['Satellite Map Box Labels', new MapBoxProvider(DEV_MAPBOX_API_KEY, 'mapbox/satellite-streets-v10', MapBoxProvider.STYLE, 'jpg70')],
['Satellite Here Maps', new HereMapsProvider(DEV_HEREMAPS_APP_ID, DEV_HEREMAPS_APP_CODE, 'aerial', 'satellite.day', 'jpg')],
['Satellite Bing Maps', new BingMapsProvider(DEV_BING_API_KEY, BingMapsProvider.AERIAL)],
['Satellite Maps Tiler Labels', new MapTilerProvider(DEV_MAPTILER_API_KEY, 'maps', 'hybrid', 'jpg')],
['Satellite Maps Tiler', new MapTilerProvider(DEV_MAPTILER_API_KEY, 'tiles', 'satellite', 'jpg')],
['Height Map Box', new MapBoxProvider(DEV_MAPBOX_API_KEY, 'mapbox.terrain-rgb', MapBoxProvider.MAP_ID, 'pngraw')],
['Height Map Tiler', new MapTilerProvider(DEV_MAPTILER_API_KEY, 'tiles', 'terrain-rgb', 'png')],
['Debug Height Map Box', new HeightDebugProvider(new MapBoxProvider(DEV_MAPBOX_API_KEY, 'mapbox.terrain-rgb', MapBoxProvider.MAP_ID, 'pngraw'))],
['Debug', new DebugProvider()]
];
}
var modes = [
["Planar", MapView.PLANAR],
["Height", MapView.HEIGHT],
["Height Shader", MapView.HEIGHT_SHADER],
["Spherical", MapView.SPHERICAL]
['Planar', MapView.PLANAR],
['Height', MapView.HEIGHT],
['Height Shader', MapView.HEIGHT_SHADER],
['Spherical', MapView.SPHERICAL]
];
var lods = [
["Raycast", LODRaycast],
["Frustum", LODFrustum],
["Radial", LODRadial]
['Raycast', LODRaycast],
['Frustum', LODFrustum],
['Radial', LODRadial]
];
var ids = ["mapbox_api", "heremaps_id", "heremaps_code", "bing_api", "maptiler_api", "openmap_tiles_server"];
var ids = ['mapbox_api', 'heremaps_id', 'heremaps_code', 'bing_api', 'maptiler_api', 'openmap_tiles_server'];
for (var i = 0; i < ids.length; i++) {
var box = document.getElementById(ids[i]);
box.onchange = function (event) {
Expand All @@ -32642,18 +32642,18 @@
scene.add(map);
};
}
var lod = document.getElementById("lod");
var lod = document.getElementById('lod');
lod.onchange = function (event) {
if (map !== undefined) {
map.lod = new lods[lod.selectedIndex][1]();
}
};
for (var i = 0; i < lods.length; i++) {
var option = document.createElement("option");
var option = document.createElement('option');
option.innerHTML = lods[i][0];
lod.appendChild(option);
}
var mode = document.getElementById("mode");
var mode = document.getElementById('mode');
mode.onchange = function (event) {
if (map !== undefined) {
scene.remove(map);
Expand All @@ -32662,30 +32662,30 @@
}
};
for (var i = 0; i < modes.length; i++) {
var option = document.createElement("option");
var option = document.createElement('option');
option.innerHTML = modes[i][0];
option.value = modes[i][1];
mode.appendChild(option);
}
var providerColor = document.getElementById("providerColor");
var providerColor = document.getElementById('providerColor');
providerColor.onchange = function (event) {
if (map !== undefined) {
map.setProvider(providers[event.target.selectedIndex][1]);
}
};
for (var i = 0; i < providers.length; i++) {
var option = document.createElement("option");
var option = document.createElement('option');
option.innerHTML = providers[i][0];
providerColor.appendChild(option);
}
var providerHeight = document.getElementById("providerHeight");
var providerHeight = document.getElementById('providerHeight');
providerHeight.onchange = function (event) {
if (map !== undefined) {
map.setHeightProvider(providers[event.target.selectedIndex][1]);
}
};
for (var i = 0; i < providers.length; i++) {
var option = document.createElement("option");
var option = document.createElement('option');
option.innerHTML = providers[i][0];
providerHeight.appendChild(option);
}
Expand Down Expand Up @@ -32733,17 +32733,17 @@
exposure: 0.5
};
const uniforms = sky.material.uniforms;
uniforms["turbidity"].value = effectController.turbidity;
uniforms["rayleigh"].value = effectController.rayleigh;
uniforms["mieCoefficient"].value = effectController.mieCoefficient;
uniforms["mieDirectionalG"].value = effectController.mieDirectionalG;
uniforms['turbidity'].value = effectController.turbidity;
uniforms['rayleigh'].value = effectController.rayleigh;
uniforms['mieCoefficient'].value = effectController.mieCoefficient;
uniforms['mieDirectionalG'].value = effectController.mieDirectionalG;
var theta = Math.PI * (effectController.inclination - 0.5);
var phi = 2 * Math.PI * (effectController.azimuth - 0.5);
var sun = new Vector3();
sun.x = Math.cos(phi);
sun.y = Math.sin(phi) * Math.sin(theta);
sun.z = Math.sin(phi) * Math.cos(theta);
uniforms["sunPosition"].value.copy(sun);
uniforms['sunPosition'].value.copy(sun);
return sky;
}

Expand Down
8 changes: 3 additions & 5 deletions example/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -31290,7 +31290,7 @@
return new Vector3(-Math.cos(rotX + Math.PI) * cos, Math.sin(rotY), Math.sin(rotX + Math.PI) * cos);
}
static mapboxAltitude(color) {
return ((color.r * 255.0 * 65536.0 + color.g * 255.0 * 256.0 + color.b * 255.0) * 0.1) - 10000.0;
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;
Expand Down Expand Up @@ -32514,7 +32514,7 @@
MapBoxProvider.STYLE = 100;
MapBoxProvider.MAP_ID = 101;

var canvas = document.getElementById("canvas");
var canvas = document.getElementById('canvas');
const SPHERE = 0;
const PLANE = 1;
const scenes = [createWorldScene(), createMapScene()];
Expand All @@ -32528,9 +32528,7 @@
scene.background = new Color(0x000000);
var loader = new TextureLoader();
loader.load('2k_earth_daymap.jpg', function (texture) {
var sphere = new Mesh(new SphereGeometry(UnitsUtils.EARTH_RADIUS, 256, 256), new MeshBasicMaterial({
map: texture
}));
var sphere = new Mesh(new SphereGeometry(UnitsUtils.EARTH_RADIUS, 256, 256), new MeshBasicMaterial({ map: texture }));
scene.add(sphere);
});
var camera = new PerspectiveCamera(60, 1, 0.01, 1e8);
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "geo-three",
"version": "0.1.10",
"version": "0.1.11",
"type": "module",
"description": "geo-three is library for tile based geographic map layers in with three.js supporting selective loading/unloading of real-time generated 3D tiles",
"main": "build/Main.d.ts",
Expand All @@ -17,11 +17,11 @@
"url": "https://github.com/tentone/geothree.git"
},
"scripts": {
"build-example": "rollup -c rollup.example.js",
"start": "rollup -c rollup.dev.js --watch",
"start": "npm run examples && http-server example",
"examples": "rollup -c rollup.example.js",
"build": "rollup -c rollup.config.js",
"docs": "typedoc --out docs ./source/Main.ts",
"pub": "npm run build && npm run docs && npm publish --access public .",
"pub": "npm run build && npm run docs && npm run examples && npm publish --access public .",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts --fix ."
},
Expand All @@ -44,7 +44,6 @@
"devDependencies": {
"@rollup/plugin-strip": "3.0.2",
"@rollup/plugin-typescript": "10.0.1",
"@rollup/plugin-html": "1.0.1",
"@rollup/plugin-node-resolve": "15.0.1",
"@types/offscreencanvas": "2019.7.0",
"@types/three": "^0.146.0",
Expand All @@ -55,10 +54,9 @@
"eslint-plugin-tsdoc": "0.2.17",
"eslint-plugin-typescript": "0.14.0",
"rollup": "3.8.1",
"rollup-plugin-livereload": "2.0.5",
"rollup-plugin-serve": "2.0.2",
"three": "^0.147.0",
"typedoc": "0.23.23",
"typescript": "4.9.4"
"typescript": "4.9.4",
"http-server": "14.1.1"
}
}
30 changes: 0 additions & 30 deletions rollup.dev.js

This file was deleted.

0 comments on commit 89c3ac2

Please sign in to comment.