All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EnvironmentFlatteningService.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Rendering.h"
7 #include "VectorMathDecl.h"
8 #include "ICallback.h"
9 #include "CallbackCollection.h"
10 #include "EnvironmentFlatteningConfiguration.h"
11 
12 namespace Eegeo
13 {
14  namespace Rendering
15  {
17  {
18  public:
19  static const float DefaultNormalScale;
20 
22 
23  void ToggleFlattened();
24  void Update(float dt);
25 
26  void SetIsFlattened(bool isFlattened);
27 
28  bool IsFlattened() const;
29 
30  float GetCurrentScale() const;
31 
32  float GetFlattenedScale() const;
33 
34  static dv3 GetScaledPointEcef(const dv3& pointEcef, float environmentScale);
35  static dv3 GetScaledPointAboveGroundEcef(const dv3& pointEcef, float heightAboveGround, float environmentScale);
36 
37  void InsertChangedCallback(Eegeo::Helpers::ICallback0& callback);
38  void RemoveChangedCallback(Eegeo::Helpers::ICallback0& callback);
39 
40 
44  {
45  PennerInOutBack,
46  Linear,
47  SmoothStep,
48  };
49 
51  static const float DefaultEaseDurationSeconds;
52 
54  static const float DefaultFlatScale;
55 
57  void SetCurrentScale(float scale);
58 
60  void SetEasingType(EasingType easingType);
61 
63  void SetEaseDuration(float easeDurationSeconds);
64 
66  void SetFlattenedScale(float scaleWhenFlattened);
67 
68  private:
69  float CalculateScale() const;
70 
71  // todo - make properties const once deprecated mutation methods are removed
72  float m_scaleWhenFlattened;
73  EnvironmentFlatteningEasing::Type m_easingType;
74  float m_easeDurationSeconds;
75 
76  // canonical state
77  bool m_isFlattened;
78  bool m_legacyManualScale;
79  float m_interpParam;
80 
81  // auxiliary state
82  float m_scale;
83 
84  Eegeo::Helpers::CallbackCollection0 m_changedCallbacks;
85  };
86  }
87 }