| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Slippy Map Tiles (3D Tiles Renderer)</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- Import maps polyfill -->
- <!-- Remove this when import maps will be widely supported -->
- <script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>
-
- <script type="importmap">
- {
- "imports": {
- "threepipe": "./../../dist/index.mjs",
- "@threepipe/plugin-3d-tiles-renderer": "./../../plugins/3d-tiles-renderer/dist/index.mjs"
- }
- }
-
- </script>
- <style id="example-style">
- html, body, #canvas-container, #mcanvas {
- width: 100%;
- height: 100%;
- margin: 0;
- overflow: hidden;
- }
- </style>
- <script type="module" src="../examples-utils/simple-code-preview.mjs"></script>
- <script id="example-script" type="module" lang="ts">
- import {_testFinish, LoadingScreenPlugin, ThreeViewer, SSAAPlugin} from 'threepipe'
- import {SlippyMapTilesLoadPlugin} from '@threepipe/plugin-3d-tiles-renderer'
-
- const viewer = new ThreeViewer({
- canvas: document.getElementById('mcanvas'),
- msaa: true, renderScale: window.devicePixelRatio,
- tonemap: false,
- })
- viewer.addPluginsSync([SlippyMapTilesLoadPlugin, LoadingScreenPlugin, SSAAPlugin])
-
- // todo once loaded small tiles, its not loading back the bigger ones on zoom out
- // also getting weird behaviour sometimes
-
- async function init() {
-
- viewer.scene.mainCamera.position.set(0,0, 20)
- viewer.scene.mainCamera.minNearPlane = 0.1
- viewer.scene.mainCamera.setDirty()
-
- // https://github.com/CesiumGS/3d-tiles-samples
- // from https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/example/data/root.b3dm
- const result = await viewer.load('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
- autoCenter: true,
- autoScale: true,
- autoScaleRadius: 30,
- fileExtension: SlippyMapTilesLoadPlugin.DUMMY_EXT,
- tiles: {
- errorTarget: 1,
- XYZTilesPlugin: {
- projection: 'planar',
- center: true
- },
- }
- })
- viewer.setDirty()
- console.log(result)
- // result.rotation.x = - Math.PI / 2;
- }
- init().finally(_testFinish)
- </script>
- </head>
- <body>
- <div id="canvas-container">
- <canvas id="mcanvas"></canvas>
- </div>
-
- </body>
|