mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:17:34 +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" };
|
QString OculusAPIPlugin::NAME { "Oculus Rift" };
|
||||||
|
|
||||||
OculusAPIPlugin::OculusAPIPlugin() {
|
OculusAPIPlugin::OculusAPIPlugin() {
|
||||||
if (isRunning()) {
|
if (hifi::ovr::available()) {
|
||||||
_session = hifi::ovr::acquireRenderSession();
|
_session = hifi::ovr::acquireRenderSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OculusAPIPlugin::~OculusAPIPlugin() {
|
OculusAPIPlugin::~OculusAPIPlugin() {
|
||||||
if (isRunning()) {
|
if (hifi::ovr::available() && isRunning()) {
|
||||||
hifi::ovr::releaseRenderSession(_session);
|
hifi::ovr::releaseRenderSession(_session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OculusAPIPlugin::isRunning() const {
|
bool OculusAPIPlugin::isRunning() const {
|
||||||
return (qApp->property(hifi::properties::OCULUS_STORE).toBool());
|
return _session;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OculusAPIPlugin::requestNonceAndUserID(NonceUserIDCallback callback) {
|
void OculusAPIPlugin::requestNonceAndUserID(NonceUserIDCallback callback) {
|
||||||
#ifdef OCULUS_APP_ID
|
#ifdef OCULUS_APP_ID
|
||||||
|
if (!isRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_nonceUserIDCallback = callback;
|
_nonceUserIDCallback = callback;
|
||||||
ovr_User_GetUserProof();
|
ovr_User_GetUserProof();
|
||||||
ovr_User_GetLoggedInUser();
|
ovr_User_GetLoggedInUser();
|
||||||
|
@ -42,7 +46,10 @@ void OculusAPIPlugin::requestNonceAndUserID(NonceUserIDCallback callback) {
|
||||||
|
|
||||||
void OculusAPIPlugin::handleOVREvents() {
|
void OculusAPIPlugin::handleOVREvents() {
|
||||||
#ifdef OCULUS_APP_ID
|
#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
|
// pop messages to see if we got a return for an entitlement check
|
||||||
ovrMessageHandle message { nullptr };
|
ovrMessageHandle message { nullptr };
|
||||||
|
|
||||||
|
@ -108,6 +115,5 @@ void OculusAPIPlugin::handleOVREvents() {
|
||||||
// free the message handle to cleanup and not leak
|
// free the message handle to cleanup and not leak
|
||||||
ovr_FreeMessage(message);
|
ovr_FreeMessage(message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue