"frame-start" event?


Is there an event fired each frame after time/camera modification but before CallbackProperties?

Both clock.onTick and scene.preRender seem to be fired after CallbackProperties.

Thank you.

By CallbackProperties I assume you mean you are using a CallbackProperty assigned to an entity value? Technically those can be called at any time, but the display update loop does call them in the manner that you describe.

The short answer is no, but can you help me understand what the use case is and what you are trying to do?

I’m trying to implement the following.

  • Create entities. For dynamic properties use SampledProperties where possible. Otherwise use CallbackProperties.

  • Let Cesium control animation and camera

  • Each frame:

  1. On “frame-start” event get updated time and camera. Adjust application state accordingly (rather costly calculations).

  2. Let CallbackProperties pull updated application state

If I use scene.preRender or clock.onTick for #1 the app state is updated too late and CallbackProperties pull previous state and thus are 1 frame off of SampledProperties.

I’ve tried to use CallbackProperty of the very first (fake) entity as “frame-start” event to no avail.

Now, I’m about to check in each CallbackProperty if it is the first invocation this frame and fire “frame-start” (and use scene.preRender as “frame-end” to reset).

Can you propose a better solution?

Side note. In some cases I let CallbackProperties evaluate everything they need lazily and memoize results to not repeat calculations. But that “calculate all than pull” approach is simplier and more practical in most cases.

Thank you.