mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 03:47:56 +02:00
get actual name for OpenVrDispayPlugin
This commit is contained in:
parent
1bc8484a4b
commit
1bae22fed0
6 changed files with 29 additions and 19 deletions
|
@ -410,6 +410,15 @@ void OpenVrDisplayPlugin::init() {
|
||||||
emit deviceConnected(getName());
|
emit deviceConnected(getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString OpenVrDisplayPlugin::getName() const {
|
||||||
|
std::string headsetName = getOpenVrDeviceName();
|
||||||
|
if (headsetName == "HTC") {
|
||||||
|
headsetName += " Vive";
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::fromStdString(headsetName);
|
||||||
|
}
|
||||||
|
|
||||||
bool OpenVrDisplayPlugin::internalActivate() {
|
bool OpenVrDisplayPlugin::internalActivate() {
|
||||||
if (!_system) {
|
if (!_system) {
|
||||||
_system = acquireOpenVrSystem();
|
_system = acquireOpenVrSystem();
|
||||||
|
@ -444,7 +453,6 @@ bool OpenVrDisplayPlugin::internalActivate() {
|
||||||
|
|
||||||
_openVrDisplayActive = true;
|
_openVrDisplayActive = true;
|
||||||
_container->setIsOptionChecked(StandingHMDSensorMode, true);
|
_container->setIsOptionChecked(StandingHMDSensorMode, true);
|
||||||
|
|
||||||
_system->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
|
_system->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
|
||||||
// Recommended render target size is per-eye, so double the X size for
|
// Recommended render target size is per-eye, so double the X size for
|
||||||
// left + right eyes
|
// left + right eyes
|
||||||
|
|
|
@ -36,7 +36,7 @@ class OpenVrDisplayPlugin : public HmdDisplayPlugin {
|
||||||
using Parent = HmdDisplayPlugin;
|
using Parent = HmdDisplayPlugin;
|
||||||
public:
|
public:
|
||||||
bool isSupported() const override;
|
bool isSupported() const override;
|
||||||
const QString getName() const override { return NAME; }
|
const QString getName() const override;
|
||||||
|
|
||||||
glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
||||||
glm::mat4 getCullingProjection(const glm::mat4& baseProjection) const override;
|
glm::mat4 getCullingProjection(const glm::mat4& baseProjection) const override;
|
||||||
|
|
|
@ -66,6 +66,22 @@ bool oculusViaOpenVR() {
|
||||||
return enableDebugOpenVR && isOculusPresent() && vr::VR_IsHmdPresent();
|
return enableDebugOpenVR && isOculusPresent() && vr::VR_IsHmdPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getOpenVrDeviceName() {
|
||||||
|
auto system = acquireOpenVrSystem();
|
||||||
|
std::string trackingSystemName = "";
|
||||||
|
if (system) {
|
||||||
|
uint32_t HmdTrackingIndex = 0;
|
||||||
|
uint32_t bufferLength = system->GetStringTrackedDeviceProperty(HmdTrackingIndex, vr::Prop_TrackingSystemName_String, NULL, 0, NULL);
|
||||||
|
if (bufferLength > 0) {
|
||||||
|
char* stringBuffer = new char[bufferLength];
|
||||||
|
system->GetStringTrackedDeviceProperty(HmdTrackingIndex, vr::Prop_ManufacturerName_String, stringBuffer, bufferLength, NULL);
|
||||||
|
trackingSystemName = stringBuffer;
|
||||||
|
delete[] stringBuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return trackingSystemName;
|
||||||
|
}
|
||||||
|
|
||||||
bool openVrSupported() {
|
bool openVrSupported() {
|
||||||
static const QString DEBUG_FLAG("HIFI_DEBUG_OPENVR");
|
static const QString DEBUG_FLAG("HIFI_DEBUG_OPENVR");
|
||||||
static bool enableDebugOpenVR = QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG);
|
static bool enableDebugOpenVR = QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <controllers/Forward.h>
|
#include <controllers/Forward.h>
|
||||||
#include <plugins/Forward.h>
|
#include <plugins/Forward.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
bool oculusViaOpenVR(); // is the user using Oculus via OpenVR
|
bool oculusViaOpenVR(); // is the user using Oculus via OpenVR
|
||||||
bool openVrSupported();
|
bool openVrSupported();
|
||||||
|
@ -26,6 +27,7 @@ void enableOpenVrKeyboard(PluginContainer* container);
|
||||||
void disableOpenVrKeyboard();
|
void disableOpenVrKeyboard();
|
||||||
bool isOpenVrKeyboardShown();
|
bool isOpenVrKeyboardShown();
|
||||||
QString getVrSettingString(const char* section, const char* setting);
|
QString getVrSettingString(const char* section, const char* setting);
|
||||||
|
std::string getOpenVrDeviceName();
|
||||||
|
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
|
|
|
@ -334,21 +334,6 @@ ViveControllerManager::InputDevice::InputDevice(vr::IVRSystem*& system) :
|
||||||
_configStringMap[Config::FeetHipsChestAndShoulders] = QString("FeetHipsChestAndShoulders");
|
_configStringMap[Config::FeetHipsChestAndShoulders] = QString("FeetHipsChestAndShoulders");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ViveControllerManager::InputDevice::getTrackingSystemName() {
|
|
||||||
std::string trackingSystemName = "";
|
|
||||||
if (_system) {
|
|
||||||
uint32_t HmdTrackingIndex = 0;
|
|
||||||
uint32_t bufferLength = _system->GetStringTrackedDeviceProperty(HmdTrackingIndex, vr::Prop_TrackingSystemName_String, NULL, 0, NULL);
|
|
||||||
if (bufferLength > 0) {
|
|
||||||
char* stringBuffer = new char[bufferLength];
|
|
||||||
_system->GetStringTrackedDeviceProperty(HmdTrackingIndex, vr::Prop_ManufacturerName_String, stringBuffer, bufferLength, NULL);
|
|
||||||
trackingSystemName = stringBuffer;
|
|
||||||
delete[] stringBuffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return trackingSystemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||||
_poseStateMap.clear();
|
_poseStateMap.clear();
|
||||||
_buttonPressedMap.clear();
|
_buttonPressedMap.clear();
|
||||||
|
@ -356,7 +341,7 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
|
||||||
_trackedControllers = 0;
|
_trackedControllers = 0;
|
||||||
|
|
||||||
if (_headsetName == "") {
|
if (_headsetName == "") {
|
||||||
_headsetName = getTrackingSystemName();
|
_headsetName = getOpenVrDeviceName();
|
||||||
if (_headsetName == "HTC") {
|
if (_headsetName == "HTC") {
|
||||||
_headsetName += " Vive";
|
_headsetName += " Vive";
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ private:
|
||||||
void calibrateOrUncalibrate(const controller::InputCalibrationData& inputCalibration);
|
void calibrateOrUncalibrate(const controller::InputCalibrationData& inputCalibration);
|
||||||
void calibrate(const controller::InputCalibrationData& inputCalibration);
|
void calibrate(const controller::InputCalibrationData& inputCalibration);
|
||||||
void uncalibrate();
|
void uncalibrate();
|
||||||
std::string getTrackingSystemName();
|
|
||||||
void sendUserActivityData(QString activity);
|
void sendUserActivityData(QString activity);
|
||||||
void configureCalibrationSettings(const QJsonObject configurationSettings);
|
void configureCalibrationSettings(const QJsonObject configurationSettings);
|
||||||
QJsonObject configurationSettings();
|
QJsonObject configurationSettings();
|
||||||
|
|
Loading…
Reference in a new issue