I’m writing a custom data source in rust and compiling it to wasm.
#[wasm_bindgen]
pub struct SatelliteDataSource {
satellites: Option<BTreeSet<Satellite>>,
changed_event: Event,
clock: DataSourceClock,
clustering: EntityCluster,
entities: EntityCollection,
error_event: Event,
is_loading: bool,
loading_event: Event,
name: String,
show: bool,
}
For the most part this seems to be working well. The problem is that my update function seems to be getting called on every single tick of the viewer when I really only want to update my data once every second or so. I am re-calculating the position of the entities here on every tick. I’m wanting to use an interpolated position property to try and reduce the load on my data source since it runs on the main thread and blocks the viewer causing poor performance.
It’s my understanding that the DataSourceClock class is what should be used to modify the tick rate of this data source.
Here’s what settings i’m using currently.
let clock = new DataSourceClock();
clock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
clock.multiplier = 1.0;
clock.currentTime = JulianDate.fromDate(new Date());
let sats = new SatelliteDataSource(clock);
If I understand it correctly this should tick once a second?
however tick still seems to be getting called every frame which is not what I want.