Skip to content

Commit

Permalink
Using facial tracking handles in a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Oct 25, 2024
1 parent 96baf8b commit 7443f7c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions src/devices/openxrheadset/OpenXrInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,10 @@ bool OpenXrInterface::prepareXrSession()
.next = NULL,
.facialTrackingType = XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC,
};
result = m_pimpl->pfn_xrCreateFacialTrackerHTC(m_pimpl->session, &facial_tracker_create_info, m_pimpl->htc_eye_facial_tracker);
result = m_pimpl->pfn_xrCreateFacialTrackerHTC(m_pimpl->session, &facial_tracker_create_info, &m_pimpl->htc_eye_facial_tracker);
if (!m_pimpl->checkXrOutput(result, "Failed to create eye facial tracker! Avoiding using it."))
{
m_pimpl->htc_eye_facial_tracker = nullptr;
m_pimpl->htc_eye_facial_tracking_supported = false;
}
else
{
Expand All @@ -549,10 +549,10 @@ bool OpenXrInterface::prepareXrSession()
.next = NULL,
.facialTrackingType = XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC,
};
result = m_pimpl->pfn_xrCreateFacialTrackerHTC(m_pimpl->session, &facial_tracker_create_info, m_pimpl->htc_lip_facial_tracker);
result = m_pimpl->pfn_xrCreateFacialTrackerHTC(m_pimpl->session, &facial_tracker_create_info, &m_pimpl->htc_lip_facial_tracker);
if (!m_pimpl->checkXrOutput(result, "Failed to create lip facial tracker! Avoiding using it."))
{
m_pimpl->htc_lip_facial_tracker = nullptr;
m_pimpl->htc_lip_facial_tracking_supported = false;
}
else
{
Expand Down Expand Up @@ -1203,15 +1203,15 @@ void OpenXrInterface::updateXrActions()
}
}

if (m_pimpl->htc_eye_facial_tracker)
if (m_pimpl->htc_eye_facial_tracking_supported)
{
XrFacialExpressionsHTC expressions = { .type = XR_TYPE_FACIAL_EXPRESSIONS_HTC,
.next = NULL,
.isActive = XR_TRUE,
.sampleTime = m_pimpl->frame_state.predictedDisplayTime,
.expressionCount = static_cast<uint32_t>(m_pimpl->htc_eye_expressions.size()),
.expressionWeightings = m_pimpl->htc_eye_expressions.data() };
result = m_pimpl->pfn_xrGetFacialExpressionsHTC(*m_pimpl->htc_eye_facial_tracker, &expressions);
result = m_pimpl->pfn_xrGetFacialExpressionsHTC(m_pimpl->htc_eye_facial_tracker, &expressions);
if (!m_pimpl->checkXrOutput(result, "Failed to get the facial expressions of the eye tracker!") || !expressions.isActive)
{
if (!expressions.isActive)
Expand All @@ -1222,15 +1222,15 @@ void OpenXrInterface::updateXrActions()
}
}

if (m_pimpl->htc_lip_facial_tracker)
if (m_pimpl->htc_lip_facial_tracking_supported)
{
XrFacialExpressionsHTC expressions = { .type = XR_TYPE_FACIAL_EXPRESSIONS_HTC,
.next = NULL,
.isActive = XR_TRUE,
.sampleTime = m_pimpl->frame_state.predictedDisplayTime,
.expressionCount = static_cast<uint32_t>(m_pimpl->htc_lip_expressions.size()),
.expressionWeightings = m_pimpl->htc_lip_expressions.data() };
result = m_pimpl->pfn_xrGetFacialExpressionsHTC(*m_pimpl->htc_lip_facial_tracker, &expressions);
result = m_pimpl->pfn_xrGetFacialExpressionsHTC(m_pimpl->htc_lip_facial_tracker, &expressions);
if (!m_pimpl->checkXrOutput(result, "Failed to get the facial expressions of the lip tracker!") || !expressions.isActive)
{
if (!expressions.isActive)
Expand Down Expand Up @@ -2012,12 +2012,12 @@ bool OpenXrInterface::shouldResetLocalReferenceSpace()

bool OpenXrInterface::eyeExpressionsSupported() const
{
return m_pimpl->htc_eye_facial_tracker;
return m_pimpl->htc_eye_facial_tracking_supported;
}

bool OpenXrInterface::lipExpressionsSupported() const
{
return m_pimpl->htc_lip_facial_tracker;
return m_pimpl->htc_lip_facial_tracking_supported;
}

const std::vector<float>& OpenXrInterface::eyeExpressions() const
Expand Down Expand Up @@ -2054,16 +2054,16 @@ void OpenXrInterface::close()
{
m_pimpl->closing = true;

if (m_pimpl->htc_eye_facial_tracker)
if (m_pimpl->htc_eye_facial_tracking_supported)
{
m_pimpl->pfn_xrDestroyFacialTrackerHTC(*m_pimpl->htc_eye_facial_tracker);
m_pimpl->htc_eye_facial_tracker = nullptr;
m_pimpl->pfn_xrDestroyFacialTrackerHTC(m_pimpl->htc_eye_facial_tracker);
m_pimpl->htc_eye_facial_tracking_supported = false;
}

if (m_pimpl->htc_lip_facial_tracker)
if (m_pimpl->htc_lip_facial_tracking_supported)
{
m_pimpl->pfn_xrDestroyFacialTrackerHTC(*m_pimpl->htc_lip_facial_tracker);
m_pimpl->htc_lip_facial_tracker = nullptr;
m_pimpl->pfn_xrDestroyFacialTrackerHTC(m_pimpl->htc_lip_facial_tracker);
m_pimpl->htc_lip_facial_tracking_supported = false;
}

if (m_pimpl->glFrameBufferId != 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/devices/openxrheadset/impl/OpenXrInterfaceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ class OpenXrInterface::Implementation
PFN_xrGetFacialExpressionsHTC pfn_xrGetFacialExpressionsHTC = NULL;

// Handles for eye and lip tracking
XrFacialTrackerHTC* htc_eye_facial_tracker = nullptr;
XrFacialTrackerHTC* htc_lip_facial_tracker = nullptr;
XrFacialTrackerHTC htc_eye_facial_tracker = XR_NULL_HANDLE;
XrFacialTrackerHTC htc_lip_facial_tracker = XR_NULL_HANDLE;

// Stucts to store the facial expressions
std::vector<float> htc_eye_expressions;
Expand Down

0 comments on commit 7443f7c

Please sign in to comment.