Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model with clipping plane doesn't update when edge width changes #6878

Closed
hpinkos opened this issue Aug 3, 2018 · 1 comment
Closed

Model with clipping plane doesn't update when edge width changes #6878

hpinkos opened this issue Aug 3, 2018 · 1 comment

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Aug 3, 2018

var viewer = new Cesium.Viewer('cesiumContainer');
var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 1000);
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll(0, 0, 0));

var clippingPlanes = new Cesium.ClippingPlaneCollection({
    planes : [
        new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0)
    ],
    edgeWidth : 3.0
});

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
    url : '../../SampleData/models/CesiumAir/Cesium_Air.glb',
    modelMatrix : modelMatrix,
    minimumPixelSize : 128,
    clippingPlanes: clippingPlanes
}));

model.readyPromise.then(function(model) {
    // Play and loop all animations at half-speed
    model.activeAnimations.addAll({
        speedup : 0.5,
        loop : Cesium.ModelAnimationLoop.REPEAT
    });

    var camera = viewer.camera;

    // Zoom to model
    var controller = viewer.scene.screenSpaceCameraController;
    var r = 2.0 * Math.max(model.boundingSphere.radius, camera.frustum.near);
    controller.minimumZoomDistance = r * 0.5;

    var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());
    var heading = Cesium.Math.toRadians(230.0);
    var pitch = Cesium.Math.toRadians(-20.0);
    camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, r * 2.0));
}).otherwise(function(error){
    window.alert(error);
});

Sandcastle.addToolbarButton('Change edge width', function() {
    clippingPlanes.edgeWith = 0;
});
@hpinkos
Copy link
Contributor Author

hpinkos commented Aug 3, 2018

Oh no wait, i just had a typo

@hpinkos hpinkos closed this as completed Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant