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 models in 2D near the IDL. #3936

Merged
merged 10 commits into from
May 25, 2016
Merged

Fix models in 2D near the IDL. #3936

merged 10 commits into from
May 25, 2016

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented May 19, 2016

Adds another command to each node (when not scene3DOnly). Updates that command to position it on the opposite side of the map. Adds the command only if the bounding sphere intersects the IDL.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 19, 2016

Can we add a this for this? Are you writing tests in this branch or models-2D?

var nodeCommand = {
show : true,
boundingSphere : boundingSphere,
command : command,
pickCommand : pickCommand
pickCommand : pickCommand,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does picking work for models crossing the IDL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So picking works across the IDL even though there is only one pick command?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I see.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 19, 2016

Just those comments.

@bagnell
Copy link
Contributor Author

bagnell commented May 19, 2016

Can we add a this for this? Are you writing tests in this branch or models-2D?

I added tests in models-2D so you don't see them in the diff, but I'll add one with a model crossing the IDL here.

@bagnell
Copy link
Contributor Author

bagnell commented May 19, 2016

@pjcozzi This is ready for another look. There are some failing tests that were caused by #3933. I'll fix them in the models-2D branch. All of the model tests here should pass though.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 19, 2016

Using this code in Sandcastle:

var viewer = new Cesium.Viewer('cesiumContainer', {
    infoBox : false,
    selectionIndicator : false
});

function createModel(url, height) {
    viewer.entities.removeAll();

    var position = Cesium.Cartesian3.fromDegrees(-179.0744619, 44.0503706, height);
    var heading = Cesium.Math.toRadians(135);
    var pitch = 0;
    var roll = 0;
    var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);

    var entity = viewer.entities.add({
        name : url,
        position : position,
        orientation : orientation,
        model : {
            uri : url,
            minimumPixelSize : 128,
            //maximumScale : 20000
        }
    });
    viewer.trackedEntity = entity;
}

var options = [{
    text : 'Aircraft',
    onselect : function() {
        createModel('../../SampleData/models/CesiumAir/Cesium_Air.glb', 5000.0);
    }
}, {
    text : 'Ground vehicle',
    onselect : function() {
        createModel('../../SampleData/models/CesiumGround/Cesium_Ground.glb', 0);
    }
}, {
    text : 'Milk truck',
    onselect : function() {
        createModel('../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck-kmc.glb', 0);
    }
}, {
    text : 'Skinned character',
    onselect : function() {
        createModel('../../SampleData/models/CesiumMan/Cesium_Man.glb', 0);
    }
}];

Sandcastle.addToolbarMenu(options);

Switch to 2D, zoom in a bit, then pan to the left. The model changes orientation and then Cesium throws an exception (only got the exception once though).

ok

@bagnell
Copy link
Contributor Author

bagnell commented May 23, 2016

@pjcozzi This is ready for another look.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 23, 2016

JSHint fails in CI:

Source/Scene/Model.js
line 3164 col 9 'scratchCartographic' is already defined.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 23, 2016

Just got this again when panning left to right (back and forth a few times) in 2D using the above code.

image

@bagnell
Copy link
Contributor Author

bagnell commented May 24, 2016

@pjcozzi I can reproduce that error consistently now after talking offline. The problem is in master as well. It happens when the camera lines up with the IDL. I'm working on a fix but it doesn't need to hold up this PR.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 25, 2016

This is ready since #3953 was merged.

@pjcozzi pjcozzi merged commit ad1f72c into models-2D May 25, 2016
@pjcozzi pjcozzi deleted the models-2D-idl branch May 25, 2016 11:40
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