1. A concise explanation of the problem you're experiencing.
While trying to add a polyline entity with clampToGround set to true, I get a rendering error, and Cesium stops rendering. This is happening on simple iOS Cordova build on an iphoneX.
The rendering error does not happen unless clampToGround is set to true.
Looking through the Cesium code, I traced it to the Primitive.prototype.update function. While updating a groundprimitive in a PrimitiveCollection.
The error thrown in tryAndCatchError is (Full Reponse in attached txt):
statusCode: 0
response: "{\"6-0-0\":[10.662392616271973,26.89437484741211],\"6-0-1\":[6.744882106781006,20.60187530517578],\"6-0-2\":[4.049985408782959,14.190625190734863]…"
responseHeaders: {}
here is the relevant code:
function updateAndRenderPrimitives(scene) {
var frameState = scene._frameState;
//----EXCEPTION THROWN FROM INSIDE HERE-----
scene._groundPrimitives.update(frameState);
...
Primitive.prototype.update = function(frameState) {
if (((!defined(this.geometryInstances)) && (this._va.length === 0)) ||
(defined(this.geometryInstances) && isArray(this.geometryInstances) && this.geometryInstances.length === 0) ||
(!defined(this.appearance)) ||
(frameState.mode !== SceneMode.SCENE3D && frameState.scene3DOnly) ||
(!frameState.passes.render && !frameState.passes.pick)) {
return;
}
//----EXCEPTION THROWN HERE-----
if (defined(this._error)) {
throw this._error;
}
if (defined(this.rtcCenter) && !frameState.scene3DOnly) {
throw new DeveloperError('RTC rendering is only available for 3D only scenes.');
}
if (this._state === PrimitiveState.FAILED) {
return;
}
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
(from https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polyline.html)
var viewer = new Cesium.Viewer('cesiumContainer');
var redLine = viewer.entities.add({
name : 'Red line on terrain',
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([-75, 35,
-125, 35]),
width : 5,
material : Cesium.Color.RED,
clampToGround : true
}
});
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I am attempting to evaluate Cesium for my company. I am trying to dynamically draw paths on the ground by touching points on the screen. This works without clampToGround set but not with it set. Even the most simple example of adding a polyline entity with clampToGround set results in a crash (rendering stopped undefined [object object])
4. The Cesium version you're using, your operating system and browser.
Cesium v1.55. iOS12. Mobile Safari. Cordova build 8.1.2
Reponse.txt (538 KB)