reduce log spam in Vive plugins

This commit is contained in:
Brad Hefta-Gaub 2016-06-24 10:53:46 -07:00
parent da74114b32
commit 39ff03cfb5
2 changed files with 24 additions and 8 deletions

View file

@ -96,7 +96,9 @@ bool OpenVrDisplayPlugin::internalActivate() {
glm::vec3 uiPos(0.0f, UI_HEIGHT, UI_RADIUS - (0.5f * zSize) - UI_Z_OFFSET); glm::vec3 uiPos(0.0f, UI_HEIGHT, UI_RADIUS - (0.5f * zSize) - UI_Z_OFFSET);
_sensorResetMat = glm::inverse(createMatFromQuatAndPos(glm::quat(), uiPos)); _sensorResetMat = glm::inverse(createMatFromQuatAndPos(glm::quat(), uiPos));
} else { } else {
qDebug() << "OpenVR: error could not get chaperone pointer"; #if DEV_BUILD
qDebug() << "OpenVR: error could not get chaperone pointer";
#endif
} }
return Parent::internalActivate(); return Parent::internalActivate();

View file

@ -64,17 +64,25 @@ vr::IVRSystem* acquireOpenVrSystem() {
if (hmdPresent) { if (hmdPresent) {
Lock lock(mutex); Lock lock(mutex);
if (!activeHmd) { if (!activeHmd) {
qCDebug(displayplugins) << "OpenVR: No vr::IVRSystem instance active, building"; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: No vr::IVRSystem instance active, building";
#endif
vr::EVRInitError eError = vr::VRInitError_None; vr::EVRInitError eError = vr::VRInitError_None;
activeHmd = vr::VR_Init(&eError, vr::VRApplication_Scene); activeHmd = vr::VR_Init(&eError, vr::VRApplication_Scene);
qCDebug(displayplugins) << "OpenVR display: HMD is " << activeHmd << " error is " << eError; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR display: HMD is " << activeHmd << " error is " << eError;
#endif
} }
if (activeHmd) { if (activeHmd) {
qCDebug(displayplugins) << "OpenVR: incrementing refcount"; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: incrementing refcount";
#endif
++refCount; ++refCount;
} }
} else { } else {
qCDebug(displayplugins) << "OpenVR: no hmd present"; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: no hmd present";
#endif
} }
return activeHmd; return activeHmd;
} }
@ -82,10 +90,14 @@ vr::IVRSystem* acquireOpenVrSystem() {
void releaseOpenVrSystem() { void releaseOpenVrSystem() {
if (activeHmd) { if (activeHmd) {
Lock lock(mutex); Lock lock(mutex);
qCDebug(displayplugins) << "OpenVR: decrementing refcount"; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: decrementing refcount";
#endif
--refCount; --refCount;
if (0 == refCount) { if (0 == refCount) {
qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; #if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system";
#endif
vr::VR_Shutdown(); vr::VR_Shutdown();
activeHmd = nullptr; activeHmd = nullptr;
} }
@ -261,7 +273,9 @@ void handleOpenVrEvents() {
default: default:
break; break;
} }
qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; #if DEV_BUILD
qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")";
#endif
} }
} }