st/oxr: Add helper functions for action state.

This commit is contained in:
Ryan Pavlik 2020-07-23 17:53:04 -05:00 committed by Rylie Pavlik
parent 4516ed9b22
commit 4d8622728f

View file

@ -12,6 +12,7 @@
#include "util/u_debug.h"
#include "util/u_time.h"
#include "util/u_misc.h"
#include "math/m_vec2.h"
#include "xrt/xrt_compiler.h"
@ -1210,6 +1211,24 @@ oxr_action_cache_update(struct oxr_logger *log,
}
}
static inline bool
oxr_state_equal_bool(const struct oxr_action_state *a, const struct oxr_action_state *b)
{
return a->value.boolean == b->value.boolean;
}
static inline bool
oxr_state_equal_vec1(const struct oxr_action_state *a, const struct oxr_action_state *b)
{
return a->value.vec1.x == b->value.vec1.x;
}
static inline bool
oxr_state_equal_vec2(const struct oxr_action_state *a, const struct oxr_action_state *b)
{
return (a->value.vec2.x == b->value.vec2.x) && (a->value.vec2.y == b->value.vec2.y);
}
#define BOOL_CHECK(NAME) \
if (act_attached->NAME.current.active) { \
active |= true; \