Merge branch 'master' of https://github.com/highfidelity/hifi into handControlsWhileLoading

This commit is contained in:
Brad Hefta-Gaub 2016-10-13 20:54:24 -07:00
commit 652af860ed
8 changed files with 48 additions and 10 deletions

View file

@ -668,6 +668,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails())); connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused); connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused);
// We could clear ATP assets only when changing domains, but it's possible that the domain you are connected
// to has gone down and switched to a new content set, so when you reconnect the cached ATP assets will no longer be valid.
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, DependencyManager::get<ScriptCache>().data(), &ScriptCache::clearATPScriptsFromCache);
// update our location every 5 seconds in the metaverse server, assuming that we are authenticated with one // update our location every 5 seconds in the metaverse server, assuming that we are authenticated with one
const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * MSECS_PER_SECOND; const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * MSECS_PER_SECOND;

View file

@ -414,6 +414,7 @@ void OpenGLDisplayPlugin::customizeContext() {
_cursorPipeline = gpu::Pipeline::create(program, state); _cursorPipeline = gpu::Pipeline::create(program, state);
} }
} }
updateCompositeFramebuffer();
} }
void OpenGLDisplayPlugin::uncustomizeContext() { void OpenGLDisplayPlugin::uncustomizeContext() {
@ -557,10 +558,7 @@ void OpenGLDisplayPlugin::compositeScene() {
} }
void OpenGLDisplayPlugin::compositeLayers() { void OpenGLDisplayPlugin::compositeLayers() {
auto renderSize = getRecommendedRenderSize(); updateCompositeFramebuffer();
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("displayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
}
{ {
PROFILE_RANGE_EX("compositeScene", 0xff0077ff, (uint64_t)presentCount()) PROFILE_RANGE_EX("compositeScene", 0xff0077ff, (uint64_t)presentCount())
@ -760,3 +758,10 @@ void OpenGLDisplayPlugin::render(std::function<void(gpu::Batch& batch)> f) {
OpenGLDisplayPlugin::~OpenGLDisplayPlugin() { OpenGLDisplayPlugin::~OpenGLDisplayPlugin() {
qDebug() << "Destroying OpenGLDisplayPlugin"; qDebug() << "Destroying OpenGLDisplayPlugin";
} }
void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
auto renderSize = getRecommendedRenderSize();
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
}
}

View file

@ -78,6 +78,8 @@ protected:
glm::uvec2 getSurfaceSize() const; glm::uvec2 getSurfaceSize() const;
glm::uvec2 getSurfacePixels() const; glm::uvec2 getSurfacePixels() const;
void updateCompositeFramebuffer();
virtual void compositeLayers(); virtual void compositeLayers();
virtual void compositeScene(); virtual void compositeScene();
virtual void compositeOverlay(); virtual void compositeOverlay();

View file

@ -23,7 +23,7 @@
#include "AccountManager.h" #include "AccountManager.h"
const QString HIFI_URL_SCHEME = "hifi"; const QString HIFI_URL_SCHEME = "hifi";
const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome"; const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome";
const QString SANDBOX_HIFI_ADDRESS = "hifi://localhost"; const QString SANDBOX_HIFI_ADDRESS = "hifi://localhost";
const QString SANDBOX_STATUS_URL = "http://localhost:60332/status"; const QString SANDBOX_STATUS_URL = "http://localhost:60332/status";
const QString INDEX_PATH = "/"; const QString INDEX_PATH = "/";

View file

@ -36,6 +36,19 @@ void ScriptCache::clearCache() {
_scriptCache.clear(); _scriptCache.clear();
} }
void ScriptCache::clearATPScriptsFromCache() {
Lock lock(_containerLock);
qCDebug(scriptengine) << "Clearing ATP scripts from ScriptCache";
for (auto it = _scriptCache.begin(); it != _scriptCache.end();) {
if (it.key().scheme() == "atp") {
qCDebug(scriptengine) << "Removing: " << it.key();
it = _scriptCache.erase(it);
} else {
++it;
}
}
}
QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) { QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) {
QUrl url = ResourceManager::normalizeURL(unnormalizedURL); QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
QString scriptContents; QString scriptContents;

View file

@ -39,6 +39,7 @@ class ScriptCache : public QObject, public Dependency {
public: public:
void clearCache(); void clearCache();
Q_INVOKABLE void clearATPScriptsFromCache();
void getScriptContents(const QString& scriptOrURL, contentAvailableCallback contentAvailable, bool forceDownload = false); void getScriptContents(const QString& scriptOrURL, contentAvailableCallback contentAvailable, bool forceDownload = false);

View file

@ -377,9 +377,6 @@ void OpenVrDisplayPlugin::init() {
} }
bool OpenVrDisplayPlugin::internalActivate() { bool OpenVrDisplayPlugin::internalActivate() {
_openVrDisplayActive = true;
_container->setIsOptionChecked(StandingHMDSensorMode, true);
if (!_system) { if (!_system) {
_system = acquireOpenVrSystem(); _system = acquireOpenVrSystem();
} }
@ -388,6 +385,18 @@ bool OpenVrDisplayPlugin::internalActivate() {
return false; return false;
} }
// If OpenVR isn't running, then the compositor won't be accessible
// FIXME find a way to launch the compositor?
if (!vr::VRCompositor()) {
qWarning() << "Failed to acquire OpenVR compositor";
releaseOpenVrSystem();
_system = nullptr;
return false;
}
_openVrDisplayActive = true;
_container->setIsOptionChecked(StandingHMDSensorMode, true);
_system->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y); _system->GetRecommendedRenderTargetSize(&_renderTargetSize.x, &_renderTargetSize.y);
// Recommended render target size is per-eye, so double the X size for // Recommended render target size is per-eye, so double the X size for
// left + right eyes // left + right eyes

View file

@ -109,8 +109,12 @@ void releaseOpenVrSystem() {
vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto }; vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto };
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 };
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 };
vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT);
vr::VRCompositor()->Submit(vr::Eye_Right, &vrTexture, &OPENVR_TEXTURE_BOUNDS_RIGHT); auto compositor = vr::VRCompositor();
if (compositor) {
compositor->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT);
compositor->Submit(vr::Eye_Right, &vrTexture, &OPENVR_TEXTURE_BOUNDS_RIGHT);
}
vr::VR_Shutdown(); vr::VR_Shutdown();
_openVrQuitRequested = false; _openVrQuitRequested = false;