All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InteriorsCameraController.h
1 // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "GlobeCamera.h"
7 #include "ICallback.h"
8 #include "Interiors.h"
9 #include "ITouchController.h"
10 #include "VectorMath.h"
11 #include "GlobeCameraTouchSettings.h"
12 #include "Rendering.h"
13 #include "InteriorsCameraConfiguration.h"
14 
15 namespace Eegeo
16 {
17  namespace Resources
18  {
19  namespace Interiors
20  {
22  {
23  private:
24  Camera::GlobeCamera::GlobeCameraTouchSettings BuildTouchSettings() const;
25  void UpdateCameraView();
26  void HandleInteractionStateChanged();
27  v3 CalculateInterestPointTangentSpaceExpanded(const float distanceToInterest) const;
28  v3 CalculateInterestPointTangentSpaceNonExpanded() const;
29 
30  InteriorInteractionModel& m_interiorInteractionModel;
31  const IImmutableInteriorViewModel& m_interiorViewModel;
32  Camera::GlobeCamera::GlobeCameraTouchController& m_globeCameraTouchController;
33  Camera::GlobeCamera::GlobeCameraController& m_globeCameraController;
34  const Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
35  const InteriorsCameraConfiguration m_config;
36  Helpers::TCallback0<InteriorsCameraController> m_interactionStateChangedCallback;
37 
38  bool m_applyRestrictions;
39  float m_cameraInterestAltitude;
40  bool m_applyFloorOffset;
41  float m_previousCollapsedDistanceToInterest;
42  bool m_updateControllers;
43 
44  public:
45 
46  static InteriorsCameraConfiguration CreateDefaultConfig();
47 
49  InteriorInteractionModel& interiorInteractionModel,
50  const IImmutableInteriorViewModel& interiorViewModel,
51  const Rendering::EnvironmentFlatteningService& environmentFlatteningService,
52  Camera::GlobeCamera::GlobeCameraTouchController& m_globeCameraTouchController,
53  Camera::GlobeCamera::GlobeCameraController& globeCameraController);
54 
56 
57  const Camera::CameraState GetCameraState() const;
58  const Camera::RenderCamera GetRenderCamera() const;
59  dv3 ComputeNonFlattenedCameraPosition() const;
60  dv3 CalculateInterestPoint(float expandedParam, float distanceToInterest) const;
61  Camera::GlobeCamera::GlobeCameraTouchController& GetTouchController() const;
62  Camera::GlobeCamera::GlobeCameraController& GetGlobeCameraController();
63 
64  void Update(float dt);
65 
66  void UpdateScreenProperties(const Rendering::ScreenProperties& screenProperties);
67 
68  void SetInterestLocation(const dv3& interestPointEcef);
69  const dv3& GetInterestLocation() const;
70 
71  void SetDistanceToInterest(float distanceMeters);
72  const float GetDistanceToInterest() const;
73 
74  void SetHeading(float headingDegrees);
75  float GetHeadingDegrees() const;
76 
77  void SetTilt(float tiltDegrees);
78  void SetApplyRestrictions(bool applyRestrictions);
79  void SetApplyFloorOffset(bool applyFloorOffset);
80  float GetCameraInterestAltitude() const;
81  void SetCameraInterestAltitude(float cameraInterestAltitude);
82  float GetFloorOffsetHeight() const;
83  void SetUpdateControllers(bool updateControllers);
84 
85  private:
86  bool NeedsCameraViewUpdate(const dv3& newInterestEcef, const float newDistance) const;
87  };
88 
89  inline InteriorsCameraConfiguration InteriorsCameraController::CreateDefaultConfig()
90  {
92 
93  config.BuildingHorizontalScreenSpacePercentInPortrait = 0.78f;
94  config.BuildingHorizontalScreenSpacePercentInLandscape = 0.56f;
95  config.PositionUpdateThresholdDistanceSq = 0.002;
96  config.ExpandedLookAtDistanceScale = 1.0f;
97  config.ExpandedLookAtUpOffset = 0.0f;
98  config.ExpandedLookAtRightOffset = 0.f;
99 
100  return config;
101  }
102  }
103  }
104 }