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

Entity disappears when switching material #4096

Closed
lilleyse opened this issue Jul 6, 2016 · 0 comments
Closed

Entity disappears when switching material #4096

lilleyse opened this issue Jul 6, 2016 · 0 comments

Comments

@lilleyse
Copy link
Contributor

lilleyse commented Jul 6, 2016

When you have two entities of the same shape on the screen, one with a color and one with a material, and you change their materials at the same time, the entity with the material disappears. I noticed this while working on #4005. Originally I thought something was wrong with the entity shadows, but it seems to be a wider issue. I plan on investigating more, but if anyone has a hunch let me know. To test, click the first button, then the next, then the last.

var viewer = new Cesium.Viewer('cesiumContainer');

var checkerMaterial = new Cesium.CheckerboardMaterialProperty({
    evenColor : Cesium.Color.RED.withAlpha(0.5),
    oddColor : Cesium.Color.RED.withAlpha(0.0),
    repeat : new Cesium.Cartesian2(5.0, 10.0)
});

var checkerMaterial2 = new Cesium.CheckerboardMaterialProperty({
    evenColor : Cesium.Color.GREEN.withAlpha(0.5),
    oddColor : Cesium.Color.GREEN.withAlpha(0.0),
    repeat : new Cesium.Cartesian2(5.0, 10.0)
});

var checkerMaterial3 = new Cesium.CheckerboardMaterialProperty({
    evenColor : Cesium.Color.BLUE.withAlpha(0.5),
    oddColor : Cesium.Color.BLUE.withAlpha(0.0),
    repeat : new Cesium.Cartesian2(5.0, 10.0)
});

var checkerBox = viewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
    box : {
        dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
        material : checkerMaterial
    }
});

var blueBox = viewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
    box : {
        dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
        material : Cesium.Color.RED
    }
});


Sandcastle.addToolbarButton('Switch first', function() {
    blueBox.box.material = Cesium.Color.GREEN;
});

Sandcastle.addToolbarButton('Switch second', function() {
    checkerBox.box.material = checkerMaterial2;
});

Sandcastle.addToolbarButton('Switch both', function() {
    blueBox.box.material = Cesium.Color.BLUE;
    checkerBox.box.material = checkerMaterial3;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant