Revert "Merge branch 'master' of https://github.com/Vindicus999/WiVRn"
This reverts commit6212dccc2b, reversing changes made to80e31b642a.
This commit is contained in:
@@ -18,43 +18,53 @@
|
||||
*/
|
||||
|
||||
#include "htc_face_tracker.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
static XrFacialTrackerHTC make_tracker(xr::instance & inst, xr::session & s, XrFacialTrackingTypeHTC type)
|
||||
xr::htc_face_tracker::htc_face_tracker(instance & inst, session & s, bool eye, bool lip) :
|
||||
s(s)
|
||||
{
|
||||
if (!eye && !lip)
|
||||
return;
|
||||
|
||||
xrCreateFacialTrackerHTC = inst.get_proc<PFN_xrCreateFacialTrackerHTC>("xrCreateFacialTrackerHTC");
|
||||
xrGetFacialExpressionsHTC = inst.get_proc<PFN_xrGetFacialExpressionsHTC>("xrGetFacialExpressionsHTC");
|
||||
xrDestroyFacialTrackerHTC = inst.get_proc<PFN_xrDestroyFacialTrackerHTC>("xrDestroyFacialTrackerHTC");
|
||||
|
||||
XrFacialTrackerCreateInfoHTC create_info{
|
||||
.type = XR_TYPE_FACIAL_TRACKER_CREATE_INFO_HTC,
|
||||
.facialTrackingType = type,
|
||||
.next = nullptr,
|
||||
};
|
||||
auto xrCreateFacialTrackerHTC = inst.get_proc<PFN_xrCreateFacialTrackerHTC>("xrCreateFacialTrackerHTC");
|
||||
XrFacialTrackerHTC id;
|
||||
CHECK_XR(xrCreateFacialTrackerHTC(s, &create_info, &id));
|
||||
return id;
|
||||
|
||||
if (eye)
|
||||
{
|
||||
create_info.facialTrackingType = XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC;
|
||||
xrCreateFacialTrackerHTC(s, &create_info, &this->eye);
|
||||
}
|
||||
if (lip)
|
||||
{
|
||||
create_info.facialTrackingType = XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC;
|
||||
xrCreateFacialTrackerHTC(s, &create_info, &this->lip);
|
||||
}
|
||||
}
|
||||
|
||||
static XrFacialTrackerHTC get_eye_tracker(xr::instance & inst, xr::session & s)
|
||||
xr::htc_face_tracker::~htc_face_tracker()
|
||||
{
|
||||
static XrFacialTrackerHTC res = make_tracker(inst, s, XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC);
|
||||
return res;
|
||||
}
|
||||
static XrFacialTrackerHTC get_lip_tracker(xr::instance & inst, xr::session & s)
|
||||
{
|
||||
static XrFacialTrackerHTC res = make_tracker(inst, s, XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC);
|
||||
return res;
|
||||
}
|
||||
if (!xrDestroyFacialTrackerHTC)
|
||||
return;
|
||||
|
||||
xr::htc_face_tracker::htc_face_tracker(instance & inst, session & s, bool eye, bool lip) :
|
||||
xrGetFacialExpressionsHTC(inst.get_proc<PFN_xrGetFacialExpressionsHTC>("xrGetFacialExpressionsHTC")),
|
||||
eye(eye ? get_eye_tracker(inst, s) : XR_NULL_HANDLE),
|
||||
lip(lip ? get_lip_tracker(inst, s) : XR_NULL_HANDLE)
|
||||
{
|
||||
if (eye)
|
||||
CHECK_XR(xrDestroyFacialTrackerHTC(std::exchange(eye, nullptr)));
|
||||
if (lip)
|
||||
CHECK_XR(xrDestroyFacialTrackerHTC(std::exchange(lip, nullptr)));
|
||||
}
|
||||
|
||||
void xr::htc_face_tracker::get_weights(XrTime time, packet_type & out_expressions)
|
||||
{
|
||||
assert(xrGetFacialExpressionsHTC);
|
||||
if (!(eye || lip) || !xrGetFacialExpressionsHTC)
|
||||
return;
|
||||
|
||||
XrFacialExpressionsHTC expressions{
|
||||
.type = XR_TYPE_FACIAL_EXPRESSIONS_HTC,
|
||||
|
||||
Reference in New Issue
Block a user