I’m attempting to create a section box from a tilesets clipping plane collection, where only the geometry inside the box is visible by pushing/pulling the faces. Similar to below:
To get all 6 faces, I have been creating a clipping plane in each dimension using the tilesets bounding sphere:
private createTilesetClippingPlanes(tileset: Cesium3DTileset): ClippingPlaneCollection {
const boundingSphereRadius = tileset.boundingSphere.radius;
const topPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1), boundingSphereRadius);
topPlane.face = ClippingPlaneFace.Top;
const bottomPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, 1), boundingSphereRadius);
bottomPlane.face = ClippingPlaneFace.Bottom;
const frontPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(-1, 0.0, 0.0), boundingSphereRadius);
frontPlane.face = ClippingPlaneFace.Front;
const backPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(1, 0.0, 0.0), boundingSphereRadius);
backPlane.face = ClippingPlaneFace.Back;
const leftPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, -1, 0.0), boundingSphereRadius);
leftPlane.face = ClippingPlaneFace.Left;
const rightPlane = new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 1, 0.0), boundingSphereRadius);
rightPlane.face = ClippingPlaneFace.Right;
// create the clipping planes
const clippingPlanes: ClippingPlaneCollection = new Cesium.ClippingPlaneCollection({
planes : [
topPlane,
bottomPlane,
frontPlane,
backPlane,
leftPlane,
rightPlane
],
unionClippingRegions: true,
enabled : false
});
return clippingPlanes;
}
I then add the planes to the viewers entity collection, where the dimensions of the plane equal the diameter of the bounding sphere and enable them when I want to section the tileset. I’ve been using this sandcastle to help me out.
In order to achieve this, when a face is pulled/pushed (lets say the top face), the side faces will need their origins updated along with their dimensions updated to either stretch or shrink to the edges of the top face.
But it doesn’t look like I can edit the dimensions / origin of the planes. Is this possible? I have access to the analytics SDK and attempted to use the ClippingPlaneEditor, but this was too restrictive. I’ve also noticed there is a CullingVolume in the SDK but haven’t figured out how to use this yet.
Is there anything I can do to achieve the above (or similar)? Anything in the SDK that can help me out?
Thanks for your time,
Tom