首页 > 解决方案 > 在 Cesium 中,tileset 上的 Clipping Planes 不起作用

问题描述

当我使用 Cesium 1.49 时,我可以在图块集上剪裁平面。但是当我将 Cesium 更新到 1.50 时,它无法在图块集上裁剪平面。我应该怎么做?

function clipplanes(dig_point){
console.log(dig_point);
var points = dig_point;

var pointsLength = points.length;

// Create center points for each clipping plane
var clippingPlanes = [];
for (var i = 0; i < pointsLength; ++i) {
    var nextIndex = (i + 1) % pointsLength;
    var midpoint = Cesium.Cartesian3.add(points[i], points[nextIndex], new Cesium.Cartesian3());
    midpoint = Cesium.Cartesian3.multiplyByScalar(midpoint, 0.5, midpoint);
    var up = Cesium.Cartesian3.normalize(midpoint, new Cesium.Cartesian3());
    var right = Cesium.Cartesian3.subtract(points[nextIndex], midpoint, new Cesium.Cartesian3());
    right = Cesium.Cartesian3.normalize(right, right);
    var normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3());
    normal = Cesium.Cartesian3.normalize(normal, normal);
    // Compute distance by pretending the plane is at the origin
    var originCenteredPlane = new Cesium.Plane(normal, 0.0);
    var distance = Cesium.Plane.getPointDistance(originCenteredPlane, midpoint);
    clippingPlanes.push(new Cesium.ClippingPlane(normal, distance));
}
globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
    planes : clippingPlanes,
    edgeColor: Cesium.Color.WHITE,
});
//3d tile挖洞
UAVtileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
    planes : clippingPlanes,
    edgeColor: Cesium.Color.WHITE,
});

}

标签: cesium

解决方案


这是开发人员已知的问题:

https://github.com/AnalyticalGraphicsInc/cesium/issues/6600

也在这里讨论:

https://groups.google.com/forum/#!topic/cesium-dev/V3HMRAqToeU

希望这可以帮助。


推荐阅读