diff options
author | Justin Berger <j.david.berger@gmail.com> | 2018-03-16 10:39:26 -0600 |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2018-03-16 10:39:26 -0600 |
commit | e5cc00096e7b0700c75160c62f598a8af412c082 (patch) | |
tree | ea341f6bf2af0609d888c5910a15e323cd24be73 /src/persistent_scene.c | |
parent | fc575131ccf05c605ba567b95851976fad7c5444 (diff) | |
download | libsurvive-e5cc00096e7b0700c75160c62f598a8af412c082.tar.gz libsurvive-e5cc00096e7b0700c75160c62f598a8af412c082.tar.bz2 |
Refactored how the persistence (now called sensor_activations) worked
Diffstat (limited to 'src/persistent_scene.c')
-rw-r--r-- | src/persistent_scene.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/persistent_scene.c b/src/persistent_scene.c deleted file mode 100644 index cfc389f..0000000 --- a/src/persistent_scene.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "persistent_scene.h" -#include "linmath.h" -#include <stdlib.h> -#include <string.h> -#include <survive.h> - -bool PersistentScene_isStillValid(const PersistentScene *self, uint32_t timecode_now, uint32_t idx, int lh) { - const uint32_t *data_timecode = self->timecode[idx][lh]; - return !(timecode_now - data_timecode[0] > self->tolerance || timecode_now - data_timecode[1] > self->tolerance); -} - -void PersistentScene_add(PersistentScene *self, SurviveObject *so, PoserDataLight *lightData) { - int axis = (lightData->acode & 1); - uint32_t *data_timecode = &self->timecode[lightData->sensor_id][lightData->lh][axis]; - FLT *angle = &self->angles[lightData->sensor_id][lightData->lh][axis]; - - *angle = lightData->angle; - *data_timecode = lightData->timecode; -} - -void PersistentScene_ForEachCorrespondence(PersistentScene *self, PersistentScene_ForEachCorrespondence_fn fn, - SurviveObject *so, uint32_t timecode_now, void *user) { - for (int lh = 0; lh < NUM_LIGHTHOUSES; lh++) { - for (size_t i = 0; i < so->sensor_ct; i++) { - if (PersistentScene_isStillValid(self, timecode_now, i, lh)) { - double *pts = self->angles[i][lh]; - fn(so, lh, i, pts, user); - } - } - } -} - -void PersistentScene_ctor(PersistentScene *self) { - memset(self, 0, sizeof(PersistentScene)); - self->tolerance = 1500000; -} |