mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 04:27:44 +02:00
Merge branch 'master' into 21369
This commit is contained in:
commit
e6a5930365
19 changed files with 228 additions and 76 deletions
|
@ -161,7 +161,12 @@ Rectangle {
|
||||||
text.text: devicename
|
text.text: devicename
|
||||||
onCheckBoxClicked: {
|
onCheckBoxClicked: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
AudioDevice.setInputDeviceAsync(devicename)
|
if (devicename.length > 0) {
|
||||||
|
console.log("Audio.qml about to call AudioDevice.setInputDeviceAsync().devicename:" + devicename);
|
||||||
|
AudioDevice.setInputDeviceAsync(devicename);
|
||||||
|
} else {
|
||||||
|
console.log("Audio.qml attempted to set input device to empty device name.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +222,13 @@ Rectangle {
|
||||||
text.text: devicename
|
text.text: devicename
|
||||||
onCheckBoxClicked: {
|
onCheckBoxClicked: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
AudioDevice.setOutputDeviceAsync(devicename)
|
if (devicename.length > 0) {
|
||||||
|
console.log("Audio.qml about to call AudioDevice.setOutputDeviceAsync().devicename:" + devicename);
|
||||||
|
AudioDevice.setOutputDeviceAsync(devicename);
|
||||||
|
} else {
|
||||||
|
console.log("Audio.qml attempted to set output device to empty device name.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4126,10 +4126,10 @@ void Application::updateMyAvatarLookAtPosition() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// I am not looking at anyone else, so just look forward
|
// I am not looking at anyone else, so just look forward
|
||||||
if (isHMD) {
|
auto headPose = myAvatar->getHeadControllerPoseInSensorFrame();
|
||||||
glm::mat4 worldHeadMat = myAvatar->getSensorToWorldMatrix() *
|
if (headPose.isValid()) {
|
||||||
myAvatar->getHeadControllerPoseInSensorFrame().getMatrix();
|
glm::mat4 worldHeadMat = myAvatar->getSensorToWorldMatrix() * headPose.getMatrix();
|
||||||
lookAtSpot = transformPoint(worldHeadMat, glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
lookAtSpot = transformPoint(worldHeadMat, glm::vec3(0.0f, 0.0f, TREE_SCALE));
|
||||||
} else {
|
} else {
|
||||||
lookAtSpot = myAvatar->getHead()->getEyePosition() +
|
lookAtSpot = myAvatar->getHead()->getEyePosition() +
|
||||||
(myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
(myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||||
|
|
|
@ -21,15 +21,35 @@
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
|
||||||
#include "AvatarBookmarks.h"
|
#include "AvatarBookmarks.h"
|
||||||
|
#include "InterfaceLogging.h"
|
||||||
|
|
||||||
#include <QtQuick/QQuickWindow>
|
#include <QtQuick/QQuickWindow>
|
||||||
|
|
||||||
AvatarBookmarks::AvatarBookmarks() {
|
AvatarBookmarks::AvatarBookmarks() {
|
||||||
_bookmarksFilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + AVATARBOOKMARKS_FILENAME;
|
_bookmarksFilename = PathUtils::getAppDataPath() + "/" + AVATARBOOKMARKS_FILENAME;
|
||||||
readFromFile();
|
readFromFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarBookmarks::readFromFile() {
|
||||||
|
// migrate old avatarbookmarks.json, used to be in 'local' folder on windows
|
||||||
|
QString oldConfigPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + AVATARBOOKMARKS_FILENAME;
|
||||||
|
QFile oldConfig(oldConfigPath);
|
||||||
|
|
||||||
|
// I imagine that in a year from now, this code for migrating (as well as the two lines above)
|
||||||
|
// may be removed since all bookmarks should have been migrated by then
|
||||||
|
// - Robbie Uvanni (6.8.2017)
|
||||||
|
if (oldConfig.exists()) {
|
||||||
|
if (QDir().rename(oldConfigPath, _bookmarksFilename)) {
|
||||||
|
qCDebug(interfaceapp) << "Successfully migrated" << AVATARBOOKMARKS_FILENAME;
|
||||||
|
} else {
|
||||||
|
qCDebug(interfaceapp) << "Failed to migrate" << AVATARBOOKMARKS_FILENAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmarks::readFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
|
void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
|
||||||
// Add menus/actions
|
// Add menus/actions
|
||||||
auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkAvatar);
|
auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkAvatar);
|
||||||
|
|
|
@ -29,6 +29,7 @@ public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addBookmarkToMenu(Menu* menubar, const QString& name, const QString& address) override;
|
void addBookmarkToMenu(Menu* menubar, const QString& name, const QString& address) override;
|
||||||
|
void readFromFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json";
|
const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json";
|
||||||
|
|
|
@ -2664,8 +2664,8 @@ bool MyAvatar::FollowHelper::shouldActivateVertical(const MyAvatar& myAvatar, co
|
||||||
return (offset.y > CYLINDER_TOP) || (offset.y < CYLINDER_BOTTOM);
|
return (offset.y > CYLINDER_TOP) || (offset.y < CYLINDER_BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat4& desiredBodyMatrix, const glm::mat4& currentBodyMatrix, bool hasDriveInput) {
|
void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat4& desiredBodyMatrix,
|
||||||
_desiredBodyMatrix = desiredBodyMatrix;
|
const glm::mat4& currentBodyMatrix, bool hasDriveInput) {
|
||||||
|
|
||||||
if (myAvatar.getHMDLeanRecenterEnabled()) {
|
if (myAvatar.getHMDLeanRecenterEnabled()) {
|
||||||
if (!isActive(Rotation) && shouldActivateRotation(myAvatar, desiredBodyMatrix, currentBodyMatrix)) {
|
if (!isActive(Rotation) && shouldActivateRotation(myAvatar, desiredBodyMatrix, currentBodyMatrix)) {
|
||||||
|
@ -2679,7 +2679,7 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 desiredWorldMatrix = myAvatar.getSensorToWorldMatrix() * _desiredBodyMatrix;
|
glm::mat4 desiredWorldMatrix = myAvatar.getSensorToWorldMatrix() * desiredBodyMatrix;
|
||||||
glm::mat4 currentWorldMatrix = myAvatar.getSensorToWorldMatrix() * currentBodyMatrix;
|
glm::mat4 currentWorldMatrix = myAvatar.getSensorToWorldMatrix() * currentBodyMatrix;
|
||||||
|
|
||||||
AnimPose followWorldPose(currentWorldMatrix);
|
AnimPose followWorldPose(currentWorldMatrix);
|
||||||
|
|
|
@ -702,7 +702,6 @@ private:
|
||||||
Vertical,
|
Vertical,
|
||||||
NumFollowTypes
|
NumFollowTypes
|
||||||
};
|
};
|
||||||
glm::mat4 _desiredBodyMatrix;
|
|
||||||
float _timeRemaining[NumFollowTypes];
|
float _timeRemaining[NumFollowTypes];
|
||||||
|
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "AudioClient.h"
|
#include <AudioClient.h>
|
||||||
|
#include <AudioClientLogging.h>
|
||||||
|
|
||||||
#include "AudioDeviceScriptingInterface.h"
|
#include "AudioDeviceScriptingInterface.h"
|
||||||
#include "SettingsScriptingInterface.h"
|
#include "SettingsScriptingInterface.h"
|
||||||
|
|
||||||
|
@ -44,17 +46,23 @@ AudioDeviceScriptingInterface::AudioDeviceScriptingInterface(): QAbstractListMod
|
||||||
onDeviceChanged();
|
onDeviceChanged();
|
||||||
//set up previously saved device
|
//set up previously saved device
|
||||||
SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance();
|
SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance();
|
||||||
const QString inDevice = settings->getValue("audio_input_device").toString();
|
const QString inDevice = settings->getValue("audio_input_device", _currentInputDevice).toString();
|
||||||
if (inDevice != _currentInputDevice) {
|
if (inDevice != _currentInputDevice) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call setInputDeviceAsync() device: [" << inDevice << "] _currentInputDevice:" << _currentInputDevice;
|
||||||
setInputDeviceAsync(inDevice);
|
setInputDeviceAsync(inDevice);
|
||||||
}
|
}
|
||||||
const QString outDevice = settings->getValue("audio_output_device").toString();
|
|
||||||
|
// If the audio_output_device setting is not available, use the _currentOutputDevice
|
||||||
|
auto outDevice = settings->getValue("audio_output_device", _currentOutputDevice).toString();
|
||||||
if (outDevice != _currentOutputDevice) {
|
if (outDevice != _currentOutputDevice) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call setOutputDeviceAsync() outDevice: [" << outDevice << "] _currentOutputDevice:" << _currentOutputDevice;
|
||||||
setOutputDeviceAsync(outDevice);
|
setOutputDeviceAsync(outDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) {
|
bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "deviceName:" << deviceName;
|
||||||
|
|
||||||
bool result;
|
bool result;
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchInputToAudioDevice",
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchInputToAudioDevice",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
|
@ -64,6 +72,9 @@ bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) {
|
bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) {
|
||||||
|
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "deviceName:" << deviceName;
|
||||||
|
|
||||||
bool result;
|
bool result;
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchOutputToAudioDevice",
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchOutputToAudioDevice",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
|
@ -86,8 +97,10 @@ bool AudioDeviceScriptingInterface::setDeviceFromMenu(const QString& deviceMenuN
|
||||||
for (ScriptingAudioDeviceInfo di: _devices) {
|
for (ScriptingAudioDeviceInfo di: _devices) {
|
||||||
if (mode == di.mode && deviceMenuName.contains(di.name)) {
|
if (mode == di.mode && deviceMenuName.contains(di.name)) {
|
||||||
if (mode == QAudio::AudioOutput) {
|
if (mode == QAudio::AudioOutput) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call setOutputDeviceAsync() device: [" << di.name << "]";
|
||||||
setOutputDeviceAsync(di.name);
|
setOutputDeviceAsync(di.name);
|
||||||
} else {
|
} else {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call setInputDeviceAsync() device: [" << di.name << "]";
|
||||||
setInputDeviceAsync(di.name);
|
setInputDeviceAsync(di.name);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -98,12 +111,26 @@ bool AudioDeviceScriptingInterface::setDeviceFromMenu(const QString& deviceMenuN
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDeviceScriptingInterface::setInputDeviceAsync(const QString& deviceName) {
|
void AudioDeviceScriptingInterface::setInputDeviceAsync(const QString& deviceName) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "deviceName:" << deviceName;
|
||||||
|
|
||||||
|
if (deviceName.isEmpty()) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "attempt to set empty deviceName:" << deviceName << "... ignoring!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchInputToAudioDevice",
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchInputToAudioDevice",
|
||||||
Qt::QueuedConnection,
|
Qt::QueuedConnection,
|
||||||
Q_ARG(const QString&, deviceName));
|
Q_ARG(const QString&, deviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDeviceScriptingInterface::setOutputDeviceAsync(const QString& deviceName) {
|
void AudioDeviceScriptingInterface::setOutputDeviceAsync(const QString& deviceName) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "deviceName:" << deviceName;
|
||||||
|
|
||||||
|
if (deviceName.isEmpty()) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "attempt to set empty deviceName:" << deviceName << "... ignoring!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchOutputToAudioDevice",
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchOutputToAudioDevice",
|
||||||
Qt::QueuedConnection,
|
Qt::QueuedConnection,
|
||||||
Q_ARG(const QString&, deviceName));
|
Q_ARG(const QString&, deviceName));
|
||||||
|
@ -241,8 +268,11 @@ void AudioDeviceScriptingInterface::onCurrentInputDeviceChanged(const QString& n
|
||||||
void AudioDeviceScriptingInterface::onCurrentOutputDeviceChanged(const QString& name)
|
void AudioDeviceScriptingInterface::onCurrentOutputDeviceChanged(const QString& name)
|
||||||
{
|
{
|
||||||
currentDeviceUpdate(name, QAudio::AudioOutput);
|
currentDeviceUpdate(name, QAudio::AudioOutput);
|
||||||
|
|
||||||
|
// FIXME - this is kinda janky to set the setting on the result of a signal
|
||||||
//we got a signal that device changed. Save it now
|
//we got a signal that device changed. Save it now
|
||||||
SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance();
|
SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance();
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call settings->setValue('audio_output_device', name); name:" << name;
|
||||||
settings->setValue("audio_output_device", name);
|
settings->setValue("audio_output_device", name);
|
||||||
emit currentOutputDeviceChanged(name);
|
emit currentOutputDeviceChanged(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,10 @@ AudioClient::AudioClient() :
|
||||||
|
|
||||||
connect(&_receivedAudioStream, &MixedProcessedAudioStream::processSamples,
|
connect(&_receivedAudioStream, &MixedProcessedAudioStream::processSamples,
|
||||||
this, &AudioClient::processReceivedSamples, Qt::DirectConnection);
|
this, &AudioClient::processReceivedSamples, Qt::DirectConnection);
|
||||||
connect(this, &AudioClient::changeDevice, this, [=](const QAudioDeviceInfo& outputDeviceInfo) { switchOutputToAudioDevice(outputDeviceInfo); });
|
connect(this, &AudioClient::changeDevice, this, [=](const QAudioDeviceInfo& outputDeviceInfo) {
|
||||||
|
qCDebug(audioclient) << "got AudioClient::changeDevice signal, about to call switchOutputToAudioDevice() outputDeviceInfo: [" << outputDeviceInfo.deviceName() << "]";
|
||||||
|
switchOutputToAudioDevice(outputDeviceInfo);
|
||||||
|
});
|
||||||
|
|
||||||
connect(&_receivedAudioStream, &InboundAudioStream::mismatchedAudioCodec, this, &AudioClient::handleMismatchAudioFormat);
|
connect(&_receivedAudioStream, &InboundAudioStream::mismatchedAudioCodec, this, &AudioClient::handleMismatchAudioFormat);
|
||||||
|
|
||||||
|
@ -379,7 +382,8 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) {
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(audioclient) << "[" << deviceName << "] [" << getNamedAudioDeviceForMode(mode, deviceName).deviceName() << "]";
|
qCDebug(audioclient) << "defaultAudioDeviceForMode mode: " << (mode == QAudio::AudioOutput ? "Output" : "Input")
|
||||||
|
<< " [" << deviceName << "] [" << getNamedAudioDeviceForMode(mode, deviceName).deviceName() << "]";
|
||||||
|
|
||||||
return getNamedAudioDeviceForMode(mode, deviceName);
|
return getNamedAudioDeviceForMode(mode, deviceName);
|
||||||
#endif
|
#endif
|
||||||
|
@ -555,8 +559,12 @@ void AudioClient::start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioClient::stop() {
|
void AudioClient::stop() {
|
||||||
|
|
||||||
// "switch" to invalid devices in order to shut down the state
|
// "switch" to invalid devices in order to shut down the state
|
||||||
|
qCDebug(audioclient) << "AudioClient::stop(), about to call switchInputToAudioDevice(null)";
|
||||||
switchInputToAudioDevice(QAudioDeviceInfo());
|
switchInputToAudioDevice(QAudioDeviceInfo());
|
||||||
|
|
||||||
|
qCDebug(audioclient) << "AudioClient::stop(), about to call switchOutputToAudioDevice(null)";
|
||||||
switchOutputToAudioDevice(QAudioDeviceInfo());
|
switchOutputToAudioDevice(QAudioDeviceInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,12 +756,12 @@ QVector<QString> AudioClient::getDeviceNames(QAudio::Mode mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::switchInputToAudioDevice(const QString& inputDeviceName) {
|
bool AudioClient::switchInputToAudioDevice(const QString& inputDeviceName) {
|
||||||
qCDebug(audioclient) << "[" << inputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName).deviceName() << "]";
|
qCDebug(audioclient) << "switchInputToAudioDevice [" << inputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName).deviceName() << "]";
|
||||||
return switchInputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName));
|
return switchInputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::switchOutputToAudioDevice(const QString& outputDeviceName) {
|
bool AudioClient::switchOutputToAudioDevice(const QString& outputDeviceName) {
|
||||||
qCDebug(audioclient) << "[" << outputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName).deviceName() << "]";
|
qCDebug(audioclient) << "switchOutputToAudioDevice [" << outputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName).deviceName() << "]";
|
||||||
return switchOutputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName));
|
return switchOutputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,6 +1306,7 @@ void AudioClient::setIsStereoInput(bool isStereoInput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// change in channel count for desired input format, restart the input device
|
// change in channel count for desired input format, restart the input device
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to call switchInputToAudioDevice:" << _inputAudioDeviceName;
|
||||||
switchInputToAudioDevice(_inputAudioDeviceName);
|
switchInputToAudioDevice(_inputAudioDeviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1334,6 +1343,7 @@ void AudioClient::outputFormatChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "inputDeviceInfo: [" << inputDeviceInfo.deviceName() << "]";
|
||||||
bool supportedFormat = false;
|
bool supportedFormat = false;
|
||||||
|
|
||||||
// cleanup any previously initialized device
|
// cleanup any previously initialized device
|
||||||
|
@ -1448,6 +1458,8 @@ void AudioClient::outputNotify() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo) {
|
bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo) {
|
||||||
|
qCDebug(audioclient) << "AudioClient::switchOutputToAudioDevice() outputDeviceInfo: [" << outputDeviceInfo.deviceName() << "]";
|
||||||
|
|
||||||
bool supportedFormat = false;
|
bool supportedFormat = false;
|
||||||
|
|
||||||
Lock localAudioLock(_localAudioMutex);
|
Lock localAudioLock(_localAudioMutex);
|
||||||
|
@ -1582,7 +1594,11 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
|
int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "numFrames:" << numFrames << "persist:" << persist;
|
||||||
|
|
||||||
numFrames = std::min(std::max(numFrames, MIN_BUFFER_FRAMES), MAX_BUFFER_FRAMES);
|
numFrames = std::min(std::max(numFrames, MIN_BUFFER_FRAMES), MAX_BUFFER_FRAMES);
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "clamped numFrames:" << numFrames << "_sessionOutputBufferSizeFrames:" << _sessionOutputBufferSizeFrames;
|
||||||
|
|
||||||
if (numFrames != _sessionOutputBufferSizeFrames) {
|
if (numFrames != _sessionOutputBufferSizeFrames) {
|
||||||
qCInfo(audioclient, "Audio output buffer set to %d frames", numFrames);
|
qCInfo(audioclient, "Audio output buffer set to %d frames", numFrames);
|
||||||
_sessionOutputBufferSizeFrames = numFrames;
|
_sessionOutputBufferSizeFrames = numFrames;
|
||||||
|
@ -1594,6 +1610,7 @@ int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
|
||||||
// The buffer size can't be adjusted after QAudioOutput::start() has been called, so
|
// The buffer size can't be adjusted after QAudioOutput::start() has been called, so
|
||||||
// recreate the device by switching to the default.
|
// recreate the device by switching to the default.
|
||||||
QAudioDeviceInfo outputDeviceInfo = defaultAudioDeviceForMode(QAudio::AudioOutput);
|
QAudioDeviceInfo outputDeviceInfo = defaultAudioDeviceForMode(QAudio::AudioOutput);
|
||||||
|
qCDebug(audioclient) << __FUNCTION__ << "about to send changeDevice signal outputDeviceInfo: [" << outputDeviceInfo.deviceName() << "]";
|
||||||
emit changeDevice(outputDeviceInfo); // On correct thread, please, as setOutputBufferSize can be called from main thread.
|
emit changeDevice(outputDeviceInfo); // On correct thread, please, as setOutputBufferSize can be called from main thread.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,12 @@ void HmdDisplayPlugin::internalPresent() {
|
||||||
float shiftLeftBy = getLeftCenterPixel() - (sourceSize.x / 2);
|
float shiftLeftBy = getLeftCenterPixel() - (sourceSize.x / 2);
|
||||||
float newWidth = sourceSize.x - shiftLeftBy;
|
float newWidth = sourceSize.x - shiftLeftBy;
|
||||||
|
|
||||||
|
// Experimentally adjusted the region presented in preview to avoid seeing the masked pixels and recenter the center...
|
||||||
|
static float SCALE_WIDTH = 0.9f;
|
||||||
|
static float SCALE_OFFSET = 2.0f;
|
||||||
|
newWidth *= SCALE_WIDTH;
|
||||||
|
shiftLeftBy *= SCALE_OFFSET;
|
||||||
|
|
||||||
const unsigned int RATIO_Y = 9;
|
const unsigned int RATIO_Y = 9;
|
||||||
const unsigned int RATIO_X = 16;
|
const unsigned int RATIO_X = 16;
|
||||||
glm::uvec2 originalClippedSize { newWidth, newWidth * RATIO_Y / RATIO_X };
|
glm::uvec2 originalClippedSize { newWidth, newWidth * RATIO_Y / RATIO_X };
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
|
|
||||||
|
UserActivityLogger::UserActivityLogger() {
|
||||||
|
_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
UserActivityLogger& UserActivityLogger::getInstance() {
|
UserActivityLogger& UserActivityLogger::getInstance() {
|
||||||
static UserActivityLogger sharedInstance;
|
static UserActivityLogger sharedInstance;
|
||||||
return sharedInstance;
|
return sharedInstance;
|
||||||
|
@ -42,6 +46,12 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
||||||
actionPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"action_name\"");
|
actionPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"action_name\"");
|
||||||
actionPart.setBody(QByteArray().append(action));
|
actionPart.setBody(QByteArray().append(action));
|
||||||
multipart->append(actionPart);
|
multipart->append(actionPart);
|
||||||
|
|
||||||
|
// Log the local-time that this event was logged
|
||||||
|
QHttpPart elapsedPart;
|
||||||
|
elapsedPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"elapsed_ms\"");
|
||||||
|
elapsedPart.setBody(QString::number(_timer.elapsed()).toLocal8Bit());
|
||||||
|
multipart->append(elapsedPart);
|
||||||
|
|
||||||
// If there are action details, add them to the multipart
|
// If there are action details, add them to the multipart
|
||||||
if (!details.isEmpty()) {
|
if (!details.isEmpty()) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
|
@ -51,8 +52,10 @@ private slots:
|
||||||
void requestError(QNetworkReply& errorReply);
|
void requestError(QNetworkReply& errorReply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UserActivityLogger() {};
|
UserActivityLogger();
|
||||||
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false };
|
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false };
|
||||||
|
|
||||||
|
QElapsedTimer _timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_UserActivityLogger_h
|
#endif // hifi_UserActivityLogger_h
|
||||||
|
|
|
@ -69,7 +69,7 @@ std::vector<vec3> polygon() {
|
||||||
std::vector<vec3> result;
|
std::vector<vec3> result;
|
||||||
result.reserve(SIDES);
|
result.reserve(SIDES);
|
||||||
double angleIncrement = 2.0 * M_PI / SIDES;
|
double angleIncrement = 2.0 * M_PI / SIDES;
|
||||||
for (size_t i = 0; i < SIDES; ++i) {
|
for (size_t i = 0; i < SIDES; i++) {
|
||||||
double angle = (double)i * angleIncrement;
|
double angle = (double)i * angleIncrement;
|
||||||
result.push_back(vec3{ cos(angle) * 0.5, 0.0, sin(angle) * 0.5 });
|
result.push_back(vec3{ cos(angle) * 0.5, 0.0, sin(angle) * 0.5 });
|
||||||
}
|
}
|
||||||
|
@ -172,20 +172,20 @@ void setupFlatShape(GeometryCache::ShapeData& shapeData, const geometry::Solid<N
|
||||||
vertices.reserve(N * faceCount * 2);
|
vertices.reserve(N * faceCount * 2);
|
||||||
solidIndices.reserve(faceIndexCount * faceCount);
|
solidIndices.reserve(faceIndexCount * faceCount);
|
||||||
|
|
||||||
for (size_t f = 0; f < faceCount; ++f) {
|
for (size_t f = 0; f < faceCount; f++) {
|
||||||
const Face<N>& face = shape.faces[f];
|
const Face<N>& face = shape.faces[f];
|
||||||
// Compute the face normal
|
// Compute the face normal
|
||||||
vec3 faceNormal = shape.getFaceNormal(f);
|
vec3 faceNormal = shape.getFaceNormal(f);
|
||||||
|
|
||||||
// Create the vertices for the face
|
// Create the vertices for the face
|
||||||
for (Index i = 0; i < N; ++i) {
|
for (Index i = 0; i < N; i++) {
|
||||||
Index originalIndex = face[i];
|
Index originalIndex = face[i];
|
||||||
vertices.push_back(shape.vertices[originalIndex]);
|
vertices.push_back(shape.vertices[originalIndex]);
|
||||||
vertices.push_back(faceNormal);
|
vertices.push_back(faceNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the wire indices for unseen edges
|
// Create the wire indices for unseen edges
|
||||||
for (Index i = 0; i < N; ++i) {
|
for (Index i = 0; i < N; i++) {
|
||||||
Index a = i;
|
Index a = i;
|
||||||
Index b = (i + 1) % N;
|
Index b = (i + 1) % N;
|
||||||
auto token = indexToken(face[a], face[b]);
|
auto token = indexToken(face[a], face[b]);
|
||||||
|
@ -197,7 +197,7 @@ void setupFlatShape(GeometryCache::ShapeData& shapeData, const geometry::Solid<N
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the solid face indices
|
// Create the solid face indices
|
||||||
for (Index i = 0; i < N - 2; ++i) {
|
for (Index i = 0; i < N - 2; i++) {
|
||||||
solidIndices.push_back(0 + baseVertex);
|
solidIndices.push_back(0 + baseVertex);
|
||||||
solidIndices.push_back(i + 1 + baseVertex);
|
solidIndices.push_back(i + 1 + baseVertex);
|
||||||
solidIndices.push_back(i + 2 + baseVertex);
|
solidIndices.push_back(i + 2 + baseVertex);
|
||||||
|
@ -229,10 +229,10 @@ void setupSmoothShape(GeometryCache::ShapeData& shapeData, const geometry::Solid
|
||||||
|
|
||||||
solidIndices.reserve(faceIndexCount * faceCount);
|
solidIndices.reserve(faceIndexCount * faceCount);
|
||||||
|
|
||||||
for (size_t f = 0; f < faceCount; ++f) {
|
for (size_t f = 0; f < faceCount; f++) {
|
||||||
const Face<N>& face = shape.faces[f];
|
const Face<N>& face = shape.faces[f];
|
||||||
// Create the wire indices for unseen edges
|
// Create the wire indices for unseen edges
|
||||||
for (Index i = 0; i < N; ++i) {
|
for (Index i = 0; i < N; i++) {
|
||||||
Index a = face[i];
|
Index a = face[i];
|
||||||
Index b = face[(i + 1) % N];
|
Index b = face[(i + 1) % N];
|
||||||
auto token = indexToken(a, b);
|
auto token = indexToken(a, b);
|
||||||
|
@ -244,7 +244,7 @@ void setupSmoothShape(GeometryCache::ShapeData& shapeData, const geometry::Solid
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the solid face indices
|
// Create the solid face indices
|
||||||
for (Index i = 0; i < N - 2; ++i) {
|
for (Index i = 0; i < N - 2; i++) {
|
||||||
solidIndices.push_back(face[i] + baseVertex);
|
solidIndices.push_back(face[i] + baseVertex);
|
||||||
solidIndices.push_back(face[i + 1] + baseVertex);
|
solidIndices.push_back(face[i + 1] + baseVertex);
|
||||||
solidIndices.push_back(face[i + 2] + baseVertex);
|
solidIndices.push_back(face[i + 2] + baseVertex);
|
||||||
|
@ -256,23 +256,30 @@ void setupSmoothShape(GeometryCache::ShapeData& shapeData, const geometry::Solid
|
||||||
}
|
}
|
||||||
|
|
||||||
template <uint32_t N>
|
template <uint32_t N>
|
||||||
void extrudePolygon(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& vertexBuffer, gpu::BufferPointer& indexBuffer) {
|
void extrudePolygon(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& vertexBuffer, gpu::BufferPointer& indexBuffer, bool isConical = false) {
|
||||||
using namespace geometry;
|
using namespace geometry;
|
||||||
Index baseVertex = (Index)(vertexBuffer->getSize() / SHAPE_VERTEX_STRIDE);
|
Index baseVertex = (Index)(vertexBuffer->getSize() / SHAPE_VERTEX_STRIDE);
|
||||||
VertexVector vertices;
|
VertexVector vertices;
|
||||||
IndexVector solidIndices, wireIndices;
|
IndexVector solidIndices, wireIndices;
|
||||||
|
|
||||||
// Top and bottom faces
|
// Top (if not conical) and bottom faces
|
||||||
std::vector<vec3> shape = polygon<N>();
|
std::vector<vec3> shape = polygon<N>();
|
||||||
for (const vec3& v : shape) {
|
if (isConical) {
|
||||||
vertices.push_back(vec3(v.x, 0.5f, v.z));
|
for (uint32_t i = 0; i < N; i++) {
|
||||||
vertices.push_back(vec3(0, 1, 0));
|
vertices.push_back(vec3(0.0f, 0.5f, 0.0f));
|
||||||
|
vertices.push_back(vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const vec3& v : shape) {
|
||||||
|
vertices.push_back(vec3(v.x, 0.5f, v.z));
|
||||||
|
vertices.push_back(vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (const vec3& v : shape) {
|
for (const vec3& v : shape) {
|
||||||
vertices.push_back(vec3(v.x, -0.5f, v.z));
|
vertices.push_back(vec3(v.x, -0.5f, v.z));
|
||||||
vertices.push_back(vec3(0, -1, 0));
|
vertices.push_back(vec3(0.0f, -1.0f, 0.0f));
|
||||||
}
|
}
|
||||||
for (uint32_t i = 2; i < N; ++i) {
|
for (uint32_t i = 2; i < N; i++) {
|
||||||
solidIndices.push_back(baseVertex + 0);
|
solidIndices.push_back(baseVertex + 0);
|
||||||
solidIndices.push_back(baseVertex + i);
|
solidIndices.push_back(baseVertex + i);
|
||||||
solidIndices.push_back(baseVertex + i - 1);
|
solidIndices.push_back(baseVertex + i - 1);
|
||||||
|
@ -280,7 +287,7 @@ void extrudePolygon(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& ver
|
||||||
solidIndices.push_back(baseVertex + i + N - 1);
|
solidIndices.push_back(baseVertex + i + N - 1);
|
||||||
solidIndices.push_back(baseVertex + i + N);
|
solidIndices.push_back(baseVertex + i + N);
|
||||||
}
|
}
|
||||||
for (uint32_t i = 1; i <= N; ++i) {
|
for (uint32_t i = 1; i <= N; i++) {
|
||||||
wireIndices.push_back(baseVertex + (i % N));
|
wireIndices.push_back(baseVertex + (i % N));
|
||||||
wireIndices.push_back(baseVertex + i - 1);
|
wireIndices.push_back(baseVertex + i - 1);
|
||||||
wireIndices.push_back(baseVertex + (i % N) + N);
|
wireIndices.push_back(baseVertex + (i % N) + N);
|
||||||
|
@ -290,12 +297,12 @@ void extrudePolygon(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& ver
|
||||||
// Now do the sides
|
// Now do the sides
|
||||||
baseVertex += 2 * N;
|
baseVertex += 2 * N;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < N; ++i) {
|
for (uint32_t i = 0; i < N; i++) {
|
||||||
vec3 left = shape[i];
|
vec3 left = shape[i];
|
||||||
vec3 right = shape[(i + 1) % N];
|
vec3 right = shape[(i + 1) % N];
|
||||||
vec3 normal = glm::normalize(left + right);
|
vec3 normal = glm::normalize(left + right);
|
||||||
vec3 topLeft = vec3(left.x, 0.5f, left.z);
|
vec3 topLeft = (isConical ? vec3(0.0f, 0.5f, 0.0f) : vec3(left.x, 0.5f, left.z));
|
||||||
vec3 topRight = vec3(right.x, 0.5f, right.z);
|
vec3 topRight = (isConical ? vec3(0.0f, 0.5f, 0.0f) : vec3(right.x, 0.5f, right.z));
|
||||||
vec3 bottomLeft = vec3(left.x, -0.5f, left.z);
|
vec3 bottomLeft = vec3(left.x, -0.5f, left.z);
|
||||||
vec3 bottomRight = vec3(right.x, -0.5f, right.z);
|
vec3 bottomRight = vec3(right.x, -0.5f, right.z);
|
||||||
|
|
||||||
|
@ -325,6 +332,41 @@ void extrudePolygon(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& ver
|
||||||
shapeData.setupIndices(indexBuffer, solidIndices, wireIndices);
|
shapeData.setupIndices(indexBuffer, solidIndices, wireIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawCircle(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& vertexBuffer, gpu::BufferPointer& indexBuffer) {
|
||||||
|
// Draw a circle with radius 1/4th the size of the bounding box
|
||||||
|
using namespace geometry;
|
||||||
|
|
||||||
|
Index baseVertex = (Index)(vertexBuffer->getSize() / SHAPE_VERTEX_STRIDE);
|
||||||
|
VertexVector vertices;
|
||||||
|
IndexVector solidIndices, wireIndices;
|
||||||
|
const int NUM_CIRCLE_VERTICES = 64;
|
||||||
|
|
||||||
|
std::vector<vec3> shape = polygon<NUM_CIRCLE_VERTICES>();
|
||||||
|
for (const vec3& v : shape) {
|
||||||
|
vertices.push_back(vec3(v.x, 0.0f, v.z));
|
||||||
|
vertices.push_back(vec3(0.0f, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 2; i < NUM_CIRCLE_VERTICES; i++) {
|
||||||
|
solidIndices.push_back(baseVertex + 0);
|
||||||
|
solidIndices.push_back(baseVertex + i);
|
||||||
|
solidIndices.push_back(baseVertex + i - 1);
|
||||||
|
solidIndices.push_back(baseVertex + NUM_CIRCLE_VERTICES);
|
||||||
|
solidIndices.push_back(baseVertex + i + NUM_CIRCLE_VERTICES - 1);
|
||||||
|
solidIndices.push_back(baseVertex + i + NUM_CIRCLE_VERTICES);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 1; i <= NUM_CIRCLE_VERTICES; i++) {
|
||||||
|
wireIndices.push_back(baseVertex + (i % NUM_CIRCLE_VERTICES));
|
||||||
|
wireIndices.push_back(baseVertex + i - 1);
|
||||||
|
wireIndices.push_back(baseVertex + (i % NUM_CIRCLE_VERTICES) + NUM_CIRCLE_VERTICES);
|
||||||
|
wireIndices.push_back(baseVertex + (i - 1) + NUM_CIRCLE_VERTICES);
|
||||||
|
}
|
||||||
|
|
||||||
|
shapeData.setupVertices(vertexBuffer, vertices);
|
||||||
|
shapeData.setupIndices(indexBuffer, solidIndices, wireIndices);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME solids need per-face vertices, but smooth shaded
|
// FIXME solids need per-face vertices, but smooth shaded
|
||||||
// components do not. Find a way to support using draw elements
|
// components do not. Find a way to support using draw elements
|
||||||
// or draw arrays as appropriate
|
// or draw arrays as appropriate
|
||||||
|
@ -357,8 +399,8 @@ void GeometryCache::buildShapes() {
|
||||||
Index baseVertex = (Index)(_shapeVertices->getSize() / SHAPE_VERTEX_STRIDE);
|
Index baseVertex = (Index)(_shapeVertices->getSize() / SHAPE_VERTEX_STRIDE);
|
||||||
ShapeData& shapeData = _shapes[Line];
|
ShapeData& shapeData = _shapes[Line];
|
||||||
shapeData.setupVertices(_shapeVertices, VertexVector {
|
shapeData.setupVertices(_shapeVertices, VertexVector {
|
||||||
vec3(-0.5, 0, 0), vec3(-0.5f, 0, 0),
|
vec3(-0.5f, 0.0f, 0.0f), vec3(-0.5f, 0.0f, 0.0f),
|
||||||
vec3(0.5f, 0, 0), vec3(0.5f, 0, 0)
|
vec3(0.5f, 0.0f, 0.0f), vec3(0.5f, 0.0f, 0.0f)
|
||||||
});
|
});
|
||||||
IndexVector wireIndices;
|
IndexVector wireIndices;
|
||||||
// Only two indices
|
// Only two indices
|
||||||
|
@ -367,20 +409,22 @@ void GeometryCache::buildShapes() {
|
||||||
shapeData.setupIndices(_shapeIndices, IndexVector(), wireIndices);
|
shapeData.setupIndices(_shapeIndices, IndexVector(), wireIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not implememented yet:
|
|
||||||
|
|
||||||
//Triangle,
|
//Triangle,
|
||||||
extrudePolygon<3>(_shapes[Triangle], _shapeVertices, _shapeIndices);
|
extrudePolygon<3>(_shapes[Triangle], _shapeVertices, _shapeIndices);
|
||||||
//Hexagon,
|
//Hexagon,
|
||||||
extrudePolygon<6>(_shapes[Hexagon], _shapeVertices, _shapeIndices);
|
extrudePolygon<6>(_shapes[Hexagon], _shapeVertices, _shapeIndices);
|
||||||
//Octagon,
|
//Octagon,
|
||||||
extrudePolygon<8>(_shapes[Octagon], _shapeVertices, _shapeIndices);
|
extrudePolygon<8>(_shapes[Octagon], _shapeVertices, _shapeIndices);
|
||||||
|
|
||||||
//Quad,
|
|
||||||
//Circle,
|
|
||||||
//Torus,
|
|
||||||
//Cone,
|
|
||||||
//Cylinder,
|
//Cylinder,
|
||||||
|
extrudePolygon<64>(_shapes[Cylinder], _shapeVertices, _shapeIndices);
|
||||||
|
//Cone,
|
||||||
|
extrudePolygon<64>(_shapes[Cone], _shapeVertices, _shapeIndices, true);
|
||||||
|
//Circle
|
||||||
|
drawCircle(_shapes[Circle], _shapeVertices, _shapeIndices);
|
||||||
|
// Not implememented yet:
|
||||||
|
//Quad,
|
||||||
|
//Torus,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::Stream::FormatPointer& getSolidStreamFormat() {
|
gpu::Stream::FormatPointer& getSolidStreamFormat() {
|
||||||
|
@ -597,7 +641,7 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, con
|
||||||
auto pointCount = points.size();
|
auto pointCount = points.size();
|
||||||
auto colorCount = colors.size();
|
auto colorCount = colors.size();
|
||||||
int compactColor = 0;
|
int compactColor = 0;
|
||||||
for (auto i = 0; i < pointCount; ++i) {
|
for (auto i = 0; i < pointCount; i++) {
|
||||||
const auto& point = points[i];
|
const auto& point = points[i];
|
||||||
*(vertex++) = point.x;
|
*(vertex++) = point.x;
|
||||||
*(vertex++) = point.y;
|
*(vertex++) = point.y;
|
||||||
|
@ -674,7 +718,7 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con
|
||||||
const glm::vec3 NORMAL(0.0f, 0.0f, 1.0f);
|
const glm::vec3 NORMAL(0.0f, 0.0f, 1.0f);
|
||||||
auto pointCount = points.size();
|
auto pointCount = points.size();
|
||||||
auto colorCount = colors.size();
|
auto colorCount = colors.size();
|
||||||
for (auto i = 0; i < pointCount; ++i) {
|
for (auto i = 0; i < pointCount; i++) {
|
||||||
const glm::vec3& point = points[i];
|
const glm::vec3& point = points[i];
|
||||||
if (i < colorCount) {
|
if (i < colorCount) {
|
||||||
const glm::vec4& color = colors[i];
|
const glm::vec4& color = colors[i];
|
||||||
|
|
|
@ -142,8 +142,8 @@ public:
|
||||||
Dodecahedron,
|
Dodecahedron,
|
||||||
Icosahedron,
|
Icosahedron,
|
||||||
Torus, // not yet implemented
|
Torus, // not yet implemented
|
||||||
Cone, // not yet implemented
|
Cone,
|
||||||
Cylinder, // not yet implemented
|
Cylinder,
|
||||||
NUM_SHAPES,
|
NUM_SHAPES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,6 @@ var toolBar = (function () {
|
||||||
|
|
||||||
that.toggle = function () {
|
that.toggle = function () {
|
||||||
that.setActive(!isActive);
|
that.setActive(!isActive);
|
||||||
activeButton.editProperties({isActive: isActive});
|
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
}
|
}
|
||||||
|
@ -642,6 +641,8 @@ var toolBar = (function () {
|
||||||
enabled: active
|
enabled: active
|
||||||
}));
|
}));
|
||||||
isActive = active;
|
isActive = active;
|
||||||
|
activeButton.editProperties({isActive: isActive});
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
|
|
|
@ -610,6 +610,7 @@ hr {
|
||||||
.dropdown dl[dropped="true"] {
|
.dropdown dl[dropped="true"] {
|
||||||
color: #404040;
|
color: #404040;
|
||||||
background: linear-gradient(#afafaf, #afafaf);
|
background: linear-gradient(#afafaf, #afafaf);
|
||||||
|
z-index: 998;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown dt {
|
.dropdown dt {
|
||||||
|
@ -657,7 +658,8 @@ hr {
|
||||||
font-family: FiraSans-SemiBold;
|
font-family: FiraSans-SemiBold;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #404040;
|
color: #404040;
|
||||||
background-color: #afafaf
|
background-color: #afafaf;
|
||||||
|
z-index: 999;
|
||||||
}
|
}
|
||||||
.dropdown li:hover {
|
.dropdown li:hover {
|
||||||
background-color: #00b4ef;
|
background-color: #00b4ef;
|
||||||
|
|
|
@ -503,7 +503,7 @@ div.jsoneditor-contextmenu-root {
|
||||||
div.jsoneditor-contextmenu {
|
div.jsoneditor-contextmenu {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
z-index: 99999;
|
z-index: 998;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.jsoneditor-contextmenu ul,
|
div.jsoneditor-contextmenu ul,
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
<option value="Hexagon">Hexagon</option>
|
<option value="Hexagon">Hexagon</option>
|
||||||
<option value="Triangle">Triangle</option>
|
<option value="Triangle">Triangle</option>
|
||||||
<option value="Octagon">Octagon</option>
|
<option value="Octagon">Octagon</option>
|
||||||
|
<option value="Cylinder">Cylinder</option>
|
||||||
|
<option value="Cone">Cone</option>
|
||||||
|
<option value="Circle">Circle</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="property text">
|
<div class="property text">
|
||||||
|
|
|
@ -43,7 +43,7 @@ var LOCAL_TABLET_MODEL_PATH = Script.resourcesPath() + "meshes/tablet-with-home-
|
||||||
// returns object with two fields:
|
// returns object with two fields:
|
||||||
// * position - position in front of the user
|
// * position - position in front of the user
|
||||||
// * rotation - rotation of entity so it faces the user.
|
// * rotation - rotation of entity so it faces the user.
|
||||||
function calcSpawnInfo(hand, height) {
|
function calcSpawnInfo(hand, tabletHeight) {
|
||||||
var finalPosition;
|
var finalPosition;
|
||||||
|
|
||||||
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
||||||
|
@ -53,30 +53,35 @@ function calcSpawnInfo(hand, height) {
|
||||||
hand = NO_HANDS;
|
hand = NO_HANDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var handController = null;
|
||||||
if (HMD.active && hand !== NO_HANDS) {
|
if (HMD.active && hand !== NO_HANDS) {
|
||||||
var handController = getControllerWorldLocation(hand, true);
|
handController = getControllerWorldLocation(hand, true);
|
||||||
|
}
|
||||||
|
|
||||||
var TABLET_UP_OFFSET = 0.1;
|
if (handController && handController.valid) {
|
||||||
var TABLET_FORWARD_OFFSET = 0.1;
|
// Orient tablet per hand pitch and yaw.
|
||||||
var normal = Vec3.multiplyQbyV(handController.rotation, {x: 0, y: -1, z: 0});
|
// Angle it back similar to holding it like a book.
|
||||||
var pitch = Math.asin(normal.y);
|
// Move tablet up so that hand is at bottom.
|
||||||
var MAX_PITCH = Math.PI / 4;
|
// Move tablet back so that hand is in front.
|
||||||
if (pitch < -MAX_PITCH) {
|
|
||||||
pitch = -MAX_PITCH;
|
var position = handController.position;
|
||||||
} else if (pitch > MAX_PITCH) {
|
var rotation = handController.rotation;
|
||||||
pitch = MAX_PITCH;
|
|
||||||
|
if (hand === Controller.Standard.LeftHand) {
|
||||||
|
rotation = Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(0, 90, 0));
|
||||||
|
} else {
|
||||||
|
rotation = Quat.multiply(rotation, Quat.fromPitchYawRollDegrees(0, -90, 0));
|
||||||
}
|
}
|
||||||
|
var normal = Vec3.multiplyQbyV(rotation, Vec3.UNIT_NEG_Y);
|
||||||
|
var lookAt = Quat.lookAt(Vec3.ZERO, normal, Vec3.multiplyQbyV(MyAvatar.orientation, Vec3.UNIT_Y));
|
||||||
|
var TABLET_RAKE_ANGLE = 30;
|
||||||
|
rotation = Quat.multiply(Quat.angleAxis(TABLET_RAKE_ANGLE, Vec3.multiplyQbyV(lookAt, Vec3.UNIT_X)), lookAt);
|
||||||
|
|
||||||
// rebuild normal from pitch and heading.
|
var RELATIVE_SPAWN_OFFSET = { x: 0, y: 0.4, z: 0.05 };
|
||||||
var heading = Math.atan2(normal.z, normal.x);
|
position = Vec3.sum(position, Vec3.multiplyQbyV(rotation, Vec3.multiply(tabletHeight, RELATIVE_SPAWN_OFFSET)));
|
||||||
normal = {x: Math.cos(heading), y: Math.sin(pitch), z: Math.sin(heading)};
|
|
||||||
|
|
||||||
var position = Vec3.sum(handController.position, {x: 0, y: TABLET_UP_OFFSET, z: 0});
|
|
||||||
var rotation = Quat.lookAt({x: 0, y: 0, z: 0}, normal, Y_AXIS);
|
|
||||||
var offset = Vec3.multiplyQbyV(rotation, {x: 0, y: height / 2, z: TABLET_FORWARD_OFFSET});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
position: Vec3.sum(offset, position),
|
position: position,
|
||||||
rotation: rotation
|
rotation: rotation
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString outputPath) {
|
||||||
_baker->moveToThread(qApp->getNextWorkerThread());
|
_baker->moveToThread(qApp->getNextWorkerThread());
|
||||||
} else {
|
} else {
|
||||||
qCDebug(model_baking) << "Failed to determine baker type for file" << inputUrl;
|
qCDebug(model_baking) << "Failed to determine baker type for file" << inputUrl;
|
||||||
return;
|
QApplication::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// invoke the bake method on the baker thread
|
// invoke the bake method on the baker thread
|
||||||
|
@ -60,5 +60,5 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString outputPath) {
|
||||||
|
|
||||||
void BakerCLI::handleFinishedBaker() {
|
void BakerCLI::handleFinishedBaker() {
|
||||||
qCDebug(model_baking) << "Finished baking file.";
|
qCDebug(model_baking) << "Finished baking file.";
|
||||||
QApplication::quit();
|
QApplication::exit(_baker.get()->hasErrors());
|
||||||
}
|
}
|
Loading…
Reference in a new issue