All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CameraSplinePlaybackController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Camera.h"
6 #include "RenderCamera.h"
7 #include "Geometry.h"
8 #include "Streaming.h"
9 #include "CameraState.h"
10 #include "Rendering.h"
11 #include "ICallback.h"
12 #include "CallbackCollection.h"
13 
14 namespace Eegeo
15 {
16  namespace Camera
17  {
18  namespace SplinePlayback
19  {
20  enum SplinePlaybackState
21  {
22  Started,
23  Playing,
24  Stopped
25  };
26 
27  typedef Helpers::ICallback1<const SplinePlaybackState&> TPlaybackStateChangedCallback;
28 
30  {
31  public:
33 
34  RenderCamera GetRenderCamera() const { return m_camera; }
35  bool IsPlaying() const { return m_playing; }
36 
37  double GetPlaybackSpeed() const { return m_playbackSpeed; }
38  void SetPlaybackSpeed(double speed) { m_playbackSpeed = speed; }
39 
40  void TogglePlaybackDirection();
41 
42  bool IsLooped() const { return m_looped; }
43  void SetLooped(bool looped) { m_looped = looped; }
44 
45  void SetSplines(Geometry::ISpline* pPositionSpline, Geometry::ISpline* pTargetSpline);
46  void Play();
47  void Stop();
48  void Update(float dt);
49 
50  Camera::CameraState GetCameraState() const;
51 
52  void UpdateScreenProperties(const Eegeo::Rendering::ScreenProperties& screenProperties);
53 
54  void RegisterPlaybackStateCallback(TPlaybackStateChangedCallback& callback);
55  void UnregisterPlaybackStateCallback(TPlaybackStateChangedCallback& callback);
56 
57  private:
58  double m_time;
59  double m_playbackSpeed;
60  bool m_playing;
61  bool m_looped;
62 
63  bool m_playReversed;
64 
66 
67  Geometry::ISpline* m_pPositionSpline;
68  Geometry::ISpline* m_pTargetSpline;
69  Camera::RenderCamera m_camera;
70  const Streaming::ResourceCeilingProvider& m_resourceCeilingProvider;
71  float m_fovDegrees;
72 
73  void UpdateCamera();
74  void UpdateFovAndClippingPlanes();
75  };
76 
77  }
78  }
79 }