Is there a way to force the update of a primitive? eg when the geometryInstances have changed? I have tried quite a few hacks but nothing seems to be working. Looking at the implementation of Polygon and some other direct primitive implementations, it looks like they need to be recreated each time (this._createPrimitive flag).
I am trying to generally enhance Primitves so that any geometry contained in a primitive can be edited, whilst keeping the reference to the primitive. My first assesment is that it is currently a bad idea.
In general, you can’t modify the positions, e.g., add or remove, in a primitive without recreating it, which allows Cesium to combine primitives for efficient rendering. Have you seen the geometries tutorial? This is explained in more detail there.
Yes. I got confused by polygon and extentprimitive, etc... And the lack of one for ellipse and circle. Now i understand and i extended this implementation for the ones i was missing.
Thanks.
If you are using either Viewer or CesiumWidget, you can just call render(). But unless you are using a custom render loop, this happens automatically every frame. While you can change the modelMatrix of an existing primitive (as long as it’s a single geometry and you’re in 3D), you can update the geometry instances; you need to remove that Primitive and create a new one. The “fix” for this is adding dynamic buffers to the Geometry system; but that is a few months out.
I'm seeing posts as far back as 2013 that in order to update cesium primitives, the primitive needs to be removed from the scene and re-added after the update. I see that there is a feature called dynamic buffering that would allow the update of the primitive, but I can't find the status on this feature. Can a primitive's geometry and/or appearance be updated without first removing the primitive from the scene?
It looks as of today, the only way to update primitives is to recreate them. There’s some more discussion and ideas for improvement in this issue as well: