All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WorldStateManager.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include <vector>
6 #include "WorldStates.h"
7 #include "Timer.h"
8 #include "IChangeStateCallback.h"
9 #include "VectorMathDecl.h"
10 #include "Camera.h"
11 #include "IStreamingVolume.h"
12 
13 namespace Eegeo
14 {
15  namespace WorldStates
16  {
18  {
19  public:
20  WorldStateManager(const std::vector<IWorldState*>& states, const std::vector<float>& progressBarAtStateStarts);
21 
23 
24  void RequestChangeState();
25 
26  void Update(float dt,
27  const Camera::RenderCamera& renderCamera,
28  const dv3& ecefInterestPoint,
29  Streaming::IStreamingVolume& streamingVolume);
30 
31  bool IsInLastState() const;
32  float GetProgress() const;
33 
34  private:
35 
36  void AddState(IWorldState* stateToAdd, float progressBarAtStateStart, float progressBarAtStateEnd);
37  void Start();
38 
39  void EnterState(IWorldState* stateToEnter);
40  void ExitState(IWorldState* stateToExit);
41 
42  void ChangeState();
43 
44  struct StateEntry
45  {
46  IWorldState* state;
47  float progressBarAtStateStart;
48  float progressBarAtStateEnd;
49 
50  StateEntry(IWorldState* state, float progressBarAtStateStart, float progressBarAtStateEnd)
51  : state(state), progressBarAtStateStart(progressBarAtStateStart), progressBarAtStateEnd(progressBarAtStateEnd)
52  {}
53  };
54  typedef std::vector<StateEntry> TWorldStatesVec;
55  TWorldStatesVec m_worldStates;
56  TChangeStateCallback<WorldStateManager> m_changeStateCallback;
57  Helpers::Timer m_stateTimer;
58  bool m_stateChangeRequested;
59  };
60  }
61 }