OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
camera.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef CAMERA_H
19 #define CAMERA_H
20 
21 #include "index.h"
22 #include "input.h"
23 #include "position.h"
24 
25 namespace Engine
26 {
27 
31 class Camera : public Position
32 {
33  public:
34 
39  enum Direction
40  {
41  FORWARD,
42  BACKWARD,
43  LEFT,
44  RIGHT
45  };
46 
47  enum CameraMode
48  {
49  FLY_MODE ,
50  EGO_MODE
51  };
52 
57  explicit Camera(void);
58 
64  explicit Camera( const std::string & camera_name );
65  virtual ~Camera() = default;
66 
75  void setScissorView( Vector4f sci );
76  void setScissorView( int x , int y , int width , int height );
77 
83  void setName( const std::string & name );
84 
89  void setMode( CameraMode mode );
90 
91  void invertPitch(void);
92  void invertYaw(void);
93 
99  Vector4f getView(void);
100 
106  std::string getName(void);
107 
113  void AutoRotation( Position * object );
114  void AutoRotationReset(void);
115 
122  void move( Direction dir , float speed );
123  void move_ex( Camera::Direction dir , float distance , Position * object );
124 
130  float getPitch(void);
131 
137  float getYaw(void);
138 
143  void transform(void);
144 
149  void setPitch( float value );
150 
156  void setYaw( float value );
157 
158 
159  protected:
160 
167  float getRadian( float angle );
168 
169  private:
170 
171  std::string mName;
172  Vector4f scissor;
174  float mPitch;
175  float mYaw;
177  float m_rotation_yaw_counter;
178 
179  CameraMode mMode;
180 };
181 
182 }
183 
184 #endif // CAMERA_H
void setName(const std::string &name)
setName
Definition: Camera.cpp:42
void setYaw(float value)
setYaw
Definition: Camera.cpp:75
void setMode(CameraMode mode)
setMode
Definition: Camera.cpp:100
void transform(void)
transform
Definition: Camera.cpp:220
float getYaw(void)
getYaw
Definition: Camera.cpp:95
Definition: element.h:23
float getRadian(float angle)
getRadian
Definition: Camera.cpp:215
The Camera class.
Definition: camera.h:31
void move(Direction dir, float speed)
move
Definition: Camera.cpp:175
float getPitch(void)
getPitch
Definition: Camera.cpp:90
void AutoRotation(Position *object)
follow
Definition: Camera.cpp:110
Vector4f getView(void)
getView
Definition: Camera.cpp:65
void setScissorView(Vector4f sci)
setView
Definition: Camera.cpp:52
std::string getName(void)
getName
Definition: Camera.cpp:47
Camera(void)
Camera.
Definition: Camera.cpp:22
Direction
The Direction enum.
Definition: camera.h:39
void setPitch(float value)
setPitch
Definition: Camera.cpp:70
The Position class.
Definition: position.h:29