All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PlaneSimulation.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Traffic.h"
7 #include "Random.h"
8 #include "PlaneSimulationConfig.h"
9 #include "TrafficSimulationConfiguration.h"
10 #include "InteriorTransitionModel.h"
11 #include "Camera.h"
12 #include "Streaming.h"
13 #include "Terrain.h"
14 #include "Rendering.h"
15 #include "Helpers.h"
16 #include <string>
17 
18 namespace Eegeo
19 {
20  namespace Traffic
21  {
23  {
24 
25  public:
27  const Config::PlaneSimulationConfig& planeSimulationConfig,
28  VehicleRenderablesModel* renderablesModel,
29  Random& randomGenerator,
32  const Rendering::EnvironmentFlatteningService& environmentFlatteningService,
33  Resources::Interiors::InteriorTransitionModel& m_pInteriorTransitionModel
34  );
35 
36  ~PlaneSimulation();
37 
38  VehicleRenderablesModel& GetRenderablesModel() const { return *m_pVehicleRenderablesModel; }
39 
40  void Update(float deltaSeconds, const Camera::RenderCamera& renderCamera);
41 
42  void ApplyVehicleSuffixChange(const std::string &suffix);
43  void UpdateConfig(const Config::TrafficSimulationConfiguration& newConfig);
44 
45  void SetPlaneSimulationConfig(const Config::PlaneSimulationConfig& planeSimulationConfig) { m_planeSimulationConfig = planeSimulationConfig; }
46  void SetEnabled(bool value);
47 
48  static Config::PlaneSimulationConfig CreateDefaultPlaneSimulationConfig();
49 
50  private:
51  PlaneVehicle* TryCreateNewPlane(const Camera::RenderCamera& renderCamera);
52  void RemoveAllPlanesInScene();
53 
54  bool m_enabled;
55  VehicleRenderablesModel* m_pVehicleRenderablesModel;
56  Streaming::CameraFrustumStreamingVolume& m_streamingVolume;
57  Random& m_randomGenerator;
60  const Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
61  float m_secondsToNextTerrainQuery;
62 
63  Resources::Interiors::InteriorTransitionModel& m_interiorTransitionModel;
64  void HandleInteriorTransitionChange();
65  Helpers::TCallback0<PlaneSimulation> m_interiorTransitionCallback;
66 
67  PlaneVehicle* m_currentPlane;
68  std::string m_modelNodeNameSuffix;
69 
70  Config::PlaneSimulationConfig m_planeSimulationConfig;
71  Helpers::RouletteWheelSelector* m_pRouletteWheelSelector;
72  };
73  }
74 }