Camera.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <etk/types.hpp>
10 #include <etk/math/Vector3D.hpp>
11 #include <etk/math/Vector2D.hpp>
12 #include <etk/math/Matrix4.hpp>
13 #include <ege/Ray.hpp>
14 #include <ewol/resource/Colored3DObject.hpp>
15 
16 
17 namespace ege {
18  class Camera : public ememory::EnableSharedFromThis<Camera>{
19  public:
23  Camera();
27  virtual ~Camera() {};
28  public:
33  virtual void periodicCall(float _step) {};
34  public:
38  virtual void configureOpenGL();
39  protected:
41  public:
46  const mat4& getMatrixCamera() const {
47  return m_matrix;
48  };
49  protected:
51 
54  virtual void updateProjectionMatrix();
55  public:
60  const mat4& getMatrixProjection() const {
61  return m_matrixProjection;
62  };
63  public:
64  virtual vec3 getViewVector() const {
65  return vec3(0,0,-1);
66  }
67  virtual vec3 getEye() const {
68  return vec3(0,0,0);
69  }
70  protected:
71  float m_aspectRatio;
72  public:
77  virtual void setAspectRatio(float _ratio);
82  virtual void setSceenSize(const vec2& _screenSize) {
83  setAspectRatio(_screenSize.x()/_screenSize.y());
84  }
89  float getAspectRatio() const {
90  return m_aspectRatio;
91  }
92  protected:
93  float m_angleView;
94  public:
99  virtual void setXAngleView(float _angleRad);
105  virtual void setYAngleView(float _angleRad) {
106  setXAngleView(_angleRad * m_aspectRatio);
107  }
112  float getXAngleView() const {
113  return m_angleView;
114  }
115  protected:
116  float m_zFar;
117  public:
122  virtual void setZFar(float _distance);
127  float getZFar() {
128  return m_zFar;
129  }
130  protected:
131  float m_zNear;
132  public:
137  virtual void setZNear(float _distance);
142  float getZNear() {
143  return m_zNear;
144  }
145  public:
151  virtual ege::Ray getRayFromScreen(const vec2& _offset);
158  ege::Ray getRayFromScreenPosition(const vec2& _position, const vec2& _size);
159  protected:
166  public:
172  };
173 }
174 
virtual void setYAngleView(float _angleRad)
Set the the Y angle view of the camera:
Definition: Camera.hpp:105
const mat4 & getMatrixProjection() const
get the transformation matix for the camera.
Definition: Camera.hpp:60
virtual void configureOpenGL()
Configure projection matrix and camera matrix.
const T & x() const
virtual void setZFar(float _distance)
Set the Z far distane of the camera:
float m_aspectRatio
depending to the display the aspect ratio is simply calculated x/y
Definition: Camera.hpp:71
Camera()
Constructor.
float m_zNear
Z camera near view.
Definition: Camera.hpp:131
mat4 m_matrixProjection
projection matrix.
Definition: Camera.hpp:48
float getAspectRatio() const
get the current aspect Ratio.
Definition: Camera.hpp:89
mat4 m_matrix
transformation matrix.
Definition: Camera.hpp:40
virtual void updateProjectionMatrix()
virtual void setXAngleView(float _angleRad)
Set the the X angle view of the camera:
virtual ege::Ray getRayFromScreen(const vec2 &_offset)
float getZFar()
Get the Z far distane of the camera:
Definition: Camera.hpp:127
Definition: AudioElement.hpp:8
virtual void setSceenSize(const vec2 &_screenSize)
Set the screen size to display OpenGl interface.
Definition: Camera.hpp:82
Definition: Camera.hpp:18
float getXAngleView() const
get the current X angle view.
Definition: Camera.hpp:112
Definition: Ray.hpp:17
const T & y() const
virtual void drawDebug(ememory::SharedPtr< ewol::resource::Colored3DObject > _draw, ememory::SharedPtr< ege::Camera > _camera)
Debug display of the current element.
Definition: Camera.hpp:171
float m_angleView
X angle view of the camera.
Definition: Camera.hpp:93
virtual void setZNear(float _distance)
Set the Z near distane of the camera:
vec2 tansformPositionToAngle(vec3 _vect)
get Tetha and psy angle from a position:
virtual ~Camera()
Destructor.
Definition: Camera.hpp:27
virtual void periodicCall(float _step)
It is really needed to call the camera periodicly for performing automatic movement.
Definition: Camera.hpp:33
ege::Ray getRayFromScreenPosition(const vec2 &_position, const vec2 &_size)
virtual void setAspectRatio(float _ratio)
Set the aspectRatio of the camera:
const mat4 & getMatrixCamera() const
get the transformation matix for the camera.
Definition: Camera.hpp:46
float m_zFar
Z camera far view.
Definition: Camera.hpp:116
float getZNear()
Get the Z Near distane of the camera:
Definition: Camera.hpp:142