All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EegeoWorld.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include <string>
6 #include <vector>
7 #include "EegeoSDK.h"
8 #include "Timer.h"
9 #include "PlatformConfig.h"
10 #include "WebLoadRequestCompletionCallback.h"
11 #include "EnvironmentCharacterSet.h"
12 #include "LoadingScreen.h"
13 #include "DefaultWorkPool.h"
14 #include "Tasks.h"
15 #include "IJpegLoader.h"
16 #include "Modules.h"
17 #include "IPlatformAbstractionModule.h"
18 #include "CoreModule.h"
19 #include "MapModule.h"
20 #include "TrafficModule.h"
21 #include "RoutesModule.h"
22 #include "RenderingModule.h"
23 #include "LightingModule.h"
24 #include "FontsModule.h"
25 #include "TerrainModelModule.h"
26 #include "TerrainPresentationModule.h"
27 #include "TerrainStreamingModule.h"
28 #include "TransportModelModule.h"
29 #include "TransportPresentationModule.h"
30 #include "TransportStreamingModule.h"
31 #include "BuildingModelModule.h"
32 #include "BuildingPresentationModule.h"
33 #include "BuildingStreamingModule.h"
34 #include "PlaceNamesModelModule.h"
35 #include "PlaceNamesPresentationModule.h"
36 #include "PlaceNamesStreamingModule.h"
37 #include "ShadowModelModule.h"
38 #include "ShadowPresentationModule.h"
39 #include "StreamingModule.h"
40 #include "DebugRenderingModule.h"
41 #include "AsyncLoadersModule.h"
42 #include "EnvironmentMaterialModule.h"
43 #include "DataModule.h"
44 #include "Web.h"
45 #include "WorldStateManager.h"
46 #include "FrameTimer.h"
47 #include "FrameTimerVisualiser.h"
48 #include "Profiler.h"
49 #include "ProfileVisualiser.h"
50 #include "Rendering.h"
51 #include "EegeoUpdateParameters.h"
52 #include "EegeoDrawParameters.h"
53 #include "EegeoShapes.h"
54 #include "InteriorHighlightsModule.h"
55 #include "FeatureInteraction.h"
56 #include "SearchServiceCredentials.h"
57 #include "TimeProvider.h"
58 
59 
60 #define EEGEO_PLATFORM_VERSION_NUMBER "EEGEO_PLATFORM_VERSION_NUMBER_TARGET"
61 #define EEGEO_PLATFORM_VERSION_HASH "EEGEO_PLATFORM_VERSION_COMMIT_HASH_TARGET"
62 
64 namespace Eegeo
65 {
66  class EegeoWorld
67  {
68  private:
69  Modules::IPlatformAbstractionModule& m_platformAbstractionModule;
70  Eegeo::Location::ILocationService& m_locationService;
71  Eegeo::UI::NativeUIFactories& m_nativeInputFactories;
73  const Eegeo::Config::PlatformConfig m_platformConfig;
74 
75  WorldStates::WorldStateManager* m_pWorldStateManager;
76 
77  Debug::FrameTimer* m_pFrameTimer;
78  Debug::FrameTimerVisualiser* m_pFrameTimerVisualiser;
79 
80  Debug::Profile::Profiler* m_pProfiler;
81  Debug::Profile::ProfileVisualiser* m_pProfileVisualiser;
82 
83  Helpers::TimeProvider* m_pTimeProvider;
84 
85  Web::ApiTokenValidator* m_pApiTokenValidator;
86  Web::ApiTokenModel* m_pApiTokenModel;
87  Web::ApiTokenService* m_pApiTokenService;
88 
89  Modules::Core::CoreModule* m_pCoreModule;
90  Modules::Map::MapModule* m_pMapModule;
91  Modules::Data::DataModule* m_pDataModule;
92  Shapes::ShapesModule* m_pShapesModule;
93  Modules::Map::MapDebugModule* m_pMapDebugModule;
94 
95  Modules::RoutesModule* m_pRoutesModule;
96  Modules::TrafficModule* m_pTrafficModule;
97  Modules::AnimatedObjectsModule* m_pAnimatedObjectsModule;
98 
99 
100  Eegeo::Resources::ResourceSpatialQueryService *m_pResourceSpatialQueryService;
101 
102 
103 
104 
105 
107 
108  Eegeo::Web::WebConnectivityValidator* m_pWebConnectivityValidator;
109  Eegeo::Web::WebConnectivityErrorHandler* m_pWebConnectivityErrorHandler;
110 
111 
112 
113  bool m_waitForInitialLocation;
114 
115  void PreDraw(const Rendering::RenderContext& renderContext, Rendering::GLState& glState);
116  void DrawWorldPhases(const Rendering::RenderContext& renderContext, Rendering::GLState& glState, Rendering::IRenderableFilter& renderableFilter);
117  void DrawAllPhases(const Rendering::RenderContext& renderContext, Rendering::GLState& glState, Rendering::IRenderableFilter& renderableFilter);
118  void PostDraw(const Rendering::RenderContext& renderContext, Rendering::GLState& glState);
119 
120  public:
121 
122  EegeoWorld(const std::string& apiToken,
123  Modules::IPlatformAbstractionModule& platformAbstractionModule,
125  const Eegeo::Rendering::ScreenProperties& screenProperties,
126  Eegeo::Location::ILocationService& locationService,
127  Eegeo::UI::NativeUIFactories& nativeInputFactories,
128  EnvironmentCharacterSet::Type characterSetType,
129  Eegeo::Config::PlatformConfig platformConfig,
130  IEegeoErrorHandler* pErrorHandler=NULL);
131 
133  EegeoWorld(const std::string& apiToken,
134  Modules::IPlatformAbstractionModule& platformAbstractionModule,
136  const Eegeo::Rendering::ScreenProperties& screenProperties,
137  Eegeo::Location::ILocationService& locationService,
138  Eegeo::UI::NativeUIFactories& nativeInputFactories,
139  EnvironmentCharacterSet::Type characterSetType,
140  Eegeo::Config::PlatformConfig platformConfig,
142  IEegeoErrorHandler* pErrorHandler=NULL
143  );
144 
145  ~EegeoWorld();
146 
147  Eegeo::Debug::FrameTimer& GetFrameTimer() { return *m_pFrameTimer; }
148  Eegeo::Debug::FrameTimerVisualiser& GetFrameTimerVisualiser() { return *m_pFrameTimerVisualiser; }
149  Eegeo::Debug::Profile::Profiler& GetProfiler() { return *m_pProfiler; }
150  Eegeo::Debug::Profile::ProfileVisualiser& GetProfileVisualiser() { return *m_pProfileVisualiser; }
151 
152  Eegeo::Concurrency::Tasks::IWorkPool& GetWorkPool() { return m_workPool; }
153 
154  Eegeo::Resources::ResourceSpatialQueryService &GetResourceSpatialQueryService() { return *m_pResourceSpatialQueryService; }
155 
156  Eegeo::Resources::Roads::Navigation::NavigationGraphDebuggingService &GetNavigationGraphDebuggingService() { return *m_pNavGraphDebuggingService; }
157 
158  const Eegeo::Rendering::AsyncTexturing::IAsyncTexture& GetPlaceholderTexture() const;
159  const Eegeo::Helpers::GLHelpers::TextureInfo& GetEnvironmentPlaceholderTexture() const;
160 
161  Eegeo::UI::NativeUIFactories &GetNativeUIFactories() { return m_nativeInputFactories; }
162 
163  Eegeo::Location::ILocationService &GetLocationService() { return m_locationService; }
164 
165  Modules::Map::MapModule& GetMapModule() const { return *m_pMapModule; }
166  Modules::Map::MapDebugModule& GetMapDebugModule() const { return *m_pMapDebugModule; }
167  Modules::Core::CoreModule& GetCoreModule() const { return *m_pCoreModule; }
168  Modules::Data::DataModule& GetDataModule() { return *m_pDataModule; }
169  Shapes::ShapesModule& GetShapesModule() const { return *m_pShapesModule; }
170  Resources::Interiors::Highlights::InteriorHighlightsModule& GetInteriorHighlightsModule() const;
171  FeatureInteraction::FeatureInteractionModule& GetFeatureInteractionModule() const { return m_pMapModule->GetFeatureInteractionModule(); }
172 
173  Modules::IPlatformAbstractionModule& GetPlatformAbstractionModule() const { return m_platformAbstractionModule; }
174 
175  Modules::Core::RenderingModule& GetRenderingModule() const { return m_pCoreModule->GetRenderingModule(); }
176  Modules::Core::DebugRenderingModule& GetDebugRenderingModule() const { return m_pCoreModule->GetDebugRenderingModule(); }
177  Modules::Core::LightingModule& GetLightingModule() const { return m_pCoreModule->GetLightingModule(); }
178  Modules::Core::FontsModule& GetFontsModule() const { return m_pCoreModule->GetFontsModule(); }
179  Modules::Core::AsyncLoadersModule& GetAsyncLoadersModule() const { return m_pCoreModule->GetAsyncLoadersModule(); }
180  Modules::Core::SceneModelsModule& GetSceneModelsModule() const { return m_pCoreModule->GetSceneModelsModule(); }
181 
182  Modules::Map::Layers::TerrainModelModule& GetTerrainModelModule() const { return m_pMapModule->GetTerrainModelModule(); }
183  Modules::Map::Layers::TerrainPresentationModule& GetTerrainPresentationModule() const { return m_pMapModule->GetTerrainPresentationModule(); }
184  Modules::Map::Layers::TerrainStreamingModule& GetTerrainStreamingModule() const { return m_pMapModule->GetTerrainStreamingModule(); }
185 
186  Modules::Map::Layers::TransportModelModule& GetTransportModelModule() const { return m_pMapModule->GetTransportModelModule(); }
187  Modules::Map::Layers::TransportPresentationModule& GetTransportPresentationModule() const { return m_pMapModule->GetTransportPresentationModule(); }
188  Modules::Map::Layers::TransportStreamingModule& GetTransportStreamingModule() const { return m_pMapModule->GetTransportStreamingModule(); }
189 
190  Modules::Map::Layers::BuildingModelModule& GetBuildingModelModule() const { return m_pMapModule->GetBuildingModelModule(); }
191  Modules::Map::Layers::BuildingStreamingModule& GetBuildingStreamingModule() const { return m_pMapModule->GetBuildingStreamingModule(); }
192  Modules::Map::Layers::BuildingPresentationModule& GetBuildingPresentationModule() const { return m_pMapModule->GetBuildingPresentationModule(); }
193 
194  Modules::Map::Layers::PlaceNamesModelModule& GetPlaceNamesModelModule() const { return m_pMapModule->GetPlaceNamesModelModule(); }
195  Modules::Map::Layers::PlaceNamesPresentationModule& GetPlaceNamesPresentationModule() const { return m_pMapModule->GetPlaceNamesPresentationModule(); }
196  Modules::Map::Layers::PlaceNamesStreamingModule& GetPlaceNamesStreamingModule() const { return m_pMapModule->GetPlaceNamesStreamingModule(); }
197 
198  Modules::Map::Layers::ShadowModelModule& GetShadowModelModule() const { return m_pMapModule->GetShadowModelModule(); }
199  Modules::Map::Layers::ShadowPresentationModule& GetShadowPresentationModule() const { return m_pMapModule->GetShadowPresentationModule(); }
200 
201  Modules::Map::StreamingModule& GetStreamingModule() const { return m_pMapModule->GetStreamingModule(); }
202  Modules::Map::CityThemesModule& GetCityThemesModule() const { return m_pMapModule->GetCityThemesModule(); }
203  Modules::Map::EnvironmentMaterialModule& GetEnvironmentMaterialModule() const { return m_pMapModule->GetEnvironmentMaterialModule(); }
204  Modules::Map::WeatherModule& GetWeatherModule() const { return m_pMapModule->GetWeatherModule(); }
205  Modules::Map::CoverageTreeModule& GetCoverageTreeModule() const { return m_pMapModule->GetCoverageTreeModule(); }
206 
207  Modules::TrafficModule& GetTrafficModule() const { return *m_pTrafficModule; }
208  Modules::RoutesModule& GetRoutesModule() const { return *m_pRoutesModule; }
209  Modules::AnimatedObjectsModule& GetAnimatedObjectsModule() const { return *m_pAnimatedObjectsModule; }
210 
211  Eegeo::Web::WebConnectivityValidator& GetWebConnectivityValidator() const { return *m_pWebConnectivityValidator; }
212  Web::ApiTokenService& GetApiTokenService();
213  Web::ApiTokenModel& GetApiTokenModel();
214 
215  bool GetWaitForInitialLocation() const { return m_waitForInitialLocation; }
216  void SetWaitForInitialLocation(bool wait) { m_waitForInitialLocation = wait; }
217 
218  bool IsStreaming(bool includePrecacheService) const;
219 
220  const bool Initialising() const;
221  const bool Validated() const;
222 
223  void EarlyUpdate(float dt);
224  void Update(const EegeoUpdateParameters& updateParameters);
225  void Draw(const EegeoDrawParameters& drawParameters, Rendering::IRenderableFilter& renderableFilter);
226  void Draw(const EegeoDrawParameters& drawParameters);
227  void OnPause();
228  void OnResume();
229 
230  float GetInitialisationProgress() const;
231 
232  void InitialiseWorldStates();
233  void TeardownWorldStates();
234  };
235 }