Merge branch 'master' of http://github.com/highfidelity/hifi into taapre

This commit is contained in:
Olivier Prat 2018-04-25 09:19:21 +02:00
commit f332849d9a
13 changed files with 73 additions and 28 deletions

View file

@ -380,10 +380,15 @@ void EntityServer::trackSend(const QUuid& dataID, quint64 dataLastEdited, const
} }
void EntityServer::trackViewerGone(const QUuid& sessionID) { void EntityServer::trackViewerGone(const QUuid& sessionID) {
QWriteLocker locker(&_viewerSendingStatsLock); {
_viewerSendingStats.remove(sessionID); QWriteLocker locker(&_viewerSendingStatsLock);
_viewerSendingStats.remove(sessionID);
}
if (_entitySimulation) { if (_entitySimulation) {
_entitySimulation->clearOwnership(sessionID); _tree->withReadLock([&] {
_entitySimulation->clearOwnership(sessionID);
});
} }
} }

View file

@ -17,6 +17,7 @@ StackView {
id: stack id: stack
initialItem: inputConfiguration initialItem: inputConfiguration
property alias messageVisible: imageMessageBox.visible property alias messageVisible: imageMessageBox.visible
property alias selectedPlugin: box.currentText
Rectangle { Rectangle {
id: inputConfiguration id: inputConfiguration
anchors.fill: parent anchors.fill: parent

View file

@ -34,7 +34,7 @@ Rectangle {
readonly property bool hmdHead: headBox.checked readonly property bool hmdHead: headBox.checked
readonly property bool headPuck: headPuckBox.checked readonly property bool headPuck: headPuckBox.checked
readonly property bool handController: handBox.checked readonly property bool handController: handBox.checked
readonly property bool handPuck: handPuckBox.checked readonly property bool handPuck: handPuckBox.checked
readonly property bool hmdDesktop: hmdInDesktop.checked readonly property bool hmdDesktop: hmdInDesktop.checked
@ -105,7 +105,7 @@ Rectangle {
RalewayBold { RalewayBold {
size: 12 size: 12
text: "Vive HMD" text: stack.selectedPlugin + " HMD"
color: hifi.colors.lightGrayText color: hifi.colors.lightGrayText
} }
@ -143,7 +143,7 @@ Rectangle {
anchors.topMargin: 5 anchors.topMargin: 5
anchors.left: openVrConfiguration.left anchors.left: openVrConfiguration.left
anchors.leftMargin: leftMargin + 10 anchors.leftMargin: leftMargin + 10
onClicked: { onClicked: {
if (checked) { if (checked) {
headBox.checked = false; headBox.checked = false;
@ -772,12 +772,12 @@ Rectangle {
RalewayBold { RalewayBold {
id: advanceSettings id: advanceSettings
text: "Advanced Settings" text: "Advanced Settings"
size: 12 size: 12
color: hifi.colors.white color: hifi.colors.white
anchors.top: advanceSeperator.bottom anchors.top: advanceSeperator.bottom
anchors.topMargin: 10 anchors.topMargin: 10
anchors.left: parent.left anchors.left: parent.left
@ -795,7 +795,7 @@ Rectangle {
anchors.topMargin: 5 anchors.topMargin: 5
anchors.left: openVrConfiguration.left anchors.left: openVrConfiguration.left
anchors.leftMargin: leftMargin + 10 anchors.leftMargin: leftMargin + 10
onClicked: { onClicked: {
if (!checked & hmdInDesktop.checked) { if (!checked & hmdInDesktop.checked) {
headBox.checked = true; headBox.checked = true;
@ -809,9 +809,9 @@ Rectangle {
RalewayBold { RalewayBold {
id: viveDesktopText id: viveDesktopText
size: 10 size: 10
text: "Use Vive devices in desktop mode" text: "Use " + stack.selectedPlugin + " devices in desktop mode"
color: hifi.colors.white color: hifi.colors.white
anchors { anchors {
left: viveInDesktop.right left: viveInDesktop.right
leftMargin: 5 leftMargin: 5
@ -819,7 +819,7 @@ Rectangle {
} }
} }
NumberAnimation { NumberAnimation {
id: numberAnimation id: numberAnimation
target: openVrConfiguration target: openVrConfiguration

View file

@ -38,11 +38,8 @@ void SimpleEntitySimulation::clearOwnership(const QUuid& ownerID) {
entity->clearSimulationOwnership(); entity->clearSimulationOwnership();
entity->markAsChangedOnServer(); entity->markAsChangedOnServer();
if (auto element = entity->getElement()) { if (auto element = entity->getElement()) {
auto tree = getEntityTree(); DirtyOctreeElementOperator op(element);
tree->withReadLock([&] { getEntityTree()->recurseTreeWithOperator(&op);
DirtyOctreeElementOperator op(element);
tree->recurseTreeWithOperator(&op);
});
} }
} else { } else {
++itemItr; ++itemItr;

View file

@ -114,6 +114,11 @@ btConvexHullShape* createConvexHull(const ShapeInfo::PointList& points) {
minCorner = glm::min(minCorner, points[i]); minCorner = glm::min(minCorner, points[i]);
} }
center /= (float)(points.size()); center /= (float)(points.size());
if (glm::any(glm::isnan(center))) {
// don't feed garbage to Bullet
assert(false); // crash here in DEBUG so we can investigate source of bad input
return nullptr;
}
float margin = hull->getMargin(); float margin = hull->getMargin();
@ -265,7 +270,7 @@ btTriangleIndexVertexArray* createStaticMeshArray(const ShapeInfo& info) {
} }
const btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) { const btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) {
btCollisionShape* shape = NULL; btCollisionShape* shape = nullptr;
int type = info.getType(); int type = info.getType();
switch(type) { switch(type) {
case SHAPE_TYPE_BOX: { case SHAPE_TYPE_BOX: {

View file

@ -32,7 +32,8 @@ QStringList InputConfiguration::inputPlugins() {
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) { for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
QString pluginName = plugin->getName(); QString pluginName = plugin->getName();
if (pluginName == QString("OpenVR")) { if (pluginName == QString("OpenVR")) {
inputPlugins << QString("Vive"); QString headsetName = plugin->getDeviceName();
inputPlugins << headsetName;
} else { } else {
inputPlugins << pluginName; inputPlugins << pluginName;
} }
@ -54,7 +55,8 @@ QStringList InputConfiguration::activeInputPlugins() {
if (plugin->configurable()) { if (plugin->configurable()) {
QString pluginName = plugin->getName(); QString pluginName = plugin->getName();
if (pluginName == QString("OpenVR")) { if (pluginName == QString("OpenVR")) {
activePlugins << QString("Vive"); QString headsetName = plugin->getDeviceName();
activePlugins << headsetName;
} else { } else {
activePlugins << pluginName; activePlugins << pluginName;
} }
@ -74,7 +76,7 @@ QString InputConfiguration::configurationLayout(QString pluginName) {
QString sourcePath; QString sourcePath;
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) { for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
if (plugin->getName() == pluginName) { if (plugin->getName() == pluginName || plugin->getDeviceName() == pluginName) {
return plugin->configurationLayout(); return plugin->configurationLayout();
} }
} }

View file

@ -26,10 +26,11 @@ public:
// If an input plugin is only a single device, it will only return it's primary name. // If an input plugin is only a single device, it will only return it's primary name.
virtual QStringList getSubdeviceNames() { return { getName() }; }; virtual QStringList getSubdeviceNames() { return { getName() }; };
virtual void setConfigurationSettings(const QJsonObject configurationSettings) { } virtual void setConfigurationSettings(const QJsonObject configurationSettings) { }
virtual QJsonObject configurationSettings() { return QJsonObject(); } virtual QJsonObject configurationSettings() { return QJsonObject(); }
virtual QString configurationLayout() { return QString(); } virtual QString configurationLayout() { return QString(); }
virtual QString getDeviceName() { return QString(); }
virtual void calibrate() {} virtual void calibrate() {}
virtual bool uncalibrate() { return false; } virtual bool uncalibrate() { return false; }
virtual bool configurable() { return false; } virtual bool configurable() { return false; }
virtual bool isHandController() const { return false; } virtual bool isHandController() const { return false; }
virtual bool isHeadController() const { return false; } virtual bool isHeadController() const { return false; }

View file

@ -36,7 +36,6 @@
Q_DECLARE_LOGGING_CATEGORY(displayplugins) Q_DECLARE_LOGGING_CATEGORY(displayplugins)
const char* OpenVrDisplayPlugin::NAME { "OpenVR (Vive)" };
const char* StandingHMDSensorMode { "Standing HMD Sensor Mode" }; // this probably shouldn't be hardcoded here const char* StandingHMDSensorMode { "Standing HMD Sensor Mode" }; // this probably shouldn't be hardcoded here
const char* OpenVrThreadedSubmit { "OpenVR Threaded Submit" }; // this probably shouldn't be hardcoded here const char* OpenVrThreadedSubmit { "OpenVR Threaded Submit" }; // this probably shouldn't be hardcoded here
@ -410,6 +409,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 +452,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

View file

@ -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;
@ -78,7 +78,6 @@ private:
vr::IVRSystem* _system { nullptr }; vr::IVRSystem* _system { nullptr };
std::atomic<vr::EDeviceActivityLevel> _hmdActivityLevel { vr::k_EDeviceActivityLevel_Unknown }; std::atomic<vr::EDeviceActivityLevel> _hmdActivityLevel { vr::k_EDeviceActivityLevel_Unknown };
std::atomic<uint32_t> _keyboardSupressionCount{ 0 }; std::atomic<uint32_t> _keyboardSupressionCount{ 0 };
static const char* NAME;
vr::HmdMatrix34_t _lastGoodHMDPose; vr::HmdMatrix34_t _lastGoodHMDPose;
mat4 _sensorResetMat; mat4 _sensorResetMat;

View file

@ -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);

View file

@ -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>

View file

@ -11,6 +11,7 @@
#include "ViveControllerManager.h" #include "ViveControllerManager.h"
#include <algorithm> #include <algorithm>
#include <string>
#include <PerfStat.h> #include <PerfStat.h>
#include <PathUtils.h> #include <PathUtils.h>
@ -339,6 +340,12 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
_validTrackedObjects.clear(); _validTrackedObjects.clear();
_trackedControllers = 0; _trackedControllers = 0;
if (_headsetName == "") {
_headsetName = getOpenVrDeviceName();
if (_headsetName == "HTC") {
_headsetName += " Vive";
}
}
// While the keyboard is open, we defer strictly to the keyboard values // While the keyboard is open, we defer strictly to the keyboard values
if (isOpenVrKeyboardShown()) { if (isOpenVrKeyboardShown()) {
_axisStateMap.clear(); _axisStateMap.clear();

View file

@ -52,6 +52,8 @@ public:
bool activate() override; bool activate() override;
void deactivate() override; void deactivate() override;
QString getDeviceName() { return QString::fromStdString(_inputDevice->_headsetName); }
void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); } void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); }
void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override; void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override;
@ -161,6 +163,7 @@ private:
HandConfig _handConfig { HandConfig::HandController }; HandConfig _handConfig { HandConfig::HandController };
FilteredStick _filteredLeftStick; FilteredStick _filteredLeftStick;
FilteredStick _filteredRightStick; FilteredStick _filteredRightStick;
std::string _headsetName {""};
std::vector<PuckPosePair> _validTrackedObjects; std::vector<PuckPosePair> _validTrackedObjects;
std::map<uint32_t, glm::mat4> _pucksPostOffset; std::map<uint32_t, glm::mat4> _pucksPostOffset;