Created
August 28, 2020 13:11
-
-
Save fredj/47b6c57c0f89200fdfd750b817153677 to your computer and use it in GitHub Desktop.
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
// Grant CesiumJS access to your ion assets | |
Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNzg2OTI5Ni1hOTY2LTRjZDYtYjdlMy1lZjM2YTlhNzU3YWIiLCJpZCI6MTg3NTIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NzQzNTAyNTB9.42EaQ9sZ9b8Qa3_W5c4opP_ARS3LYY9c-xAz9g_UrkY"; | |
var viewer = new Cesium.Viewer("cesiumContainer"); | |
var location = Cesium.Cartesian3.fromDegrees(7.05468, 46.61793); | |
var plane = Cesium.Plane.transform(Cesium.Plane.ORIGIN_ZX_PLANE, Cesium.Transforms.eastNorthUpToFixedFrame(location)); | |
var ids = [68881, 139225]; | |
for (var i; i < ids.length; i++) { | |
var tileset = viewer.scene.primitives.add( | |
new Cesium.Cesium3DTileset({ | |
url: Cesium.IonResource.fromAssetId(ids[i]), | |
}) | |
); | |
tileset.readyPromise | |
.then(function () { | |
viewer.zoomTo(tileset); | |
tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({ | |
modelMatrix: Cesium.Matrix4.inverse(tileset.root.computedTransform, new Cesium.Matrix4()), | |
planes: [ | |
Cesium.ClippingPlane.fromPlane(plane) | |
], | |
edgeWidth: 5.0 | |
}); | |
}) | |
.otherwise(function (error) { | |
console.log(error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment