Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CCamera.h
Go to the documentation of this file.
1 // Copyright (C) 2004-2013 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef CCAMERA_H
22 #define CCAMERA_H
23 
24 #include "IObject.h"
25 
26 #include "../Math_LIB/MInterpolator.h"
27 
28 #include <queue>
29 
30 namespace OpenSkyNet {
31  namespace Core {
34 
35  class Director;
36 
42  public:
46  CameraEffectData(CAMERA_EFFECT type_) : _type(type_) {}
47  };
48 
50  float _begin, _end, _speed;
51 
52  StaticCameraEffectData(CAMERA_EFFECT type_, float begin_,
53  float end_, float speed_) : CameraEffectData(type_),
54  _begin(begin_), _end(end_), _speed(speed_) {
55  assert(type_ > NO_CAMERA_EFFECT && type_ < MAX_STATIC_CAMERA_EFFECT);
56  }
57  };
58 
62 
65 
68 
71 
74 
76  float _radians;
77 
78  float _speed;
79 
81  bool _useForward, _useRot, _useAxisAngle;
82 
83  MovingCameraEffectData(const Math::Point<>& endPos_, float speed_) :
84  CameraEffectData(MOVE), _endPos(endPos_), _speed(speed_),
85  _useForward(false), _useRot(false), _useAxisAngle(false) {}
86 
87  MovingCameraEffectData(const Math::Point<>& centerOfRot_,
88  const Math::Point<>& endForward_, float speed_) :
89  CameraEffectData(ORBIT), _endForward(endForward_),
90  _centerOfRot(centerOfRot_), _speed(speed_),
91  _useForward(true), _useRot(false), _useAxisAngle(false) {}
92 
93  MovingCameraEffectData(const Math::Point<>& centerOfRot_,
94  const Math::Matrix3x3& endRot_, float speed_) :
95  CameraEffectData(ORBIT), _endRot(endRot_),
96  _centerOfRot(centerOfRot_), _speed(speed_),
97  _useForward(false), _useRot(true), _useAxisAngle(false) {}
98 
99  MovingCameraEffectData(const Math::Point<>& centerOfRot_,
100  const Math::Point<>& axis_, float radians_, float speed_) :
101  CameraEffectData(ORBIT), _axis(axis_), _centerOfRot(centerOfRot_),
102  _radians(radians_), _speed(speed_),
103  _useForward(false), _useRot(false), _useAxisAngle(true) {}
104  };
105 
106  friend class Core::Director;
107  private:
108  std::queue<CameraEffectData*> _q;
109  CameraEffectData* _currEffect;
110  Math::LerpOverTime3 _fade;
111  bool _isBusy;
112  Math::Point<> _angVel;
113  public:
114  Cinematographer() : _currEffect(0), _isBusy(false) {}
115 
117  virtual Cinematographer& operator=(const Cinematographer& rhs_);
118 
119  virtual ~Cinematographer() {
120  if (_currEffect) delete _currEffect;
121  while (!_q.empty()) {
122  delete _q.front();
123  _q.pop();
124  }
125  }
126 
127  virtual Math::Point<> getAngVel() const { return _angVel; }
128  virtual void getAngVel(Math::Point<>& angVel_) const { angVel_ = _angVel; }
129  virtual void setAngVel(const Math::Point<> &angVel_) {
130  _angVel = angVel_;
131  setHasAngVelChanged(true);
132  }
133 
134  virtual void lookAt(const Math::Point<>& p_) = 0;
135 
136  virtual float getAspectRatio() const = 0;
137 
138  virtual void getFOVRads(OpenSkyNet::Math::Point<float, 2>& fOV_) const = 0;
139 
140  virtual void getCameraToViewportRay(const OpenSkyNet::Math::Point<float, 2>& screenSpaceOrigin_,
141  OpenSkyNet::Math::Point<>& origin_, OpenSkyNet::Math::Point<>& dir_) const = 0;
142 
143  inline void setFadeColor(const Math::Point<>& fadeColor_) { _fade._end = fadeColor_; }
144 
145  inline bool isBusy() const { return _isBusy; }
146  };
147  }
148 }
149 
150 #endif //CCAMERA_H
Definition: CCamera.h:32
DIRECTOR_CAM
Definition: CCamera.h:33
CAMERA_EFFECT _type
Definition: CCamera.h:44
void setFadeColor(const Math::Point<> &fadeColor_)
Definition: CCamera.h:143
Definition: CCamera.h:32
Definition: CCamera.h:41
Definition: CCamera.h:33
Definition: CCamera.h:33
bool isBusy() const
Definition: CCamera.h:145
Definition: CCamera.h:32
virtual void getAngVel(Math::Point<> &angVel_) const
Definition: CCamera.h:128
Definition: CCamera.h:32
CameraEffectData(CAMERA_EFFECT type_)
Definition: CCamera.h:46
Definition: CCamera.h:33
Definition: CCamera.h:32
Math::Point _centerOfRot
Definition: CCamera.h:73
MovingCameraEffectData(const Math::Point<> &centerOfRot_, const Math::Point<> &axis_, float radians_, float speed_)
Definition: CCamera.h:99
Definition: CCamera.h:33
Definition: MInterpolator.h:72
Definition: CCamera.h:33
virtual ~Cinematographer()
Definition: CCamera.h:119
Definition: CCamera.h:33
StaticCameraEffectData(CAMERA_EFFECT type_, float begin_, float end_, float speed_)
Definition: CCamera.h:52
virtual void setAngVel(const Math::Point<> &angVel_)
Definition: CCamera.h:129
Definition: CCamera.h:33
MovingCameraEffectData(const Math::Point<> &centerOfRot_, const Math::Point<> &endForward_, float speed_)
Definition: CCamera.h:87
#define CORE_DLL
Definition: CCoreDLL.h:57
Definition: CCamera.h:32
Definition: MPoint.h:33
Definition: IObject.h:75
CAMERA_EFFECT
Definition: CCamera.h:32
Math::Matrix3x3 _endRot
Definition: CCamera.h:61
Definition: CCamera.h:33
Definition: CCamera.h:33
Definition: CCamera.h:32
Math::Point _endForward
Definition: CCamera.h:67
Definition: MMatrix3x3.h:32
Definition: CCamera.h:33
Definition: CCamera.h:32
Cinematographer()
Definition: CCamera.h:114
virtual Math::Point getAngVel() const
Definition: CCamera.h:127
MovingCameraEffectData(const Math::Point<> &centerOfRot_, const Math::Matrix3x3 &endRot_, float speed_)
Definition: CCamera.h:93
MovingCameraEffectData(const Math::Point<> &endPos_, float speed_)
Definition: CCamera.h:83
Definition: CCamera.h:32
Definition: CCameraUpdater.h:31
Definition: CCamera.h:32