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

Fix polyline collection update when model matrix changes #5327

Merged
merged 2 commits into from
May 16, 2017

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented May 16, 2017

Polyline wasn't updating properly when the PolylineCollection model matrix values changed because it was copying the reference to PolylineCollection.modelMatrix instead of copying the values.

Here is an example that doesn't update in master but updates in this branch.

var viewer = new Cesium.Viewer('cesiumContainer');
var localPolylines = viewer.scene.primitives.add(new Cesium.PolylineCollection());

var lon = -125;
var lat = 35;
var center = new Cesium.Cartesian3();

var localPolyline = localPolylines.add({
    positions : [
        new Cesium.Cartesian3(0.0, 0.0, 0.0),
        new Cesium.Cartesian3(1000000.0, 0.0, 0.0)
    ],
    width : 10.0,
    material : Cesium.Material.fromType(Cesium.Material.PolylineArrowType)
});

setInterval(function() {
    lon += 0.3;
    center = Cesium.Cartesian3.fromDegrees(lon, lat, 0, undefined, center);
    localPolylines.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center, undefined, localPolylines.modelMatrix);
}, 100);

@bagnell
Copy link
Contributor

bagnell commented May 16, 2017

Can you add a test and update CHANGES.md?

@bagnell
Copy link
Contributor

bagnell commented May 16, 2017

Your example doesn't work in master, but its strange that changing the x coordinate of the second point to 1e7 makes it work.

@hpinkos
Copy link
Contributor Author

hpinkos commented May 16, 2017

@bagnell ready. When writing my specs I also found a spot in PolylinePipeline where I needed to normalize a Plane normal

@bagnell bagnell merged commit 41ba0b0 into master May 16, 2017
@bagnell bagnell deleted the polyline-model-matrix branch May 16, 2017 20:13
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

Successfully merging this pull request may close these issues.

2 participants