Bubba-3D  0.9.0
Awesome game engine!
Camera.h
1 /*
2  * This file is part of Bubba-3D.
3  *
4  * Bubba-3D is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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  * Bubba-3D 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with Bubba-3D. If not, see http://www.gnu.org/licenses/.
16  */
17 #pragma once
18 
19 #include <linmath/float4x4.h>
20 #include <linmath/float3.h>
21 #include "IComponent.h"
22 
26 class Camera : public IComponent{
27 public:
28  Camera(chag::float3 position, chag::float3 lookAt,
29  chag::float3 up, float fov, float ratio,
30  float nearPlane, float farPlane):
31  m_vPosition(position), m_vLookAt(lookAt), m_vUp(up), m_fFov(fov),
32  m_fRatio(ratio), m_fNearPlane(nearPlane), m_fFarPlane(farPlane)
33  {
34  }
35 
36  ~Camera() = default;
37 
38  virtual void update(float dt) = 0;
39  virtual chag::float4x4 getViewMatrix() = 0;
40  virtual chag::float4x4 getProjectionMatrix() = 0;
41 
42  virtual void setPosition(chag::float3 position);
43  virtual void setLookAt(chag::float3 lookAt);
44  virtual void setUpVector(chag::float3 up);
45  chag::float3 getPosition() { return m_vPosition; };
46  chag::float3 getLookAt() { return m_vLookAt; };
47  chag::float3 getUp() { return m_vUp; };
48 
49 protected:
50  chag::float3 m_vPosition;
51  chag::float3 m_vLookAt;
52  chag::float3 m_vUp;
53  float m_fFov = 60.0f;
54  float m_fRatio = 1.0f;
55  float m_fNearPlane = 0.1f;
56  float m_fFarPlane = 100.0f;
57 };
Definition: Camera.h:26