All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InteriorController.h
1 #pragma once
2 
3 #include "Types.h"
4 #include "Interiors.h"
5 #include "Buildings.h"
6 #include "Rendering.h"
7 #include "Lighting.h"
8 #include "ICallback.h"
9 #include "VectorMath.h"
10 #include "CallbackCollection.h"
11 #include "InteriorMetaDataAccessPermission.h"
12 
13 
14 #include <string>
15 #include <vector>
16 
17 namespace Eegeo
18 {
19  namespace Resources
20  {
21  namespace Interiors
22  {
24  {
25  public:
27  InteriorSelectionModel& selectionModel,
28  InteriorInteractionModel& interiorInteractionModel,
29  Markers::InteriorMarkerModelRepository& interiorMarkerModelRepository,
30  MetaData::IInteriorMetaDataService& interiorMetaDataService,
31  bool validateIndoorMapPermission,
32  float interiorSelectionTimeoutDuration,
33  InteriorTransitionModel& interiorTransitionModel,
34  InteriorViewModel& viewModel,
35  InteriorsBackgroundViewModel& interiorBackgroundViewModel,
36  InteriorLandmarkViewModel& interiorLandmarkViewModel,
37  InteriorsModelRepository& modelRepository,
38  InteriorsCellResourceObserver& cellResourceObserver,
39  Resources::Buildings::LandmarkToRenderableRepository& landmarkToRenderableRepository,
40  PropRenderableRepository& propRenderableRepository,
41  Lighting::GlobalShadowing& globalShadowing,
42  Rendering::EnvironmentFlatteningService& environmentFlatteningService
43  );
44 
46 
47  void Update(float dt);
48 
49  private:
50  void HandleSelectionChanged(const InteriorId& previousSelection);
51  void HandleInteriorAdded(InteriorsModel& model);
52  void HandleInteriorRemoved(InteriorsModel& model);
53  void HandleInteriorAddedToSceneGraph(const InteriorsCellResource& interiorCellResource);
54  void HandleInteriorRemovedFromSceneGraph(const InteriorsCellResource& interiorCellResource);
55  void HandleLandmarkRenderableAdded(const std::string& landmarkName, Rendering::Renderables::CustomLandmarkRenderable& landmarkRenderable);
56  void HandleLandmarkRenderableRemoved(const std::string& landmarkName, Rendering::Renderables::CustomLandmarkRenderable& landmarkRenderable);
57  void HandleInteractionStateChanged();
58  void HandleInteractionModelChanged();
59  void HandleInteractionModelBackgroundColorChanged();
60  void HandleTransitionModelChanged();
61  void HandleEnvironmentFlatteningServiceChanged();
62  void HandlePropAdded(Rendering::Renderables::InstancedInteriorFloorRenderable& renderable);
63 
64  void OnIndoorMarkerAdded(const Markers::InteriorMarkerModel& interiorMarker);
65  void OnInteriorMetaDataAdded(const Resources::Interiors::MetaData::InteriorMetaDataModelMessage& message);
66  void OnInteriorMetaDataRemoved(const Resources::Interiors::MetaData::InteriorMetaDataModelMessage& message);
67  void OnInteriorMetaDataRequestCancelled(const Resources::Interiors::MetaData::InteriorMetaDataModelMessage& message);
68 
69  std::string GetSelectedIndoorMapId() const;
70  std::string GetInteractionIndoorMapId() const;
71  MetaData::AccessPermission::Type GetAccessPermission(
72  const std::string& indoorMapId) const;
73  bool CanAssignToInteractionModel(const std::string& selectedIndoorMapId) const;
74 
75  void AssignInteractionModel(const std::string& indoorMapId);
76  void ClearInteractionModel();
77  void ClearSelectionIfAccessNotAllowed(const std::string& indoorMapId);
78  bool NeedsMetaDataRequest(const std::string& indoorMapId) const;
79 
80  void RefreshInteractionModel();
81  void RefreshInteractionModelFor(const std::string& indoorMapId);
82  bool NeedsInteractionModelRefreshFor(const std::string& indoorMapId) const;
83 
84  void RefreshTransitionView();
85 
86  void ResetLandmarkRenderableTransition(Rendering::Renderables::CustomLandmarkRenderable& landmarkRenderable);
87 
88  float CalcInteriorFadeParam() const;
89  float CalcBackgroundFadeParam() const;
90 
91  int DetermineInitialZeroBasedFloorIndex(const InteriorsModel& interiorModel) const;
92 
93  InteriorSelectionModel& m_selectionModel;
94  InteriorInteractionModel& m_interiorInteractionModel;
95  Markers::InteriorMarkerModelRepository& m_interiorMarkerModelRepository;
96  MetaData::IInteriorMetaDataService& m_interiorMetaDataService;
97  const bool m_validateIndoorMapPermission;
98  const float m_interiorSelectionTimeoutDuration;
99  InteriorTransitionModel& m_interiorTransitionModel;
100  InteriorViewModel& m_viewModel;
101  InteriorsBackgroundViewModel& m_interiorBackgroundViewModel;
102  InteriorLandmarkViewModel& m_interiorLandmarkViewModel;
103  InteriorsModelRepository& m_modelRepository;
104  InteriorsCellResourceObserver& m_cellResourceObserver;
105  Resources::Buildings::LandmarkToRenderableRepository& m_landmarkToRenderableRepository;
106  PropRenderableRepository& m_propRenderableRepository;
107  Lighting::GlobalShadowing& m_globalShadowing;
108  Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
109 
110  float m_interiorSelectionTimeoutRemaining;
111  bool m_interiorSelectionTimeoutStarted;
112 
115  Helpers::TCallback1<InteriorController, const InteriorsCellResource> m_interiorRemovedFromSceneGraphCallback;
120  Helpers::TCallback0<InteriorController> m_interiorInteractionModelChangedCallback;
121  Helpers::TCallback0<InteriorController> m_interiorInteractionStateChangedCallback;
122  Helpers::TCallback0<InteriorController> m_interiorInteractionModelBackgroundColorChangedCallback;
123  Helpers::TCallback0<InteriorController> m_interiorTransitionModelChangedCallback;
124  Helpers::TCallback0<InteriorController> m_environmentFlatteningServiceChangedCallback;
130  };
131  }
132  }
133 }