mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 14:03:17 +02:00
Merge branch 'fogbugz_2028_part2' of https://github.com/zfox23/hifi into centered-toolbar
This commit is contained in:
commit
6aad78c8e8
8 changed files with 166 additions and 14 deletions
|
@ -237,6 +237,7 @@ void DomainGatekeeper::updateNodePermissions() {
|
|||
userPerms.permissions |= NodePermissions::Permission::canAdjustLocks;
|
||||
userPerms.permissions |= NodePermissions::Permission::canRezPermanentEntities;
|
||||
userPerms.permissions |= NodePermissions::Permission::canRezTemporaryEntities;
|
||||
userPerms.permissions |= NodePermissions::Permission::canWriteToAssetServer;
|
||||
} else {
|
||||
// this node is an agent
|
||||
const QHostAddress& addr = node->getLocalSocket().getAddress();
|
||||
|
@ -312,6 +313,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo
|
|||
userPerms.permissions |= NodePermissions::Permission::canAdjustLocks;
|
||||
userPerms.permissions |= NodePermissions::Permission::canRezPermanentEntities;
|
||||
userPerms.permissions |= NodePermissions::Permission::canRezTemporaryEntities;
|
||||
userPerms.permissions |= NodePermissions::Permission::canWriteToAssetServer;
|
||||
newNode->setPermissions(userPerms);
|
||||
return newNode;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ PreferencesDialog {
|
|||
id: root
|
||||
objectName: "GeneralPreferencesDialog"
|
||||
title: "General Settings"
|
||||
showCategories: ["Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers"]
|
||||
showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers"]
|
||||
property var settings: Settings {
|
||||
category: root.objectName
|
||||
property alias x: root.x
|
||||
|
|
|
@ -523,6 +523,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
|
||||
_previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
|
||||
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
|
||||
_constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true),
|
||||
_scaleMirror(1.0f),
|
||||
_rotateMirror(0.0f),
|
||||
_raiseMirror(0.0f),
|
||||
|
@ -2150,6 +2151,10 @@ void Application::setFieldOfView(float fov) {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
||||
_constrainToolbarPosition.set(setting);
|
||||
}
|
||||
|
||||
void Application::aboutApp() {
|
||||
InfoView::show(INFO_WELCOME_PATH);
|
||||
}
|
||||
|
|
|
@ -206,6 +206,9 @@ public:
|
|||
float getFieldOfView() { return _fieldOfView.get(); }
|
||||
void setFieldOfView(float fov);
|
||||
|
||||
float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); }
|
||||
void setSettingConstrainToolbarPosition(bool setting);
|
||||
|
||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||
|
||||
virtual controller::ScriptingInterface* getControllerScriptingInterface() { return _controllerScriptingInterface; }
|
||||
|
@ -506,6 +509,7 @@ private:
|
|||
|
||||
Setting::Handle<QString> _previousScriptLocation;
|
||||
Setting::Handle<float> _fieldOfView;
|
||||
Setting::Handle<bool> _constrainToolbarPosition;
|
||||
|
||||
float _scaleMirror;
|
||||
float _rotateMirror;
|
||||
|
|
|
@ -68,6 +68,13 @@ void setupPreferences() {
|
|||
preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Clear overlays when moving", getter, setter));
|
||||
}
|
||||
|
||||
// UI
|
||||
{
|
||||
auto getter = []()->bool { return qApp->getSettingConstrainToolbarPosition(); };
|
||||
auto setter = [](bool value) { qApp->setSettingConstrainToolbarPosition(value); };
|
||||
preferences->addPreference(new CheckPreference("UI", "Constrain Toolbar Position to Horizontal Center", getter, setter));
|
||||
}
|
||||
|
||||
// Snapshots
|
||||
static const QString SNAPSHOTS { "Snapshots" };
|
||||
{
|
||||
|
|
|
@ -10,9 +10,15 @@
|
|||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <atlbase.h>
|
||||
#include <Wbemidl.h>
|
||||
#include <string>
|
||||
|
||||
//#include <atlbase.h>
|
||||
//#include <Wbemidl.h>
|
||||
|
||||
#include <dxgi1_3.h>
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
@ -53,9 +59,101 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
CGLDestroyRendererInfo(rendererInfo);
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
|
||||
struct ConvertLargeIntegerToQString {
|
||||
QString convert(const LARGE_INTEGER& version) {
|
||||
QString value;
|
||||
value.append(QString::number(uint32_t(((version.HighPart & 0xFFFF0000) >> 16) & 0x0000FFFF)));
|
||||
value.append(".");
|
||||
value.append(QString::number(uint32_t((version.HighPart) & 0x0000FFFF)));
|
||||
value.append(".");
|
||||
value.append(QString::number(uint32_t(((version.LowPart & 0xFFFF0000) >> 16) & 0x0000FFFF)));
|
||||
value.append(".");
|
||||
value.append(QString::number(uint32_t((version.LowPart) & 0x0000FFFF)));
|
||||
return value;
|
||||
}
|
||||
} convertDriverVersionToString;
|
||||
|
||||
// Create the DXGI factory
|
||||
// Let s get into DXGI land:
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
IDXGIFactory1* pFactory = nullptr;
|
||||
hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) );
|
||||
if (hr != S_OK || pFactory == nullptr) {
|
||||
qCDebug(shared) << "Unable to create DXGI";
|
||||
return this;
|
||||
}
|
||||
|
||||
std::vector<int> validAdapterList;
|
||||
using AdapterEntry = std::pair<std::pair<DXGI_ADAPTER_DESC1, LARGE_INTEGER>, std::vector<DXGI_OUTPUT_DESC>>;
|
||||
std::vector<AdapterEntry> adapterToOutputs;
|
||||
// Enumerate adapters and outputs
|
||||
{
|
||||
UINT adapterNum = 0;
|
||||
IDXGIAdapter1* pAdapter = nullptr;
|
||||
while (pFactory->EnumAdapters1(adapterNum, &pAdapter) != DXGI_ERROR_NOT_FOUND) {
|
||||
|
||||
// Found an adapter, get descriptor
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
pAdapter->GetDesc1(&adapterDesc);
|
||||
|
||||
LARGE_INTEGER version;
|
||||
hr = pAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version);
|
||||
|
||||
std::wstring wDescription (adapterDesc.Description);
|
||||
std::string description(wDescription.begin(), wDescription.end());
|
||||
qCDebug(shared) << "Found adapter: " << description.c_str()
|
||||
<< " Driver version: " << convertDriverVersionToString.convert(version);
|
||||
|
||||
AdapterEntry adapterEntry;
|
||||
adapterEntry.first.first = adapterDesc;
|
||||
adapterEntry.first.second = version;
|
||||
|
||||
|
||||
|
||||
UINT outputNum = 0;
|
||||
IDXGIOutput * pOutput;
|
||||
bool hasOutputConnectedToDesktop = false;
|
||||
while (pAdapter->EnumOutputs(outputNum, &pOutput) != DXGI_ERROR_NOT_FOUND) {
|
||||
|
||||
// FOund an output attached to the adapter, get descriptor
|
||||
DXGI_OUTPUT_DESC outputDesc;
|
||||
pOutput->GetDesc(&outputDesc);
|
||||
|
||||
adapterEntry.second.push_back(outputDesc);
|
||||
|
||||
std::wstring wDeviceName(outputDesc.DeviceName);
|
||||
std::string deviceName(wDeviceName.begin(), wDeviceName.end());
|
||||
qCDebug(shared) << " Found output: " << deviceName.c_str() << " desktop: " << (outputDesc.AttachedToDesktop ? "true" : "false")
|
||||
<< " Rect [ l=" << outputDesc.DesktopCoordinates.left << " r=" << outputDesc.DesktopCoordinates.right
|
||||
<< " b=" << outputDesc.DesktopCoordinates.bottom << " t=" << outputDesc.DesktopCoordinates.top << " ]";
|
||||
|
||||
hasOutputConnectedToDesktop |= (bool) outputDesc.AttachedToDesktop;
|
||||
|
||||
pOutput->Release();
|
||||
outputNum++;
|
||||
}
|
||||
|
||||
adapterToOutputs.push_back(adapterEntry);
|
||||
|
||||
// add this adapter to the valid list if has output
|
||||
if (hasOutputConnectedToDesktop && !adapterEntry.second.empty()) {
|
||||
validAdapterList.push_back(adapterNum);
|
||||
}
|
||||
|
||||
pAdapter->Release();
|
||||
adapterNum++;
|
||||
}
|
||||
}
|
||||
pFactory->Release();
|
||||
|
||||
|
||||
// THis was the previous technique used to detect the platform we are running on on windows.
|
||||
/*
|
||||
// COM must be initialized already using CoInitialize. E.g., by the audio subsystem.
|
||||
CComPtr<IWbemLocator> spLoc = NULL;
|
||||
HRESULT hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc);
|
||||
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc);
|
||||
if (hr != S_OK || spLoc == NULL) {
|
||||
qCDebug(shared) << "Unable to connect to WMI";
|
||||
return this;
|
||||
|
@ -139,7 +237,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
var.ChangeType(CIM_UINT64); // We're going to receive some integral type, but it might not be uint.
|
||||
// We might be hosed here. The parameter is documented to be UINT32, but that's only 4 GB!
|
||||
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||
_dedicatedMemoryMB = (uint) (var.ullVal / BYTES_PER_MEGABYTE);
|
||||
_dedicatedMemoryMB = (uint64_t) (var.ullVal / BYTES_PER_MEGABYTE);
|
||||
}
|
||||
else {
|
||||
qCDebug(shared) << "Unable to get video AdapterRAM";
|
||||
|
@ -149,6 +247,22 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
}
|
||||
hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances);
|
||||
}
|
||||
*/
|
||||
|
||||
if (!validAdapterList.empty()) {
|
||||
auto& adapterEntry = adapterToOutputs[validAdapterList.front()];
|
||||
|
||||
std::wstring wDescription(adapterEntry.first.first.Description);
|
||||
std::string description(wDescription.begin(), wDescription.end());
|
||||
_name = QString(description.c_str());
|
||||
|
||||
_driver = convertDriverVersionToString.convert(adapterEntry.first.second);
|
||||
|
||||
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||
_dedicatedMemoryMB = (uint64_t)(adapterEntry.first.first.DedicatedVideoMemory / BYTES_PER_MEGABYTE);
|
||||
_isValid = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -14,17 +14,19 @@
|
|||
#ifndef hifi_GPUIdent_h
|
||||
#define hifi_GPUIdent_h
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class GPUIdent
|
||||
{
|
||||
public:
|
||||
unsigned int getMemory() { return _dedicatedMemoryMB; }
|
||||
uint64_t getMemory() { return _dedicatedMemoryMB; }
|
||||
QString getName() { return _name; }
|
||||
QString getDriver() { return _driver; }
|
||||
bool isValid() { return _isValid; }
|
||||
// E.g., GPUIdent::getInstance()->getMemory();
|
||||
static GPUIdent* getInstance(const QString& vendor = "", const QString& renderer = "") { return _instance.ensureQuery(vendor, renderer); }
|
||||
private:
|
||||
uint _dedicatedMemoryMB { 0 };
|
||||
uint64_t _dedicatedMemoryMB { 0 };
|
||||
QString _name { "" };
|
||||
QString _driver { "" };
|
||||
bool _isQueried { false };
|
||||
|
|
|
@ -715,7 +715,8 @@ var stepTurnAround = function(name) {
|
|||
this.tempTag = name + "-temporary";
|
||||
|
||||
this.onActionBound = this.onAction.bind(this);
|
||||
this.numTimesTurnPressed = 0;
|
||||
this.numTimesSnapTurnPressed = 0;
|
||||
this.numTimesSmoothTurnPressed = 0;
|
||||
}
|
||||
stepTurnAround.prototype = {
|
||||
start: function(onFinish) {
|
||||
|
@ -724,19 +725,26 @@ stepTurnAround.prototype = {
|
|||
|
||||
showEntitiesWithTag(this.tag);
|
||||
|
||||
this.numTimesTurnPressed = 0;
|
||||
this.numTimesSnapTurnPressed = 0;
|
||||
this.numTimesSmoothTurnPressed = 0;
|
||||
this.smoothTurnDown = false;
|
||||
Controller.actionEvent.connect(this.onActionBound);
|
||||
|
||||
this.interval = Script.setInterval(function() {
|
||||
debug("TurnAround | Checking if finished", this.numTimesTurnPressed);
|
||||
debug("TurnAround | Checking if finished",
|
||||
this.numTimesSnapTurnPressed, this.numTimesSmoothTurnPressed);
|
||||
var FORWARD_THRESHOLD = 90;
|
||||
var REQ_NUM_TIMES_PRESSED = 3;
|
||||
var REQ_NUM_TIMES_SNAP_TURN_PRESSED = 3;
|
||||
var REQ_NUM_TIMES_SMOOTH_TURN_PRESSED = 2;
|
||||
|
||||
var dir = Quat.getFront(MyAvatar.orientation);
|
||||
var angle = Math.atan2(dir.z, dir.x);
|
||||
var angleDegrees = ((angle / Math.PI) * 180);
|
||||
|
||||
if (this.numTimesTurnPressed >= REQ_NUM_TIMES_PRESSED && Math.abs(angleDegrees) < FORWARD_THRESHOLD) {
|
||||
var hasTurnedEnough = this.numTimesSnapTurnPressed >= REQ_NUM_TIMES_SNAP_TURN_PRESSED
|
||||
|| this.numTimesSmoothTurnPressed >= REQ_NUM_TIMES_SMOOTH_TURN_PRESSED;
|
||||
var facingForward = Math.abs(angleDegrees) < FORWARD_THRESHOLD
|
||||
if (hasTurnedEnough && facingForward) {
|
||||
Script.clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
playSuccessSound();
|
||||
|
@ -746,9 +754,19 @@ stepTurnAround.prototype = {
|
|||
},
|
||||
onAction: function(action, value) {
|
||||
var STEP_YAW_ACTION = 6;
|
||||
var SMOOTH_YAW_ACTION = 4;
|
||||
|
||||
if (action == STEP_YAW_ACTION && value != 0) {
|
||||
debug("TurnAround | Got yaw action");
|
||||
this.numTimesTurnPressed += 1;
|
||||
debug("TurnAround | Got step yaw action");
|
||||
++this.numTimesSnapTurnPressed;
|
||||
} else if (action == SMOOTH_YAW_ACTION) {
|
||||
debug("TurnAround | Got smooth yaw action");
|
||||
if (this.smoothTurnDown && value === 0) {
|
||||
this.smoothTurnDown = false;
|
||||
++this.numTimesSmoothTurnPressed;
|
||||
} else if (!this.smoothTurnDown && value !== 0) {
|
||||
this.smoothTurnDown = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
cleanup: function() {
|
||||
|
|
Loading…
Reference in a new issue