High update rate

Hi

I have a scenario when i update my primitives quite fast.

In this scenario I’m getting an exception from time time of “Cannot read property ‘0’ of undefined” at z.getGeometryInstanceAttributes.

From looking in the code https://github.com/AnalyticalGraphicsInc/cesium/blob/1.0/Source/Scene/Primitive.js#L1079

I can see that the primitive in some state that the defined check at start passed but _perInstanceAttributeLocations is still undefined.

Any ideas ?

Nir

Hi Nir,

Does constructing the primitive with “asynchronous : false” fix the problem?

Patrick

Hi
It’s fixed the problem but created a new one. the user can’t pan or zoom while data is updated…

Any way to prioritize user input ?

Nir

When async is false, the work is done in the main thread so it is going to block user input. We’re going to do some optimizations here in the next several months, but it might get 30-60% faster, not something like 10x faster.

When async is true (default), you are probably coming across a bug in Cesium. Can you reproduce it in Chrome and Firefox? Can you submit an issue with a minimal code example to reproduce it?

Patrick

You probably want to use asynchronous but check if Primitive.ready is true before calling getGeometryInstanceAttributes. When loading geometry asynchronously, the instance attributes aren’t available until Primitive.ready is true. The widget.scene.preRender event would be the best place to add that check and your code using it.

Can getGeometryInstanceAttributes throw if ready if false like Model does?

Patrick

It already does, as a DeveloperError (which is not there if the minified version is being used). Maybe it should be a runtime error instead?

Nah, it sounds like a developer error. Long-term, we may even be able to batch these up so users don’t have to check for ready, but I can’t justify it right now.