All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VehicleRenderer.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 "Lighting.h"
8 #include "Rendering.h"
9 #include "VectorMathDecl.h"
10 #include "Streaming.h"
11 #include "IRenderableFilter.h"
12 #include "ITrafficThemeModelObserver.h"
13 #include "LayerIds.h"
14 #include <vector>
15 
16 namespace Eegeo
17 {
18  namespace Traffic
19  {
21  {
22  public:
23 
24  enum MaterialType
25  {
26  INVALID = 0,
27  RoadVehicles,
28  TrainVehicles,
29  TramVehicles,
30  PlaneVehicles,
31  MAX
32  };
33 
34  VehicleRenderer(VehicleModelNodeRepository& vehicleModelRepository,
37  Rendering::IMaterialProvider& materialProvider,
38  Themes::TrafficThemeModel& trafficThemesModel,
39  int maxVehiclesToDraw);
40 
41  ~VehicleRenderer();
42 
43  void EnqueueRenderables(const Rendering::RenderContext& renderContext, Rendering::RenderQueue& renderQueue);
44  void ResetSubmittedRenderables();
45  void SubmitForRendering(VehicleRenderablesModel& vehicleRenderables,
47  MaterialType materialType,
48  const Rendering::LayerIds::Values& layer,
49  const dv3& ecefCameraPosition
50  );
51 
52  void OnThemeChanged (const Themes::TrafficThemeModel& themeModel);
53  void OnThemeStateChanged (const Themes::TrafficThemeModel& themeModel);
54 
55  private:
56 
57  void UpdateMaterials(const Themes::TrafficThemeModel& themeModel);
58 
59  VehicleModelNodeRepository& m_vehicleModelNodeRepository;
61  Rendering::IMaterialProvider& m_materialProvider;
62 
63  std::vector<Rendering::Renderables::ModelRenderable*> m_renderablesPool;
64 
65  int m_nextRenderablesCount;
66 
67  Rendering::Materials::ModelMaterial& GetMaterialForType(MaterialType& type);
68 
69  Themes::TrafficThemeModel& m_trafficThemesModel;
70 
71  Rendering::Materials::ModelMaterial* m_roadVehiclesMaterial;
72  Rendering::Materials::ModelMaterial* m_trainMaterial;
74  Rendering::Materials::ModelMaterial* m_planeMaterial;
75  };
76  }
77 }