diff --git a/interface/compiledResources/.placeholder b/interface/compiledResources/.placeholder new file mode 100644 index 0000000000..e69de29bb2 diff --git a/interface/resources/images/+android/Default-Sky-9-cubemap.ktx b/interface/resources/images/+gles/Default-Sky-9-cubemap.ktx similarity index 100% rename from interface/resources/images/+android/Default-Sky-9-cubemap.ktx rename to interface/resources/images/+gles/Default-Sky-9-cubemap.ktx diff --git a/interface/resources/images/Default-Sky-9-cubemap.ktx b/interface/resources/images/Default-Sky-9-cubemap.ktx index 6d46791fa2..70f495c3ab 100644 Binary files a/interface/resources/images/Default-Sky-9-cubemap.ktx and b/interface/resources/images/Default-Sky-9-cubemap.ktx differ diff --git a/interface/resources/meshes/+android/defaultAvatar_full.fst b/interface/resources/meshes/+gles/defaultAvatar_full.fst similarity index 100% rename from interface/resources/meshes/+android/defaultAvatar_full.fst rename to interface/resources/meshes/+gles/defaultAvatar_full.fst diff --git a/interface/resources/meshes/defaultAvatar_full.fst b/interface/resources/meshes/defaultAvatar_full.fst index 7d917318dd..aa1c17fc40 100644 --- a/interface/resources/meshes/defaultAvatar_full.fst +++ b/interface/resources/meshes/defaultAvatar_full.fst @@ -1,135 +1,89 @@ -name = being_of_light +name = mannequin type = body+head scale = 1 -filename = being_of_light/being_of_light.fbx -texdir = being_of_light/textures +filename = mannequin/mannequin.baked.fbx joint = jointRoot = Hips -joint = jointLeftHand = LeftHand -joint = jointHead = HeadTop_End joint = jointLean = Spine +joint = jointLeftHand = LeftHand +joint = jointHead = Head joint = jointEyeLeft = LeftEye -joint = jointRightHand = RightHand -joint = jointNeck = Head joint = jointEyeRight = RightEye +joint = jointRightHand = RightHand +joint = jointNeck = Neck freeJoint = LeftArm freeJoint = LeftForeArm freeJoint = RightArm freeJoint = RightForeArm -bs = MouthFrown_L = Frown_Left = 1 -bs = MouthLeft = Midmouth_Left = 1 -bs = BrowsU_R = BrowsUp_Right = 1 -bs = ChinUpperRaise = UpperLipUp_Right = 0.5 -bs = ChinUpperRaise = UpperLipUp_Left = 0.5 -bs = MouthSmile_R = Smile_Right = 1 -bs = MouthDimple_L = Smile_Left = 0.25 -bs = EyeBlink_L = Blink_Left = 1 -bs = BrowsD_L = BrowsDown_Left = 1 -bs = MouthFrown_R = Frown_Right = 1 -bs = MouthDimple_R = Smile_Right = 0.25 -bs = Sneer = Squint_Right = 0.5 -bs = Sneer = Squint_Left = 0.5 -bs = Sneer = NoseScrunch_Right = 0.75 -bs = Sneer = NoseScrunch_Left = 0.75 -bs = EyeSquint_L = Squint_Left = 1 -bs = EyeBlink_R = Blink_Right = 1 -bs = JawLeft = JawRotateY_Left = 0.5 -bs = BrowsD_R = BrowsDown_Right = 1 -bs = EyeSquint_R = Squint_Right = 1 -bs = Puff = CheekPuff_Right = 1 -bs = Puff = CheekPuff_Left = 1 -bs = LipsUpperClose = UpperLipIn = 1 -bs = JawOpen = MouthOpen = 0.69999999999999996 -bs = LipsUpperUp = UpperLipUp_Right = 0.69999999999999996 -bs = LipsUpperUp = UpperLipUp_Left = 0.69999999999999996 -bs = LipsLowerDown = LowerLipDown_Right = 0.69999999999999996 -bs = LipsLowerDown = LowerLipDown_Left = 0.69999999999999996 -bs = LipsLowerOpen = LowerLipOut = 1 -bs = EyeOpen_L = EyesWide_Left = 1 -bs = LipsPucker = MouthNarrow_Right = 1 -bs = LipsPucker = MouthNarrow_Left = 1 -bs = EyeOpen_R = EyesWide_Right = 1 -bs = JawRight = Jaw_Right = 1 -bs = MouthRight = Midmouth_Right = 1 -bs = ChinLowerRaise = Jaw_Up = 1 -bs = LipsUpperOpen = UpperLipOut = 1 -bs = BrowsU_C = BrowsUp_Right = 1 -bs = BrowsU_C = BrowsUp_Left = 1 -bs = JawFwd = JawForeward = 1 -bs = BrowsU_L = BrowsUp_Left = 1 -bs = MouthSmile_L = Smile_Left = 1 -bs = LipsLowerClose = LowerLipIn = 1 -bs = LipsFunnel = TongueUp = 1 -bs = LipsFunnel = MouthWhistle_NarrowAdjust_Right = 0.5 -bs = LipsFunnel = MouthWhistle_NarrowAdjust_Left = 0.5 -bs = LipsFunnel = MouthNarrow_Right = 1 -bs = LipsFunnel = MouthNarrow_Left = 1 -bs = LipsFunnel = Jaw_Down = 0.35999999999999999 -bs = LipsFunnel = JawForeward = 0.39000000000000001 -jointIndex = LeftHandIndex1 = 50 -jointIndex = LeftHandIndex2 = 51 -jointIndex = LeftHandIndex3 = 52 -jointIndex = LeftHandIndex4 = 53 -jointIndex = Spine1 = 12 -jointIndex = Spine2 = 13 -jointIndex = RightHandThumb1 = 18 -jointIndex = RightHandThumb2 = 19 -jointIndex = RightHandThumb3 = 20 -jointIndex = RightHandThumb4 = 21 -jointIndex = LeftFoot = 8 -jointIndex = LeftForeArm = 40 -jointIndex = Neck = 62 -jointIndex = Head = 63 -jointIndex = Hips = 0 -jointIndex = RightHandPinky1 = 30 -jointIndex = RightHandPinky2 = 31 -jointIndex = RightHandPinky3 = 32 -jointIndex = RightHandPinky4 = 33 -jointIndex = RightLeg = 2 -jointIndex = RightForeArm = 16 -jointIndex = LeftHandRing1 = 46 -jointIndex = LeftHandRing2 = 47 -jointIndex = LeftHandRing3 = 48 -jointIndex = LeftHandRing4 = 49 -jointIndex = LeftHandThumb1 = 54 -jointIndex = LeftHandThumb2 = 55 -jointIndex = LeftHandThumb3 = 56 -jointIndex = LeftHandThumb4 = 57 -jointIndex = HeadTop_End = 66 -jointIndex = LeftUpLeg = 6 -jointIndex = LeftToeBase = 9 -jointIndex = LeftHandPinky1 = 42 -jointIndex = LeftHandPinky2 = 43 -jointIndex = LeftHandPinky3 = 44 -jointIndex = LeftHandPinky4 = 45 -jointIndex = LeftLeg = 7 -jointIndex = RightEye = 65 -jointIndex = RightHand = 17 -jointIndex = RightToeBase = 4 -jointIndex = RightUpLeg = 1 -jointIndex = RightArm = 15 -jointIndex = RightHandRing1 = 26 -jointIndex = RightHandRing2 = 27 -jointIndex = RightHandRing3 = 28 -jointIndex = RightHandRing4 = 29 -jointIndex = RightHandIndex1 = 22 -jointIndex = RightHandIndex2 = 23 -jointIndex = RightHandIndex3 = 24 -jointIndex = RightHandIndex4 = 25 -jointIndex = LeftToe_End = 10 -jointIndex = LeftHandMiddle1 = 58 -jointIndex = LeftHandMiddle2 = 59 -jointIndex = LeftHandMiddle3 = 60 -jointIndex = LeftShoulder = 38 +bs = EyeBlink_L = blink = 1 +bs = JawOpen = mouth_Open = 1 +bs = LipsFunnel = Oo = 1 +bs = BrowsU_L = brow_Up = 1 +jointIndex = RightHandPinky2 = 19 jointIndex = LeftHandMiddle4 = 61 -jointIndex = RightFoot = 3 jointIndex = LeftHand = 41 -jointIndex = RightHandMiddle1 = 34 -jointIndex = RightHandMiddle2 = 35 +jointIndex = LeftHandRing4 = 49 jointIndex = RightHandMiddle3 = 36 -jointIndex = RightShoulder = 14 -jointIndex = LeftEye = 64 +jointIndex = LeftHandThumb4 = 57 +jointIndex = RightToe_End = 10 +jointIndex = LeftHandRing1 = 46 +jointIndex = LeftForeArm = 40 +jointIndex = RightHandIndex4 = 29 +jointIndex = LeftShoulder = 38 jointIndex = RightHandMiddle4 = 37 -jointIndex = Body = 67 -jointIndex = LeftArm = 39 -jointIndex = RightToe_End = 5 +jointIndex = RightShoulder = 14 +jointIndex = LeftLeg = 2 +jointIndex = LeftToe_End = 5 +jointIndex = Hips = 0 +jointIndex = RightFoot = 8 +jointIndex = RightHandThumb2 = 31 +jointIndex = LeftHandMiddle3 = 60 +jointIndex = RightHandThumb1 = 30 +jointIndex = Neck = 62 jointIndex = Spine = 11 +jointIndex = RightHandThumb4 = 33 +jointIndex = RightHandMiddle1 = 34 +jointIndex = LeftHandIndex4 = 53 +jointIndex = face = 68 +jointIndex = RightHandRing3 = 24 +jointIndex = LeftHandPinky4 = 45 +jointIndex = LeftHandMiddle2 = 59 +jointIndex = RightHandThumb3 = 32 +jointIndex = LeftHandPinky3 = 44 +jointIndex = HeadTop_End = 66 +jointIndex = Spine1 = 12 +jointIndex = LeftHandRing3 = 48 +jointIndex = mannequin1 = 67 +jointIndex = RightEye = 65 +jointIndex = RightHandRing4 = 25 +jointIndex = RightHandPinky4 = 21 +jointIndex = LeftHandRing2 = 47 +jointIndex = RightHandIndex3 = 28 +jointIndex = RightUpLeg = 6 +jointIndex = LeftArm = 39 +jointIndex = LeftHandThumb3 = 56 +jointIndex = RightHandIndex2 = 27 +jointIndex = RightForeArm = 16 +jointIndex = RightArm = 15 +jointIndex = RightHandRing2 = 23 +jointIndex = LeftHandMiddle1 = 58 +jointIndex = Spine2 = 13 +jointIndex = LeftHandThumb2 = 55 +jointIndex = RightHandMiddle2 = 35 +jointIndex = RightHandPinky1 = 18 +jointIndex = LeftUpLeg = 1 +jointIndex = RightLeg = 7 +jointIndex = LeftHandIndex2 = 51 +jointIndex = RightHand = 17 +jointIndex = LeftHandIndex3 = 52 +jointIndex = LeftFoot = 3 +jointIndex = RightHandPinky3 = 20 +jointIndex = RightHandIndex1 = 26 +jointIndex = LeftHandPinky1 = 42 +jointIndex = RightToeBase = 9 +jointIndex = LeftHandIndex1 = 50 +jointIndex = LeftToeBase = 4 +jointIndex = LeftHandPinky2 = 43 +jointIndex = RightHandRing1 = 22 +jointIndex = LeftHandThumb1 = 54 +jointIndex = LeftEye = 64 +jointIndex = Head = 63 diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a484910c8e..d5c02ae1c8 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -52,6 +52,7 @@ #include +#include #include #include #include @@ -321,7 +322,7 @@ static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains static bool DISABLE_DEFERRED = true; #else static const QString RENDER_FORWARD{ "HIFI_RENDER_FORWARD" }; -static bool DISABLE_DEFERRED = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD); +static bool DISABLE_DEFERRED = QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD); #endif static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; @@ -1047,7 +1048,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo DependencyManager::get().data(), &AddressManager::storeCurrentAddress); // Inititalize sample before registering - _sampleSound = DependencyManager::get()->getSound(QUrl(PathUtils::resourcesUrl() + "sounds/sample.wav")); + _sampleSound = DependencyManager::get()->getSound(PathUtils::resourcesUrl("sounds/sample.wav")); auto scriptEngines = DependencyManager::get().data(); scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){ @@ -1132,9 +1133,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // Make sure we don't time out during slow operations at startup updateHeartbeat(); - // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. - // DependencyManager::get()->initializeShapePipelines(); - // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. static const QString TESTER = "HIFI_TESTER"; @@ -1819,9 +1817,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo PROFILE_RANGE(render, "Process Default Skybox"); auto textureCache = DependencyManager::get(); - auto skyboxUrl = QFileSelector().select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx").toStdString(); + QFileSelector fileSelector; + fileSelector.setExtraSelectors(FileUtils::getFileSelectors()); + auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx"); - _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl); + _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString()); _defaultSkyboxAmbientTexture = _defaultSkyboxTexture; _defaultSkybox->setCubemap(_defaultSkyboxTexture); @@ -1832,7 +1832,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo return entityServerNode && !isPhysicsEnabled(); }); - _snapshotSound = DependencyManager::get()->getSound(QUrl(PathUtils::resourcesUrl() + "sounds/snap.wav")); + _snapshotSound = DependencyManager::get()->getSound(PathUtils::resourcesUrl("sounds/snap.wav")); QVariant testProperty = property(hifi::properties::TEST); qDebug() << testProperty; @@ -2224,7 +2224,6 @@ void Application::initializeGL() { _isGLInitialized = true; } - gl::initModuleGl(); _glWidget->makeCurrent(); if (!nsightActive()) { _chromiumShareContext = new OffscreenGLCanvas(); @@ -2364,7 +2363,7 @@ void Application::initializeUi() { offscreenUi->setProxyWindow(_window->windowHandle()); // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to // support the window management and scripting proxies for VR use - offscreenUi->createDesktop(PathUtils::qmlBaseUrl("hifi/Desktop.qml")); + offscreenUi->createDesktop(PathUtils::qmlUrl("hifi/Desktop.qml")); // FIXME either expose so that dialogs can set this themselves or // do better detection in the offscreen UI of what has focus offscreenUi->setNavigationFocused(false); @@ -5867,9 +5866,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get().data()); scriptEngine->registerGlobalObject("Users", DependencyManager::get().data()); - scriptEngine->registerGlobalObject("App", this); - scriptEngine->registerFunction("App", "isAndroid", Application::isAndroid, 0); - scriptEngine->registerGlobalObject("LimitlessSpeechRecognition", DependencyManager::get().data()); scriptEngine->registerGlobalObject("GooglePoly", DependencyManager::get().data()); @@ -7463,18 +7459,6 @@ void Application::updateThreadPoolCount() const { QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize); } -QScriptValue Application::isAndroid(QScriptContext* context, QScriptEngine* engine) { - return QScriptValue(engine, isAndroid()); -} - -bool Application::isAndroid() { -#ifdef Q_OS_ANDROID - return true; -#else - return false; -#endif -} - void Application::updateSystemTabletMode() { qApp->setProperty(hifi::properties::HMD, isHMDMode()); if (isHMDMode()) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 6be198ede3..effb35caee 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -284,9 +284,6 @@ public: bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; } void saveNextPhysicsStats(QString filename); - static Q_INVOKABLE QScriptValue isAndroid(QScriptContext* context, QScriptEngine* engine); - static bool isAndroid(); - signals: void svoImportRequested(const QString& url); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index d83e78eb17..93e46de6ab 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1801,7 +1801,7 @@ void MyAvatar::initAnimGraph() { } else if (!_fstAnimGraphOverrideUrl.isEmpty()) { graphUrl = _fstAnimGraphOverrideUrl; } else { - graphUrl = QUrl(PathUtils::resourcesUrl() + "avatar/avatar-animation.json"); + graphUrl = PathUtils::resourcesUrl("avatar/avatar-animation.json"); } _skeletonModel->getRig().initAnimGraph(graphUrl); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index a2254760fc..98a8d10f28 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -48,11 +48,6 @@ int main(int argc, const char* argv[]) { CrashReporter crashReporter { BUG_SPLAT_DATABASE, BUG_SPLAT_APPLICATION_NAME, BuildInfo::VERSION }; #endif -#if USE_GLES - qputenv("QT_ANGLE_PLATFORM", "d3d11"); - QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); -#endif - #ifdef Q_OS_LINUX QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); #endif diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index b53b59ee5a..c13b5b2e0d 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -139,8 +139,7 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue callback) { auto assetClient = DependencyManager::get(); auto request = assetClient->createDeleteMappingsRequest(paths); -#if !defined(Q_OS_ANDROID) -// TODO: just to make android compile + connect(request, &DeleteMappingsRequest::finished, this, [this, callback](DeleteMappingsRequest* request) mutable { if (callback.isCallable()) { QJSValueList args { request->getErrorString() }; @@ -149,7 +148,6 @@ void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue request->deleteLater(); }); -#endif request->start(); } @@ -157,8 +155,7 @@ void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { auto assetClient = DependencyManager::get(); auto request = assetClient->createGetAllMappingsRequest(); -#if !defined(Q_OS_ANDROID) -// TODO: just to make android compile + connect(request, &GetAllMappingsRequest::finished, this, [this, callback](GetAllMappingsRequest* request) mutable { auto mappings = request->getMappings(); auto map = callback.engine()->newObject(); @@ -174,7 +171,6 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { request->deleteLater(); }); -#endif request->start(); } @@ -182,8 +178,7 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString newPath, QJSValue callback) { auto assetClient = DependencyManager::get(); auto request = assetClient->createRenameMappingRequest(oldPath, newPath); -#if !defined(Q_OS_ANDROID) -// TODO: just to make android compile + connect(request, &RenameMappingRequest::finished, this, [this, callback](RenameMappingRequest* request) mutable { if (callback.isCallable()) { QJSValueList args{ request->getErrorString() }; @@ -192,15 +187,14 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new request->deleteLater(); }); -#endif + request->start(); } void AssetMappingsScriptingInterface::setBakingEnabled(QStringList paths, bool enabled, QJSValue callback) { auto assetClient = DependencyManager::get(); auto request = assetClient->createSetBakingEnabledRequest(paths, enabled); -#if !defined(Q_OS_ANDROID) -// TODO: just to make android compile + connect(request, &SetBakingEnabledRequest::finished, this, [this, callback](SetBakingEnabledRequest* request) mutable { if (callback.isCallable()) { QJSValueList args{ request->getErrorString() }; @@ -209,7 +203,7 @@ void AssetMappingsScriptingInterface::setBakingEnabled(QStringList paths, bool e request->deleteLater(); }); -#endif + request->start(); } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index a5aca0d2b9..e3182bb56d 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -103,7 +103,7 @@ AvatarData::~AvatarData() { QUrl AvatarData::_defaultFullAvatarModelUrl = {}; // In C++, if this initialization were in the AvatarInfo, every file would have it's own copy, even for class vars. const QUrl& AvatarData::defaultFullAvatarModelUrl() { if (_defaultFullAvatarModelUrl.isEmpty()) { - _defaultFullAvatarModelUrl = QUrl(PathUtils::resourcesUrl() + "/meshes/defaultAvatar_full.fst"); + _defaultFullAvatarModelUrl = PathUtils::resourcesUrl("/meshes/defaultAvatar_full.fst"); } return _defaultFullAvatarModelUrl; } diff --git a/libraries/gl/src/gl/Config.cpp b/libraries/gl/src/gl/Config.cpp index 6b486539cf..b291674572 100644 --- a/libraries/gl/src/gl/Config.cpp +++ b/libraries/gl/src/gl/Config.cpp @@ -13,10 +13,17 @@ #include -#if defined(Q_OS_MAC) +#if defined(Q_OS_WIN) +#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_MAC) #include +#else +#include +#include #endif + + #if defined(Q_OS_WIN) static void* getGlProcessAddress(const char *namez) { @@ -52,6 +59,13 @@ static void* getGlProcessAddress(const char *namez) { return (void*)result; } +#elif defined(Q_OS_MAC) +#else + +static void* getGlProcessAddress(const char *namez) { + return (void*)glXGetProcAddressARB((const GLubyte*)namez); +} + #endif diff --git a/libraries/gl/src/gl/Context.cpp b/libraries/gl/src/gl/Context.cpp index f0d911fc85..889aa9cef3 100644 --- a/libraries/gl/src/gl/Context.cpp +++ b/libraries/gl/src/gl/Context.cpp @@ -135,8 +135,6 @@ void Context::clear() { #if defined(GL_CUSTOM_CONTEXT) -#pragma optimize( "", off) - static void debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) { if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) { return; @@ -367,8 +365,6 @@ void Context::create() { doneCurrent(); } -#pragma optimize( "", on) - #endif diff --git a/libraries/gl/src/gl/GLWindow.cpp b/libraries/gl/src/gl/GLWindow.cpp index 360c49a5f2..e1e6279b1c 100644 --- a/libraries/gl/src/gl/GLWindow.cpp +++ b/libraries/gl/src/gl/GLWindow.cpp @@ -41,8 +41,6 @@ bool GLWindow::makeCurrent() { qCDebug(glLogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); }); - //Q_ASSERT(_context->qglContext() == QOpenGLContext::currentContext()); - return makeCurrentResult; } diff --git a/libraries/networking/src/FileResourceRequest.cpp b/libraries/networking/src/FileResourceRequest.cpp index 1dfb00c932..b55f1839a0 100644 --- a/libraries/networking/src/FileResourceRequest.cpp +++ b/libraries/networking/src/FileResourceRequest.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "ResourceManager.h" @@ -37,7 +38,9 @@ void FileResourceRequest::doSend() { // Allow platform specific versions of files loaded out of a resource cache via file:// - filename = QFileSelector().select(filename); + QFileSelector fileSelector; + fileSelector.setExtraSelectors(FileUtils::getFileSelectors()); + filename = fileSelector.select(filename); if (!_byteRange.isValid()) { _result = ResourceRequest::InvalidByteRange; diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 3dca084d8a..5bc0b9c5ed 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -230,7 +231,6 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo } #include -#include model::MeshPointer DeferredLightingEffect::getPointLightMesh() { if (!_pointLightMesh) { @@ -565,9 +565,9 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, // Haze if (haze) { - batch.setUniformBuffer(HAZE_MODEL_BUFFER_SLOT, haze->getHazeParametersBuffer()); + batch.setUniformBuffer(HAZE_MODEL_BUFFER_SLOT, haze->getHazeParametersBuffer()); } - + batch.draw(gpu::TRIANGLE_STRIP, 4); deferredLightingEffect->unsetKeyLightBatch(batch, locations->lightBufferUnit, locations->ambientBufferUnit, SKYBOX_MAP_UNIT); @@ -734,9 +734,11 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { PROFILE_RANGE(render, "Process Default Skybox"); auto textureCache = DependencyManager::get(); - auto skyboxUrl = QFileSelector().select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx").toStdString(); + QFileSelector fileSelector; + fileSelector.setExtraSelectors(FileUtils::getFileSelectors()); + auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx"); - _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl); + _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString()); _defaultSkyboxAmbientTexture = _defaultSkyboxTexture; _defaultSkybox->setCubemap(_defaultSkyboxTexture); diff --git a/libraries/render-utils/src/LightingModel.h b/libraries/render-utils/src/LightingModel.h index d7d2f2bba1..e058b10921 100644 --- a/libraries/render-utils/src/LightingModel.h +++ b/libraries/render-utils/src/LightingModel.h @@ -96,7 +96,7 @@ protected: float enableObscurance{ 1.0f }; - float enableMaterialTexturing { 0.0f }; + float enableMaterialTexturing { 1.0f }; float enableWireframe { 0.0f }; // false by default Parameters() {} @@ -148,7 +148,7 @@ public: bool enableSpecular{ true }; bool enableAlbedo{ true }; - bool enableMaterialTexturing { false }; + bool enableMaterialTexturing { true }; bool enableAmbientLight{ true }; bool enableDirectionalLight{ true }; diff --git a/libraries/shared/src/PathUtils.cpp b/libraries/shared/src/PathUtils.cpp index bc9402c8ed..e01dae5bee 100644 --- a/libraries/shared/src/PathUtils.cpp +++ b/libraries/shared/src/PathUtils.cpp @@ -73,12 +73,16 @@ const QString& PathUtils::resourcesUrl() { return staticResourcePath; } +QUrl PathUtils::resourcesUrl(const QString& relativeUrl) { + return QUrl(resourcesUrl() + relativeUrl); +} + const QString& PathUtils::qmlBaseUrl() { static const QString staticResourcePath = resourcesUrl() + "qml/"; return staticResourcePath; } -QUrl PathUtils::qmlBaseUrl(const QString& relativeUrl) { +QUrl PathUtils::qmlUrl(const QString& relativeUrl) { return QUrl(qmlBaseUrl() + relativeUrl); } diff --git a/libraries/shared/src/PathUtils.h b/libraries/shared/src/PathUtils.h index b55416a313..fa366ad9b7 100644 --- a/libraries/shared/src/PathUtils.h +++ b/libraries/shared/src/PathUtils.h @@ -34,9 +34,10 @@ class PathUtils : public QObject, public Dependency { Q_PROPERTY(QUrl defaultScripts READ defaultScriptsLocation CONSTANT) public: static const QString& resourcesUrl(); + static QUrl resourcesUrl(const QString& relative); static const QString& resourcesPath(); static const QString& qmlBaseUrl(); - static QUrl qmlBaseUrl(const QString& relative); + static QUrl qmlUrl(const QString& relative); #ifdef DEV_BUILD static const QString& projectRootPath(); #endif diff --git a/libraries/shared/src/shared/FileUtils.cpp b/libraries/shared/src/shared/FileUtils.cpp index 7e1db8b4ca..7b88321e99 100644 --- a/libraries/shared/src/shared/FileUtils.cpp +++ b/libraries/shared/src/shared/FileUtils.cpp @@ -12,6 +12,8 @@ #include "FileUtils.h" +#include + #include #include #include @@ -21,8 +23,21 @@ #include #include + #include "../SharedLogging.h" +const QStringList& FileUtils::getFileSelectors() { + static std::once_flag once; + static QStringList extraSelectors; + std::call_once(once, [] { +#if defined(USE_GLES) + extraSelectors << "gles"; +#endif + }); + return extraSelectors; + +} + QString FileUtils::readFile(const QString& filename) { QFile file(filename); diff --git a/libraries/shared/src/shared/FileUtils.h b/libraries/shared/src/shared/FileUtils.h index d68fcd8a44..9a5e2d5aba 100644 --- a/libraries/shared/src/shared/FileUtils.h +++ b/libraries/shared/src/shared/FileUtils.h @@ -13,10 +13,11 @@ #define hifi_FileUtils_h #include - +#include class FileUtils { public: + static const QStringList& getFileSelectors(); static void locateFile(QString fileName); static QString standardPath(QString subfolder); static QString readFile(const QString& filename); diff --git a/libraries/ui/src/InfoView.cpp b/libraries/ui/src/InfoView.cpp index 99bd8b1339..650d43831c 100644 --- a/libraries/ui/src/InfoView.cpp +++ b/libraries/ui/src/InfoView.cpp @@ -46,7 +46,7 @@ void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQue registerType(); QUrl url; if (QDir(path).isRelative()) { - url = QUrl(PathUtils::resourcesUrl() + path); + url = PathUtils::resourcesUrl(path); } else { url = QUrl::fromLocalFile(path); } diff --git a/libraries/ui/src/OffscreenQmlElement.h b/libraries/ui/src/OffscreenQmlElement.h index 0259085598..aa4b8cf1a9 100644 --- a/libraries/ui/src/OffscreenQmlElement.h +++ b/libraries/ui/src/OffscreenQmlElement.h @@ -15,6 +15,7 @@ #include #include + class QQmlContext; #define HIFI_QML_DECL \ @@ -42,7 +43,7 @@ public: \ private: #define HIFI_QML_DEF(x) \ - const QUrl x::QML = PathUtils::qmlBaseUrl(#x ".qml"); \ + const QUrl x::QML = PathUtils::qmlUrl(#x ".qml"); \ const QString x::NAME = #x; \ \ void x::registerType() { \ diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index f59ecf208b..db3df34dc5 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -71,7 +71,7 @@ public: withWriteLock([&] { for (auto url : urls) { if (url.isRelative()) { - url = PathUtils::qmlBaseUrl(url.toString()); + url = PathUtils::qmlUrl(url.toString()); } _callbacks[url].push_back(callback); } @@ -1535,4 +1535,4 @@ void OffscreenQmlSurface::sendToQml(const QVariant& message) { } -#include "OffscreenQmlSurface.moc" \ No newline at end of file +#include "OffscreenQmlSurface.moc" diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index b4e468af51..1ecf86f484 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -173,7 +173,7 @@ void TabletScriptingInterface::preloadSounds() { const QStringList &audioSettings = tabletSoundsButtonClick.get(); for (int i = 0; i < TabletAudioEvents::Last; i++) { SharedSoundPointer sound = DependencyManager::get()-> - getSound(QUrl(PathUtils::resourcesUrl() + audioSettings.at(i))); + getSound(PathUtils::resourcesUrl(audioSettings.at(i))); _audioEvents.insert(static_cast(i), sound); } } diff --git a/libraries/ui/src/ui/types/FileTypeProfile.cpp b/libraries/ui/src/ui/types/FileTypeProfile.cpp index d090ae6f5d..90a2c6ba18 100644 --- a/libraries/ui/src/ui/types/FileTypeProfile.cpp +++ b/libraries/ui/src/ui/types/FileTypeProfile.cpp @@ -16,14 +16,13 @@ #if !defined(Q_OS_ANDROID) static const QString QML_WEB_ENGINE_STORAGE_NAME = "qmlWebEngine"; -FileTypeProfile::FileTypeProfile(QObject* parent) - : QQuickWebEngineProfile(parent) +FileTypeProfile::FileTypeProfile(QObject* parent) : + QQuickWebEngineProfile(parent) { static const QString WEB_ENGINE_USER_AGENT = "Chrome/48.0 (HighFidelityInterface)"; setHttpUserAgent(WEB_ENGINE_USER_AGENT); auto requestInterceptor = new FileTypeRequestInterceptor(this); setRequestInterceptor(requestInterceptor); - } #endif \ No newline at end of file diff --git a/libraries/ui/src/ui/types/FileTypeRequestInterceptor.cpp b/libraries/ui/src/ui/types/FileTypeRequestInterceptor.cpp index 7178bc89ac..25866ad395 100644 --- a/libraries/ui/src/ui/types/FileTypeRequestInterceptor.cpp +++ b/libraries/ui/src/ui/types/FileTypeRequestInterceptor.cpp @@ -22,4 +22,4 @@ void FileTypeRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info RequestFilters::interceptFileType(info); } -#endif +#endif \ No newline at end of file diff --git a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp index 8962a9d61d..381bdb10bd 100644 --- a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp +++ b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp @@ -17,12 +17,13 @@ static const QString QML_WEB_ENGINE_STORAGE_NAME = "qmlWebEngine"; -HFWebEngineProfile::HFWebEngineProfile(QObject* parent) - : QQuickWebEngineProfile(parent) +HFWebEngineProfile::HFWebEngineProfile(QObject* parent) : + QQuickWebEngineProfile(parent) { setStorageName(QML_WEB_ENGINE_STORAGE_NAME); + // we use the HFWebEngineRequestInterceptor to make sure that web requests are authenticated for the interface user - auto requestInterceptor = new HFWebEngineRequestInterceptor(this); + auto requestInterceptor = new HFWebEngineRequestInterceptor(this); setRequestInterceptor(requestInterceptor); } diff --git a/libraries/ui/src/ui/types/HFWebEngineRequestInterceptor.cpp b/libraries/ui/src/ui/types/HFWebEngineRequestInterceptor.cpp index cecdddd2b6..5a11c32efa 100644 --- a/libraries/ui/src/ui/types/HFWebEngineRequestInterceptor.cpp +++ b/libraries/ui/src/ui/types/HFWebEngineRequestInterceptor.cpp @@ -22,4 +22,4 @@ void HFWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& i RequestFilters::interceptHFWebEngineRequest(info); } -#endif +#endif \ No newline at end of file diff --git a/libraries/ui/src/ui/types/RequestFilters.cpp b/libraries/ui/src/ui/types/RequestFilters.cpp index 0553d94df5..4cd51c6d98 100644 --- a/libraries/ui/src/ui/types/RequestFilters.cpp +++ b/libraries/ui/src/ui/types/RequestFilters.cpp @@ -79,4 +79,4 @@ void RequestFilters::interceptFileType(QWebEngineUrlRequestInfo& info) { info.setHttpHeader(CONTENT_HEADER.toLocal8Bit(), TYPE_VALUE.toLocal8Bit()); } } -#endif +#endif \ No newline at end of file diff --git a/scripts/+android/defaultScripts.js b/scripts/+android/defaultScripts.js new file mode 100644 index 0000000000..a115e498da --- /dev/null +++ b/scripts/+android/defaultScripts.js @@ -0,0 +1,110 @@ +"use strict"; +/* jslint vars: true, plusplus: true */ + +// +// defaultScripts.js +// examples +// +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +var DEFAULT_SCRIPTS_COMBINED = [ + "system/progress.js"/*, + "system/away.js", + "system/controllers/controllerDisplayManager.js", + "system/controllers/handControllerGrabAndroid.js", + "system/controllers/handControllerPointerAndroid.js", + "system/controllers/squeezeHands.js", + "system/controllers/grab.js", + "system/controllers/teleport.js", + "system/controllers/toggleAdvancedMovementForHandControllers.js", + "system/dialTone.js", + "system/firstPersonHMD.js", + "system/bubble.js", + "system/android.js", + "developer/debugging/debugAndroidMouse.js"*/ +]; + +var DEFAULT_SCRIPTS_SEPARATE = [ ]; + +// add a menu item for debugging +var MENU_CATEGORY = "Developer"; +var MENU_ITEM = "Debug defaultScripts.js"; + +var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; +var previousSetting = Settings.getValue(SETTINGS_KEY); + +if (previousSetting === '' || previousSetting === false || previousSetting === 'false') { + previousSetting = false; +} + +if (previousSetting === true || previousSetting === 'true') { + previousSetting = true; +} + +if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_ITEM)) { + Menu.addMenuItem({ + menuName: MENU_CATEGORY, + menuItemName: MENU_ITEM, + isCheckable: true, + isChecked: previousSetting, + grouping: "Advanced" + }); +} + +function loadSeparateDefaults() { + for (var i in DEFAULT_SCRIPTS_SEPARATE) { + Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); + } +} + +function runDefaultsTogether() { + for (var i in DEFAULT_SCRIPTS_COMBINED) { + Script.include(DEFAULT_SCRIPTS_COMBINED[i]); + } + loadSeparateDefaults(); +} + +function runDefaultsSeparately() { + for (var i in DEFAULT_SCRIPTS_COMBINED) { + Script.load(DEFAULT_SCRIPTS_COMBINED[i]); + } + loadSeparateDefaults(); +} + +// start all scripts +if (Menu.isOptionChecked(MENU_ITEM)) { + // we're debugging individual default scripts + // so we load each into its own ScriptEngine instance + runDefaultsSeparately(); +} else { + // include all default scripts into this ScriptEngine + runDefaultsTogether(); +} + +function menuItemEvent(menuItem) { + if (menuItem === MENU_ITEM) { + var isChecked = Menu.isOptionChecked(MENU_ITEM); + if (isChecked === true) { + Settings.setValue(SETTINGS_KEY, true); + } else if (isChecked === false) { + Settings.setValue(SETTINGS_KEY, false); + } + Menu.triggerOption("Reload All Scripts"); + } +} + +function removeMenuItem() { + if (!Menu.isOptionChecked(MENU_ITEM)) { + Menu.removeMenuItem(MENU_CATEGORY, MENU_ITEM); + } +} + +Script.scriptEnding.connect(function() { + removeMenuItem(); +}); + +Menu.menuItemEvent.connect(menuItemEvent); diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 471e693a0c..71755e3abb 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -12,69 +12,31 @@ // var DEFAULT_SCRIPTS_COMBINED = [ + "system/progress.js", + "system/away.js", + "system/audio.js", + "system/hmd.js", + "system/menu.js", + "system/bubble.js", + "system/snapshot.js", + "system/help.js", + "system/pal.js", // "system/mod.js", // older UX, if you prefer + "system/makeUserConnection.js", + "system/tablet-goto.js", + "system/marketplaces/marketplaces.js", + "system/commerce/wallet.js", + "system/edit.js", + "system/notifications.js", + "system/dialTone.js", + "system/firstPersonHMD.js", + "system/tablet-ui/tabletUI.js", + "system/emote.js" ]; - -function pushAll(dest, orig) { - for (var k in orig) { - dest.push(orig[k]); - } -} - -if (!App.isAndroid()) { - pushAll(DEFAULT_SCRIPTS_COMBINED, [ - "system/progress.js", - "system/away.js", - "system/audio.js", - "system/hmd.js", - "system/menu.js", - "system/bubble.js", - "system/snapshot.js", - "system/help.js", - "system/pal.js", // "system/mod.js", // older UX, if you prefer - "system/makeUserConnection.js", - "system/tablet-goto.js", - "system/marketplaces/marketplaces.js", - "system/commerce/wallet.js", - "system/edit.js", - "system/notifications.js", - "system/dialTone.js", - "system/firstPersonHMD.js", - "system/tablet-ui/tabletUI.js", - "system/emote.js" - ]); -} else { - pushAll(DEFAULT_SCRIPTS_COMBINED, [ - "system/progress.js"/*, - "system/away.js", - "system/controllers/controllerDisplayManager.js", - "system/controllers/handControllerGrabAndroid.js", - "system/controllers/handControllerPointerAndroid.js", - "system/controllers/squeezeHands.js", - "system/controllers/grab.js", - "system/controllers/teleport.js", - "system/controllers/toggleAdvancedMovementForHandControllers.js", - "system/dialTone.js", - "system/firstPersonHMD.js", - "system/bubble.js", - "system/android.js", - "developer/debugging/debugAndroidMouse.js"*/ - ]); -} - var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js" //"system/chat.js" ]; - -if (!App.isAndroid()) { - pushAll(DEFAULT_SCRIPTS_SEPARATE, [ - "system/controllers/controllerScripts.js" - ]); -} else { - pushAll(DEFAULT_SCRIPTS_SEPARATE, []); -} - // add a menu item for debugging var MENU_CATEGORY = "Developer"; var MENU_ITEM = "Debug defaultScripts.js"; diff --git a/tests/render-perf/src/main.cpp b/tests/render-perf/src/main.cpp index c70a74cd7f..4cdc76f36a 100644 --- a/tests/render-perf/src/main.cpp +++ b/tests/render-perf/src/main.cpp @@ -226,9 +226,7 @@ public: _context.makeCurrent(); window->setSurfaceType(QSurface::OpenGLSurface); _context.makeCurrent(_context.qglContext(), window); -#ifdef Q_OS_WIN - wglSwapIntervalEXT(0); -#endif + gl::setSwapInterval(0); // GPU library init gpu::Context::init(); _gpuContext = std::make_shared(); diff --git a/tests/render-texture-load/src/main.cpp b/tests/render-texture-load/src/main.cpp index 67b80d9ba8..066b39fc40 100644 --- a/tests/render-texture-load/src/main.cpp +++ b/tests/render-texture-load/src/main.cpp @@ -11,6 +11,8 @@ #include #include +#include + #include #include #include @@ -147,9 +149,7 @@ public: } _context.makeCurrent(); - glewExperimental = true; - glewInit(); - glGetError(); + gl::initModuleGl(); //wglSwapIntervalEXT(0); _frameTimes.resize(FRAME_TIME_BUFFER_SIZE, 0); @@ -441,6 +441,7 @@ protected: } void reportMemory() { +#if !defined(USE_GLES) static GLint lastMemory = 0; GLint availableMem; glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &availableMem); @@ -449,6 +450,7 @@ protected: qDebug() << "Delta " << availableMem - lastMemory; } lastMemory = availableMem; +#endif } void derezTexture() {