All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LabelController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Labels.h"
6 #include "ILabelController.h"
7 #include "Rendering.h"
8 #include "Streaming.h"
9 #include "ICallback.h"
10 #include "LabelLayer.h"
11 
12 #include "LabelViewTypes.h"
13 #include <vector>
14 
15 namespace Eegeo
16 {
17  namespace Labels
18  {
20  {
21  public:
22  typedef std::vector<const ILabelAnchorFilterModel*> LabelAnchorFilterModelVector;
23  typedef std::vector<ILabelAnchorFilterModelObserver*> LabelAnchorFilterModelObserverVector;
24 
25 
26  LabelController(const ILabelViewRepository& labelViewRepository,
27  LabelViewRepositoryObserver& labelViewRepositoryObserver,
28  ILabelRenderer& labelRenderer,
29  const ILabelOptionsModel& labelOptionsModel,
30  Eegeo::Labels::ILabelOptionsModelObserver& labelOptionsModelObserver,
31  const LabelAnchorFilterModelVector& labelHiddenFilterModels,
32  const LabelAnchorFilterModelObserverVector& labelHiddenFilterModelObservers,
33  const Rendering::EnvironmentFlatteningService& environmentFlatteningService,
34  IOcclusionResolver& occlusionResolver,
35  const ILabelStyleRepository& labelStyleRepository,
36  const Streaming::ResourceCeilingProvider& resourceCeilingProvider,
37  float cameraAltitudeToCullPastHorizon,
38  const std::vector<double>& lodRefinementAltitudes,
39  float lodRefinementHysteresis
40  );
41 
42  ~LabelController();
43 
44  void Update(float deltaTime, const Camera::RenderCamera& renderCamera);
45 
46  private:
47  bool FetchFromRepository();
48 
49  void UpdateHiddenState();
50 
51  void UpdateTransforms(const LabelViewUpdateParams& labelViewUpdateParams);
52 
53  void UpdateOcclusion(const LabelViewUpdateParams& labelViewUpdateParams);
54 
55  void BuildOcclusionInput();
56 
57  void UpdateFadeState(const LabelViewUpdateParams& labelViewUpdateParams);
58 
59  void SubmitToRenderer();
60 
61  void DebugDraw(const Camera::RenderCamera& renderCamera, const u32 debugDrawFlags);
62 
63  void OnLabelOptionsModelChanged();
64 
65  void OnLabelHiddenFilterModelChanged();
66 
67  int CalcZoomLevel(const float cameraAltitude) const;
68 
69  bool IsLabelHidden(const LabelView& labelView) const;
70 
71  const ILabelViewRepository& m_labelViewRepository;
72  LabelViewRepositoryObserver& m_labelViewRepositoryObserver;
73  ILabelRenderer& m_labelRenderer;
74  const ILabelOptionsModel& m_labelOptionsModel;
75  Eegeo::Labels::ILabelOptionsModelObserver& m_labelOptionsModelObserver;
76  const LabelAnchorFilterModelVector m_labelHiddenFilterModels;
77  const LabelAnchorFilterModelObserverVector m_labelHiddenFilterModelObservers;
78  const Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
79  IOcclusionResolver& m_occlusionResolver;
80  const ILabelStyleRepository& m_labelStyleRepository;
81  const Streaming::ResourceCeilingProvider& m_resourceCeilingProvider;
82  const std::vector<double> m_lodRefinementAltitudes;
83  const float m_lodRefinementHysteresis;
84 
85  Helpers::TCallback0<LabelController> m_labelOptionsModelChangedCallback;
86  Helpers::TCallback0<LabelController> m_labelHiddenFilterModelChangedCallback;
87 
88  float m_previousEnvironmentFlatteningScale;
89  float m_cameraAltitudeToCullPastHorizon;
90  std::vector<int> m_cullingStats;
91  int m_currentZoomLevel;
92  bool m_labelHiddenFilterModelChanged;
93 
94  std::vector<LabelView*> m_repositoryViewList;
95  std::vector<LabelView*> m_repositoryViewForCurrentZoomList;
96  std::vector<LabelView*> m_viewList;
97  std::vector<LabelView*> m_occludableList;
98  };
99  }
100 }