Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / global.cpp
blob623686f98486584957d6e566af91122303b8ec22
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2020 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 // Copyright (C) 2013-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 //
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "stdpch.h"
24 #include "global.h"
25 #include "water_env_map_rdr.h"
26 #include "interface_v3/interface_manager.h"
28 using namespace NLMISC;
30 // ***************************************************************************
31 // Data
32 NLWEB::CHttpPackageProvider *HttpPackageProvider = NULL;
34 // Main System
35 NL3D::UDriver *Driver = NULL; // The main 3D Driver
36 NL3D::IStereoDisplay *StereoDisplay = NULL; // Stereo display
37 NL3D::IStereoHMD *StereoHMD = NULL; // Head mount display
38 bool StereoDisplayAttached = false; // Is stereo display handling the display mode
39 CSoundManager *SoundMngr = NULL; // the sound manager
40 NL3D::UMaterial GenericMat; // Generic Material
41 NL3D::UTextContext *TextContext = NULL; // Context for all the text in the client.
43 // Effects
44 NL3D::CFXAA *FXAA = NULL;
46 // Main 3D Objects
47 NL3D::UScene *Scene = NULL;
48 NL3D::UScene *SceneRoot = NULL;
49 NL3D::UInstanceGroup *BackgroundIG = NULL;
50 NL3D::ULandscape *Landscape = NULL;
51 NL3D::UCloudScape *CloudScape = NULL;
52 NL3D::UCamera MainCam;
53 NL3D::UVisualCollisionManager *CollisionManager = NULL;
54 #ifdef USE_WATER_ENV_MAP
55 CWaterEnvMapRdr WaterEnvMapRdr;
56 NL3D::UWaterEnvMap *WaterEnvMap = NULL;
57 uint WaterEnvMapRefCount = 0;
58 NL3D::UCamera WaterEnvMapSkyCam;
59 NL3D::UCamera WaterEnvMapCanopyCam;
60 #endif
62 // Network Walls
63 bool UserCharPosReceived = false;
64 bool SabrinaPhraseBookLoaded = false;
66 // Main scene matrices.
67 NLMISC::CMatrix MainSceneViewMatrix; // Matrix to transform from world space to camera space
68 NLMISC::CMatrix InvMainSceneViewMatrix; // Matrix to transform from camera space to world space
70 // Misc
71 bool InitCloudScape = true; // tells that the cloud scape must be reinitialized
72 CEntityAnimationManager *EAM = NULL;
73 CProgress ProgressBar;
74 TBackground LoadingBackground = StartBackground;
75 string LoadingBackgroundBG;
76 string LoadingMusic;
77 CContinent *LoadingContinent = NULL;
78 bool ConnectionReadySent= false;
79 bool PermanentlyBanned = false;
80 bool IgnoreEntityDbUpdates = false;
81 bool FreeTrial = false;
83 std::vector<std::pair<
84 std::string, std::string> > VRDeviceCache;
86 /// Ring main page
87 string RingMainURL;
88 string NewsAtProgress;
90 void resetTextContext (const char *font, bool resetInterfaceManager)
92 if (TextContext != NULL)
93 Driver->deleteTextContext(TextContext);
94 TextContext = Driver->createTextContext(NLMISC::startsWith(font, "ui") ? font : CPath::lookup(font));
95 if (TextContext != NULL)
96 TextContext->setKeep800x600Ratio(false);
97 else
98 nlerror("Cannot create a TextContext with font %s.", font);
100 // Reset the text indexes
101 if (resetInterfaceManager)
103 CInterfaceManager *im = CInterfaceManager::getInstance();
104 CViewRenderer::setTextContext( TextContext );
105 im->resetTextIndex();