Showing the changes to interface/src/Application.cpp (1 of 258 files). Show all
Unified · Split
| @@ -92,6 +92,7 @@ · 91 unmodified lines | |||
| 92 | #include <RenderableWebEntityItem.h> | 92 | #include <RenderableWebEntityItem.h> |
| 93 | #include <RenderDeferredTask.h> | 93 | #include <RenderDeferredTask.h> |
| 94 | #include <ResourceCache.h> | 94 | #include <ResourceCache.h> |
| 95 | #include <RenderScriptingInterface.h> | ||
| 95 | #include <SceneScriptingInterface.h> | 96 | #include <SceneScriptingInterface.h> |
| 96 | #include <RecordingScriptingInterface.h> | 97 | #include <RecordingScriptingInterface.h> |
| 97 | #include <ScriptCache.h> | 98 | #include <ScriptCache.h> |
| @@ -104,6 +105,7 @@ · 6 unmodified lines | |||
| 104 | #include <VrMenu.h> | 105 | #include <VrMenu.h> |
| 105 | #include <recording/Deck.h> | 106 | #include <recording/Deck.h> |
| 106 | #include <recording/Recorder.h> | 107 | #include <recording/Recorder.h> |
| 108 | #include <QmlWebWindowClass.h> | ||
| 107 | 109 | ||
| 108 | #include "AnimDebugDraw.h" | 110 | #include "AnimDebugDraw.h" |
| 109 | #include "AudioClient.h" | 111 | #include "AudioClient.h" |
| @@ -344,6 +346,7 @@ bool setupEssentials(int& argc, char** argv) { · 234 unmodified lines | |||
| 344 | #endif | 346 | #endif |
| 345 | DependencyManager::set<DiscoverabilityManager>(); | 347 | DependencyManager::set<DiscoverabilityManager>(); |
| 346 | DependencyManager::set<SceneScriptingInterface>(); | 348 | DependencyManager::set<SceneScriptingInterface>(); |
| 349 | DependencyManager::set<RenderScriptingInterface>(); | ||
| 347 | DependencyManager::set<OffscreenUi>(); | 350 | DependencyManager::set<OffscreenUi>(); |
| 348 | DependencyManager::set<AutoUpdater>(); | 351 | DependencyManager::set<AutoUpdater>(); |
| 349 | DependencyManager::set<PathUtils>(); | 352 | DependencyManager::set<PathUtils>(); |
| @@ -365,6 +368,17 @@ Cube3DOverlay* _keyboardFocusHighlight{ nullptr }; · 15 unmodified lines | |||
| 365 | int _keyboardFocusHighlightID{ -1 }; | 368 | int _keyboardFocusHighlightID{ -1 }; |
| 366 | PluginContainer* _pluginContainer; | 369 | PluginContainer* _pluginContainer; |
| 367 | 370 | ||
| 371 | |||
| 372 | // FIXME hack access to the internal share context for the Chromium helper | ||
| 373 | // Normally we'd want to use QWebEngine::initialize(), but we can't because | ||
| 374 | // our primary context is a QGLWidget, which can't easily be initialized to share | ||
| 375 | // from a QOpenGLContext. | ||
| 376 | // | ||
| 377 | // So instead we create a new offscreen context to share with the QGLWidget, | ||
| 378 | // and manually set THAT to be the shared context for the Chromium helper | ||
| 379 | OffscreenGLCanvas* _chromiumShareContext { nullptr }; | ||
| 380 | Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); | ||
| 381 | |||
| 368 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : | 382 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : |
| 369 | QApplication(argc, argv), | 383 | QApplication(argc, argv), |
| 370 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), | 384 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), |
| @@ -626,6 +640,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 255 unmodified lines | |||
| 626 | _glWidget->makeCurrent(); | 640 | _glWidget->makeCurrent(); |
| 627 | _glWidget->initializeGL(); | 641 | _glWidget->initializeGL(); |
| 628 | 642 | ||
| 643 | _chromiumShareContext = new OffscreenGLCanvas(); | ||
| 644 | _chromiumShareContext->create(_glWidget->context()->contextHandle()); | ||
| 645 | _chromiumShareContext->makeCurrent(); | ||
| 646 | qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | ||
| 647 | |||
| 629 | _offscreenContext = new OffscreenGLCanvas(); | 648 | _offscreenContext = new OffscreenGLCanvas(); |
| 630 | _offscreenContext->create(_glWidget->context()->contextHandle()); | 649 | _offscreenContext->create(_glWidget->context()->contextHandle()); |
| 631 | _offscreenContext->makeCurrent(); | 650 | _offscreenContext->makeCurrent(); |
| @@ -689,13 +708,37 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 57 unmodified lines | |||
| 689 | } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) { | 708 | } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) { |
| 690 | VrMenu::toggle(); // show context menu even on non-stereo displays | 709 | VrMenu::toggle(); // show context menu even on non-stereo displays |
| 691 | } else if (action == controller::toInt(controller::Action::RETICLE_X)) { | 710 | } else if (action == controller::toInt(controller::Action::RETICLE_X)) { |
| 692 | auto globalPos = QCursor::pos(); | 711 | auto oldPos = QCursor::pos(); |
| 693 | globalPos.setX(globalPos.x() + state); | 712 | auto newPos = oldPos; |
| 694 | QCursor::setPos(globalPos); | 713 | newPos.setX(oldPos.x() + state); |
| 714 | QCursor::setPos(newPos); | ||
| 715 | |||
| 716 | |||
| 717 | // NOTE: This is some debugging code we will leave in while debugging various reticle movement strategies, | ||
| 718 | // remove it after we're done | ||
| 719 | const float REASONABLE_CHANGE = 50.0f; | ||
| 720 | glm::vec2 oldPosG = { oldPos.x(), oldPos.y() }; | ||
| 721 | glm::vec2 newPosG = { newPos.x(), newPos.y() }; | ||
| 722 | auto distance = glm::distance(oldPosG, newPosG); | ||
| 723 | if (distance > REASONABLE_CHANGE) { | ||
| 724 | qDebug() << "Action::RETICLE_X... UNREASONABLE CHANGE! distance:" << distance << " oldPos:" << oldPosG << " newPos:" << newPosG; | ||
| 725 | } | ||
| 726 | |||
| 695 | } else if (action == controller::toInt(controller::Action::RETICLE_Y)) { | 727 | } else if (action == controller::toInt(controller::Action::RETICLE_Y)) { |
| 696 | auto globalPos = QCursor::pos(); | 728 | auto oldPos = QCursor::pos(); |
| 697 | globalPos.setY(globalPos.y() + state); | 729 | auto newPos = oldPos; |
| 698 | QCursor::setPos(globalPos); | 730 | newPos.setY(oldPos.y() + state); |
| 731 | QCursor::setPos(newPos); | ||
| 732 | |||
| 733 | // NOTE: This is some debugging code we will leave in while debugging various reticle movement strategies, | ||
| 734 | // remove it after we're done | ||
| 735 | const float REASONABLE_CHANGE = 50.0f; | ||
| 736 | glm::vec2 oldPosG = { oldPos.x(), oldPos.y() }; | ||
| 737 | glm::vec2 newPosG = { newPos.x(), newPos.y() }; | ||
| 738 | auto distance = glm::distance(oldPosG, newPosG); | ||
| 739 | if (distance > REASONABLE_CHANGE) { | ||
| 740 | qDebug() << "Action::RETICLE_Y... UNREASONABLE CHANGE! distance:" << distance << " oldPos:" << oldPosG << " newPos:" << newPosG; | ||
| 741 | } | ||
| 699 | } | 742 | } |
| 700 | } | 743 | } |
| 701 | }); | 744 | }); |
| @@ -709,9 +752,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 7 unmodified lines | |||
| 709 | _applicationStateDevice->addInputVariant(QString("ComfortMode"), controller::StateController::ReadLambda([]() -> float { | 752 | _applicationStateDevice->addInputVariant(QString("ComfortMode"), controller::StateController::ReadLambda([]() -> float { |
| 710 | return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode); | 753 | return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode); |
| 711 | })); | 754 | })); |
| 712 | _applicationStateDevice->addInputVariant(QString("Grounded"), controller::StateController::ReadLambda([]() -> float { | 755 | _applicationStateDevice->addInputVariant(QString("Grounded"), controller::StateController::ReadLambda([]() -> float { |
| 713 | return (float)qApp->getMyAvatar()->getCharacterController()->onGround(); | 756 | return (float)qApp->getMyAvatar()->getCharacterController()->onGround(); |
| 714 | })); | 757 | })); |
| 715 | 758 | ||
| 716 | userInputMapper->registerDevice(_applicationStateDevice); | 759 | userInputMapper->registerDevice(_applicationStateDevice); |
| 717 | 760 | ||
| @@ -1164,26 +1207,15 @@ void Application::paintGL() { · 446 unmodified lines | |||
| 1164 | 1207 | ||
| 1165 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | 1208 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 1166 | PerformanceTimer perfTimer("Mirror"); | 1209 | PerformanceTimer perfTimer("Mirror"); |
| 1167 | auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor(); | 1210 | auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer(); |
| 1168 | 1211 | ||
| 1169 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; | 1212 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| 1213 | renderArgs._blitFramebuffer = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); | ||
| 1214 | |||
| 1170 | renderRearViewMirror(&renderArgs, _mirrorViewRect); | 1215 | renderRearViewMirror(&renderArgs, _mirrorViewRect); |
| 1171 | renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE; | ||
| 1172 | 1216 | ||
| 1173 | { | 1217 | renderArgs._blitFramebuffer.reset(); |
| 1174 | float ratio = ((float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale()); | 1218 | renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE; |
| 1175 | // Flip the src and destination rect horizontally to do the mirror | ||
| 1176 | auto mirrorRect = glm::ivec4(0, 0, _mirrorViewRect.width() * ratio, _mirrorViewRect.height() * ratio); | ||
| 1177 | auto mirrorRectDest = glm::ivec4(mirrorRect.z, mirrorRect.y, mirrorRect.x, mirrorRect.w); | ||
| 1178 | |||
| 1179 | auto selfieFbo = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); | ||
| 1180 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | ||
| 1181 | batch.setFramebuffer(selfieFbo); | ||
| 1182 | batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); | ||
| 1183 | batch.blit(primaryFbo, mirrorRect, selfieFbo, mirrorRectDest); | ||
| 1184 | batch.setFramebuffer(nullptr); | ||
| 1185 | }); | ||
| 1186 | } | ||
| 1187 | } | 1219 | } |
| 1188 | 1220 | ||
| 1189 | { | 1221 | { |
| @@ -1263,15 +1295,14 @@ void Application::paintGL() { · 73 unmodified lines | |||
| 1263 | hmdOffset.x = -hmdOffset.x; | 1295 | hmdOffset.x = -hmdOffset.x; |
| 1264 | 1296 | ||
| 1265 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() | 1297 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 1266 | + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0) | 1298 | + glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0) |
| 1267 | + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror | 1299 | + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror |
| 1268 | + mirrorBodyOrientation * hmdOffset); | 1300 | + mirrorBodyOrientation * hmdOffset); |
| 1269 | |||
| 1270 | } else { | 1301 | } else { |
| 1271 | _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() | 1302 | _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() |
| 1272 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | 1303 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 1273 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() | 1304 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 1274 | + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0) | 1305 | + glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0) |
| 1275 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * | 1306 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 1276 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 1307 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1277 | } | 1308 | } |
| @@ -1355,65 +1386,11 @@ void Application::paintGL() { · 77 unmodified lines | |||
| 1355 | renderArgs._context->setStereoProjections(eyeProjections); | 1386 | renderArgs._context->setStereoProjections(eyeProjections); |
| 1356 | renderArgs._context->setStereoViews(eyeOffsets); | 1387 | renderArgs._context->setStereoViews(eyeOffsets); |
| 1357 | } | 1388 | } |
| 1389 | renderArgs._blitFramebuffer = finalFramebuffer; | ||
| 1358 | displaySide(&renderArgs, _myCamera); | 1390 | displaySide(&renderArgs, _myCamera); |
| 1359 | renderArgs._context->enableStereo(false); | ||
| 1360 | 1391 | ||
| 1361 | // Blit primary to final FBO | 1392 | renderArgs._blitFramebuffer.reset(); |
| 1362 | auto primaryFbo = framebufferCache->getPrimaryFramebuffer(); | 1393 | renderArgs._context->enableStereo(false); |
| 1363 | |||
| 1364 | if (renderArgs._renderMode == RenderArgs::MIRROR_RENDER_MODE) { | ||
| 1365 | if (displayPlugin->isStereo()) { | ||
| 1366 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | ||
| 1367 | gpu::Vec4i srcRectLeft; | ||
| 1368 | srcRectLeft.z = size.width() / 2; | ||
| 1369 | srcRectLeft.w = size.height(); | ||
| 1370 | |||
| 1371 | gpu::Vec4i srcRectRight; | ||
| 1372 | srcRectRight.x = size.width() / 2; | ||
| 1373 | srcRectRight.z = size.width(); | ||
| 1374 | srcRectRight.w = size.height(); | ||
| 1375 | |||
| 1376 | gpu::Vec4i destRectLeft; | ||
| 1377 | destRectLeft.x = srcRectLeft.z; | ||
| 1378 | destRectLeft.z = srcRectLeft.x; | ||
| 1379 | destRectLeft.y = srcRectLeft.y; | ||
| 1380 | destRectLeft.w = srcRectLeft.w; | ||
| 1381 | |||
| 1382 | gpu::Vec4i destRectRight; | ||
| 1383 | destRectRight.x = srcRectRight.z; | ||
| 1384 | destRectRight.z = srcRectRight.x; | ||
| 1385 | destRectRight.y = srcRectRight.y; | ||
| 1386 | destRectRight.w = srcRectRight.w; | ||
| 1387 | |||
| 1388 | batch.setFramebuffer(finalFramebuffer); | ||
| 1389 | batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f)); | ||
| 1390 | // BLit left to right and right to left in stereo | ||
| 1391 | batch.blit(primaryFbo, srcRectRight, finalFramebuffer, destRectLeft); | ||
| 1392 | batch.blit(primaryFbo, srcRectLeft, finalFramebuffer, destRectRight); | ||
| 1393 | }); | ||
| 1394 | } else { | ||
| 1395 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | ||
| 1396 | gpu::Vec4i srcRect; | ||
| 1397 | srcRect.z = size.width(); | ||
| 1398 | srcRect.w = size.height(); | ||
| 1399 | gpu::Vec4i destRect; | ||
| 1400 | destRect.x = size.width(); | ||
| 1401 | destRect.y = 0; | ||
| 1402 | destRect.z = 0; | ||
| 1403 | destRect.w = size.height(); | ||
| 1404 | batch.setFramebuffer(finalFramebuffer); | ||
| 1405 | batch.blit(primaryFbo, srcRect, finalFramebuffer, destRect); | ||
| 1406 | }); | ||
| 1407 | } | ||
| 1408 | } else { | ||
| 1409 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { | ||
| 1410 | gpu::Vec4i rect; | ||
| 1411 | rect.z = size.width(); | ||
| 1412 | rect.w = size.height(); | ||
| 1413 | batch.setFramebuffer(finalFramebuffer); | ||
| 1414 | batch.blit(primaryFbo, rect, finalFramebuffer, rect); | ||
| 1415 | }); | ||
| 1416 | } | ||
| 1417 | } | 1394 | } |
| 1418 | 1395 | ||
| 1419 | // Overlay Composition, needs to occur after screen space effects have completed | 1396 | // Overlay Composition, needs to occur after screen space effects have completed |
| @@ -1421,7 +1398,9 @@ void Application::paintGL() { · 1 unmodified line | |||
| 1421 | { | 1398 | { |
| 1422 | PROFILE_RANGE(__FUNCTION__ "/compositor"); | 1399 | PROFILE_RANGE(__FUNCTION__ "/compositor"); |
| 1423 | PerformanceTimer perfTimer("compositor"); | 1400 | PerformanceTimer perfTimer("compositor"); |
| 1401 | |||
| 1424 | auto primaryFbo = finalFramebuffer; | 1402 | auto primaryFbo = finalFramebuffer; |
| 1403 | |||
| 1425 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFbo)); | 1404 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFbo)); |
| 1426 | if (displayPlugin->isStereo()) { | 1405 | if (displayPlugin->isStereo()) { |
| 1427 | QRect currentViewport(QPoint(0, 0), QSize(size.width() / 2, size.height())); | 1406 | QRect currentViewport(QPoint(0, 0), QSize(size.width() / 2, size.height())); |
| @@ -1446,7 +1425,9 @@ void Application::paintGL() { · 18 unmodified lines | |||
| 1446 | { | 1425 | { |
| 1447 | PROFILE_RANGE(__FUNCTION__ "/pluginOutput"); | 1426 | PROFILE_RANGE(__FUNCTION__ "/pluginOutput"); |
| 1448 | PerformanceTimer perfTimer("pluginOutput"); | 1427 | PerformanceTimer perfTimer("pluginOutput"); |
| 1428 | |||
| 1449 | auto finalTexturePointer = finalFramebuffer->getRenderBuffer(0); | 1429 | auto finalTexturePointer = finalFramebuffer->getRenderBuffer(0); |
| 1430 | |||
| 1450 | GLuint finalTexture = gpu::GLBackend::getTextureID(finalTexturePointer); | 1431 | GLuint finalTexture = gpu::GLBackend::getTextureID(finalTexturePointer); |
| 1451 | Q_ASSERT(0 != finalTexture); | 1432 | Q_ASSERT(0 != finalTexture); |
| 1452 | 1433 | ||
| @@ -2574,7 +2555,7 @@ void Application::init() { · 1121 unmodified lines | |||
| 2574 | 2555 | ||
| 2575 | _environment.init(); | 2556 | _environment.init(); |
| 2576 | 2557 | ||
| 2577 | DependencyManager::get<DeferredLightingEffect>()->init(this); | 2558 | DependencyManager::get<DeferredLightingEffect>()->init(); |
| 2578 | 2559 | ||
| 2579 | DependencyManager::get<AvatarManager>()->init(); | 2560 | DependencyManager::get<AvatarManager>()->init(); |
| 2580 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); | 2561 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); |
| @@ -2992,6 +2973,9 @@ void Application::update(float deltaTime) { · 411 unmodified lines | |||
| 2992 | _physicsEngine->changeObjects(motionStates); | 2973 | _physicsEngine->changeObjects(motionStates); |
| 2993 | 2974 | ||
| 2994 | myAvatar->prepareForPhysicsSimulation(); | 2975 | myAvatar->prepareForPhysicsSimulation(); |
| 2976 | _physicsEngine->forEachAction([&](EntityActionPointer action) { | ||
| 2977 | action->prepareForPhysicsSimulation(); | ||
| 2978 | }); | ||
| 2995 | 2979 | ||
| 2996 | getEntities()->getTree()->withWriteLock([&] { | 2980 | getEntities()->getTree()->withWriteLock([&] { |
| 2997 | _physicsEngine->stepSimulation(); | 2981 | _physicsEngine->stepSimulation(); |
| @@ -3404,7 +3388,7 @@ QImage Application::renderAvatarBillboard(RenderArgs* renderArgs) { · 406 unmodified lines | |||
| 3404 | renderArgs->_renderMode = RenderArgs::DEFAULT_RENDER_MODE; | 3388 | renderArgs->_renderMode = RenderArgs::DEFAULT_RENDER_MODE; |
| 3405 | renderRearViewMirror(renderArgs, QRect(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE), true); | 3389 | renderRearViewMirror(renderArgs, QRect(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE), true); |
| 3406 | 3390 | ||
| 3407 | auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor(); | 3391 | auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer(); |
| 3408 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); | 3392 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); |
| 3409 | renderArgs->_context->downloadFramebuffer(primaryFbo, glm::ivec4(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE), image); | 3393 | renderArgs->_context->downloadFramebuffer(primaryFbo, glm::ivec4(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE), image); |
| 3410 | 3394 | ||
| @@ -3674,34 +3658,19 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 263 unmodified lines | |||
| 3674 | // For now every frame pass the renderContext | 3658 | // For now every frame pass the renderContext |
| 3675 | { | 3659 | { |
| 3676 | PerformanceTimer perfTimer("EngineRun"); | 3660 | PerformanceTimer perfTimer("EngineRun"); |
| 3677 | render::RenderContext renderContext; | ||
| 3678 | |||
| 3679 | auto sceneInterface = DependencyManager::get<SceneScriptingInterface>(); | ||
| 3680 | 3661 | ||
| 3681 | renderContext._cullOpaque = sceneInterface->doEngineCullOpaque(); | 3662 | auto renderInterface = DependencyManager::get<RenderScriptingInterface>(); |
| 3682 | renderContext._sortOpaque = sceneInterface->doEngineSortOpaque(); | 3663 | auto renderContext = renderInterface->getRenderContext(); |
| 3683 | renderContext._renderOpaque = sceneInterface->doEngineRenderOpaque(); | ||
| 3684 | renderContext._cullTransparent = sceneInterface->doEngineCullTransparent(); | ||
| 3685 | renderContext._sortTransparent = sceneInterface->doEngineSortTransparent(); | ||
| 3686 | renderContext._renderTransparent = sceneInterface->doEngineRenderTransparent(); | ||
| 3687 | |||
| 3688 | renderContext._maxDrawnOpaqueItems = sceneInterface->getEngineMaxDrawnOpaqueItems(); | ||
| 3689 | renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems(); | ||
| 3690 | renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems(); | ||
| 3691 | |||
| 3692 | renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus(); | ||
| 3693 | if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned)) { | ||
| 3694 | renderContext._drawItemStatus |= render::showNetworkStatusFlag; | ||
| 3695 | } | ||
| 3696 | renderContext._drawHitEffect = sceneInterface->doEngineDisplayHitEffect(); | ||
| 3697 | |||
| 3698 | renderContext._occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion); | ||
| 3699 | renderContext._fxaaStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing); | ||
| 3700 | 3664 | ||
| 3701 | renderArgs->_shouldRender = LODManager::shouldRender; | 3665 | renderArgs->_shouldRender = LODManager::shouldRender; |
| 3702 | |||
| 3703 | renderContext.args = renderArgs; | ||
| 3704 | renderArgs->_viewFrustum = getDisplayViewFrustum(); | 3666 | renderArgs->_viewFrustum = getDisplayViewFrustum(); |
| 3667 | renderContext.setArgs(renderArgs); | ||
| 3668 | |||
| 3669 | bool occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion); | ||
| 3670 | bool antialiasingStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing); | ||
| 3671 | bool showOwnedStatus = Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned); | ||
| 3672 | renderContext.setOptions(occlusionStatus, antialiasingStatus, showOwnedStatus); | ||
| 3673 | |||
| 3705 | _renderEngine->setRenderContext(renderContext); | 3674 | _renderEngine->setRenderContext(renderContext); |
| 3706 | 3675 | ||
| 3707 | // Before the deferred pass, let's try to use the render engine | 3676 | // Before the deferred pass, let's try to use the render engine |
| @@ -3709,15 +3678,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 1 unmodified line | |||
| 3709 | _renderEngine->run(); | 3678 | _renderEngine->run(); |
| 3710 | myAvatar->endRenderRun(); | 3679 | myAvatar->endRenderRun(); |
| 3711 | 3680 | ||
| 3712 | auto engineRC = _renderEngine->getRenderContext(); | 3681 | auto engineContext = _renderEngine->getRenderContext(); |
| 3713 | sceneInterface->setEngineFeedOpaqueItems(engineRC->_numFeedOpaqueItems); | 3682 | renderInterface->setItemCounts(engineContext->getItemsConfig()); |
| 3714 | sceneInterface->setEngineDrawnOpaqueItems(engineRC->_numDrawnOpaqueItems); | ||
| 3715 | |||
| 3716 | sceneInterface->setEngineFeedTransparentItems(engineRC->_numFeedTransparentItems); | ||
| 3717 | sceneInterface->setEngineDrawnTransparentItems(engineRC->_numDrawnTransparentItems); | ||
| 3718 | |||
| 3719 | sceneInterface->setEngineFeedOverlay3DItems(engineRC->_numFeedOverlay3DItems); | ||
| 3720 | sceneInterface->setEngineDrawnOverlay3DItems(engineRC->_numDrawnOverlay3DItems); | ||
| 3721 | } | 3683 | } |
| 3722 | 3684 | ||
| 3723 | activeRenderingThread = nullptr; | 3685 | activeRenderingThread = nullptr; |
| @@ -4143,6 +4105,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 419 unmodified lines | |||
| 4143 | LocationScriptingInterface::locationSetter); | 4105 | LocationScriptingInterface::locationSetter); |
| 4144 | 4106 | ||
| 4145 | scriptEngine->registerFunction("WebWindow", WebWindowClass::constructor, 1); | 4107 | scriptEngine->registerFunction("WebWindow", WebWindowClass::constructor, 1); |
| 4108 | scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor); | ||
| 4146 | 4109 | ||
| 4147 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); | 4110 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); |
| 4148 | scriptEngine->registerGlobalObject("Stats", Stats::getInstance()); | 4111 | scriptEngine->registerGlobalObject("Stats", Stats::getInstance()); |
| @@ -4171,11 +4134,12 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 22 unmodified lines | |||
| 4171 | scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0); | 4134 | scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0); |
| 4172 | 4135 | ||
| 4173 | scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); | 4136 | scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); |
| 4137 | scriptEngine->registerGlobalObject("Render", DependencyManager::get<RenderScriptingInterface>().data()); | ||
| 4174 | 4138 | ||
| 4175 | scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget()); | 4139 | scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget()); |
| 4176 | } | 4140 | } |
| 4177 | 4141 | ||
| 4178 | bool Application::canAcceptURL(const QString& urlString) { | 4142 | bool Application::canAcceptURL(const QString& urlString) const { |
| 4179 | QUrl url(urlString); | 4143 | QUrl url(urlString); |
| 4180 | if (urlString.startsWith(HIFI_URL_SCHEME)) { | 4144 | if (urlString.startsWith(HIFI_URL_SCHEME)) { |
| 4181 | return true; | 4145 | return true; |