15 #ifndef hifi_Application_h
16 #define hifi_Application_h
18 #include <QtWidgets/QApplication>
20 #include <AbstractScriptingServicesInterface.h>
21 #include <AbstractUriHandler.h>
22 #include <AbstractViewStateInterface.h>
23 #include <AvatarHashMap.h>
24 #include <EntityEditPacketSender.h>
25 #include <ModerationFlags.h>
26 #include <OctreeQuery.h>
27 #include <PhysicsEngine.h>
28 #include <ShapeManager.h>
29 #include <TouchEvent.h>
30 #include <ui-plugins/PluginContainer.h>
32 #include "avatar/MyAvatar.h"
33 #include "ConnectionMonitor.h"
34 #include "CursorManager.h"
35 #include "FancyCamera.h"
36 #include "graphics/GraphicsEngine.h"
37 #include "LoginStateManager.h"
38 #include "octree/OctreePacketProcessor.h"
39 #include "PerformanceManager.h"
40 #include "RefreshRateManager.h"
41 #include "scripting/DialogsManagerScriptingInterface.h"
42 #include "ui/ApplicationOverlay.h"
43 #include "ui/OverlayConductor.h"
44 #include "ui/overlays/Overlays.h"
45 #include "VisionSqueeze.h"
46 #include "workload/GameWorkload.h"
53 class CompositorHelper;
54 class ControllerScriptingInterface;
55 class DiscordPresence;
56 class EntityScriptServerLogDialog;
59 class KeyboardMouseDevice;
62 class ModalDialogListener;
64 class TouchscreenDevice;
65 class TouchscreenVirtualPadDevice;
66 class QCommandLineParser;
71 namespace controller {
72 class StateController;
79 #define qApp (static_cast<Application*>(QCoreApplication::instance()))
81 class Application :
public QApplication,
84 public AbstractUriHandler,
85 public PluginContainer
91 int& argc,
char** argv,
92 const QCommandLineParser& parser,
93 QElapsedTimer& startup_time
106 void initialize(
const QCommandLineParser &parser);
108 MainWindow* getWindow()
const {
return _window; }
109 virtual QThread* getMainThread()
override {
return thread(); }
111 bool isAboutToQuit()
const {
return _aboutToQuit; }
112 bool isServerlessMode()
const;
113 bool isInterstitialMode()
const {
return _interstitialMode; }
114 bool failedToConnectToEntityServer()
const {
return _failedToConnectToEntityServer; }
116 void setPreviousSessionCrashed(
bool value) { _previousSessionCrashed = value; }
119 Q_INVOKABLE QString getUserAgent();
121 PerformanceManager& getPerformanceManager() {
return _performanceManager; }
122 RefreshRateManager& getRefreshRateManager() {
return _refreshRateManager; }
123 float getGameLoopRate()
const {
return _gameLoopCounter.rate(); }
126 FileLogger* getLogger()
const {
return _logger; }
129 bool getUseDiscordPresence()
const {
return _useDiscordPresence.get(); }
130 void setUseDiscordPresence(
bool enable);
132 QString getPreviousScriptLocation() {
return _previousScriptLocation.get(); }
133 void setPreviousScriptLocation(
const QString& previousScriptLocation) { _previousScriptLocation.set(previousScriptLocation); }
135 void replaceDomainContent(
const QString& url,
const QString& itemName);
137 void openDirectory(
const QString& path);
139 void overrideEntry() { _overrideEntry =
true; }
140 void forceDisplayName(
const QString& displayName) { getMyAvatar()->setDisplayName(displayName); }
141 void forceLoginWithTokens(
const QString& tokens);
142 void setConfigFileURL(
const QString& fileUrl);
144 void loadAvatarScripts(
const QVector<QString>& urls);
145 void unloadAvatarScripts();
147 Q_INVOKABLE
void copyToClipboard(
const QString& text);
149 Q_INVOKABLE
void setMinimumGPUTextureMemStabilityCount(
int stabilityCount) { _minimumGPUTextureMemSizeStabilityCount = stabilityCount; }
151 virtual ControllerScriptingInterface* getControllerScriptingInterface() {
return _controllerScriptingInterface; }
155 VisionSqueeze& getVisionSqueeze() {
return _visionSqueeze; }
159 virtual ui::Menu* getPrimaryMenu()
override;
160 virtual void showDisplayPluginsTools(
bool show)
override;
162 virtual GLWidget* getPrimaryWidget()
override;
164 virtual VKWidget* getPrimaryWidget()
override;
166 virtual MainWindow* getPrimaryWindow()
override;
167 virtual QOpenGLContext* getPrimaryContext()
override;
168 virtual bool isForeground()
const override;
170 bool hasFocus()
const;
174 void showCursor(
const Cursor::Icon& cursor);
176 Overlays& getOverlays() {
return _overlays; }
177 ApplicationOverlay& getApplicationOverlay() {
return *_applicationOverlay; }
178 const ApplicationOverlay& getApplicationOverlay()
const {
return *_applicationOverlay; }
179 CompositorHelper& getApplicationCompositor()
const;
181 virtual PickRay computePickRay(
float x,
float y)
const override;
183 static void setupQmlSurface(QQmlContext* surfaceContext,
bool setAdditionalContextProperties);
185 float getHMDTabletScale() {
return _hmdTabletScale.get(); }
186 void setHMDTabletScale(
float hmdTabletScale) { _hmdTabletScale.set(hmdTabletScale); }
187 float getDesktopTabletScale() {
return _desktopTabletScale.get(); }
188 void setDesktopTabletScale(
float desktopTabletScale) { _desktopTabletScale.set(desktopTabletScale); }
190 bool getDesktopTabletBecomesToolbarSetting() {
return _desktopTabletBecomesToolbarSetting.get(); }
191 void setDesktopTabletBecomesToolbarSetting(
bool value);
192 bool getHmdTabletBecomesToolbarSetting() {
return _hmdTabletBecomesToolbarSetting.get(); }
193 void setHmdTabletBecomesToolbarSetting(
bool value);
195 bool getLogWindowOnTopSetting() {
return _keepLogWindowOnTop.get(); }
196 void setLogWindowOnTopSetting(
bool keepOnTop) { _keepLogWindowOnTop.set(keepOnTop); }
197 bool getPreferStylusOverLaser() {
return _preferStylusOverLaserSetting.get(); }
198 void setPreferStylusOverLaser(
bool value) { _preferStylusOverLaserSetting.set(value); }
199 bool getPreferAvatarFingerOverStylus() {
return _preferAvatarFingerOverStylusSetting.get(); }
200 void setPreferAvatarFingerOverStylus(
bool value) { _preferAvatarFingerOverStylusSetting.set(value); }
202 void setMouseCaptureVR(
bool value);
203 bool getMouseCaptureVR();
205 bool getMiniTabletEnabled() {
return _miniTabletEnabledSetting.get(); }
206 void setMiniTabletEnabled(
bool enabled);
208 float getSettingConstrainToolbarPosition() {
return _constrainToolbarPosition.get(); }
209 void setSettingConstrainToolbarPosition(
bool setting);
211 float getAwayStateWhenFocusLostInVREnabled() {
return _awayStateWhenFocusLostInVREnabled.get(); }
212 void setAwayStateWhenFocusLostInVREnabled(
bool setting);
214 QUuid getTabletScreenID()
const;
215 QUuid getTabletHomeButtonID()
const;
216 QUuid getTabletFrameID()
const;
217 QVector<QUuid> getTabletIDs()
const;
219 void confirmConnectWithoutAvatarEntities();
221 bool getLoginDialogPoppedUp()
const {
return _loginDialogPoppedUp; }
222 void createLoginDialog();
223 void updateLoginDialogPosition();
225 void createAvatarInputsBar();
226 void destroyAvatarInputsBar();
239 void initializePluginManager(
const QCommandLineParser& parser);
241 virtual void requestReset()
override { resetSensors(
false); }
242 virtual bool makeRenderingContextCurrent()
override {
return true; }
244 static void shutdownPlugins();
246 void initializeDisplayPlugins();
247 virtual DisplayPluginPointer getActiveDisplayPlugin()
const override;
248 void setActiveDisplayPlugin(
const QString& pluginName);
250 glm::uvec2 getUiSize()
const;
251 QRect getRecommendedHUDRect()
const;
252 glm::vec2 getDeviceSize()
const;
253 bool isThrottleRendering()
const;
254 float getTargetRenderFrameRate()
const;
257 bool hasRiftControllers();
258 bool hasViveControllers();
263 virtual bool isHMDMode()
const override;
264 glm::mat4 getHMDSensorPose()
const;
265 glm::mat4 getEyeOffset(
int eye)
const;
266 glm::mat4 getEyeProjection(
int eye)
const;
271 void initializeRenderEngine();
276 glm::uvec2 getCanvasSize()
const;
277 float getRenderResolutionScale()
const;
279 render::ScenePointer getMain3DScene()
override {
return _graphicsEngine->getRenderScene(); }
280 render::EnginePointer getRenderEngine()
override {
return _graphicsEngine->getRenderEngine(); }
281 gpu::ContextPointer getGPUContext()
const {
return _graphicsEngine->getGPUContext(); }
282 float getRenderLoopRate()
const {
return _graphicsEngine->getRenderLoopRate(); }
286 bool notify(QObject*, QEvent*)
override;
287 bool event(QEvent* event)
override;
288 bool eventFilter(QObject*
object, QEvent* event)
override;
290 void postLambdaEvent(
const std::function<
void()>& f)
override;
291 void sendLambdaEvent(
const std::function<
void()>& f)
override;
292 virtual void pushPostUpdateLambda(
void* key,
const std::function<
void()>& func)
override;
296 Camera& getCamera() {
return _myCamera; }
297 const Camera& getCamera()
const {
return _myCamera; }
299 void copyViewFrustum(ViewFrustum& viewOut)
const;
303 void copyDisplayViewFrustum(ViewFrustum& viewOut)
const;
305 void updateCamera(RenderArgs& renderArgs,
float deltaTime);
306 void updateSecondaryCameraViewFrustum();
308 const ConicalViewFrustums& getConicalViews()
const override {
return _conicalViews; }
310 float getFieldOfView() {
return _fieldOfView.get(); }
311 void setFieldOfView(
float fov);
313 bool getCameraClippingEnabled() {
return _cameraClippingEnabled.get(); }
314 void setCameraClippingEnabled(
bool enabled);
316 void updateMyAvatarLookAtPosition(
float deltaTime);
320 QSharedPointer<EntityTreeRenderer> getEntities()
const {
return DependencyManager::get<EntityTreeRenderer>(); }
321 EntityTreePointer getEntityClipboard()
const {
return _entityClipboard; }
323 std::shared_ptr<EntityEditPacketSender> getEntityEditPacketSender() {
return _entityEditSender; }
325 void setMaxOctreePacketsPerSecond(
int maxOctreePPS);
326 int getMaxOctreePacketsPerSecond()
const {
return _maxOctreePPS; }
327 bool isMissingSequenceNumbers() {
return _isMissingSequenceNumbers; }
333 virtual bool canAcceptURL(
const QString& url)
const override;
334 virtual bool acceptURL(
const QString& url,
bool defaultUpload =
false)
override;
338 bool isPhysicsEnabled()
const {
return _physicsEnabled; }
339 PhysicsEnginePointer getPhysicsEngine() {
return _physicsEngine; }
340 const GameWorkload& getGameWorkload()
const {
return _gameWorkload; }
342 float getNumCollisionObjects()
const {
return _physicsEngine ? _physicsEngine->getNumCollisionObjects() : 0; }
343 void saveNextPhysicsStats(QString filename) { _physicsEngine->saveNextPhysicsStats(filename); }
347 virtual glm::vec3 getAvatarPosition()
const override {
return getMyAvatar()->getWorldPosition(); }
349 void clearAvatarOverrideUrl() { _avatarOverrideUrl = QUrl(); _saveAvatarOverrideUrl =
false; }
350 QUrl getAvatarOverrideUrl() {
return _avatarOverrideUrl; }
351 bool getSaveAvatarOverrideUrl() {
return _saveAvatarOverrideUrl; }
353 int getOtherAvatarsReplicaCount() {
return DependencyManager::get<AvatarHashMap>()->getReplicaCount(); }
354 void setOtherAvatarsReplicaCount(
int count) { DependencyManager::get<AvatarHashMap>()->setReplicaCount(count); }
358 using SnapshotOperator = std::tuple<std::function<void(
const QImage&)>, float,
bool>;
359 void addSnapshotOperator(
const SnapshotOperator& snapshotOperator);
360 bool takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOperators);
362 void takeSnapshot(
bool notify,
bool includeAnimated =
false,
float aspectRatio = 0.0f,
const QString& filename = QString());
363 void takeSecondaryCameraSnapshot(
const bool& notify,
const QString& filename = QString());
364 void takeSecondaryCamera360Snapshot(
const glm::vec3& cameraPosition,
365 const bool& cubemapOutputFormat,
367 const QString& filename = QString());
368 void shareSnapshot(
const QString& filename,
const QUrl& href = QUrl(
""));
371 #if defined(Q_OS_ANDROID)
372 void beforeEnterBackground();
373 void enterBackground();
374 void enterForeground();
375 void toggleAwayMode();
379 void svoImportRequested(
const QString& url);
381 void fullAvatarURLChanged(
const QString& newValue,
const QString& modelName);
383 void beforeAboutToQuit();
384 void activeDisplayPluginChanged();
386 void uploadRequest(QString path);
388 void interstitialModeChanged(
bool isInInterstitialMode);
390 void loginDialogFocusEnabled();
391 void loginDialogFocusDisabled();
393 void miniTabletEnabledChanged(
bool enabled);
394 void awayStateWhenFocusLostInVRChanged(
bool enabled);
396 void darkThemePreferenceChanged(
bool useDarkTheme);
397 void menuBarVisibilityChanged(
bool visible);
400 void updateThreadPoolCount()
const;
402 static void gotoTutorial();
403 void goToErrorDomainURL(QUrl errorDomainURL);
404 void handleLocalServerConnection()
const;
405 void readArgumentsFromLocalSocket()
const;
406 void showUrlHandler(
const QUrl& url);
408 #if (PR_BUILD || DEV_BUILD)
409 void sendWrongProtocolVersionsSignature(
bool checked) { ::sendWrongProtocolVersionsSignature(checked); }
412 void hmdVisibleChanged(
bool visible);
414 void reloadResourceCaches();
416 void updateHeartbeat()
const;
418 static void deadlockApplication();
419 static void unresponsiveApplication();
420 void crashOnShutdown();
422 void rotationModeChanged()
const;
424 void setIsServerlessMode(
bool serverlessDomain);
425 std::map<QString, QString> prepareServerlessDomainContents(QUrl domainURL, QByteArray data);
427 void loadServerlessDomain(QUrl domainURL);
428 void loadErrorDomain(QUrl domainURL);
429 void setIsInterstitialMode(
bool interstitialMode);
431 void updateVerboseLogging();
433 void setCachebustRequire();
435 QString getGraphicsCardType();
436 bool gpuTextureMemSizeStable();
438 Q_INVOKABLE SharedSoundPointer getSampleSound()
const {
return _sampleSound; }
440 static void runTests();
443 void showDialog(
const QUrl& widgetUrl,
const QUrl& tabletUrl,
const QString& name)
const;
444 Q_INVOKABLE
void loadDialog();
445 Q_INVOKABLE
void loadScriptURLDialog()
const;
446 void toggleLogDialog();
447 void recreateLogWindow(
int);
448 void toggleEntityScriptServerLogDialog();
449 Q_INVOKABLE
void showAssetServerWidget(QString filePath =
"");
450 Q_INVOKABLE
void loadAddAvatarBookmarkDialog()
const;
451 Q_INVOKABLE
void loadAvatarBrowser()
const;
453 void showLoginScreen();
454 static void showHelp();
456 void updateSystemTabletMode();
458 void captureMouseChanged(
bool captureMouse);
459 void toggleOverlays();
460 void setOverlaysVisible(
bool visible);
461 Q_INVOKABLE
void centerUI() { _overlayConductor.centerUI(); }
463 void addAssetToWorldMessageClose();
465 void loadLODToolsDialog();
466 void loadEntityStatisticsDialog();
467 void loadDomainConnectionDialog();
468 void showScriptLogs();
470 const QString getPreferredCursor()
const {
return _preferredCursor.get(); }
471 void setPreferredCursor(
const QString& cursor);
473 bool getDarkThemePreference()
const {
return _darkTheme.get(); }
474 void setDarkThemePreference(
bool value);
476 bool getMenuBarVisible()
const {
return _menuBarVisible.get(); }
477 void setMenuBarVisible(
bool visible);
488 Q_INVOKABLE
void showVRKeyboardForHudUI(
bool show);
492 void resetSensors(
bool andReload =
false);
496 QVector<EntityItemID> pasteEntities(
const QString& entityHostType,
float x,
float y,
float z);
497 bool exportEntities(
const QString& filename,
const QVector<QUuid>& entityIDs,
const glm::vec3* givenOffset =
nullptr);
498 bool exportEntities(
const QString& filename,
float x,
float y,
float z,
float scale);
499 bool importEntities(
const QString& url,
const bool isObservable =
true,
const qint64 callerId = -1);
501 void setKeyboardFocusHighlight(
const glm::vec3& position,
const glm::quat& rotation,
const glm::vec3& dimensions);
502 QUuid getKeyboardFocusEntity()
const {
return _keyboardFocusedEntity.get(); }
503 void setKeyboardFocusEntity(
const QUuid&
id);
507 void addAssetToWorldFromURL(QString url);
508 void addAssetToWorldFromURLRequestFinished();
509 void addAssetToWorld(QString filePath, QString zipFile,
bool isZip =
false);
510 void addAssetToWorldUnzipFailure(QString filePath);
511 void addAssetToWorldWithNewMapping(QString filePath, QString mapping,
int copy,
bool isZip =
false);
512 void addAssetToWorldUpload(QString filePath, QString mapping,
bool isZip =
false);
513 void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash,
bool isZip =
false);
514 void addAssetToWorldAddEntity(QString filePath, QString mapping);
516 void handleUnzip(QString sourceFile, QStringList destinationFile,
bool autoAdd,
bool isZip);
520 static void packageModel();
525 void cameraModeChanged();
526 void cameraMenuChanged();
528 void changeViewAsNeeded(
float boomLength);
532 void resetPhysicsReadyInformation();
536 void onAboutToQuit();
538 void loadSettings(
const QCommandLineParser& parser);
539 void saveSettings()
const;
540 void setFailedToConnectToEntityServer() { _failedToConnectToEntityServer =
true; }
542 bool acceptSnapshot(
const QString& urlString);
544 void setSessionUUID(
const QUuid& sessionUUID)
const;
546 void domainURLChanged(QUrl domainURL);
547 void domainConnectionRefused(
const QString& reasonMessage,
int reason,
const QString& extraInfo);
549 void updateWindowTitle()
const;
550 void nodeAdded(SharedNodePointer node);
551 void nodeActivated(SharedNodePointer node);
552 void nodeKilled(SharedNodePointer node);
554 void handleSandboxStatus(QNetworkReply* reply);
558 void onDesktopRootItemCreated(QQuickItem* qmlContext);
559 void onDesktopRootContextCreated(QQmlContext* qmlContext);
562 void notifyPacketVersionMismatch();
564 bool askToSetAvatarUrl(
const QString& url);
565 bool askToLoadScript(
const QString& scriptFilenameOrURL);
566 bool askToReplaceDomainContent(
const QString& url);
568 void onDismissedLoginDialog();
572 void clearDomainOctreeDetails(
bool clearAll =
true);
573 void resettingDomain();
577 void onPresent(quint32 frameCount);
579 void activeChanged(Qt::ApplicationState state);
580 void windowMinimizedChanged(
bool minimized);
584 void updateDisplayMode();
585 void switchDisplayMode();
586 void setDisplayPlugin(DisplayPluginPointer newPlugin);
590 void addAssetToWorldCheckModelSize();
591 void onAssetToWorldMessageBoxClosed();
592 void addAssetToWorldInfoTimeout();
593 void addAssetToWorldErrorTimeout();
597 void setShowBulletWireframe(
bool value) { _physicsEngine->setShowBulletWireframe(value); }
598 void setShowBulletAABBs(
bool value) { _physicsEngine->setShowBulletAABBs(value); }
599 void setShowBulletContactPoints(
bool value) { _physicsEngine->setShowBulletContactPoints(value); }
600 void setShowBulletConstraints(
bool value) { _physicsEngine->setShowBulletConstraints(value); }
601 void setShowBulletConstraintLimits(
bool value) { _physicsEngine->setShowBulletConstraintLimits(value); }
603 void setShowTrackedObjects(
bool value) { _showTrackedObjects = value; }
606 void cleanupBeforeQuit();
609 void update(
float deltaTime);
610 void updateLOD(
float deltaTime)
const;
611 void updateThreads(
float deltaTime);
613 void userKickConfirmation(
const QUuid& nodeID,
unsigned int banFlags = ModerationFlags::getDefaultBanFlags());
618 void setupSignalsAndOperators();
623 void pauseUntilLoginDetermined();
624 void resumeAfterLoginDialogActionTaken();
626 static QSharedPointer<OffscreenUi> getOffscreenUI();
628 void updateDialogs(
float deltaTime)
const;
630 void maybeToggleMenuVisible(QMouseEvent* event)
const;
631 void toggleTabletUI(
bool shouldOpen =
false)
const;
633 bool shouldCaptureMouse()
const;
634 void checkChangeCursor();
636 void addAssetToWorldInfo(QString modelName, QString infoText);
637 void addAssetToWorldInfoClear(QString modelName);
638 void addAssetToWorldInfoDone(QString modelName);
639 void addAssetToWorldError(QString modelName, QString errorText);
643 void resizeEvent(QResizeEvent* size) { resizeGL(); }
645 void keyPressEvent(QKeyEvent* event);
646 void keyReleaseEvent(QKeyEvent* event);
648 void focusOutEvent(QFocusEvent* event);
649 void synthesizeKeyReleasEvents();
651 void mouseMoveEvent(QMouseEvent* event);
652 void mousePressEvent(QMouseEvent* event);
653 void mouseDoublePressEvent(QMouseEvent* event);
654 void mouseReleaseEvent(QMouseEvent* event);
656 void touchBeginEvent(QTouchEvent* event);
657 void touchEndEvent(QTouchEvent* event);
658 void touchUpdateEvent(QTouchEvent* event);
659 void touchGestureEvent(QGestureEvent* event);
661 void wheelEvent(QWheelEvent* event)
const;
662 void dropEvent(QDropEvent* event);
663 static void dragEnterEvent(QDragEnterEvent* event) {
event->acceptProposedAction(); }
665 bool handleInputMethodEventForFocusedEntity(QEvent* event);
666 bool handleKeyEventForFocusedEntity(QEvent* event);
667 bool handleFileOpenEvent(QFileOpenEvent* event);
669 void processDriverBlocklistReply(
const QString& fullDriverToTest,
const QString& os,
const QString& vendor,
const QString& renderer,
const QString& api,
670 const QString& driver);
674 void queryOctree(
NodeType_t serverType, PacketType packetType);
676 int sendNackPackets();
680 void updateRenderArgs(
float deltaTime);
684 void startHMDStandBySession();
685 void endHMDSession();
689 bool importJSONFromURL(
const QString& urlString);
690 bool importSVOFromURL(
const QString& urlString);
691 bool importFromZIP(
const QString& filePath);
692 bool importImage(
const QString& urlString);
696 std::shared_ptr<MyAvatar> getMyAvatar()
const;
697 void checkSkeleton()
const;
703 void tryToEnablePhysics();
710 QWidget *_vkWindowWrapper;
715 bool _isMenuInitialized;
717 bool _startUpFinished {
false };
718 bool _quitWhenFinished {
false };
719 bool _crashOnShutdown {
false };
720 bool _aboutToQuit {
false };
721 bool _previousSessionCrashed {
false };
724 bool _overrideEntry {
false };
725 bool _settingsLoaded {
false };
727 bool _domainLoadingInProgress {
false };
728 bool _interstitialMode {
false };
729 bool _interstitialModeEnabled {
false };
731 PerformanceManager _performanceManager;
732 RefreshRateManager _refreshRateManager;
733 GameWorkload _gameWorkload;
735 ConnectionMonitor _connectionMonitor;
738 FileLogger* _logger {
nullptr };
741 QElapsedTimer& _sessionRunTimer;
742 QElapsedTimer _lastTimeUpdated;
743 QTimer _locationUpdateTimer;
744 QTimer _minimizedWindowTimer;
746 RateCounter<500> _gameLoopCounter;
748 using SteadyClock = std::chrono::steady_clock;
749 using TimePoint = SteadyClock::time_point;
750 TimePoint _queryExpiry;
752 quint64 _lastNackTime;
753 quint64 _lastSendDownstreamAudioStats;
755 bool _notifiedPacketVersionMismatchThisDomain {
false };
757 QDir _defaultScriptsLocation;
759 bool _overrideDefaultScriptsLocation;
761 qint64 _gpuTextureMemSizeStabilityCount { 0 };
762 qint64 _gpuTextureMemSizeAtLastCheck { 0 };
763 int _minimumGPUTextureMemSizeStabilityCount { 30 };
765 SharedSoundPointer _sampleSound {
nullptr };
767 VisionSqueeze _visionSqueeze;
769 DiscordPresence* _discordPresence {
nullptr };
779 GLCanvas* _primaryWidget{
nullptr };
781 VKCanvas* _primaryWidget{
nullptr };
785 std::shared_ptr<ApplicationOverlay> _applicationOverlay;
786 OverlayConductor _overlayConductor;
788 mutable QRecursiveMutex _changeCursorLock;
789 Qt::CursorShape _desiredCursor { Qt::BlankCursor };
790 bool _cursorNeedsChanging {
false };
791 bool _useSystemCursor {
false };
793 DialogsManagerScriptingInterface* _dialogsManagerScriptingInterface;
795 QPointer<LogDialog> _logDialog;
796 QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
797 ModalDialogListener* _confirmConnectWithoutAvatarEntitiesDialog {
nullptr };
799 QUuid _loginDialogID;
800 QUuid _avatarInputsBarID;
801 LoginStateManager _loginStateManager;
803 QQuickItem* _addAssetToWorldMessageBox {
nullptr };
804 QStringList _addAssetToWorldInfoKeys;
805 QStringList _addAssetToWorldInfoMessages;
806 QTimer _addAssetToWorldInfoTimer;
807 QTimer _addAssetToWorldErrorTimer;
811 bool _loginDialogPoppedUp {
false };
812 bool _developerMenuVisible {
false };
813 bool _noLoginSuggestion {
false };
815 bool _resumeAfterLoginDialogActionTaken_WasPostponed {
false };
816 bool _resumeAfterLoginDialogActionTaken_SafeToRun {
false };
818 bool _isForeground {
true };
836 void updateThemeColors();
840 DisplayPluginPointer _displayPlugin;
841 mutable std::mutex _displayPluginLock;
843 std::shared_ptr<controller::StateController> _applicationStateDevice;
844 std::shared_ptr<KeyboardMouseDevice> _keyboardMouseDevice;
845 std::shared_ptr<TouchscreenDevice> _touchscreenDevice;
846 std::shared_ptr<TouchscreenVirtualPadDevice> _touchscreenVirtualPadDevice;
847 bool _keyboardDeviceHasFocus {
true };
849 ControllerScriptingInterface* _controllerScriptingInterface {
nullptr };
851 DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin {
nullptr };
852 QString _autoSwitchDisplayModeSupportedHMDPluginName;
853 bool _previousHMDWornStatus {
false };
857 QHash<int, QKeyEvent> _keysPressed;
859 quint64 _lastAcceptedKeyPress { 0 };
861 ThreadSafeValueCache<EntityItemID> _keyboardFocusedEntity;
863 bool _reticleClickPressed {
false };
864 bool _keyboardFocusWaitingOnRenderable {
false };
866 bool _captureMouse {
false };
867 bool _ignoreMouseMove {
false };
868 QPointF _mouseCaptureTarget { NAN, NAN };
870 std::map<
void*, std::function<void()>> _postUpdateLambdas;
871 std::mutex _postUpdateLambdasLock;
873 std::atomic<bool> _pendingIdleEvent {
true };
877 EntityTreePointer _entityClipboard;
879 std::shared_ptr<OctreePacketProcessor> _octreeProcessor;
880 std::shared_ptr<EntityEditPacketSender> _entityEditSender;
881 OctreeQuery _octreeQuery {
true };
882 bool _enableProcessOctreeThread {
true };
884 uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 };
886 mutable QTimer _entityServerConnectionTimer;
888 QUuid _keyboardFocusHighlightID;
890 bool _failedToConnectToEntityServer {
false };
891 bool _isMissingSequenceNumbers {
false };
894 int _maxOctreePPS { DEFAULT_MAX_OCTREE_PPS };
898 typedef bool (Application::*AcceptURLMethod)(
const QString&);
899 static const std::vector<std::pair<QString, AcceptURLMethod>> _acceptedExtensions;
901 QTimer _addAssetToWorldResizeTimer;
902 QHash<QUuid, int> _addAssetToWorldResizeList;
906 FancyCamera _myCamera;
908 CameraMode _previousCameraMode;
909 glm::vec3 _thirdPersonHMDCameraBoom { 0.0f, 0.0f, -1.0f };
910 bool _thirdPersonHMDCameraBoomValid {
true };
911 float _scaleMirror { 1.0f };
912 float _mirrorYawOffset { 0.0f };
913 float _raiseMirror { 0.0f };
915 mutable QRecursiveMutex _viewMutex;
916 ViewFrustum _viewFrustum;
917 ViewFrustum _displayViewFrustum;
919 ConicalViewFrustums _conicalViews;
920 ConicalViewFrustums _lastQueriedViews;
925 bool _prevCameraClippingEnabled {
false };
926 unsigned int _cameraClippingRayPickID;
930 std::shared_ptr<GraphicsEngine> _graphicsEngine;
931 glm::uvec2 _renderResolution;
934 bool _isGLInitialized {
false };
938 QString _previousAvatarSkeletonModel;
939 float _previousAvatarTargetScale;
941 QUrl _avatarOverrideUrl;
942 bool _saveAvatarOverrideUrl {
false };
946 ShapeManager _shapeManager;
947 PhysicalEntitySimulationPointer _entitySimulation;
948 PhysicsEnginePointer _physicsEngine;
950 bool _physicsEnabled {
false };
954 bool _waitForServerlessToBeSet {
true };
956 bool _showTrackedObjects {
false };
957 bool _prevShowTrackedObjects {
false };
961 std::mutex _snapshotMutex;
962 std::queue<SnapshotOperator> _snapshotOperators;
963 bool _hasPrimarySnapshot {
false };
quint8 NodeType_t
An 8-bit value identifying the type of a node - domain server, audio mixer, etc.
Definition: NodeType.h:22
Interface provided by Application to other objects that need access to scripting services of the appl...
Definition: AbstractScriptingServicesInterface.h:26
virtual void registerScriptEngineWithApplicationServices(ScriptManagerPointer &scriptEngine)=0
Registers application specific services with a script engine.
Interface provided by Application to other objects that need access to the current view state details...
Definition: AbstractViewStateInterface.h:31
The ArchiveDownloadInterface API provides some facilities for working with the file system.
Definition: ArchiveDownloadInterface.h:27
customized canvas that simply forwards requests/events to the singleton application
Definition: GLCanvas.h:18
Definition: OctreeSceneStats.h:274
Definition: OctreePacketProcessor.h:25
Represents a display or device event to the scripting engine. Exposed as TouchEvent
Definition: TouchEvent.h:30
customized canvas that simply forwards requests/events to the singleton application
Definition: VKCanvas.h:22