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

Models broken when Globe is disabled #5638

Closed
mramato opened this issue Jul 17, 2017 · 1 comment
Closed

Models broken when Globe is disabled #5638

mramato opened this issue Jul 17, 2017 · 1 comment

Comments

@mramato
Copy link
Contributor

mramato commented Jul 17, 2017

The below code snippet fails because globe is false, removing the line fixes the example. This is a regression but I'm not sure which version is stopped working in. (Note you have to remove the line, not set it to true because of the way Viewer options work.)

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


var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 5000);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

var entity = viewer.entities.add({
    position : position,
    orientation : orientation,
    model : {
        uri : '../../SampleData/models/CesiumAir/Cesium_Air.glb',
        minimumPixelSize : 128,
        maximumScale : 20000
    }
});
viewer.trackedEntity = entity;

Here's the callstack

TypeError: Cannot read property 'terrainProviderChanged' of undefined
    at Scene.get (http://cesiumjs.org/Cesium/Source/Scene/Scene.js:919:34)
    at new Model (http://cesiumjs.org/Cesium/Source/Scene/Model.js:532:18)
    at Function.Model.fromGltf (http://cesiumjs.org/Cesium/Source/Scene/Model.js:1203:21)
    at ModelVisualizer.update (http://cesiumjs.org/Cesium/Source/DataSources/ModelVisualizer.js:121:31)
    at DataSourceDisplay.update (http://cesiumjs.org/Cesium/Source/DataSources/DataSourceDisplay.js:262:37)
    at Viewer._onTick (http://cesiumjs.org/Cesium/Source/Widgets/Viewer/Viewer.js:1572:49)
    at Event.raiseEvent (http://cesiumjs.org/Cesium/Source/Core/Event.js:142:30)
    at Clock.tick (http://cesiumjs.org/Cesium/Source/Core/Clock.js:308:21)
    at CesiumWidget.render (http://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:685:43)
    at render (http://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:71:32)

This is probably multiple trivial bugs. Scene should not access the globe unless it's defined and Model should not subscribe to the terrainChanged event if it's undefined.

@mramato
Copy link
Contributor Author

mramato commented Jul 17, 2017

@ggetz this is probably a quickie if you have some time.

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