ScummVM API documentation
camera.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TITANIC_CAMERA_H
23 #define TITANIC_CAMERA_H
24 
25 #include "titanic/star_control/fmatrix.h"
26 #include "titanic/star_control/base_stars.h"
27 #include "titanic/star_control/viewport.h"
28 
29 namespace Titanic {
30 
31 class CMotionControl;
32 class CErrorCode;
33 struct CNavigationInfo;
34 class FPoint;
35 class SimpleFile;
36 
37 enum StarLockLevel { ZERO_LOCKED=0, ONE_LOCKED=1, TWO_LOCKED=2, THREE_LOCKED=3 };
38 
42 class CCamera {
43 private:
44  static FMatrix *_priorOrientation;
45  static FMatrix *_newOrientation;
46 private:
47  StarLockLevel _lockLevel;
48  FMatrix _lockedStarsPos; // Each row represents the location of a locked star
49  CMotionControl *_motion; // A marked or unmarked camera mover, contains an automover
50  CViewport _viewport;
51  bool _isMoved; // Used in CPetStarfield to determine if a star destination can be set
52  bool _isInLockingProcess; // The mover/view is homing in on a new star
53 private:
59  bool createMotionControl(const CNavigationInfo *src);
60 
64  void deleteMotionController();
65 
69  bool isLocked();
70 public:
71  static void init();
72  static void deinit();
73 public:
74  CCamera(const CNavigationInfo *data);
75  CCamera(CViewport *src);
76  virtual ~CCamera();
77 
81  virtual void setViewport(const CViewport *src);
82 
86  virtual void setMotion(const CNavigationInfo *src);
87 
93  bool isNotInLockingProcess();
94 
98  virtual void setPosition(const FVector &v);
99 
103  virtual void setOrientation(const FVector &v);
104 
108  virtual void setRoleAngle(double angle);
109 
113  virtual void setFrontClip(double n);
114 
118  virtual void SetBackClip(double f);
119 
120  virtual void setCenterYAngle(int v);
121  virtual void setCenterZAngle(int v);
122  virtual void randomizeOrientation();
123  virtual void setFields(StarMode mode, double val);
124 
128  virtual void setDestination(const FVector &v);
129 
133  virtual void updatePosition(CErrorCode *errorCode);
134 
138  virtual void accelerate();
139 
143  virtual void deccelerate();
144 
148  virtual void fullSpeed();
149 
153  virtual void stop();
154 
155  virtual void reposition(double factor);
156 
160  virtual void setPosition(const FPose &pose);
161 
162  virtual void changeOrientation(FMatrix &m);
163 
167  virtual FPose getPose();
168 
169  virtual FPose getRawPose();
170 
174  virtual double getFrontClip() const;
175 
179  virtual double getBackClip() const;
180 
181 
182  virtual StarColor getStarColor() const;
183 
187  virtual FVector getRelativePos(int index, const FVector &src);
188 
189  virtual FVector getRelativePosNoCentering(int index, const FVector &src);
190  virtual FVector getRelativePosCentering(int index, const FVector &v);
191  virtual FVector getRelativePosCenteringRaw(int index, const FVector &v);
192 
196  virtual void setViewportAngle(const FPoint &angles);
197 
201  virtual StarLockLevel getLockLevel() const { return _lockLevel; }
202 
208  virtual bool addLockedStar(const FVector v);
209 
215  virtual bool removeLockedStar();
216 
224  virtual void getRelativeXCenterPixels(double *v1, double *v2, double *v3, double *v4);
225 
229  virtual void load(SimpleFile *file, int param);
230 
234  virtual void save(SimpleFile *file, int indent);
235 
242  float calcAngleForMinDist(FVector &x, FVector &y, float &minDistance);
243 
247  bool isMoved() const { return _isMoved; }
248 
252  void setIsMoved() { _isMoved = true; }
253 
257  void clearIsMoved() { _isMoved = false; }
258 
262  bool lockMarker1(FVector v1, FVector v2, FVector v3);
263 
267  bool lockMarker2(CViewport *viewport, const FVector &v);
268 
272  bool lockMarker3(CViewport *viewport, const FVector &v);
273 };
274 
275 } // End of namespace Titanic
276 
277 #endif /* TITANIC_CAMERA_H */
Definition: fmatrix.h:35
virtual void updatePosition(CErrorCode *errorCode)
virtual FPose getPose()
virtual void setMotion(const CNavigationInfo *src)
virtual bool addLockedStar(const FVector v)
Definition: error_code.h:27
Definition: viewport.h:44
bool isNotInLockingProcess()
virtual StarLockLevel getLockLevel() const
Definition: camera.h:201
bool lockMarker3(CViewport *viewport, const FVector &v)
void clearIsMoved()
Definition: camera.h:257
virtual bool removeLockedStar()
virtual void setFrontClip(double n)
Definition: simple_file.h:49
virtual void setRoleAngle(double angle)
virtual void SetBackClip(double f)
void setIsMoved()
Definition: camera.h:252
virtual void setPosition(const FVector &v)
virtual void stop()
float calcAngleForMinDist(FVector &x, FVector &y, float &minDistance)
Definition: fpose.h:34
virtual void setViewport(const CViewport *src)
virtual void fullSpeed()
virtual void setViewportAngle(const FPoint &angles)
Definition: camera.h:42
bool lockMarker1(FVector v1, FVector v2, FVector v3)
virtual void save(SimpleFile *file, int indent)
bool lockMarker2(CViewport *viewport, const FVector &v)
virtual void getRelativeXCenterPixels(double *v1, double *v2, double *v3, double *v4)
Definition: arm.h:30
virtual double getFrontClip() const
virtual void setOrientation(const FVector &v)
bool isMoved() const
Definition: camera.h:247
virtual void load(SimpleFile *file, int param)
Definition: motion_control.h:63
Definition: motion_control.h:35
virtual void deccelerate()
virtual void accelerate()
virtual FVector getRelativePos(int index, const FVector &src)
virtual double getBackClip() const
Definition: fpoint.h:32
Definition: fvector.h:36
virtual void setDestination(const FVector &v)