Does Callbackproperty destroy primitives behind the scenes?

Hello,

I try to create an entity which change position dynamically.

To make the entity not blinking i use Callbackproperty.

And then i thought, entity is an abstract above primitives. So does it mean that because it use Callbackproperty it destroy behind the scenes all the primitives and recreate them EVERY FRAME?!?!?!

If so, maybe it better for me to not use entity, and to create and recreate the primitives by myself.

Thanks in advance.

@Baruch_Levin yes, the Entity API is great for rendering things that either change constantly, or never change, but isn’t always great for drawing geometry that changes intermittently.

One solution for this would be to use a CallbackProperty while you know a value is going to change, and set the value back to a ConstantProperty once it has finished changing.

Cheers,

Hannah
Cesium Staff

1 Like

If a CallbackProperty returns the same value (strict / reference equality, if that matters) on subsequent calls, will it still perform noticeably worse than ConstantProperty? I had assumed that somebody in that pipeline was clever enough to check if the value had changed.

A frequent pattern that I use is to make entities with CallbackProperties that simply return some external value – say, looking up an entry in a Map of position-arrays for a Polyline’s positions. Then, when an event causes the value to change, I just update the Map entry, and on next render the new value will be used. This seems to perform well.