mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into spectator-camera
This commit is contained in:
commit
ee86638c4e
18 changed files with 400 additions and 249 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include <QtCore/QCommandLineParser>
|
#include <QtCore/QCommandLineParser>
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
#include <QtCore/QThreadPool>
|
#include <QtCore/QThreadPool>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
@ -481,6 +482,12 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
||||||
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
||||||
bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
|
bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
|
||||||
|
// get dir to use for cache
|
||||||
|
static const auto CACHE_SWITCH = "--cache";
|
||||||
|
QString cacheDir = getCmdOption(argc, const_cast<const char**>(argv), CACHE_SWITCH);
|
||||||
|
if (!cacheDir.isEmpty()) {
|
||||||
|
qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, cacheDir);
|
||||||
|
}
|
||||||
|
|
||||||
Setting::init();
|
Setting::init();
|
||||||
|
|
||||||
|
@ -1219,8 +1226,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
settingsTimer->stop();
|
settingsTimer->stop();
|
||||||
// Delete it (this will trigger the thread destruction
|
// Delete it (this will trigger the thread destruction
|
||||||
settingsTimer->deleteLater();
|
settingsTimer->deleteLater();
|
||||||
// Mark the settings thread as finished, so we know we can safely save in the main application
|
// Mark the settings thread as finished, so we know we can safely save in the main application
|
||||||
// shutdown code
|
// shutdown code
|
||||||
_settingsGuard.trigger();
|
_settingsGuard.trigger();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2166,48 +2173,74 @@ void Application::paintGL() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto displayPlugin = getActiveDisplayPlugin();
|
DisplayPluginPointer displayPlugin;
|
||||||
// FIXME not needed anymore?
|
{
|
||||||
_offscreenContext->makeCurrent();
|
PROFILE_RANGE(render, "/getActiveDisplayPlugin");
|
||||||
|
displayPlugin = getActiveDisplayPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
// If a display plugin loses it's underlying support, it
|
{
|
||||||
// needs to be able to signal us to not use it
|
PROFILE_RANGE(render, "/offscreenMakeCurrent");
|
||||||
if (!displayPlugin->beginFrameRender(_frameCount)) {
|
// FIXME not needed anymore?
|
||||||
_inPaint = false;
|
_offscreenContext->makeCurrent();
|
||||||
updateDisplayMode();
|
}
|
||||||
return;
|
|
||||||
|
{
|
||||||
|
PROFILE_RANGE(render, "/pluginBeginFrameRender");
|
||||||
|
// If a display plugin loses it's underlying support, it
|
||||||
|
// needs to be able to signal us to not use it
|
||||||
|
if (!displayPlugin->beginFrameRender(_frameCount)) {
|
||||||
|
_inPaint = false;
|
||||||
|
updateDisplayMode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the avatar with a fresh HMD pose
|
// update the avatar with a fresh HMD pose
|
||||||
getMyAvatar()->updateFromHMDSensorMatrix(getHMDSensorPose());
|
{
|
||||||
|
PROFILE_RANGE(render, "/updateAvatar");
|
||||||
|
getMyAvatar()->updateFromHMDSensorMatrix(getHMDSensorPose());
|
||||||
|
}
|
||||||
|
|
||||||
auto lodManager = DependencyManager::get<LODManager>();
|
auto lodManager = DependencyManager::get<LODManager>();
|
||||||
|
|
||||||
|
RenderArgs renderArgs;
|
||||||
{
|
{
|
||||||
QMutexLocker viewLocker(&_viewMutex);
|
PROFILE_RANGE(render, "/buildFrustrumAndArgs");
|
||||||
_viewFrustum.calculate();
|
{
|
||||||
}
|
QMutexLocker viewLocker(&_viewMutex);
|
||||||
RenderArgs renderArgs(_gpuContext, getEntities(), lodManager->getOctreeSizeScale(),
|
_viewFrustum.calculate();
|
||||||
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
}
|
||||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
renderArgs = RenderArgs(_gpuContext, getEntities(), lodManager->getOctreeSizeScale(),
|
||||||
{
|
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
QMutexLocker viewLocker(&_viewMutex);
|
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
||||||
renderArgs.setViewFrustum(_viewFrustum);
|
{
|
||||||
|
QMutexLocker viewLocker(&_viewMutex);
|
||||||
|
renderArgs.setViewFrustum(_viewFrustum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
|
{
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
PROFILE_RANGE(render, "/resizeGL");
|
||||||
PerformanceWarning warn(showWarnings, "Application::paintGL()");
|
PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
|
||||||
resizeGL();
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
|
PerformanceWarning warn(showWarnings, "Application::paintGL()");
|
||||||
_gpuContext->beginFrame(getHMDSensorPose());
|
resizeGL();
|
||||||
// Reset the gpu::Context Stages
|
}
|
||||||
// Back to the default framebuffer;
|
|
||||||
gpu::doInBatch(_gpuContext, [&](gpu::Batch& batch) {
|
|
||||||
batch.resetStages();
|
|
||||||
});
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
PROFILE_RANGE(render, "/gpuContextReset");
|
||||||
|
_gpuContext->beginFrame(getHMDSensorPose());
|
||||||
|
// Reset the gpu::Context Stages
|
||||||
|
// Back to the default framebuffer;
|
||||||
|
gpu::doInBatch(_gpuContext, [&](gpu::Batch& batch) {
|
||||||
|
batch.resetStages();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
PROFILE_RANGE(render, "/renderOverlay");
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
// NOTE: There is no batch associated with this renderArgs
|
// NOTE: There is no batch associated with this renderArgs
|
||||||
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
||||||
|
@ -2218,114 +2251,127 @@ void Application::paintGL() {
|
||||||
|
|
||||||
glm::vec3 boomOffset;
|
glm::vec3 boomOffset;
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("CameraUpdates");
|
PROFILE_RANGE(render, "/updateCamera");
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("CameraUpdates");
|
||||||
|
|
||||||
auto myAvatar = getMyAvatar();
|
auto myAvatar = getMyAvatar();
|
||||||
boomOffset = myAvatar->getScale() * myAvatar->getBoomLength() * -IDENTITY_FORWARD;
|
boomOffset = myAvatar->getScale() * myAvatar->getBoomLength() * -IDENTITY_FORWARD;
|
||||||
|
|
||||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
||||||
cameraMenuChanged();
|
cameraMenuChanged();
|
||||||
}
|
|
||||||
|
|
||||||
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
|
||||||
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
|
||||||
|
|
||||||
// Always use the default eye position, not the actual head eye position.
|
|
||||||
// Using the latter will cause the camera to wobble with idle animations,
|
|
||||||
// or with changes from the face tracker
|
|
||||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
|
||||||
if (isHMDMode()) {
|
|
||||||
mat4 camMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
|
||||||
_myCamera.setPosition(extractTranslation(camMat));
|
|
||||||
_myCamera.setOrientation(glm::quat_cast(camMat));
|
|
||||||
} else {
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition());
|
|
||||||
_myCamera.setOrientation(myAvatar->getMyHead()->getHeadOrientation());
|
|
||||||
}
|
}
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
|
||||||
if (isHMDMode()) {
|
|
||||||
auto hmdWorldMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
|
||||||
_myCamera.setOrientation(glm::normalize(glm::quat_cast(hmdWorldMat)));
|
|
||||||
_myCamera.setPosition(extractTranslation(hmdWorldMat) +
|
|
||||||
myAvatar->getOrientation() * boomOffset);
|
|
||||||
} else {
|
|
||||||
_myCamera.setOrientation(myAvatar->getHead()->getOrientation());
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
|
||||||
+ _myCamera.getOrientation() * boomOffset);
|
|
||||||
} else {
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
|
||||||
+ myAvatar->getOrientation() * boomOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
|
||||||
if (isHMDMode()) {
|
|
||||||
auto mirrorBodyOrientation = myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f));
|
|
||||||
|
|
||||||
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
||||||
// Mirror HMD yaw and roll
|
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
||||||
glm::vec3 mirrorHmdEulers = glm::eulerAngles(hmdRotation);
|
|
||||||
mirrorHmdEulers.y = -mirrorHmdEulers.y;
|
|
||||||
mirrorHmdEulers.z = -mirrorHmdEulers.z;
|
|
||||||
glm::quat mirrorHmdRotation = glm::quat(mirrorHmdEulers);
|
|
||||||
|
|
||||||
glm::quat worldMirrorRotation = mirrorBodyOrientation * mirrorHmdRotation;
|
// Always use the default eye position, not the actual head eye position.
|
||||||
|
// Using the latter will cause the camera to wobble with idle animations,
|
||||||
_myCamera.setOrientation(worldMirrorRotation);
|
// or with changes from the face tracker
|
||||||
|
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
||||||
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
|
||||||
// Mirror HMD lateral offsets
|
|
||||||
hmdOffset.x = -hmdOffset.x;
|
|
||||||
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
|
||||||
+ glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0)
|
|
||||||
+ mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
|
|
||||||
+ mirrorBodyOrientation * hmdOffset);
|
|
||||||
} else {
|
|
||||||
_myCamera.setOrientation(myAvatar->getWorldAlignedOrientation()
|
|
||||||
* glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
|
||||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
|
||||||
+ glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0)
|
|
||||||
+ (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
|
||||||
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
|
||||||
}
|
|
||||||
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
|
|
||||||
EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer();
|
|
||||||
if (cameraEntity != nullptr) {
|
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
mat4 camMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||||
_myCamera.setOrientation(cameraEntity->getRotation() * hmdRotation);
|
_myCamera.setPosition(extractTranslation(camMat));
|
||||||
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
_myCamera.setOrientation(glm::quat_cast(camMat));
|
||||||
_myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset));
|
|
||||||
} else {
|
} else {
|
||||||
_myCamera.setOrientation(cameraEntity->getRotation());
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition());
|
||||||
_myCamera.setPosition(cameraEntity->getPosition());
|
_myCamera.setOrientation(myAvatar->getMyHead()->getHeadOrientation());
|
||||||
|
}
|
||||||
|
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
|
if (isHMDMode()) {
|
||||||
|
auto hmdWorldMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||||
|
_myCamera.setOrientation(glm::normalize(glm::quat_cast(hmdWorldMat)));
|
||||||
|
_myCamera.setPosition(extractTranslation(hmdWorldMat) +
|
||||||
|
myAvatar->getOrientation() * boomOffset);
|
||||||
|
} else {
|
||||||
|
_myCamera.setOrientation(myAvatar->getHead()->getOrientation());
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ _myCamera.getOrientation() * boomOffset);
|
||||||
|
} else {
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ myAvatar->getOrientation() * boomOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
|
if (isHMDMode()) {
|
||||||
|
auto mirrorBodyOrientation = myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f));
|
||||||
|
|
||||||
|
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
||||||
|
// Mirror HMD yaw and roll
|
||||||
|
glm::vec3 mirrorHmdEulers = glm::eulerAngles(hmdRotation);
|
||||||
|
mirrorHmdEulers.y = -mirrorHmdEulers.y;
|
||||||
|
mirrorHmdEulers.z = -mirrorHmdEulers.z;
|
||||||
|
glm::quat mirrorHmdRotation = glm::quat(mirrorHmdEulers);
|
||||||
|
|
||||||
|
glm::quat worldMirrorRotation = mirrorBodyOrientation * mirrorHmdRotation;
|
||||||
|
|
||||||
|
_myCamera.setOrientation(worldMirrorRotation);
|
||||||
|
|
||||||
|
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
||||||
|
// Mirror HMD lateral offsets
|
||||||
|
hmdOffset.x = -hmdOffset.x;
|
||||||
|
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0)
|
||||||
|
+ mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
|
||||||
|
+ mirrorBodyOrientation * hmdOffset);
|
||||||
|
} else {
|
||||||
|
_myCamera.setOrientation(myAvatar->getWorldAlignedOrientation()
|
||||||
|
* glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
||||||
|
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||||
|
+ glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0)
|
||||||
|
+ (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||||
|
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
||||||
|
}
|
||||||
|
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
||||||
|
} else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
|
||||||
|
EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer();
|
||||||
|
if (cameraEntity != nullptr) {
|
||||||
|
if (isHMDMode()) {
|
||||||
|
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
||||||
|
_myCamera.setOrientation(cameraEntity->getRotation() * hmdRotation);
|
||||||
|
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
||||||
|
_myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset));
|
||||||
|
} else {
|
||||||
|
_myCamera.setOrientation(cameraEntity->getRotation());
|
||||||
|
_myCamera.setPosition(cameraEntity->getPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// Update camera position
|
||||||
// Update camera position
|
if (!isHMDMode()) {
|
||||||
if (!isHMDMode()) {
|
_myCamera.update(1.0f / _frameCounter.rate());
|
||||||
_myCamera.update(1.0f / _frameCounter.rate());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplicationCompositor().setFrameInfo(_frameCount, _myCamera.getTransform());
|
{
|
||||||
|
PROFILE_RANGE(render, "/updateCompositor");
|
||||||
|
getApplicationCompositor().setFrameInfo(_frameCount, _myCamera.getTransform());
|
||||||
|
}
|
||||||
|
|
||||||
// Primary rendering pass
|
gpu::FramebufferPointer finalFramebuffer;
|
||||||
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
QSize finalFramebufferSize;
|
||||||
const QSize size = framebufferCache->getFrameBufferSize();
|
{
|
||||||
// Final framebuffer that will be handled to the display-plugin
|
PROFILE_RANGE(render, "/getOutputFramebuffer");
|
||||||
auto finalFramebuffer = framebufferCache->getFramebuffer();
|
// Primary rendering pass
|
||||||
|
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||||
|
finalFramebufferSize = framebufferCache->getFrameBufferSize();
|
||||||
|
// Final framebuffer that will be handled to the display-plugin
|
||||||
|
finalFramebuffer = framebufferCache->getFramebuffer();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(render, "/mainRender");
|
PROFILE_RANGE(render, "/mainRender");
|
||||||
PerformanceTimer perfTimer("mainRender");
|
PerformanceTimer perfTimer("mainRender");
|
||||||
renderArgs._boomOffset = boomOffset;
|
renderArgs._boomOffset = boomOffset;
|
||||||
|
// FIXME is this ever going to be different from the size previously set in the render args
|
||||||
|
// in the overlay render?
|
||||||
// Viewport is assigned to the size of the framebuffer
|
// Viewport is assigned to the size of the framebuffer
|
||||||
renderArgs._viewport = ivec4(0, 0, size.width(), size.height());
|
renderArgs._viewport = ivec4(0, 0, finalFramebufferSize.width(), finalFramebufferSize.height());
|
||||||
if (displayPlugin->isStereo()) {
|
if (displayPlugin->isStereo()) {
|
||||||
// Stereo modes will typically have a larger projection matrix overall,
|
// Stereo modes will typically have a larger projection matrix overall,
|
||||||
// so we ask for the 'mono' projection matrix, which for stereo and HMD
|
// so we ask for the 'mono' projection matrix, which for stereo and HMD
|
||||||
|
@ -3625,6 +3671,133 @@ bool Application::shouldPaint(float nsecsElapsed) {
|
||||||
#include <TCHAR.h>
|
#include <TCHAR.h>
|
||||||
#include <pdh.h>
|
#include <pdh.h>
|
||||||
#pragma comment(lib, "pdh.lib")
|
#pragma comment(lib, "pdh.lib")
|
||||||
|
#pragma comment(lib, "ntdll.lib")
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
enum SYSTEM_INFORMATION_CLASS {
|
||||||
|
SystemBasicInformation = 0,
|
||||||
|
SystemProcessorPerformanceInformation = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
|
||||||
|
LARGE_INTEGER IdleTime;
|
||||||
|
LARGE_INTEGER KernelTime;
|
||||||
|
LARGE_INTEGER UserTime;
|
||||||
|
LARGE_INTEGER DpcTime;
|
||||||
|
LARGE_INTEGER InterruptTime;
|
||||||
|
ULONG InterruptCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SYSTEM_BASIC_INFORMATION {
|
||||||
|
ULONG Reserved;
|
||||||
|
ULONG TimerResolution;
|
||||||
|
ULONG PageSize;
|
||||||
|
ULONG NumberOfPhysicalPages;
|
||||||
|
ULONG LowestPhysicalPageNumber;
|
||||||
|
ULONG HighestPhysicalPageNumber;
|
||||||
|
ULONG AllocationGranularity;
|
||||||
|
ULONG_PTR MinimumUserModeAddress;
|
||||||
|
ULONG_PTR MaximumUserModeAddress;
|
||||||
|
ULONG_PTR ActiveProcessorsAffinityMask;
|
||||||
|
CCHAR NumberOfProcessors;
|
||||||
|
};
|
||||||
|
|
||||||
|
NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemInformation(
|
||||||
|
_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||||
|
_Out_writes_bytes_opt_(SystemInformationLength) PVOID SystemInformation,
|
||||||
|
_In_ ULONG SystemInformationLength,
|
||||||
|
_Out_opt_ PULONG ReturnLength
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
template <typename T>
|
||||||
|
NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, T& t) {
|
||||||
|
return NtQuerySystemInformation(SystemInformationClass, &t, (ULONG)sizeof(T), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, std::vector<T>& t) {
|
||||||
|
return NtQuerySystemInformation(SystemInformationClass, t.data(), (ULONG)(sizeof(T) * t.size()), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void updateValueAndDelta(std::pair<T, T>& pair, T newValue) {
|
||||||
|
auto& value = pair.first;
|
||||||
|
auto& delta = pair.second;
|
||||||
|
delta = (value != 0) ? newValue - value : 0;
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MyCpuInfo {
|
||||||
|
using ValueAndDelta = std::pair<LONGLONG, LONGLONG>;
|
||||||
|
std::string name;
|
||||||
|
ValueAndDelta kernel { 0, 0 };
|
||||||
|
ValueAndDelta user { 0, 0 };
|
||||||
|
ValueAndDelta idle { 0, 0 };
|
||||||
|
float kernelUsage { 0.0f };
|
||||||
|
float userUsage { 0.0f };
|
||||||
|
|
||||||
|
void update(const SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION& cpuInfo) {
|
||||||
|
updateValueAndDelta(kernel, cpuInfo.KernelTime.QuadPart);
|
||||||
|
updateValueAndDelta(user, cpuInfo.UserTime.QuadPart);
|
||||||
|
updateValueAndDelta(idle, cpuInfo.IdleTime.QuadPart);
|
||||||
|
auto totalTime = kernel.second + user.second + idle.second;
|
||||||
|
if (totalTime != 0) {
|
||||||
|
kernelUsage = (FLOAT)kernel.second / totalTime;
|
||||||
|
userUsage = (FLOAT)user.second / totalTime;
|
||||||
|
} else {
|
||||||
|
kernelUsage = userUsage = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void updateCpuInformation() {
|
||||||
|
static std::once_flag once;
|
||||||
|
static SYSTEM_BASIC_INFORMATION systemInfo {};
|
||||||
|
static SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION cpuTotals;
|
||||||
|
static std::vector<SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION> cpuInfos;
|
||||||
|
static std::vector<MyCpuInfo> myCpuInfos;
|
||||||
|
static MyCpuInfo myCpuTotals;
|
||||||
|
std::call_once(once, [&] {
|
||||||
|
NtQuerySystemInformation( SystemBasicInformation, systemInfo);
|
||||||
|
cpuInfos.resize(systemInfo.NumberOfProcessors);
|
||||||
|
myCpuInfos.resize(systemInfo.NumberOfProcessors);
|
||||||
|
for (size_t i = 0; i < systemInfo.NumberOfProcessors; ++i) {
|
||||||
|
myCpuInfos[i].name = "cpu." + std::to_string(i);
|
||||||
|
}
|
||||||
|
myCpuTotals.name = "cpu.total";
|
||||||
|
});
|
||||||
|
NtQuerySystemInformation(SystemProcessorPerformanceInformation, cpuInfos);
|
||||||
|
|
||||||
|
// Zero the CPU totals.
|
||||||
|
memset(&cpuTotals, 0, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
|
||||||
|
for (size_t i = 0; i < systemInfo.NumberOfProcessors; ++i) {
|
||||||
|
auto& cpuInfo = cpuInfos[i];
|
||||||
|
// KernelTime includes IdleTime.
|
||||||
|
cpuInfo.KernelTime.QuadPart -= cpuInfo.IdleTime.QuadPart;
|
||||||
|
|
||||||
|
// Update totals
|
||||||
|
cpuTotals.IdleTime.QuadPart += cpuInfo.IdleTime.QuadPart;
|
||||||
|
cpuTotals.KernelTime.QuadPart += cpuInfo.KernelTime.QuadPart;
|
||||||
|
cpuTotals.UserTime.QuadPart += cpuInfo.UserTime.QuadPart;
|
||||||
|
|
||||||
|
// Update friendly structure
|
||||||
|
auto& myCpuInfo = myCpuInfos[i];
|
||||||
|
myCpuInfo.update(cpuInfo);
|
||||||
|
PROFILE_COUNTER(app, myCpuInfo.name.c_str(), {
|
||||||
|
{ "kernel", myCpuInfo.kernelUsage },
|
||||||
|
{ "user", myCpuInfo.userUsage }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
myCpuTotals.update(cpuTotals);
|
||||||
|
PROFILE_COUNTER(app, myCpuTotals.name.c_str(), {
|
||||||
|
{ "kernel", myCpuTotals.kernelUsage },
|
||||||
|
{ "user", myCpuTotals.userUsage }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
|
static ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
|
||||||
static int numProcessors;
|
static int numProcessors;
|
||||||
|
@ -3677,6 +3850,26 @@ void getCpuUsage(vec3& systemAndUser) {
|
||||||
systemAndUser.z = (float)counterVal.doubleValue;
|
systemAndUser.z = (float)counterVal.doubleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupCpuMonitorThread() {
|
||||||
|
initCpuUsage();
|
||||||
|
auto cpuMonitorThread = QThread::currentThread();
|
||||||
|
|
||||||
|
QTimer* timer = new QTimer();
|
||||||
|
timer->setInterval(50);
|
||||||
|
QObject::connect(timer, &QTimer::timeout, [] {
|
||||||
|
updateCpuInformation();
|
||||||
|
vec3 kernelUserAndSystem;
|
||||||
|
getCpuUsage(kernelUserAndSystem);
|
||||||
|
PROFILE_COUNTER(app, "cpuProcess", { { "system", kernelUserAndSystem.x }, { "user", kernelUserAndSystem.y } });
|
||||||
|
PROFILE_COUNTER(app, "cpuSystem", { { "system", kernelUserAndSystem.z } });
|
||||||
|
});
|
||||||
|
QObject::connect(cpuMonitorThread, &QThread::finished, [=] {
|
||||||
|
timer->deleteLater();
|
||||||
|
cpuMonitorThread->deleteLater();
|
||||||
|
});
|
||||||
|
timer->start();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -3697,15 +3890,17 @@ void Application::idle(float nsecsElapsed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
// If tracing is enabled then monitor the CPU in a separate thread
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [] {
|
std::call_once(once, [&] {
|
||||||
initCpuUsage();
|
if (trace_app().isDebugEnabled()) {
|
||||||
|
QThread* cpuMonitorThread = new QThread(qApp);
|
||||||
|
cpuMonitorThread->setObjectName("cpuMonitorThread");
|
||||||
|
QObject::connect(cpuMonitorThread, &QThread::started, [this] { setupCpuMonitorThread(); });
|
||||||
|
QObject::connect(qApp, &QCoreApplication::aboutToQuit, cpuMonitorThread, &QThread::quit);
|
||||||
|
cpuMonitorThread->start();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vec3 kernelUserAndSystem;
|
|
||||||
getCpuUsage(kernelUserAndSystem);
|
|
||||||
PROFILE_COUNTER(app, "cpuProcess", { { "system", kernelUserAndSystem.x }, { "user", kernelUserAndSystem.y } });
|
|
||||||
PROFILE_COUNTER(app, "cpuSystem", { { "system", kernelUserAndSystem.z } });
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,6 @@ public:
|
||||||
void setAvatarOverrideUrl(const QUrl& url, bool save);
|
void setAvatarOverrideUrl(const QUrl& url, bool save);
|
||||||
QUrl getAvatarOverrideUrl() { return _avatarOverrideUrl; }
|
QUrl getAvatarOverrideUrl() { return _avatarOverrideUrl; }
|
||||||
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
|
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
|
||||||
void setCacheOverrideDir(const QString& dirName) { _cacheDir = dirName; }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void svoImportRequested(const QString& url);
|
void svoImportRequested(const QString& url);
|
||||||
|
@ -691,6 +690,5 @@ private:
|
||||||
QUrl _avatarOverrideUrl;
|
QUrl _avatarOverrideUrl;
|
||||||
bool _saveAvatarOverrideUrl { false };
|
bool _saveAvatarOverrideUrl { false };
|
||||||
|
|
||||||
QString _cacheDir;
|
|
||||||
};
|
};
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
|
@ -101,7 +101,7 @@ int main(int argc, const char* argv[]) {
|
||||||
if (allowMultipleInstances) {
|
if (allowMultipleInstances) {
|
||||||
instanceMightBeRunning = false;
|
instanceMightBeRunning = false;
|
||||||
}
|
}
|
||||||
// this needs to be done here in main, as the mechanism for setting the
|
// this needs to be done here in main, as the mechanism for setting the
|
||||||
// scripts directory appears not to work. See the bug report
|
// scripts directory appears not to work. See the bug report
|
||||||
// https://highfidelity.fogbugz.com/f/cases/5759/Issues-changing-scripts-directory-in-ScriptsEngine
|
// https://highfidelity.fogbugz.com/f/cases/5759/Issues-changing-scripts-directory-in-ScriptsEngine
|
||||||
if (parser.isSet(overrideScriptsPathOption)) {
|
if (parser.isSet(overrideScriptsPathOption)) {
|
||||||
|
@ -111,20 +111,6 @@ int main(int argc, const char* argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.isSet(overrideAppLocalDataPathOption)) {
|
|
||||||
// get dir to use for cache
|
|
||||||
QString cacheDir = parser.value(overrideAppLocalDataPathOption);
|
|
||||||
if (!cacheDir.isEmpty()) {
|
|
||||||
// tell everyone to use the right cache location
|
|
||||||
//
|
|
||||||
// this handles data8 and prepared
|
|
||||||
DependencyManager::get<ResourceManager>()->setCacheDir(cacheDir);
|
|
||||||
|
|
||||||
// this does the ktx_cache
|
|
||||||
PathUtils::getAppLocalDataPath(cacheDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instanceMightBeRunning) {
|
if (instanceMightBeRunning) {
|
||||||
// Try to connect and send message to existing interface instance
|
// Try to connect and send message to existing interface instance
|
||||||
QLocalSocket socket;
|
QLocalSocket socket;
|
||||||
|
|
|
@ -67,19 +67,14 @@ void Overlays::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::update(float deltatime) {
|
void Overlays::update(float deltatime) {
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysHUD;
|
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysWorld;
|
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&_mutex);
|
QMutexLocker locker(&_mutex);
|
||||||
overlaysHUD = _overlaysHUD;
|
foreach(const auto& thisOverlay, _overlaysHUD) {
|
||||||
overlaysWorld = _overlaysWorld;
|
thisOverlay->update(deltatime);
|
||||||
}
|
}
|
||||||
|
foreach(const auto& thisOverlay, _overlaysWorld) {
|
||||||
foreach(const auto& thisOverlay, overlaysHUD) {
|
thisOverlay->update(deltatime);
|
||||||
thisOverlay->update(deltatime);
|
}
|
||||||
}
|
|
||||||
foreach(const auto& thisOverlay, overlaysWorld) {
|
|
||||||
thisOverlay->update(deltatime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanupOverlaysToDelete();
|
cleanupOverlaysToDelete();
|
||||||
|
@ -119,14 +114,8 @@ void Overlays::renderHUD(RenderArgs* renderArgs) {
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
||||||
|
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysHUD;
|
QMutexLocker locker(&_mutex);
|
||||||
{
|
foreach(Overlay::Pointer thisOverlay, _overlaysHUD) {
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
overlaysHUD = _overlaysHUD;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach(Overlay::Pointer thisOverlay, overlaysHUD) {
|
|
||||||
|
|
||||||
// Reset all batch pipeline settings between overlay
|
// Reset all batch pipeline settings between overlay
|
||||||
geometryCache->useSimpleDrawPipeline(batch);
|
geometryCache->useSimpleDrawPipeline(batch);
|
||||||
|
@ -400,36 +389,22 @@ OverlayID Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 pointCopy = point;
|
|
||||||
if (!_enabled) {
|
if (!_enabled) {
|
||||||
return UNKNOWN_OVERLAY_ID;
|
return UNKNOWN_OVERLAY_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysHUD;
|
QMutexLocker locker(&_mutex);
|
||||||
{
|
QMapIterator<OverlayID, Overlay::Pointer> i(_overlaysHUD);
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
overlaysHUD = _overlaysHUD;
|
|
||||||
}
|
|
||||||
QMapIterator<OverlayID, Overlay::Pointer> i(overlaysHUD);
|
|
||||||
|
|
||||||
const float LARGE_NEGATIVE_FLOAT = -9999999;
|
|
||||||
glm::vec3 origin(pointCopy.x, pointCopy.y, LARGE_NEGATIVE_FLOAT);
|
|
||||||
glm::vec3 direction(0, 0, 1);
|
|
||||||
glm::vec3 thisSurfaceNormal;
|
|
||||||
unsigned int bestStackOrder = 0;
|
unsigned int bestStackOrder = 0;
|
||||||
OverlayID bestOverlayID = UNKNOWN_OVERLAY_ID;
|
OverlayID bestOverlayID = UNKNOWN_OVERLAY_ID;
|
||||||
|
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
OverlayID thisID = i.key();
|
auto thisOverlay = std::dynamic_pointer_cast<Overlay2D>(i.value());
|
||||||
if (!i.value()->is3D()) {
|
if (thisOverlay && thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
||||||
auto thisOverlay = std::dynamic_pointer_cast<Overlay2D>(i.value());
|
thisOverlay->getBoundingRect().contains(point.x, point.y, false)) {
|
||||||
if (thisOverlay && thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
if (thisOverlay->getStackOrder() > bestStackOrder) {
|
||||||
thisOverlay->getBoundingRect().contains(pointCopy.x, pointCopy.y, false)) {
|
bestOverlayID = i.key();
|
||||||
if (thisOverlay->getStackOrder() > bestStackOrder) {
|
bestStackOrder = thisOverlay->getStackOrder();
|
||||||
bestOverlayID = thisID;
|
|
||||||
bestStackOrder = thisOverlay->getStackOrder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,14 +473,9 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionInternal(const PickR
|
||||||
float bestDistance = std::numeric_limits<float>::max();
|
float bestDistance = std::numeric_limits<float>::max();
|
||||||
bool bestIsFront = false;
|
bool bestIsFront = false;
|
||||||
|
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysWorld;
|
QMutexLocker locker(&_mutex);
|
||||||
{
|
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
overlaysWorld = _overlaysWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
RayToOverlayIntersectionResult result;
|
RayToOverlayIntersectionResult result;
|
||||||
QMapIterator<OverlayID, Overlay::Pointer> i(overlaysWorld);
|
QMapIterator<OverlayID, Overlay::Pointer> i(_overlaysWorld);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
OverlayID thisID = i.key();
|
OverlayID thisID = i.key();
|
||||||
|
@ -995,13 +965,8 @@ QVector<QUuid> Overlays::findOverlays(const glm::vec3& center, float radius) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<OverlayID, Overlay::Pointer> overlaysWorld;
|
QMutexLocker locker(&_mutex);
|
||||||
{
|
QMapIterator<OverlayID, Overlay::Pointer> i(_overlaysWorld);
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
overlaysWorld = _overlaysWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMapIterator<OverlayID, Overlay::Pointer> i(overlaysWorld);
|
|
||||||
int checked = 0;
|
int checked = 0;
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
checked++;
|
checked++;
|
||||||
|
|
|
@ -198,11 +198,7 @@ gpu::TexturePointer TextureCache::getTextureByHash(const std::string& hash) {
|
||||||
std::unique_lock<std::mutex> lock(_texturesByHashesMutex);
|
std::unique_lock<std::mutex> lock(_texturesByHashesMutex);
|
||||||
weakPointer = _texturesByHashes[hash];
|
weakPointer = _texturesByHashes[hash];
|
||||||
}
|
}
|
||||||
auto result = weakPointer.lock();
|
return weakPointer.lock();
|
||||||
if (result) {
|
|
||||||
qCWarning(modelnetworking) << "QQQ Returning live texture for hash " << hash.c_str();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::TexturePointer TextureCache::cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture) {
|
gpu::TexturePointer TextureCache::cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture) {
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtNetwork/QNetworkDiskCache>
|
#include <QtNetwork/QNetworkDiskCache>
|
||||||
|
|
||||||
|
#include <shared/GlobalAppProperties.h>
|
||||||
|
|
||||||
#include "AssetRequest.h"
|
#include "AssetRequest.h"
|
||||||
#include "AssetUpload.h"
|
#include "AssetUpload.h"
|
||||||
#include "AssetUtils.h"
|
#include "AssetUtils.h"
|
||||||
|
@ -31,11 +33,12 @@
|
||||||
|
|
||||||
MessageID AssetClient::_currentID = 0;
|
MessageID AssetClient::_currentID = 0;
|
||||||
|
|
||||||
AssetClient::AssetClient(const QString& cacheDir) : _cacheDir(cacheDir) {
|
AssetClient::AssetClient() {
|
||||||
|
_cacheDir = qApp->property(hifi::properties::APP_LOCAL_DATA_PATH).toString();
|
||||||
setCustomDeleter([](Dependency* dependency){
|
setCustomDeleter([](Dependency* dependency){
|
||||||
static_cast<AssetClient*>(dependency)->deleteLater();
|
static_cast<AssetClient*>(dependency)->deleteLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
auto& packetReceiver = nodeList->getPacketReceiver();
|
auto& packetReceiver = nodeList->getPacketReceiver();
|
||||||
|
|
||||||
|
@ -105,7 +108,7 @@ void AssetClient::handleAssetMappingOperationReply(QSharedPointer<ReceivedMessag
|
||||||
|
|
||||||
MessageID messageID;
|
MessageID messageID;
|
||||||
message->readPrimitive(&messageID);
|
message->readPrimitive(&messageID);
|
||||||
|
|
||||||
AssetServerError error;
|
AssetServerError error;
|
||||||
message->readPrimitive(&error);
|
message->readPrimitive(&error);
|
||||||
|
|
||||||
|
@ -132,13 +135,13 @@ void AssetClient::handleAssetMappingOperationReply(QSharedPointer<ReceivedMessag
|
||||||
bool haveAssetServer() {
|
bool haveAssetServer() {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (!assetServer) {
|
if (!assetServer) {
|
||||||
qCWarning(asset_client) << "Could not complete AssetClient operation "
|
qCWarning(asset_client) << "Could not complete AssetClient operation "
|
||||||
<< "since you are not currently connected to an asset-server.";
|
<< "since you are not currently connected to an asset-server.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,14 +223,14 @@ MessageID AssetClient::getAsset(const QString& hash, DataOffset start, DataOffse
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
|
|
||||||
auto messageID = ++_currentID;
|
auto messageID = ++_currentID;
|
||||||
|
|
||||||
auto payloadSize = sizeof(messageID) + SHA256_HASH_LENGTH + sizeof(start) + sizeof(end);
|
auto payloadSize = sizeof(messageID) + SHA256_HASH_LENGTH + sizeof(start) + sizeof(end);
|
||||||
auto packet = NLPacket::create(PacketType::AssetGet, payloadSize, true);
|
auto packet = NLPacket::create(PacketType::AssetGet, payloadSize, true);
|
||||||
|
|
||||||
qCDebug(asset_client) << "Requesting data from" << start << "to" << end << "of" << hash << "from asset-server.";
|
qCDebug(asset_client) << "Requesting data from" << start << "to" << end << "of" << hash << "from asset-server.";
|
||||||
|
|
||||||
packet->writePrimitive(messageID);
|
packet->writePrimitive(messageID);
|
||||||
|
|
||||||
packet->write(QByteArray::fromHex(hash.toLatin1()));
|
packet->write(QByteArray::fromHex(hash.toLatin1()));
|
||||||
|
@ -254,10 +257,10 @@ MessageID AssetClient::getAssetInfo(const QString& hash, GetInfoCallback callbac
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
auto messageID = ++_currentID;
|
auto messageID = ++_currentID;
|
||||||
|
|
||||||
auto payloadSize = sizeof(messageID) + SHA256_HASH_LENGTH;
|
auto payloadSize = sizeof(messageID) + SHA256_HASH_LENGTH;
|
||||||
auto packet = NLPacket::create(PacketType::AssetGetInfo, payloadSize, true);
|
auto packet = NLPacket::create(PacketType::AssetGetInfo, payloadSize, true);
|
||||||
|
|
||||||
packet->writePrimitive(messageID);
|
packet->writePrimitive(messageID);
|
||||||
packet->write(QByteArray::fromHex(hash.toLatin1()));
|
packet->write(QByteArray::fromHex(hash.toLatin1()));
|
||||||
|
|
||||||
|
@ -278,7 +281,7 @@ void AssetClient::handleAssetGetInfoReply(QSharedPointer<ReceivedMessage> messag
|
||||||
MessageID messageID;
|
MessageID messageID;
|
||||||
message->readPrimitive(&messageID);
|
message->readPrimitive(&messageID);
|
||||||
auto assetHash = message->read(SHA256_HASH_LENGTH);
|
auto assetHash = message->read(SHA256_HASH_LENGTH);
|
||||||
|
|
||||||
AssetServerError error;
|
AssetServerError error;
|
||||||
message->readPrimitive(&error);
|
message->readPrimitive(&error);
|
||||||
|
|
||||||
|
@ -367,7 +370,7 @@ void AssetClient::handleAssetGetReply(QSharedPointer<ReceivedMessage> message, S
|
||||||
callbacks.completeCallback(true, error, message->readAll());
|
callbacks.completeCallback(true, error, message->readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
messageCallbackMap.erase(requestIt);
|
messageCallbackMap.erase(requestIt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -478,7 +481,7 @@ MessageID AssetClient::getAllAssetMappings(MappingOperationCallback callback) {
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
||||||
|
|
||||||
|
@ -501,7 +504,7 @@ MessageID AssetClient::getAllAssetMappings(MappingOperationCallback callback) {
|
||||||
MessageID AssetClient::deleteAssetMappings(const AssetPathList& paths, MappingOperationCallback callback) {
|
MessageID AssetClient::deleteAssetMappings(const AssetPathList& paths, MappingOperationCallback callback) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
||||||
|
|
||||||
|
@ -532,7 +535,7 @@ MessageID AssetClient::setAssetMapping(const QString& path, const AssetHash& has
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
auto packetList = NLPacketList::create(PacketType::AssetMappingOperation, QByteArray(), true, true);
|
||||||
|
|
||||||
|
@ -644,7 +647,7 @@ MessageID AssetClient::uploadAsset(const QByteArray& data, UploadResultCallback
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||||
|
|
||||||
if (assetServer) {
|
if (assetServer) {
|
||||||
auto packetList = NLPacketList::create(PacketType::AssetUpload, QByteArray(), true, true);
|
auto packetList = NLPacketList::create(PacketType::AssetUpload, QByteArray(), true, true);
|
||||||
|
|
||||||
|
@ -682,7 +685,7 @@ void AssetClient::handleAssetUploadReply(QSharedPointer<ReceivedMessage> message
|
||||||
} else {
|
} else {
|
||||||
auto hash = message->read(SHA256_HASH_LENGTH);
|
auto hash = message->read(SHA256_HASH_LENGTH);
|
||||||
hashString = hash.toHex();
|
hashString = hash.toHex();
|
||||||
|
|
||||||
qCDebug(asset_client) << "Successfully uploaded asset to asset-server - SHA256 hash is " << hashString;
|
qCDebug(asset_client) << "Successfully uploaded asset to asset-server - SHA256 hash is " << hashString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ using ProgressCallback = std::function<void(qint64 totalReceived, qint64 total)>
|
||||||
class AssetClient : public QObject, public Dependency {
|
class AssetClient : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AssetClient(const QString& cacheDir="");
|
AssetClient();
|
||||||
|
|
||||||
Q_INVOKABLE GetMappingRequest* createGetMappingRequest(const AssetPath& path);
|
Q_INVOKABLE GetMappingRequest* createGetMappingRequest(const AssetPath& path);
|
||||||
Q_INVOKABLE GetAllMappingsRequest* createGetAllMappingsRequest();
|
Q_INVOKABLE GetAllMappingsRequest* createGetAllMappingsRequest();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
ResourceManager::ResourceManager() {
|
ResourceManager::ResourceManager() {
|
||||||
_thread.setObjectName("Resource Manager Thread");
|
_thread.setObjectName("Resource Manager Thread");
|
||||||
|
|
||||||
auto assetClient = DependencyManager::set<AssetClient>(_cacheDir);
|
auto assetClient = DependencyManager::set<AssetClient>();
|
||||||
assetClient->moveToThread(&_thread);
|
assetClient->moveToThread(&_thread);
|
||||||
QObject::connect(&_thread, &QThread::started, assetClient.data(), &AssetClient::init);
|
QObject::connect(&_thread, &QThread::started, assetClient.data(), &AssetClient::init);
|
||||||
|
|
||||||
|
@ -160,7 +160,3 @@ bool ResourceManager::resourceExists(const QUrl& url) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::setCacheDir(const QString& cacheDir) {
|
|
||||||
// TODO: check for existence?
|
|
||||||
_cacheDir = cacheDir;
|
|
||||||
}
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ private:
|
||||||
PrefixMap _prefixMap;
|
PrefixMap _prefixMap;
|
||||||
QMutex _prefixMapLock;
|
QMutex _prefixMapLock;
|
||||||
|
|
||||||
QString _cacheDir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,6 +34,8 @@ in vec2 _texCoord0;
|
||||||
out vec4 _fragColor;
|
out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
_fragColor = vec4(0.0);
|
||||||
|
|
||||||
// Grab the fragment data from the uv
|
// Grab the fragment data from the uv
|
||||||
vec2 texCoord = _texCoord0.st;
|
vec2 texCoord = _texCoord0.st;
|
||||||
|
|
||||||
|
|
|
@ -1821,7 +1821,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
||||||
clearExceptions();
|
clearExceptions();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scriptWarningMessage("Script.include() skipping evaluation of previously included url:" + url.toString());
|
scriptPrintedMessage("Script.include() skipping evaluation of previously included url:" + url.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "PathUtils.h"
|
#include "PathUtils.h"
|
||||||
#include <QtCore/QStandardPaths>
|
#include <QtCore/QStandardPaths>
|
||||||
#include <mutex> // std::once
|
#include <mutex> // std::once
|
||||||
|
#include "shared/GlobalAppProperties.h"
|
||||||
|
|
||||||
const QString& PathUtils::resourcesPath() {
|
const QString& PathUtils::resourcesPath() {
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
@ -34,12 +35,8 @@ QString PathUtils::getAppDataPath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
|
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PathUtils::getAppLocalDataPath(const QString& overridePath /* = "" */) {
|
QString PathUtils::getAppLocalDataPath() {
|
||||||
static QString overriddenPath = "";
|
QString overriddenPath = qApp->property(hifi::properties::APP_LOCAL_DATA_PATH).toString();
|
||||||
// set the overridden path if one was passed in
|
|
||||||
if (!overridePath.isEmpty()) {
|
|
||||||
overriddenPath = overridePath;
|
|
||||||
}
|
|
||||||
// return overridden path if set
|
// return overridden path if set
|
||||||
if (!overriddenPath.isEmpty()) {
|
if (!overriddenPath.isEmpty()) {
|
||||||
return overriddenPath;
|
return overriddenPath;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
static const QString& resourcesPath();
|
static const QString& resourcesPath();
|
||||||
|
|
||||||
static QString getAppDataPath();
|
static QString getAppDataPath();
|
||||||
static QString getAppLocalDataPath(const QString& overridePath = "");
|
static QString getAppLocalDataPath();
|
||||||
|
|
||||||
static QString getAppDataFilePath(const QString& filename);
|
static QString getAppDataFilePath(const QString& filename);
|
||||||
static QString getAppLocalDataFilePath(const QString& filename);
|
static QString getAppLocalDataFilePath(const QString& filename);
|
||||||
|
|
|
@ -17,10 +17,6 @@ void moveToNewNamedThread(QObject* object, const QString& name, std::function<vo
|
||||||
QThread* thread = new QThread();
|
QThread* thread = new QThread();
|
||||||
thread->setObjectName(name);
|
thread->setObjectName(name);
|
||||||
|
|
||||||
if (priority != QThread::InheritPriority) {
|
|
||||||
thread->setPriority(priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString tempName = name;
|
QString tempName = name;
|
||||||
QObject::connect(thread, &QThread::started, [startCallback] {
|
QObject::connect(thread, &QThread::started, [startCallback] {
|
||||||
startCallback();
|
startCallback();
|
||||||
|
@ -32,6 +28,9 @@ void moveToNewNamedThread(QObject* object, const QString& name, std::function<vo
|
||||||
// put the object on the thread
|
// put the object on the thread
|
||||||
object->moveToThread(thread);
|
object->moveToThread(thread);
|
||||||
thread->start();
|
thread->start();
|
||||||
|
if (priority != QThread::InheritPriority) {
|
||||||
|
thread->setPriority(priority);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveToNewNamedThread(QObject* object, const QString& name, QThread::Priority priority) {
|
void moveToNewNamedThread(QObject* object, const QString& name, QThread::Priority priority) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace hifi { namespace properties {
|
||||||
const char* TEST = "com.highfidelity.test";
|
const char* TEST = "com.highfidelity.test";
|
||||||
const char* TRACING = "com.highfidelity.tracing";
|
const char* TRACING = "com.highfidelity.tracing";
|
||||||
const char* HMD = "com.highfidelity.hmd";
|
const char* HMD = "com.highfidelity.hmd";
|
||||||
|
const char* APP_LOCAL_DATA_PATH = "com.highfidelity.appLocalDataPath";
|
||||||
|
|
||||||
namespace gl {
|
namespace gl {
|
||||||
const char* BACKEND = "com.highfidelity.gl.backend";
|
const char* BACKEND = "com.highfidelity.gl.backend";
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace hifi { namespace properties {
|
||||||
extern const char* TEST;
|
extern const char* TEST;
|
||||||
extern const char* TRACING;
|
extern const char* TRACING;
|
||||||
extern const char* HMD;
|
extern const char* HMD;
|
||||||
|
extern const char* APP_LOCAL_DATA_PATH;
|
||||||
|
|
||||||
namespace gl {
|
namespace gl {
|
||||||
extern const char* BACKEND;
|
extern const char* BACKEND;
|
||||||
|
|
|
@ -20,7 +20,9 @@ var blastShareText = "Blast to my Connections",
|
||||||
hifiShareText = "Share to Snaps Feed",
|
hifiShareText = "Share to Snaps Feed",
|
||||||
hifiAlreadySharedText = "Already Shared to Snaps Feed",
|
hifiAlreadySharedText = "Already Shared to Snaps Feed",
|
||||||
facebookShareText = "Share to Facebook",
|
facebookShareText = "Share to Facebook",
|
||||||
twitterShareText = "Share to Twitter";
|
twitterShareText = "Share to Twitter",
|
||||||
|
shareButtonLabelTextActive = "SHARE:",
|
||||||
|
shareButtonLabelTextInactive = "SHARE";
|
||||||
|
|
||||||
function fileExtensionMatches(filePath, extension) {
|
function fileExtensionMatches(filePath, extension) {
|
||||||
return filePath.split('.').pop().toLowerCase() === extension;
|
return filePath.split('.').pop().toLowerCase() === extension;
|
||||||
|
@ -138,6 +140,8 @@ function selectImageToShare(selectedID, isSelected) {
|
||||||
var imageContainer = document.getElementById(selectedID),
|
var imageContainer = document.getElementById(selectedID),
|
||||||
image = document.getElementById(selectedID + 'img'),
|
image = document.getElementById(selectedID + 'img'),
|
||||||
shareBar = document.getElementById(selectedID + "shareBar"),
|
shareBar = document.getElementById(selectedID + "shareBar"),
|
||||||
|
showShareButtonsDots = document.getElementById(selectedID + "showShareButtonsDots"),
|
||||||
|
showShareButtonsLabel = document.getElementById(selectedID + "showShareButtonsLabel"),
|
||||||
shareButtonsDiv = document.getElementById(selectedID + "shareButtonsDiv"),
|
shareButtonsDiv = document.getElementById(selectedID + "shareButtonsDiv"),
|
||||||
shareBarHelp = document.getElementById(selectedID + "shareBarHelp"),
|
shareBarHelp = document.getElementById(selectedID + "shareBarHelp"),
|
||||||
showShareButtonsButtonDiv = document.getElementById(selectedID + "showShareButtonsButtonDiv"),
|
showShareButtonsButtonDiv = document.getElementById(selectedID + "showShareButtonsButtonDiv"),
|
||||||
|
@ -156,6 +160,9 @@ function selectImageToShare(selectedID, isSelected) {
|
||||||
shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.45)";
|
shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.45)";
|
||||||
shareBar.style.pointerEvents = "initial";
|
shareBar.style.pointerEvents = "initial";
|
||||||
|
|
||||||
|
showShareButtonsDots.style.visibility = "hidden";
|
||||||
|
showShareButtonsLabel.innerHTML = shareButtonLabelTextActive;
|
||||||
|
|
||||||
shareButtonsDiv.style.visibility = "visible";
|
shareButtonsDiv.style.visibility = "visible";
|
||||||
shareBarHelp.style.visibility = "visible";
|
shareBarHelp.style.visibility = "visible";
|
||||||
|
|
||||||
|
@ -176,6 +183,9 @@ function selectImageToShare(selectedID, isSelected) {
|
||||||
shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.0)";
|
shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.0)";
|
||||||
shareBar.style.pointerEvents = "none";
|
shareBar.style.pointerEvents = "none";
|
||||||
|
|
||||||
|
showShareButtonsDots.style.visibility = "visible";
|
||||||
|
showShareButtonsLabel.innerHTML = shareButtonLabelTextInactive;
|
||||||
|
|
||||||
shareButtonsDiv.style.visibility = "hidden";
|
shareButtonsDiv.style.visibility = "hidden";
|
||||||
shareBarHelp.style.visibility = "hidden";
|
shareBarHelp.style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
|
@ -185,6 +195,7 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
|
||||||
shareBarHelpID = parentID + "shareBarHelp",
|
shareBarHelpID = parentID + "shareBarHelp",
|
||||||
shareButtonsDivID = parentID + "shareButtonsDiv",
|
shareButtonsDivID = parentID + "shareButtonsDiv",
|
||||||
showShareButtonsButtonDivID = parentID + "showShareButtonsButtonDiv",
|
showShareButtonsButtonDivID = parentID + "showShareButtonsButtonDiv",
|
||||||
|
showShareButtonsDotsID = parentID + "showShareButtonsDots",
|
||||||
showShareButtonsLabelID = parentID + "showShareButtonsLabel",
|
showShareButtonsLabelID = parentID + "showShareButtonsLabel",
|
||||||
blastToConnectionsButtonID = parentID + "blastToConnectionsButton",
|
blastToConnectionsButtonID = parentID + "blastToConnectionsButton",
|
||||||
shareWithEveryoneButtonID = parentID + "shareWithEveryoneButton",
|
shareWithEveryoneButtonID = parentID + "shareWithEveryoneButton",
|
||||||
|
@ -199,8 +210,8 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
|
||||||
if (canShare) {
|
if (canShare) {
|
||||||
shareBarInnerHTML = '<div class="shareControlsHelp" id="' + shareBarHelpID + '" style="visibility:hidden;' + ((canBlast && blastButtonDisabled || !canBlast && hifiButtonDisabled) ? "background-color:#000;opacity:0.5;" : "") + '"></div>' +
|
shareBarInnerHTML = '<div class="shareControlsHelp" id="' + shareBarHelpID + '" style="visibility:hidden;' + ((canBlast && blastButtonDisabled || !canBlast && hifiButtonDisabled) ? "background-color:#000;opacity:0.5;" : "") + '"></div>' +
|
||||||
'<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
'<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
||||||
'<label id="' + showShareButtonsLabelID + '">SHARE</label>' +
|
'<label id="' + showShareButtonsLabelID + '">' + shareButtonLabelTextInactive + '</label>' +
|
||||||
'<span class="showShareButtonDots">' +
|
'<span id="' + showShareButtonsDotsID + '" class="showShareButtonDots">' +
|
||||||
'' +
|
'' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
|
@ -217,7 +228,7 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
|
||||||
document.getElementById(parentID + 'img').onclick = function () { selectImageToShare(parentID, true); };
|
document.getElementById(parentID + 'img').onclick = function () { selectImageToShare(parentID, true); };
|
||||||
} else {
|
} else {
|
||||||
shareBarInnerHTML = '<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
shareBarInnerHTML = '<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
||||||
'<label id="' + showShareButtonsLabelID + '">SHARE</label>' +
|
'<label id="' + showShareButtonsLabelID + '">' + shareButtonLabelTextInactive + '</label>' +
|
||||||
'<span class="showShareButtonDots">' +
|
'<span class="showShareButtonDots">' +
|
||||||
'' +
|
'' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
|
@ -230,7 +241,7 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shareBarInnerHTML = '<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
shareBarInnerHTML = '<div class="showShareButtonsButtonDiv inactive" id="' + showShareButtonsButtonDivID + '" onclick="selectImageToShare(' + parentID + ', true)">' +
|
||||||
'<label id="' + showShareButtonsLabelID + '">SHARE</label>' +
|
'<label id="' + showShareButtonsLabelID + '">' + shareButtonLabelTextInactive + '</label>' +
|
||||||
'<span class="showShareButtonDots">' +
|
'<span class="showShareButtonDots">' +
|
||||||
'' +
|
'' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
|
|
|
@ -90,14 +90,16 @@ ACClientApp::ACClientApp(int argc, char* argv[]) :
|
||||||
|
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
// start the nodeThread so its event loop is running
|
|
||||||
nodeList->startThread();
|
|
||||||
|
|
||||||
// setup a timer for domain-server check ins
|
// setup a timer for domain-server check ins
|
||||||
QTimer* domainCheckInTimer = new QTimer(nodeList.data());
|
QTimer* domainCheckInTimer = new QTimer(nodeList.data());
|
||||||
connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
||||||
domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||||
|
|
||||||
|
// start the nodeThread so its event loop is running
|
||||||
|
// (must happen after the checkin timer is created with the nodelist as it's parent)
|
||||||
|
nodeList->startThread();
|
||||||
|
|
||||||
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
||||||
|
|
||||||
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
||||||
|
|
Loading…
Reference in a new issue