|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
viewer.addPluginsSync([EnvironmentControlsPlugin, SlippyMapTilesLoadPlugin, LoadingScreenPlugin, SSAAPlugin]) |
|
|
viewer.addPluginsSync([EnvironmentControlsPlugin, 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() { |
|
|
async function init() { |
|
|
|
|
|
|
|
|
viewer.scene.mainCamera.position.set(0,0, 20) |
|
|
|
|
|
|
|
|
viewer.scene.mainCamera.controlsMode = 'environment' |
|
|
|
|
|
viewer.scene.mainCamera.position.set(0,0, 200) |
|
|
viewer.scene.mainCamera.lookAt(0,0, 0) |
|
|
viewer.scene.mainCamera.lookAt(0,0, 0) |
|
|
viewer.scene.mainCamera.minNearPlane = 0.1 |
|
|
viewer.scene.mainCamera.minNearPlane = 0.1 |
|
|
viewer.scene.mainCamera.setDirty() |
|
|
viewer.scene.mainCamera.setDirty() |
|
|
viewer.scene.mainCamera.controlsMode = 'environment' |
|
|
|
|
|
viewer.scene.mainCamera.controls.minDistance = 0.3 |
|
|
|
|
|
viewer.scene.mainCamera.controls.maxDistance = 30 |
|
|
|
|
|
|
|
|
viewer.scene.mainCamera.controls.enableDamping = true |
|
|
|
|
|
viewer.scene.mainCamera.controls.minZoom = 0.1 |
|
|
|
|
|
viewer.scene.mainCamera.controls.minDistance = 0.1 |
|
|
|
|
|
viewer.scene.mainCamera.controls.maxDistance = 400 |
|
|
|
|
|
viewer.scene.mainCamera.controls.cameraRadius = 1 |
|
|
|
|
|
viewer.scene.mainCamera.controls.fallbackPlane.normal.set( 0,0 , 1 ); |
|
|
|
|
|
viewer.scene.mainCamera.controls.up.set( 0, 0, 1 ); |
|
|
|
|
|
|
|
|
// https://github.com/CesiumGS/3d-tiles-samples |
|
|
// https://github.com/CesiumGS/3d-tiles-samples |
|
|
// from https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/example/data/root.b3dm |
|
|
// 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', { |
|
|
const result = await viewer.load('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
|
autoCenter: true, |
|
|
autoCenter: true, |
|
|
autoScale: true, |
|
|
autoScale: true, |
|
|
autoScaleRadius: 30, |
|
|
|
|
|
|
|
|
autoScaleRadius: 300, |
|
|
fileExtension: SlippyMapTilesLoadPlugin.DUMMY_EXT, |
|
|
fileExtension: SlippyMapTilesLoadPlugin.DUMMY_EXT, |
|
|
tiles: { |
|
|
tiles: { |
|
|
errorTarget: 1, |
|
|
errorTarget: 1, |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log(result) |
|
|
// result.rotation.x = - Math.PI / 2; |
|
|
// result.rotation.x = - Math.PI / 2; |
|
|
} |
|
|
} |
|
|
_testStart() |
|
|
_testStart() |