-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* RD-393 (#10) * Update image links + replace plugin by module (#13) * Add position indicators models * Install maptiler sdk 3 * Update 3D layer to sdk 3 * Add example * Add comments * Add offset * Make linter happy * Refactor mount everest example * Update examples to sdk v3 * Make biome happy * Remove break line * Fix model position issue on projection change animation --------- Co-authored-by: Jonathan Lurie <[email protected]> * Make biome happy * RD-453_telemetry (#12) * Update image links + replace plugin by module (#13) * Add position indicators models * Install maptiler sdk 3 * Update 3D layer to sdk 3 * Add example * Add comments * Add offset * Make linter happy * Refactor mount everest example * Update examples to sdk v3 * Make biome happy * Remove break line * Add telemetry module registration * Make registration works for multiple map instances * Simplify telemetry * Update sdk to v3.0.0-rc.4 * Fix model position issue on projection change animation --------- Co-authored-by: Jonathan Lurie <[email protected]> * RD-492_maplibre-v5.0.0-pre10 (#15) * Update sdk version * Update examples * Bump version * Fix version * Update dependencies * Update demos * Fix dev mode * Clean up --------- Co-authored-by: Jonathan Lurie <[email protected]>
- Loading branch information
1 parent
e42cda9
commit 2d04df7
Showing
22 changed files
with
1,690 additions
and
1,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# MapTiler 3D Models Changelog | ||
|
||
## 2.0.0 | ||
### Other | ||
- Update with MapTiler SDK v3 (globe) | ||
|
||
## 1.0.0 | ||
First release 🎉 | ||
First release 🎉 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>MapTiler 3D</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v2.3.0/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v2.3.0/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
|
||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.min.js"></script> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
|
@@ -26,18 +29,15 @@ | |
right: inherit; | ||
left: 15px; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
|
||
<div id="map"></div> | ||
|
||
<script> | ||
|
||
maptilersdk.config.apiKey = new URLSearchParams(location.search).get("key") ?? alert("Missing URL param with MapTiler API key ?key=XXXXX"); | ||
maptilersdk.config.apiKey = | ||
new URLSearchParams(location.search).get("key") ?? | ||
alert("Missing URL param with MapTiler API key ?key=XXXXX"); | ||
|
||
const newYorkCity = [-73.98918779556983, 40.74072950731568]; | ||
const capeTown = [18.428021658130994, -33.913973526198134]; | ||
|
@@ -46,8 +46,7 @@ | |
const ankara = [32.866609260522345, 39.959329480757354]; | ||
|
||
const map = new maptilersdk.Map({ | ||
container: document.getElementById('map'), | ||
// hash: true, | ||
container: document.getElementById("map"), | ||
style: maptilersdk.MapStyle.STREETS.DARK, | ||
zoom: 9, | ||
center: paris, | ||
|
@@ -56,6 +55,7 @@ | |
terrain: false, | ||
maptilerLogo: true, | ||
terrainExaggeration: 0.001, | ||
projectionControl: true, | ||
}); | ||
|
||
(async () => { | ||
|
@@ -69,29 +69,25 @@ | |
"horizon-fog-blend": 0.1, | ||
"sky-horizon-blend": 1.0, | ||
"atmosphere-blend": 0.5, | ||
}) | ||
}); | ||
|
||
const layer3D = new maptiler3d.Layer3D("custom-3D-layer"); | ||
map.addLayer(layer3D); | ||
|
||
// Increasing the intensity of the ambient light | ||
layer3D.setAmbientLight({intensity: 2}); | ||
// Increasing the intensity of the ambient light | ||
layer3D.setAmbientLight({ intensity: 2 }); | ||
|
||
// Adding a point light | ||
layer3D.addPointLight("point-light", {intensity: 30}); | ||
layer3D.addPointLight("point-light", { intensity: 30 }); | ||
|
||
const originalPlaneID = "plane"; | ||
await layer3D.addMeshFromURL( | ||
originalPlaneID, | ||
"models/plane_a340.glb", | ||
{ | ||
lngLat: paris, | ||
heading: 12, | ||
scale: 5, | ||
altitude: 5000, | ||
altitudeReference: maptiler3d.AltitudeReference.MEAN_SEA_LEVEL, | ||
} | ||
); | ||
await layer3D.addMeshFromURL(originalPlaneID, "models/plane_a340.glb", { | ||
lngLat: paris, | ||
heading: 12, | ||
scale: 5, | ||
altitude: 5000, | ||
altitudeReference: maptiler3d.AltitudeReference.MEAN_SEA_LEVEL, | ||
}); | ||
|
||
const guiObj = { | ||
play: false, | ||
|
@@ -101,17 +97,16 @@ | |
|
||
const gui = new lil.GUI({ width: 500 }); | ||
|
||
gui.add( guiObj, 'tackFlight') | ||
gui.add(guiObj, "tackFlight"); | ||
|
||
gui.add( guiObj, 'play') | ||
.onChange((play) => { | ||
gui.add(guiObj, "play").onChange((play) => { | ||
if (play) { | ||
playAnimation(); | ||
} | ||
}); | ||
|
||
gui.add( guiObj, 'speed', 0, 0.001); | ||
gui.add(guiObj, "speed", 0, 0.001); | ||
|
||
let progress = 0; | ||
|
||
function playAnimation() { | ||
|
@@ -121,8 +116,12 @@ | |
progress = 0; | ||
} | ||
|
||
const position = maptilersdk.math.haversineIntermediateWgs84(paris, ankara, progress); | ||
layer3D.modifyMesh(originalPlaneID, {lngLat: position}); | ||
const position = maptilersdk.math.haversineIntermediateWgs84( | ||
paris, | ||
ankara, | ||
progress | ||
); | ||
layer3D.modifyMesh(originalPlaneID, { lngLat: position }); | ||
|
||
if (guiObj.tackFlight) { | ||
map.setCenter(position); | ||
|
@@ -133,10 +132,8 @@ | |
requestAnimationFrame(playAnimation); | ||
} | ||
} | ||
|
||
|
||
})() | ||
|
||
})(); | ||
</script> | ||
</body> | ||
</html> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>MapTiler 3D JS</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" /> | ||
</head> | ||
|
||
<body> | ||
<h1>MapTiler 3D JS Examples</h1> | ||
<ul> | ||
<li> | ||
<a href="flight.html?key=">Flight</a> | ||
</li> | ||
<li> | ||
<a href="mountains.html?key=">Mountains</a> | ||
</li> | ||
<li> | ||
<a href="multi.html?key=">Multi</a> | ||
</li> | ||
<li> | ||
<a href="plane.html?key=">Plane</a> | ||
</li> | ||
<li> | ||
<a href="point_cad_model01.html?key=">Point Cloud - CAD-like view</a> | ||
</li> | ||
<li> | ||
<a href="point_cloud_dundee.html?key=">Point Cloud - Dundee</a> | ||
</li> | ||
<li> | ||
<a href="point_cloud_NMH.html?key=">Point Cloud - NMH</a> | ||
</li> | ||
<li> | ||
<a href="point_cloud_shore.html?key=">Point Cloud - Shore</a> | ||
</li> | ||
</ul> | ||
|
||
<script type="module"> | ||
document.querySelectorAll("a").forEach((a) => { | ||
a.href += import.meta.env.VITE_API_KEY; | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.