Showing the changes to interface/src/Application.cpp (1 of 56 files). Show all
Unified · Split
| @@ -35,7 +35,6 @@ · 34 unmodified lines | ||
| 35 | 35 | #include <QMouseEvent> |
| 36 | 36 | #include <QNetworkReply> |
| 37 | 37 | #include <QNetworkDiskCache> |
| 38 | −#include <QOpenGLFramebufferObject> | |
| 39 | 38 | #include <QObject> |
| 40 | 39 | #include <QWheelEvent> |
| 41 | 40 | #include <QScreen> |
| @@ -841,7 +840,7 @@ void Application::paintGL() { · 799 unmodified lines | ||
| 841 | 840 | DependencyManager::get<GlowEffect>()->prepare(); |
| 842 | 841 | |
| 843 | 842 | // Viewport is assigned to the size of the framebuffer |
| 844 | − QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size(); | |
| 843 | + QSize size = DependencyManager::get<TextureCache>()->getFrameBufferSize(); | |
| 845 | 844 | glViewport(0, 0, size.width(), size.height()); |
| 846 | 845 | |
| 847 | 846 | glMatrixMode(GL_MODELVIEW); |
| @@ -2731,8 +2730,9 @@ void Application::updateShadowMap() { · 1883 unmodified lines | ||
| 2731 | 2730 | activeRenderingThread = QThread::currentThread(); |
| 2732 | 2731 | |
| 2733 | 2732 | PerformanceTimer perfTimer("shadowMap"); |
| 2734 | − QOpenGLFramebufferObject* fbo = DependencyManager::get<TextureCache>()->getShadowFramebufferObject(); | |
| 2735 | − fbo->bind(); | |
| 2733 | + auto shadowFramebuffer = DependencyManager::get<TextureCache>()->getShadowFramebuffer(); | |
| 2734 | + glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(shadowFramebuffer)); | |
| 2735 | + | |
| 2736 | 2736 | glEnable(GL_DEPTH_TEST); |
| 2737 | 2737 | glClear(GL_DEPTH_BUFFER_BIT); |
| 2738 | 2738 | |
| @@ -2748,16 +2748,18 @@ void Application::updateShadowMap() { · 9 unmodified lines | ||
| 2748 | 2748 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2749 | 2749 | |
| 2750 | 2750 | int matrixCount = 1; |
| 2751 | − int targetSize = fbo->width(); | |
| 2751 | + //int targetSize = fbo->width(); | |
| 2752 | + int sourceSize = shadowFramebuffer->getWidth(); | |
| 2753 | + int targetSize = shadowFramebuffer->getWidth(); | |
| 2752 | 2754 | float targetScale = 1.0f; |
| 2753 | 2755 | if (Menu::getInstance()->isOptionChecked(MenuOption::CascadedShadows)) { |
| 2754 | 2756 | matrixCount = CASCADED_SHADOW_MATRIX_COUNT; |
| 2755 | − targetSize = fbo->width() / 2; | |
| 2757 | + targetSize = sourceSize / 2; | |
| 2756 | 2758 | targetScale = 0.5f; |
| 2757 | 2759 | } |
| 2758 | 2760 | for (int i = 0; i < matrixCount; i++) { |
| 2759 | 2761 | const glm::vec2& coord = MAP_COORDS[i]; |
| 2760 | − glViewport(coord.s * fbo->width(), coord.t * fbo->height(), targetSize, targetSize); | |
| 2762 | + glViewport(coord.s * sourceSize, coord.t * sourceSize, targetSize, targetSize); | |
| 2761 | 2763 | |
| 2762 | 2764 | // if simple shadow then since the resolution is twice as much as with cascaded, cover 2 regions with the map, not just one |
| 2763 | 2765 | int regionIncrement = (matrixCount == 1 ? 2 : 1); |
| @@ -2880,7 +2882,7 @@ void Application::updateShadowMap() { · 116 unmodified lines | ||
| 2880 | 2882 | glMatrixMode(GL_MODELVIEW); |
| 2881 | 2883 | } |
| 2882 | 2884 | |
| 2883 | − fbo->release(); | |
| 2885 | + // fbo->release(); | |
| 2884 | 2886 | |
| 2885 | 2887 | glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); |
| 2886 | 2888 | activeRenderingThread = nullptr; |
| @@ -2926,7 +2928,8 @@ PickRay Application::computePickRay(float x, float y) { · 39 unmodified lines | ||
| 2926 | 2928 | } |
| 2927 | 2929 | |
| 2928 | 2930 | QImage Application::renderAvatarBillboard() { |
| 2929 | − DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind(); | |
| 2931 | + auto primaryFramebuffer = DependencyManager::get<TextureCache>()->getPrimaryFramebuffer(); | |
| 2932 | + glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFramebuffer)); | |
| 2930 | 2933 | |
| 2931 | 2934 | // the "glow" here causes an alpha of one |
| 2932 | 2935 | Glower glower; |
| @@ -2939,7 +2942,7 @@ QImage Application::renderAvatarBillboard() { · 6 unmodified lines | ||
| 2939 | 2942 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); |
| 2940 | 2943 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); |
| 2941 | 2944 | |
| 2942 | − DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->release(); | |
| 2945 | + glBindFramebuffer(GL_FRAMEBUFFER, 0); | |
| 2943 | 2946 | |
| 2944 | 2947 | return image; |
| 2945 | 2948 | } |
| @@ -3808,17 +3811,7 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 862 unmodified lines | ||
| 3808 | 3811 | } |
| 3809 | 3812 | |
| 3810 | 3813 | // Download the FST file, to attempt to determine its model type |
| 3811 | − QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 3812 | − QNetworkRequest networkRequest = QNetworkRequest(url); | |
| 3813 | − networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); | |
| 3814 | − QNetworkReply* reply = networkAccessManager.get(networkRequest); | |
| 3815 | − qCDebug(interfaceapp) << "Downloading avatar file at " << url; | |
| 3816 | − QEventLoop loop; | |
| 3817 | − QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); | |
| 3818 | − loop.exec(); | |
| 3819 | − QByteArray fstContents = reply->readAll(); | |
| 3820 | − delete reply; | |
| 3821 | − QVariantHash fstMapping = FSTReader::readMapping(fstContents); | |
| 3814 | + QVariantHash fstMapping = FSTReader::downloadMapping(url); | |
| 3822 | 3815 | |
| 3823 | 3816 | FSTReader::ModelType modelType = FSTReader::predictModelType(fstMapping); |
| 3824 | 3817 | |
| @@ -3829,26 +3822,27 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 4 unmodified lines | ||
| 3829 | 3822 | QPushButton* bodyButton = NULL; |
| 3830 | 3823 | QPushButton* bodyAndHeadButton = NULL; |
| 3831 | 3824 | |
| 3825 | + QString modelName = fstMapping["name"].toString(); | |
| 3832 | 3826 | QString message; |
| 3833 | 3827 | QString typeInfo; |
| 3834 | 3828 | switch (modelType) { |
| 3835 | 3829 | case FSTReader::HEAD_MODEL: |
| 3836 | − message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar head?"); | |
| 3830 | + message = QString("Would you like to use '") + modelName + QString("' for your avatar head?"); | |
| 3837 | 3831 | headButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3838 | 3832 | break; |
| 3839 | 3833 | |
| 3840 | 3834 | case FSTReader::BODY_ONLY_MODEL: |
| 3841 | − message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar body?"); | |
| 3835 | + message = QString("Would you like to use '") + modelName + QString("' for your avatar body?"); | |
| 3842 | 3836 | bodyButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3843 | 3837 | break; |
| 3844 | 3838 | |
| 3845 | 3839 | case FSTReader::HEAD_AND_BODY_MODEL: |
| 3846 | − message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar?"); | |
| 3840 | + message = QString("Would you like to use '") + modelName + QString("' for your avatar?"); | |
| 3847 | 3841 | bodyAndHeadButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3848 | 3842 | break; |
| 3849 | 3843 | |
| 3850 | 3844 | default: |
| 3851 | − message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for some part of your avatar head?"); | |
| 3845 | + message = QString("Would you like to use '") + modelName + QString("' for some part of your avatar head?"); | |
| 3852 | 3846 | headButton = msgBox.addButton(tr("Use for Head"), QMessageBox::ActionRole); |
| 3853 | 3847 | bodyButton = msgBox.addButton(tr("Use for Body"), QMessageBox::ActionRole); |
| 3854 | 3848 | bodyAndHeadButton = msgBox.addButton(tr("Use for Body and Head"), QMessageBox::ActionRole); |
| @@ -3861,34 +3855,18 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 6 unmodified lines | ||
| 3861 | 3855 | msgBox.exec(); |
| 3862 | 3856 | |
| 3863 | 3857 | if (msgBox.clickedButton() == headButton) { |
| 3864 | − qCDebug(interfaceapp) << "Chose to use for head: " << url; | |
| 3865 | − _myAvatar->setFaceModelURL(url); | |
| 3866 | − UserActivityLogger::getInstance().changedModel("head", url); | |
| 3867 | − _myAvatar->sendIdentityPacket(); | |
| 3868 | − emit faceURLChanged(url); | |
| 3858 | + _myAvatar->useHeadURL(url, modelName); | |
| 3859 | + emit headURLChanged(url, modelName); | |
| 3869 | 3860 | } else if (msgBox.clickedButton() == bodyButton) { |
| 3870 | − qCDebug(interfaceapp) << "Chose to use for body: " << url; | |
| 3871 | − _myAvatar->setSkeletonModelURL(url); | |
| 3872 | − // if the head is empty, reset it to the default head. | |
| 3873 | − if (_myAvatar->getFaceModelURLString().isEmpty()) { | |
| 3874 | − _myAvatar->setFaceModelURL(DEFAULT_HEAD_MODEL_URL); | |
| 3875 | − emit faceURLChanged(DEFAULT_HEAD_MODEL_URL.toString()); | |
| 3876 | − UserActivityLogger::getInstance().changedModel("head", DEFAULT_HEAD_MODEL_URL.toString()); | |
| 3877 | − } | |
| 3878 | − UserActivityLogger::getInstance().changedModel("skeleton", url); | |
| 3879 | − _myAvatar->sendIdentityPacket(); | |
| 3880 | − emit skeletonURLChanged(url); | |
| 3861 | + _myAvatar->useBodyURL(url, modelName); | |
| 3862 | + emit bodyURLChanged(url, modelName); | |
| 3881 | 3863 | } else if (msgBox.clickedButton() == bodyAndHeadButton) { |
| 3882 | − qCDebug(interfaceapp) << "Chose to use for body + head: " << url; | |
| 3883 | − _myAvatar->setFaceModelURL(QString()); | |
| 3884 | − _myAvatar->setSkeletonModelURL(url); | |
| 3885 | − UserActivityLogger::getInstance().changedModel("skeleton", url); | |
| 3886 | − _myAvatar->sendIdentityPacket(); | |
| 3887 | − emit faceURLChanged(QString()); | |
| 3888 | − emit skeletonURLChanged(url); | |
| 3864 | + _myAvatar->useFullAvatarURL(url, modelName); | |
| 3865 | + emit fullAvatarURLChanged(url, modelName); | |
| 3889 | 3866 | } else { |
| 3890 | 3867 | qCDebug(interfaceapp) << "Declined to use the avatar: " << url; |
| 3891 | 3868 | } |
| 3869 | + | |
| 3892 | 3870 | return true; |
| 3893 | 3871 | } |
| 3894 | 3872 | |
| @@ -4400,8 +4378,7 @@ void Application::checkSkeleton() { · 505 unmodified lines | ||
| 4400 | 4378 | msgBox.setIcon(QMessageBox::Warning); |
| 4401 | 4379 | msgBox.exec(); |
| 4402 | 4380 | |
| 4403 | − _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL); | |
| 4404 | − _myAvatar->sendIdentityPacket(); | |
| 4381 | + _myAvatar->useBodyURL(DEFAULT_BODY_MODEL_URL, "Default"); | |
| 4405 | 4382 | } else { |
| 4406 | 4383 | _myAvatar->updateCharacterController(); |
| 4407 | 4384 | _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); |