Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CameraDirector.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: CameraDirector.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Camera Director singleton manages the main view camera based on the current ship
13 */
14 
15 #ifndef CameraDirector_h
16 #define CameraDirector_h
17 
18 #include "Types.h"
19 #include "Camera.h"
20 #include "SimObject.h"
21 #include "List.h"
22 
23 // +--------------------------------------------------------------------+
24 
25 class HUDView;
26 class Orbital;
27 class Ship;
28 class Sim;
29 
30 // +--------------------------------------------------------------------+
31 
33 {
34 public:
35  static const char* TYPENAME() { return "CameraDirector"; }
36 
37  enum CAM_MODE {
39 
50 
52  };
53 
54  // CONSTRUCTORS:
56  virtual ~CameraDirector();
57 
58  int operator == (const CameraDirector& that) const { return this == &that; }
59 
60  static CameraDirector* GetInstance();
61 
62  // CAMERA:
63  static int GetCameraMode();
64  static void SetCameraMode(int m, double trans_time=1);
65  static const char* GetModeName();
66 
67  static double GetRangeLimit();
68  static void SetRangeLimit(double r);
69  static void SetRangeLimits(double min, double max);
70 
71  virtual void Reset();
72  virtual void SetMode(int m, double trans_time=1);
73  virtual int GetMode() const { return requested_mode > MODE_NONE ? requested_mode : mode; }
74  virtual Camera* GetCamera() { return &camera; }
75  virtual Ship* GetShip() { return ship; }
76  virtual void SetShip(Ship* s);
77 
78  virtual void VirtualHead(double az, double el);
79  virtual void VirtualHeadOffset(double x, double y, double z);
80  virtual void VirtualAzimuth(double delta);
81  virtual void VirtualElevation(double delta);
82  virtual void ExternalAzimuth(double delta);
83  virtual void ExternalElevation(double delta);
84  virtual void ExternalRange(double delta);
85  virtual void SetOrbitPoint(double az, double el, double range);
86  virtual void SetOrbitRates(double az_rate, double el_rate, double r_rate);
87 
88  static bool IsViewCentered();
89 
90  virtual void CycleViewObject();
91 
92  virtual Orbital* GetViewOrbital() const { return external_body; }
93  virtual Ship* GetViewObject() const { return external_ship; }
94 
95  virtual void SetViewOrbital(Orbital* orb);
96  virtual void SetViewObject(Ship* obj, bool quick=false);
97  virtual void SetViewObjectGroup(ListIter<Ship> group, bool quick=false);
98  virtual void ClearGroup();
99 
100  // BEHAVIORS:
101  virtual void ExecFrame(double s);
102  virtual void Transition(double s);
103 
104  // SimObserver:
105  virtual bool Update(SimObject* obj);
106  virtual const char* GetObserverName() const;
107 
108 protected:
109  virtual void Cockpit(double s);
110  virtual void Chase(double s);
111  virtual void Target(double s);
112  virtual void Threat(double s);
113  virtual void Virtual(double s);
114  virtual void Orbit(double s);
115  virtual void Docking(double s);
116  virtual void Drop(double s);
117 
118  int mode;
120  int old_mode;
122 
124 
130 
132 
133  double virt_az;
134  double virt_el;
135  double virt_x;
136  double virt_y;
137  double virt_z;
138  double azimuth;
139  double elevation;
140  double az_rate;
141  double el_rate;
142  double range_rate;
143  double range;
144  double range_min;
145  double range_max;
146  double base_range;
147  double transition;
148 
151 
153 };
154 
155 #endif CameraDirector_h
156