mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:10:45 +02:00
adding code for if oculus is running
This commit is contained in:
parent
09770920a8
commit
c06f2f337e
1 changed files with 70 additions and 64 deletions
|
@ -17,23 +17,27 @@
|
|||
QString OculusAPIPlugin::NAME { "Oculus Rift" };
|
||||
|
||||
OculusAPIPlugin::OculusAPIPlugin() {
|
||||
if (isRunning()) {
|
||||
if (hifi::ovr::available()) {
|
||||
_session = hifi::ovr::acquireRenderSession();
|
||||
}
|
||||
}
|
||||
|
||||
OculusAPIPlugin::~OculusAPIPlugin() {
|
||||
if (isRunning()) {
|
||||
if (hifi::ovr::available() && isRunning()) {
|
||||
hifi::ovr::releaseRenderSession(_session);
|
||||
}
|
||||
}
|
||||
|
||||
bool OculusAPIPlugin::isRunning() const {
|
||||
return (qApp->property(hifi::properties::OCULUS_STORE).toBool());
|
||||
return _session;
|
||||
}
|
||||
|
||||
void OculusAPIPlugin::requestNonceAndUserID(NonceUserIDCallback callback) {
|
||||
#ifdef OCULUS_APP_ID
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_nonceUserIDCallback = callback;
|
||||
ovr_User_GetUserProof();
|
||||
ovr_User_GetLoggedInUser();
|
||||
|
@ -42,7 +46,10 @@ void OculusAPIPlugin::requestNonceAndUserID(NonceUserIDCallback callback) {
|
|||
|
||||
void OculusAPIPlugin::handleOVREvents() {
|
||||
#ifdef OCULUS_APP_ID
|
||||
if (qApp->property(hifi::properties::OCULUS_STORE).toBool()) {
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// pop messages to see if we got a return for an entitlement check
|
||||
ovrMessageHandle message { nullptr };
|
||||
|
||||
|
@ -108,6 +115,5 @@ void OculusAPIPlugin::handleOVREvents() {
|
|||
// free the message handle to cleanup and not leak
|
||||
ovr_FreeMessage(message);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue